diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-15 21:44:38 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-05-15 21:44:38 -0700 |
| commit | 597082adf45cebbf2c6a81c3f732b6d2ce4a1435 (patch) | |
| tree | 9309977e204cceaac2c18efbea2153a69f86d1f4 /src/link/Elf.zig | |
| parent | 07606d12daabe8c201dba3d5b27e702ce58d0ffb (diff) | |
| parent | d98e39fa6864f287bc50f265f98b7195849afa68 (diff) | |
| download | zig-597082adf45cebbf2c6a81c3f732b6d2ce4a1435.tar.gz zig-597082adf45cebbf2c6a81c3f732b6d2ce4a1435.zip | |
Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
* build.zig
* src/Compilation.zig
* src/codegen/spirv/spec.zig
* src/link/SpirV.zig
* test/stage2/darwin.zig
- this one might be problematic; start.zig looks for `main` in the
root source file, not `_main`. Not sure why there is an underscore
there in master branch.
Diffstat (limited to 'src/link/Elf.zig')
| -rw-r--r-- | src/link/Elf.zig | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig index e88bb036f2..0ebbe819d4 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1645,6 +1645,11 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { try argv.append(comp.libcxx_static_lib.?.full_object_path); } + // libunwind dep + if (self.base.options.link_libunwind) { + try argv.append(comp.libunwind_static_lib.?.full_object_path); + } + // libc dep if (self.base.options.link_libc) { if (self.base.options.libc_installation != null) { @@ -1653,18 +1658,9 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { } const needs_grouping = self.base.options.link_mode == .Static; if (needs_grouping) try argv.append("--start-group"); - // This matches the order of glibc.libs - try argv.appendSlice(&[_][]const u8{ - "-lm", - "-lpthread", - "-lc", - "-ldl", - "-lrt", - "-lutil", - }); + try argv.appendSlice(target_util.libcFullLinkFlags(target)); 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| { const lib_path = try std.fmt.allocPrint(arena, "{s}{c}lib{s}.so.{d}", .{ comp.glibc_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, @@ -1673,13 +1669,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { } try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a")); } else if (target.isMusl()) { - try argv.append(comp.libunwind_static_lib.?.full_object_path); try argv.append(try comp.get_libc_crt_file(arena, switch (self.base.options.link_mode) { .Static => "libc.a", .Dynamic => "libc.so", })); - } else if (self.base.options.link_libcpp) { - try argv.append(comp.libunwind_static_lib.?.full_object_path); } else { unreachable; // Compiler was supposed to emit an error for not being able to provide libc. } |
