aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-12 22:25:20 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-12 22:25:20 -0700
commita7aa3ca66c271bc6f2905e4c3f0dd78763584d5b (patch)
tree24e232f653f0e57b9c5d988cd3e10ccf842add65 /src/link
parent344dc0cc0ffcd32ffb07c43ca7123b8564f2a506 (diff)
downloadzig-a7aa3ca66c271bc6f2905e4c3f0dd78763584d5b.tar.gz
zig-a7aa3ca66c271bc6f2905e4c3f0dd78763584d5b.zip
stage2: build and provide libunwind when compiling for native libc
5ac91794cce8bd53916a378815be01e4365d53d9 made Zig link against the system libc when targeting the native C ABI. However this made it stop putting libunwind.a on the linker line when it needed to sometimes, causing undefined symbols when linking against C++ code.
Diffstat (limited to 'src/link')
-rw-r--r--src/link/Elf.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index 7b1c5474a7..83b35cf12c 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -1648,6 +1648,9 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
// libc dep
if (self.base.options.link_libc) {
if (self.base.options.libc_installation != null) {
+ if (target_util.libcNeedsLibUnwind(target)) {
+ try argv.append(comp.libunwind_static_lib.?.full_object_path);
+ }
const needs_grouping = self.base.options.link_mode == .Static;
if (needs_grouping) try argv.append("--start-group");
// This matches the order of glibc.libs