authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-13 11:38:14-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-09-13 11:38:14-07:00
logf9859c102d7d54ce109ee7afdbd59251c233e92c
treeab95e7fad34068ab1e78a31d415db5a165c0018d
parentcdb40936bd528ee92dd11cf090ab75cf08bc0fc0

fix libc++ exceptions for musl targets

This reverts commit d31be31267523cadd6d59b52633f2d4a9758a3b4. The problem was happening due to an LLVM bug exposed by having LTO enabled for libunwind. The simple workaround is to disable LTO for libunwind. It can be re-enabled in the future when the upstream bug is fixed. See #12828

2 files changed, 3 insertions(+), 8 deletions(-)

src/libunwind.zig+2-1
...@@ -109,7 +109,8 @@ pub fn buildStaticLib(comp: *Compilation) !void {...@@ -109,7 +109,8 @@ pub fn buildStaticLib(comp: *Compilation) !void {
109 .want_tsan = false,109 .want_tsan = false,
110 .want_pic = comp.bin_file.options.pic,110 .want_pic = comp.bin_file.options.pic,
111 .want_pie = comp.bin_file.options.pie,111 .want_pie = comp.bin_file.options.pie,
112 .want_lto = comp.bin_file.options.lto,112 // Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825
113 .want_lto = false,
113 .function_sections = comp.bin_file.options.function_sections,114 .function_sections = comp.bin_file.options.function_sections,
114 .emit_h = null,115 .emit_h = null,
115 .strip = comp.compilerRtStrip(),116 .strip = comp.compilerRtStrip(),
test/standalone/c_compiler/build.zig+1-7
...@@ -12,15 +12,9 @@ fn isRunnableTarget(t: CrossTarget) bool {...@@ -12,15 +12,9 @@ fn isRunnableTarget(t: CrossTarget) bool {
12}12}
1313
14pub fn build(b: *Builder) void {14pub fn build(b: *Builder) void {
15 var mode = b.standardReleaseOptions();15 const mode = b.standardReleaseOptions();
16 const target = b.standardTargetOptions(.{});16 const target = b.standardTargetOptions(.{});
1717
18 if (mode != .Debug and target.getAbi().isMusl()) {
19 // https://github.com/ziglang/zig/issues/12828
20 std.debug.print("warn: skipping musl libc++ test that regressed with LLVM 15\n", .{});
21 mode = .Debug;
22 }
23
24 const test_step = b.step("test", "Test the program");18 const test_step = b.step("test", "Test the program");
2519
26 const exe_c = b.addExecutable("test_c", null);20 const exe_c = b.addExecutable("test_c", null);