aboutsummaryrefslogtreecommitdiff
path: root/doc
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 /doc
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 'doc')
-rw-r--r--doc/docgen.zig3
1 files changed, 1 insertions, 2 deletions
diff --git a/doc/docgen.zig b/doc/docgen.zig
index 0f0e212e3c..50000da44c 100644
--- a/doc/docgen.zig
+++ b/doc/docgen.zig
@@ -1210,7 +1210,7 @@ fn genHtml(
var env_map = try process.getEnvMap(allocator);
try env_map.put("ZIG_DEBUG_COLOR", "1");
- const host = try std.zig.system.NativeTargetInfo.detect(allocator, .{});
+ const host = try std.zig.system.NativeTargetInfo.detect(.{});
const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe);
for (toc.nodes) |node| {
@@ -1474,7 +1474,6 @@ fn genHtml(
.arch_os_abi = triple,
});
const target_info = try std.zig.system.NativeTargetInfo.detect(
- allocator,
cross_target,
);
switch (host.getExternalExecutor(target_info, .{