diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/glibc.zig | 13 | ||||
| -rw-r--r-- | src/link/Elf.zig | 12 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/glibc.zig b/src/glibc.zig index 94c180f3d4..ee1b208cdd 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -16,6 +16,7 @@ const Module = @import("Package/Module.zig"); pub const Lib = struct { name: []const u8, sover: u8, + removed_in: ?Version = null, }; pub const ABI = struct { @@ -34,12 +35,12 @@ pub const ABI = struct { // The order of the elements in this array defines the linking order. pub const libs = [_]Lib{ .{ .name = "m", .sover = 6 }, - .{ .name = "pthread", .sover = 0 }, + .{ .name = "pthread", .sover = 0, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, .{ .name = "c", .sover = 6 }, - .{ .name = "dl", .sover = 2 }, - .{ .name = "rt", .sover = 1 }, + .{ .name = "dl", .sover = 2, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, + .{ .name = "rt", .sover = 1, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, .{ .name = "ld", .sover = 2 }, - .{ .name = "util", .sover = 1 }, + .{ .name = "util", .sover = 1, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, .{ .name = "resolv", .sover = 2 }, }; @@ -797,6 +798,10 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi defer stubs_asm.deinit(); for (libs, 0..) |lib, lib_i| { + if (lib.removed_in) |rem_in| { + if (target_version.order(rem_in) != .lt) continue; + } + stubs_asm.shrinkRetainingCapacity(0); try stubs_asm.appendSlice(".text\n"); 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, }); |
