| author | |
| committer | |
| log | 4b59f564344598b4d1f1a51839a4dc5cbf357012 |
| tree | ac1567c2e4fdbde343b30150b0fd42e3742e2a08 |
| parent | 459c9f05359e3405f39e4c954c62c61a493e49ae |
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.2 files changed, 3 insertions(+), 1 deletions(-)
src/Compilation.zig-1| ... | ... | @@ -3023,7 +3023,6 @@ fn wantBuildLibUnwindFromSource(comp: *Compilation) bool { |
| 3023 | 3023 | .Exe => true, |
| 3024 | 3024 | }; |
| 3025 | 3025 | return comp.bin_file.options.link_libc and is_exe_or_dyn_lib and |
| 3026 | comp.bin_file.options.libc_installation == null and | |
| 3027 | 3026 | target_util.libcNeedsLibUnwind(comp.getTarget()); |
| 3028 | 3027 | } |
| 3029 | 3028 |
src/link/Elf.zig+3| ... | ... | @@ -1648,6 +1648,9 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1648 | 1648 | // libc dep |
| 1649 | 1649 | if (self.base.options.link_libc) { |
| 1650 | 1650 | if (self.base.options.libc_installation != null) { |
| 1651 | if (target_util.libcNeedsLibUnwind(target)) { | |
| 1652 | try argv.append(comp.libunwind_static_lib.?.full_object_path); | |
| 1653 | } | |
| 1651 | 1654 | const needs_grouping = self.base.options.link_mode == .Static; |
| 1652 | 1655 | if (needs_grouping) try argv.append("--start-group"); |
| 1653 | 1656 | try argv.appendSlice(target_util.libcFullLinkFlags(target)); |