Skip to content

Commit 556c9c2

Browse files
committed
glibc: Don't link threaded stub libraries if all modules are single-threaded
Part of #24347.
1 parent b461d07 commit 556c9c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/link/Lld.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,11 @@ fn elfLink(lld: *Lld, arena: Allocator) !void {
12171217
if (lib.removed_in) |rem_in| {
12181218
if (target.os.versionRange().gnuLibCVersion().?.order(rem_in) != .lt) continue;
12191219
}
1220+
if (!comp.config.any_non_single_threaded and
1221+
(std.mem.eql(u8, lib.name, "pthread") or
1222+
std.mem.eql(u8, lib.name, "resolv") or
1223+
std.mem.eql(u8, lib.name, "rt") or
1224+
std.mem.eql(u8, lib.name, "util"))) continue;
12201225

12211226
const lib_path = try std.fmt.allocPrint(arena, "{}{c}lib{s}.so.{d}", .{
12221227
comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover,

0 commit comments

Comments
 (0)