aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-05-11 15:27:43 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2021-05-11 21:30:13 +0200
commit3b2c9ef828cc97a4c4664324d93ddbe3696b17fb (patch)
treee131d81ff8c115f65075f949bf5b6299662b682c /src
parent01e30002c52eda1ab3574f55c2e0568c56f2ed09 (diff)
downloadzig-3b2c9ef828cc97a4c4664324d93ddbe3696b17fb.tar.gz
zig-3b2c9ef828cc97a4c4664324d93ddbe3696b17fb.zip
stage2: link all libc components if using system libc
Diffstat (limited to 'src')
-rw-r--r--src/link/Elf.zig12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index c31a094093..91ee6f3206 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -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);