| author | |
| committer | |
| log | 290ccb160e2d884f70ac92d2eb16d56efd380533 |
| tree | b997efaac7edd9aac56ca5ae5d5dcf4647f8da76 |
| parent | 7a4d69983a6ac7ab91f71910cec5886ed5bec745 |
Closes #20919.2 files changed, 21 insertions(+), 4 deletions(-)
src/glibc.zig+9-4| ... | ... | @@ -16,6 +16,7 @@ const Module = @import("Package/Module.zig"); |
| 16 | 16 | pub const Lib = struct { |
| 17 | 17 | name: []const u8, |
| 18 | 18 | sover: u8, |
| 19 | removed_in: ?Version = null, | |
| 19 | 20 | }; |
| 20 | 21 | |
| 21 | 22 | pub const ABI = struct { |
| ... | ... | @@ -34,12 +35,12 @@ pub const ABI = struct { |
| 34 | 35 | // The order of the elements in this array defines the linking order. |
| 35 | 36 | pub const libs = [_]Lib{ |
| 36 | 37 | .{ .name = "m", .sover = 6 }, |
| 37 | .{ .name = "pthread", .sover = 0 }, | |
| 38 | .{ .name = "pthread", .sover = 0, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, | |
| 38 | 39 | .{ .name = "c", .sover = 6 }, |
| 39 | .{ .name = "dl", .sover = 2 }, | |
| 40 | .{ .name = "rt", .sover = 1 }, | |
| 40 | .{ .name = "dl", .sover = 2, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, | |
| 41 | .{ .name = "rt", .sover = 1, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, | |
| 41 | 42 | .{ .name = "ld", .sover = 2 }, |
| 42 | .{ .name = "util", .sover = 1 }, | |
| 43 | .{ .name = "util", .sover = 1, .removed_in = .{ .major = 2, .minor = 34, .patch = 0 } }, | |
| 43 | 44 | .{ .name = "resolv", .sover = 2 }, |
| 44 | 45 | }; |
| 45 | 46 | |
| ... | ... | @@ -797,6 +798,10 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) !voi |
| 797 | 798 | defer stubs_asm.deinit(); |
| 798 | 799 | |
| 799 | 800 | for (libs, 0..) |lib, lib_i| { |
| 801 | if (lib.removed_in) |rem_in| { | |
| 802 | if (target_version.order(rem_in) != .lt) continue; | |
| 803 | } | |
| 804 | ||
| 800 | 805 | stubs_asm.shrinkRetainingCapacity(0); |
| 801 | 806 | try stubs_asm.appendSlice(".text\n"); |
| 802 | 807 |
src/link/Elf.zig+12| ... | ... | @@ -840,6 +840,10 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod |
| 840 | 840 | } else if (target.isGnuLibC()) { |
| 841 | 841 | try system_libs.ensureUnusedCapacity(glibc.libs.len + 1); |
| 842 | 842 | for (glibc.libs) |lib| { |
| 843 | if (lib.removed_in) |rem_in| { | |
| 844 | if (target.os.version_range.linux.glibc.order(rem_in) != .lt) continue; | |
| 845 | } | |
| 846 | ||
| 843 | 847 | const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{ |
| 844 | 848 | comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, |
| 845 | 849 | }); |
| ... | ... | @@ -1286,6 +1290,10 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void { |
| 1286 | 1290 | if (needs_grouping) try argv.append("--end-group"); |
| 1287 | 1291 | } else if (target.isGnuLibC()) { |
| 1288 | 1292 | for (glibc.libs) |lib| { |
| 1293 | if (lib.removed_in) |rem_in| { | |
| 1294 | if (target.os.version_range.linux.glibc.order(rem_in) != .lt) continue; | |
| 1295 | } | |
| 1296 | ||
| 1289 | 1297 | const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{ |
| 1290 | 1298 | comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, |
| 1291 | 1299 | }); |
| ... | ... | @@ -2288,6 +2296,10 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s |
| 2288 | 2296 | if (needs_grouping) try argv.append("--end-group"); |
| 2289 | 2297 | } else if (target.isGnuLibC()) { |
| 2290 | 2298 | for (glibc.libs) |lib| { |
| 2299 | if (lib.removed_in) |rem_in| { | |
| 2300 | if (target.os.version_range.linux.glibc.order(rem_in) != .lt) continue; | |
| 2301 | } | |
| 2302 | ||
| 2291 | 2303 | const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{ |
| 2292 | 2304 | comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, |
| 2293 | 2305 | }); |