aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-08-31 19:26:16 +0200
committerAndrew Kelley <andrew@ziglang.org>2024-09-03 17:33:23 -0700
commit290ccb160e2d884f70ac92d2eb16d56efd380533 (patch)
treeb997efaac7edd9aac56ca5ae5d5dcf4647f8da76 /src/link
parent7a4d69983a6ac7ab91f71910cec5886ed5bec745 (diff)
downloadzig-290ccb160e2d884f70ac92d2eb16d56efd380533.tar.gz
zig-290ccb160e2d884f70ac92d2eb16d56efd380533.zip
glibc: Avoid building and linking stub libraries that were emptied in 2.34.
Closes #20919.
Diffstat (limited to 'src/link')
-rw-r--r--src/link/Elf.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index e577b8d45a..194c1b8ad2 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -840,6 +840,10 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
} else if (target.isGnuLibC()) {
try system_libs.ensureUnusedCapacity(glibc.libs.len + 1);
for (glibc.libs) |lib| {
+ if (lib.removed_in) |rem_in| {
+ if (target.os.version_range.linux.glibc.order(rem_in) != .lt) continue;
+ }
+
const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{
comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover,
});
@@ -1286,6 +1290,10 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
if (needs_grouping) try argv.append("--end-group");
} else if (target.isGnuLibC()) {
for (glibc.libs) |lib| {
+ if (lib.removed_in) |rem_in| {
+ if (target.os.version_range.linux.glibc.order(rem_in) != .lt) continue;
+ }
+
const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{
comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover,
});
@@ -2288,6 +2296,10 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
if (needs_grouping) try argv.append("--end-group");
} else if (target.isGnuLibC()) {
for (glibc.libs) |lib| {
+ if (lib.removed_in) |rem_in| {
+ if (target.os.version_range.linux.glibc.order(rem_in) != .lt) continue;
+ }
+
const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{
comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover,
});