Commit 290ccb160e
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,
});
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");