Skip to content

libunwind: Build C files with -fexceptions. #22524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/libunwind.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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");
try cflags.appendSlice(&.{
"-std=c99",
"-fexceptions",
});
},
.cpp => {
try cflags.appendSlice(&[_][]const u8{
"-std=c++17",
"-fno-rtti",
});
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");
Expand Down
Loading