mirror of
https://github.com/ziglang/zig.git
synced 2025-12-30 18:13:19 +00:00
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.
This commit is contained in:
parent
344dc0cc0f
commit
a7aa3ca66c
@ -3278,7 +3278,6 @@ fn wantBuildLibUnwindFromSource(comp: *Compilation) bool {
|
||||
.Exe => true,
|
||||
};
|
||||
return comp.bin_file.options.link_libc and is_exe_or_dyn_lib and
|
||||
comp.bin_file.options.libc_installation == null and
|
||||
comp.bin_file.options.object_format != .c and
|
||||
target_util.libcNeedsLibUnwind(comp.getTarget());
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user