aboutsummaryrefslogtreecommitdiff
path: root/src/link/Elf.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-11 20:28:14 -0400
committerGitHub <noreply@github.com>2021-05-11 20:28:14 -0400
commite3dd4dc91d65702c085dac9cc4d85aebfa308dfa (patch)
treeee8aadf75cd14cd5bf9833b368b2553aae2365a8 /src/link/Elf.zig
parente6881d4373ce355f3f4565c22c125870ed8fcfc8 (diff)
parentf8cf106fc971c9c61709443860b1f728ca4cfc9a (diff)
downloadzig-e3dd4dc91d65702c085dac9cc4d85aebfa308dfa.tar.gz
zig-e3dd4dc91d65702c085dac9cc4d85aebfa308dfa.zip
Merge pull request #8737 from ifreund/link-system-libc
stage2: use system libc when targeting the native OS/ABI
Diffstat (limited to 'src/link/Elf.zig')
-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);