Merge pull request #22524 from alexrp/libunwind-exceptions

`libunwind`: Build C files with `-fexceptions`.
This commit is contained in:
Alex Rønne Petersen 2025-01-19 06:46:24 +01:00 committed by GitHub
commit 0ead0beb83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,8 +36,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
.root_optimize_mode = comp.compilerRtOptMode(),
.root_strip = comp.compilerRtStrip(),
.link_libc = true,
// Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825
.lto = .none,
.lto = comp.config.lto,
}) catch |err| {
comp.setMiscFailure(
.libunwind,
@ -102,18 +101,18 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
switch (Compilation.classifyFileExt(unwind_src)) {
.c => {
try cflags.append("-std=c17");
},
.cpp => {
try cflags.appendSlice(&[_][]const u8{
"-std=c++17",
"-fno-rtti",
try cflags.appendSlice(&.{
"-std=c99",
"-fexceptions",
});
},
.cpp => {
try cflags.append("-fno-exceptions");
try cflags.append("-fno-rtti");
},
.assembly_with_cpp => {},
else => unreachable, // You can see the entire list of files just above.
else => unreachable, // See `unwind_src_list`.
}
try cflags.append("-fno-exceptions");
try cflags.append("-I");
try cflags.append(try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libunwind", "include" }));
try cflags.append("-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS");