stage2: link all libc components if using system libc

This commit is contained in:
Isaac Freund 2021-05-11 15:27:43 +02:00
parent 01e30002c5
commit 3b2c9ef828
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -1650,9 +1650,15 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
if (self.base.options.libc_installation != null) {
const needs_grouping = self.base.options.link_mode == .Static;
if (needs_grouping) try argv.append("--start-group");
try argv.append("-lm");
try argv.append("-lpthread");
try argv.append("-lc");
// This matches the order of glibc.libs
try argv.appendSlice(&[_][]const u8{
"-lm",
"-lpthread",
"-lc",
"-ldl",
"-lrt",
"-lutil",
});
if (needs_grouping) try argv.append("--end-group");
} else if (target.isGnuLibC()) {
try argv.append(comp.libunwind_static_lib.?.full_object_path);