diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-05-13 15:59:24 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-05-13 22:42:57 -0400 |
| commit | 826179bff40fdbd8c3b11138897fcfbb3367def8 (patch) | |
| tree | 23fcdea829179045785ac4303a3e694cc7e12170 /src/main.zig | |
| parent | 76a259799d5bac3effabd1df44c0dec9e4fa16d4 (diff) | |
| download | zig-826179bff40fdbd8c3b11138897fcfbb3367def8.tar.gz zig-826179bff40fdbd8c3b11138897fcfbb3367def8.zip | |
stage2: -lunwind is handled specially
* `-lc++` now implies `-lc`.
* `-lunwind` is now pulled out into a separate `link_libunwind` flag in
the frontend driver code. This allows a project to request zig to
provide libunwind even if the default situation that causes it to be
implicitly added, is not active.
* build.zig: ask for -lunwind when building the self-hosted compiler on
Linux. Otherwise we get linker errors with unresolved symbols to
libunwind.
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index bd57c1f14f..d435fb5ea4 100644 --- a/src/main.zig +++ b/src/main.zig @@ -520,6 +520,7 @@ fn buildOutputType( var ensure_libcpp_on_non_freestanding = false; var link_libc = false; var link_libcpp = false; + var link_libunwind = false; var want_native_include_dirs = false; var enable_cache: ?bool = null; var want_pic: ?bool = null; @@ -1532,6 +1533,11 @@ fn buildOutputType( _ = system_libs.orderedRemove(i); continue; } + if (mem.eql(u8, lib_name, "unwind")) { + link_libunwind = true; + _ = system_libs.orderedRemove(i); + continue; + } if (std.fs.path.isAbsolute(lib_name)) { fatal("cannot use absolute path as a system library: {s}", .{lib_name}); } @@ -1847,6 +1853,7 @@ fn buildOutputType( .system_libs = system_libs.items, .link_libc = link_libc, .link_libcpp = link_libcpp, + .link_libunwind = link_libunwind, .want_pic = want_pic, .want_pie = want_pie, .want_lto = want_lto, |
