Understanding Segmentation Faults with a custom linker script for a simple 'Hello World' - section names or base address below 64k

Basic Hello World as seen many times before on x86_64 Linux: global my_start_symbol section .text my_start_symbol: mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, msg_len syscall mov rax, 60 xor rdi, rdi syscall section .rodata: msg: db "Hello, world!", 10 msg_len: equ $ - msg My working ld linker script: ENTRY(my_start_symbol) SECTIONS { . = 0x10000; .text : { *(.text*) } .rodata : { *(.rodata*) } } Invoked with: nasm -f elf64 assembly.asm -o assembly.o ld -T linker.ld assembly.o -o assembly I get various segmentation faults when I experiment with the following changes: If I remove the . =

2022-01-25 05:42:11    分类:问答    linux   assembly   x86-64   ld   linker-scripts

uwsgi: /usr/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55

I got this error when I ran sentry run web. I am confused about it and tried a lot of things, such as: https://stackoverflow.com/questions/20357033/how-to-fix-program-name-usr-lib-x86-64-linux-gnu-libstdc-so-6-version-cxx, and https://stackoverflow.com/questions/35392310/error-building-gcc-4-8-3-from-source-libstdc-so-6-version-cxxabi-1-3-8-not. But it didn't work for me. The problem is still there: uwsgi: /usr/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55) My system runs Ubuntu 16.04. How to solve this problem? Please help me.

2022-01-25 05:41:10    分类:问答    linux   ubuntu-16.04   Sentry

带有/不带引号和单/双引号的bash字符串[重复](bash string with/without quote and single/double quote [duplicate])

问题 这个问题在这里已经有了答案: Bash 中单引号和双引号之间的区别7 个答案我什么时候应该在 shell 变量周围加上引号? (5 个回答) 4年前关闭。 $ volume=vol1 $ echo $volume vol1 $ volume="vol1" $ echo $volume vol1 $ volume='vol1' $ echo $volume vol1 以上在bash脚本中有什么区别? 都是一样的吗? 回答1 您可能会在该 wiki 上找到明确的答案。 简短的回答:在$volume附近需要报价。

2022-01-25 05:39:22    分类:技术分享    linux   string   bash

在用 C 编写的 Linux TCP/IP 服务器中处理 Ctrl-C(Handling Ctrl-C in a Linux TCP/IP Server written in C)

问题 我目前正在使用 Linux TCP/IP 服务器。 服务器程序在 C 中运行。我目前正在对其进行测试,但是每次使用 Ctrl-c 退出它时,它使用的端口都没有释放,它正在写入的数据库也没有解锁。 如何定义一个在收到 Ctrl+C 信号时退出的子程序? 回答1 查找setsockopt和SO_REUSEADDR 。 必须在旧的原始服务器进程的套接字上设置此选项,否则新的将无法绑定端口,直到TIME_WAIT期限到期。 回答2 @Bortds 通常不会立即释放端口,您必须等待一段时间。 我从我工作的一个服务器项目中找到了这个。 回答3 两种选择: 添加一个清理例程: int atexit(void (*function)(void)); 将 Ctrl+C 与:sighandler_t signal(int signum, sighandler_t handler); 正如 R 所指出的,sigaction 比信号更便携,但对于 Linux 来说可能不那么惯用。 警告:如果您的程序被 SIGKILL (Ctrl+/) 杀死或收到任何其他未处理的信号,则 atexit 例程将不会运行。

2022-01-25 05:37:18    分类:技术分享    c   linux   tcp

How to fix failed to open a session for the virtual machine kali-linux-2020.3-vbox-amd34 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year. Improve this question when I select Kali Linux and I click Start I get this error message : Failed to load R0 module C:\Program Files\Oracle\VirtualBox/VMMR0.r0: Signature #2/3: Expected at least 2 valid paths, not 1.: \Device\HarddiskVolume2\Program Files\Oracle\VirtualBox\VMMR0.r0 (VERR_SUP_VP_UNEXPECTED_VALID_PATH_COUNT). Failed to load VMMR0.r0 (VERR_SUP_VP_UNEXPECTED_VALID_PATH_COUNT)

2022-01-25 05:33:29    分类:问答    linux

查找名称包含给定字符串的所有文件,并将其突出显示(Find all files whose names contain a given string, and highlight it)

