aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/include/powerpc-linux-gnu/bits/pthread_stack_min.h
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-12-13 18:05:02 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-12-13 18:05:02 -0700
commit5d1aab72d92d0ab512464af0d3ffc036467ac011 (patch)
treeee6af9d8d7f8d4a49bbb8cc2ed7b0c2af0f33469 /lib/libc/include/powerpc-linux-gnu/bits/pthread_stack_min.h
parent1442aa7dc039fd77c483862e37b099fe6d43f369 (diff)
downloadzig-5d1aab72d92d0ab512464af0d3ffc036467ac011.tar.gz
zig-5d1aab72d92d0ab512464af0d3ffc036467ac011.zip
std.zig.system: improve native glibc version detection
When the Zig compiler is statically linked, it inspects the /usr/bin/env ELF file to determine the native glibc version, by checking the DT_RUNPATH, and then calling readlink() on the libc.so file, because typically the symlink will have e.g. libc-2.33.so in the name, revealing the glibc version. Fortunately, this information is also in readlink() of ld.so, which is available as the "INTERP" file path. This commit looks for e.g. `ld-2.33.so` on the symlink data for the dynamic linker. In theory a more complete solution would also look at `/etc/ld.so.cache` if necessary, and finally fall back to some hard coded paths, in order to resolve the location of libc.so, in order to do this readlink() trick on the resulting path. You can find that flow chart with `man ld.so`. But I think this logic will be enough to get a correct answer in all real world cases. This has been tested on Debian Buster and glibc-based Void Linux. Fixes #6469
Diffstat (limited to 'lib/libc/include/powerpc-linux-gnu/bits/pthread_stack_min.h')
0 files changed, 0 insertions, 0 deletions