mirror of
https://github.com/ziglang/zig.git
synced 2026-01-31 11:43:37 +00:00
stage2: Change libc components' linking order
Use the same order as Clang (and, by extension, GCC) for the three most important libc components: lm comes first, followed by lpthread and then lc.
This commit is contained in:
parent
780f510ac0
commit
2bb8e1ff55
@ -40,10 +40,11 @@ pub const ABI = struct {
|
||||
}
|
||||
};
|
||||
|
||||
// The order of the elements in this array defines the linking order.
|
||||
pub const libs = [_]Lib{
|
||||
.{ .name = "c", .sover = 6 },
|
||||
.{ .name = "m", .sover = 6 },
|
||||
.{ .name = "pthread", .sover = 0 },
|
||||
.{ .name = "c", .sover = 6 },
|
||||
.{ .name = "dl", .sover = 2 },
|
||||
.{ .name = "rt", .sover = 1 },
|
||||
.{ .name = "ld", .sover = 2 },
|
||||
|
||||
@ -1648,17 +1648,12 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
|
||||
// libc dep
|
||||
if (self.base.options.link_libc) {
|
||||
if (self.base.options.libc_installation != null) {
|
||||
if (self.base.options.link_mode == .Static) {
|
||||
try argv.append("--start-group");
|
||||
try argv.append("-lc");
|
||||
try argv.append("-lm");
|
||||
try argv.append("--end-group");
|
||||
} else {
|
||||
try argv.append("-lc");
|
||||
try argv.append("-lm");
|
||||
}
|
||||
|
||||
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");
|
||||
if (needs_grouping) try argv.append("--end-group");
|
||||
} else if (target.isGnuLibC()) {
|
||||
try argv.append(comp.libunwind_static_lib.?.full_object_path);
|
||||
for (glibc.libs) |lib| {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user