问题 我发现自己经常写这个命令: find . -iname "*foo*" | fgrep -i "foo" 查找名称中包含“foo”的所有文件和文件夹,并在结果中突出显示匹配的部分。 那不是很方便。 什么是更简单的解决方案? 我需要为此编写自定义命令吗? 回答1 为方便起见,您可以为此创建一个 BASH 函数: hlt() { find . -iname '*'"$1"'*' | grep --color "$1"; } 并将其称为: hlt foo 回答2 如果您使用的是 bash,请查看 Make a Bash alias that takes a parameter? 对于如何制作“自定义命令”,还请注意,没有 -i 的 grep 区分大小写,而 -iname 不区分大小写,因此您可能会遗漏一些混合大小写的亮点。 附带说明 fgrep 应该比 grep 更快,并且可能需要更少的资源:)

2022-01-25 05:33:12    分类:技术分享    linux   bash   grep   find

An executable and a shared library dependent on a same statically linked library

Suppose you're developing a shared library libshared.so. And you have a static library libstatic.a with some internal classes and functionality you need. You'd like to link it to your .so like this: g++ -o libshared.so -shared myObj.o -lstatic Also you have an executable.sh which will use your .so and dynamically open it in the runtime dlopen("libshared.so", RTLD_NOW) You know this executable was as well statically linked against libstatic.a (but you're not sure the version of the library is exactly the same as yours). So the question is: Is it safe and correct to statically link your

2022-01-25 05:28:53    分类:问答    c++   linux   shared-libraries   static-libraries   linkage

"File too short" with Tableau Data Extract API (Python and Linux)

Tableau recently expanded some tools for developers to Linux, from Windows-only. After downloading the Tableau Data Extract API libraries for Python (2.7) on Linux (64Bit, version 8.1), I extracted the files and installed the libraries using the standard 'python setup.py install' When trying to run with a code that works on Windows, I get the following error: Traceback (most recent call last): File "apache.py", line 280, in <module> print create_tableau(tsvfile) File "apache.py", line 136, in create_tableau import dataextract as tde File "/usr/local/lib/python2.7/dist-packages/dataextract/_

2022-01-25 05:12:55    分类:问答    python   linux   api   tableau-api

TCP 窗口比例选项非零的原因(The reason of non-zero TCP window scale option)

问题 我读了一些关于 TCP 窗口缩放和 BDP 的东西(不太清楚),我无法弄清楚究竟是什么导致发送方的 TCP 实现设置非零 WS,用户模式客户端程序会以某种方式影响它吗? 我认为从逻辑上讲它不能基于某些数据传输,因为它发生在 SYN-SYN+ACK TCP 阶段。 有人可以从编程的角度解释一下,用户模式客户端代码如何影响 TCP 窗口缩放选项(例如在connect()调用之前)? 以及 TCP 堆栈如何知道何时将 WS 设置为非零? 很抱歉,如果很明显。 回答1 TCP 窗口缩放索引rcv_wscale (发送SYN或SYN-ACK时为 fe)是在 Linux 内核中基于函数 tcp_select_initial_window() 中的套接字接收缓冲区计算的: /* If no clamp set the clamp to the max possible scaled window */ if (*window_clamp == 0) (*window_clamp) = (65535 << 14); space = min(*window_clamp, space); /* Quantize space offering to a multiple of mss if possible. */ if (space > mss) space = (space / mss) *

2022-01-25 05:08:24    分类:技术分享    c   linux   networking   tcp   linux-kernel

linux库问题(linux library problem)

问题 每个人都在那里,我正在编写 ac 代码,当我编译它时有一个奇怪的问题。 源代码没问题。 我使用以下选项编译它: $ gcc above_sample.c -I/home/hadoop/project/hadoop-0.20.2/src/c++/libhdfs -L/home/hadoop/project/hadoop-0.20.2/c++/Linux-amd64-64/lib -lhdfs -o above_sample. 但它显示了这样的输出: /usr/bin/ld: warning: libjvm.so, needed by /home/hadoop/project/hadoop-0.20.2/c++/Linux-amd64-64/lib/libhdfs.so, not found (try using -rpath or -rpath-link) /home/hadoop/project/hadoop-0.20.2/c++/Linux-amd64-64/lib/libhdfs.so: undefined reference to `JNI_CreateJavaVM@SUNWprivate_1.1' /home/hadoop/project/hadoop-0.20.2/c++/Linux-amd64-64/lib/libhdfs.so: undefined

2022-01-25 04:53:43    分类:技术分享    linux   gcc