mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 19:23:08 +00:00
libunwind: Build C files with -fexceptions.
See: https://github.com/llvm/llvm-project/pull/121819 This fixes LTO for libunwind, so also re-enable support for that. Closes #12828.
This commit is contained in:
parent
f38d7a92cc
commit
332add7a65
@ -36,8 +36,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
|
|||||||
.root_optimize_mode = comp.compilerRtOptMode(),
|
.root_optimize_mode = comp.compilerRtOptMode(),
|
||||||
.root_strip = comp.compilerRtStrip(),
|
.root_strip = comp.compilerRtStrip(),
|
||||||
.link_libc = true,
|
.link_libc = true,
|
||||||
// Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825
|
.lto = comp.config.lto,
|
||||||
.lto = .none,
|
|
||||||
}) catch |err| {
|
}) catch |err| {
|
||||||
comp.setMiscFailure(
|
comp.setMiscFailure(
|
||||||
.libunwind,
|
.libunwind,
|
||||||
@ -102,18 +101,18 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
|
|||||||
|
|
||||||
switch (Compilation.classifyFileExt(unwind_src)) {
|
switch (Compilation.classifyFileExt(unwind_src)) {
|
||||||
.c => {
|
.c => {
|
||||||
try cflags.append("-std=c17");
|
try cflags.appendSlice(&.{
|
||||||
},
|
"-std=c99",
|
||||||
.cpp => {
|
"-fexceptions",
|
||||||
try cflags.appendSlice(&[_][]const u8{
|
|
||||||
"-std=c++17",
|
|
||||||
"-fno-rtti",
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
.cpp => {
|
||||||
|
try cflags.append("-fno-exceptions");
|
||||||
|
try cflags.append("-fno-rtti");
|
||||||
|
},
|
||||||
.assembly_with_cpp => {},
|
.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("-I");
|
||||||
try cflags.append(try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libunwind", "include" }));
|
try cflags.append(try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libunwind", "include" }));
|
||||||
try cflags.append("-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS");
|
try cflags.append("-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user