glibc

Debugging the C runtime

夙愿已清 提交于 2019-12-22 10:08:27
问题 I want to get a detailed look at what's going on both before and after main() using GDB. Would it be enough just to recompile glibc with -g and link against that? 回答1: if you want to play with the debugger, you can use GDB this way: install the debug-info for the `glibc` package (here is the way to do it with Fedora, I don't know about the other distros) or point GDB to a consistent debug file directory: (gdb) show debug-file-directory The directory where separate debug symbols are searched

Understanding glibc malloc trimming

[亡魂溺海] 提交于 2019-12-22 06:24:36
问题 Some program that I am currently working on consumes much more memory than I think it should. So I am trying to understand how glibc malloc trimming works. I wrote the following test: #include <malloc.h> #include <unistd.h> #define NUM_CHUNKS 1000000 #define CHUNCK_SIZE 100 int main() { // disable fast bins mallopt(M_MXFAST, 0); void** array = (void**)malloc(sizeof(void*) * NUM_CHUNKS); // allocating memory for(unsigned int i = 0; i < NUM_CHUNKS; i++) { array[i] = malloc(CHUNCK_SIZE); } //

Understanding glibc malloc trimming

不想你离开。 提交于 2019-12-22 06:24:02
问题 Some program that I am currently working on consumes much more memory than I think it should. So I am trying to understand how glibc malloc trimming works. I wrote the following test: #include <malloc.h> #include <unistd.h> #define NUM_CHUNKS 1000000 #define CHUNCK_SIZE 100 int main() { // disable fast bins mallopt(M_MXFAST, 0); void** array = (void**)malloc(sizeof(void*) * NUM_CHUNKS); // allocating memory for(unsigned int i = 0; i < NUM_CHUNKS; i++) { array[i] = malloc(CHUNCK_SIZE); } //

How can I compile a Rust program so it doesn't use __cxa_thread_atexit_impl?

浪子不回头ぞ 提交于 2019-12-22 04:01:32
问题 I have compiled a Rust program for armv7-unknown-linux-gnueabihf , and I want it to run on a system that has glibc 2.16 installed. Unfortunately when running it I get this error: ./foo: /lib/libc.so.6: version `GLIBC_2.18' not found (required by ./foo) Running objdump -T foo reveals that the only symbol needed from glibc 2.18 is: 00000000 w DF *UND* 00000000 GLIBC_2.18 __cxa_thread_atexit_impl Rust makes __cxa_thread_atexit_impl a weak symbol (as seen by the little w flag from objdump ),

Library path order for alternate glibc dynamic linker (ld.so)

末鹿安然 提交于 2019-12-22 03:47:29
问题 I need to use an alternate glibc version, newer than the one installed on my system ( 2.18 vs 2.15 ). Several related issues are covered here and here. The specific question I'm asking here is the following: I set up the library path of the new dynamic linker ( ld-2.18.so ) so that the new libc ( libc-2.18.so ) is found ahead of the old libc ( libc-2.15.so ). However, when I try to run a program with the new ld , the old version of libc is picked up, generating a SEGV . Why is that happening?

ELF file TLS and LOAD program sections

孤者浪人 提交于 2019-12-21 19:31:51
问题 int i; int main() { return i; } After -static compile readelf -l shows program headers from elf: Elf file type is EXEC (Executable file) Entry point 0xxxxx30 There are 6 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x08048000 0x08048000 0x79868 0x79868 R E 0x1000 > LOAD 0x079f94 0x080c2f94 0x080c2f94 0x0078c 0x02254 RW 0x1000 << NOTE 0x0000f4 0x080480f4 0x080480f4 0x00020 0x00020 R 0x4 > TLS 0x079f94 0x080c2f94

Using glibc, why does my gethostbyname fail after I/DHCP has changed the DNS server?

旧城冷巷雨未停 提交于 2019-12-21 12:46:19
问题 If our server (running on a device) starts before a DHCP lease had been acquired then it can never connect using a hostname. If that happens it can find hosts by IP address but not by DNS. I initially thought that the Curl DNS cache was at fault as the curl connections failed. But I used CURLOPT_DNS_CACHE_TIMEOUT to prevent curl from caching address but connections still failed. 回答1: It turns out that glibc gethostbyname_r won't automatically reload it's configuration if that configuration

自定义镜像上传阿里云

梦想与她 提交于 2019-12-21 11:14:44
目录 1、alpine制作jdk镜像 2、Alpine制作jre镜像(瘦身) 3、Docker镜像上传至阿里云 1、alpine制作jdk镜像 alpine Linux简介 1.Alpine Linux是一个轻型Linux发行版,它不同于通常的Linux发行版,Alpine采用了musl libc 和 BusyBox以减少系统的体积和运行时的资源消耗。 2.Alpine Linux提供了自己的包管理工具:apk(注意:ubuntu中是apt-get),我们可以通过https://pkgs.alpinelinux.org/packages 查询包信息 3.Alpine Docker镜像继承了Alpine Linux发行版的这些优势,相比于其他Linux Docker镜像,它的体积非常小 对比常用的、没有压缩过的基础镜像(查看当前的:latest标签): Alpine - 4.8MB centos - 124.8 MB Debian - 125.1MB Centos - 196MB 4.建议使用Alpine Linux 3.10.0版本,这也是 v3.10 稳定系列的首个版本 alpine:3.10 基于alpine制作JDK8镜像 #1.下载镜像 docker pull alpine:latest #2.创建并编辑dockerfile touch Dockerfile vi

Executing binary: `GLIBCXX_3.4.11' not found

微笑、不失礼 提交于 2019-12-21 07:57:06
问题 I'm trying to run some pre-compiled code but I'm getting the following error: ./bin/stipdet: /cm/shared/apps/gcc/4.3.4/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./bin/stipdet) I googled the error and saw that some people solved similar problems by deleting the libstdc++.so.6 and adding a new dynamic link pointing to usr/local/lib . But I don't have root access on the system I'm trying to run this on, so I can't add/delete files in that directory. Does anyone know

Running a C program compiled here causes a GLIBC library not found error on another server - is it my fault or theirs?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 04:56:12
问题 A C program compiled here runs fine on our Ubuntu servers. But when a somebody else tries to run it on their particular Linux server they get the following errors: ./myprog-install: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by ./myprog-install) ./myprog-install: /lib/tls/libc.so.6: version `GLIBC_2.7' not found (required by ./myprog-install) Do I need to upgrade our glibc libraries and recompile? Or are they missing something on their server? If I run apt-cache show libc6 my