aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-09-08 18:27:26 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-09-08 20:52:49 -0700
commit3ee01c14ee7ba42b484f15daeacb67da90a81c9e (patch)
tree667a4b57b8bfc1a8b6413d014a72b113d5ec2833 /src/codegen
parentfa940bafa2720f49ee249eda1ee4cf26a247172a (diff)
downloadzig-3ee01c14ee7ba42b484f15daeacb67da90a81c9e.tar.gz
zig-3ee01c14ee7ba42b484f15daeacb67da90a81c9e.zip
std.zig.system.NativeTargetInfo: detection ignores self exe
Before, native glibc and dynamic linker detection attempted to use the executable's own binary if it was dynamically linked to answer both the C ABI question and the dynamic linker question. However, this could be problematic on a system that uses a RUNPATH for the compiler binary, locking it to an older glibc version, while system binaries such as /usr/bin/env use a newer glibc version. The problem is that libc.so.6 glibc version will match that of the system while the dynamic linker will match that of the compiler binary. Executables with these versions mismatching will fail to run. Therefore, this commit changes the logic to be the same regardless of whether the compiler binary is dynamically or statically linked. It inspects `/usr/bin/env` as an ELF file to find the answer to these questions, or if there is a shebang line, then it chases the referenced file recursively. If that does not provide the answer, then the function falls back to defaults. This commit also solves a TODO to remove an Allocator parameter to the detect() function.
Diffstat (limited to 'src/codegen')
0 files changed, 0 insertions, 0 deletions