authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-19 06:46:24+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-01-19 06:46:24+01:00
log0ead0beb8398176b47add9461d317c4777f2a2e9
tree4ef766d6d00c406097b5231ff9674034800f78fb
parent8ee80d61f6b2355f590de9722172b93a55c4f563
parent332add7a65003a700c5513f153d8e1362009e35c
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #22524 from alexrp/libunwind-exceptions

`libunwind`: Build C files with `-fexceptions`.

1 files changed, 8 insertions(+), 9 deletions(-)

src/libunwind.zig+8-9
......@@ -36,8 +36,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
3636 .root_optimize_mode = comp.compilerRtOptMode(),
3737 .root_strip = comp.compilerRtStrip(),
3838 .link_libc = true,
39 // Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825
40 .lto = .none,
39 .lto = comp.config.lto,
4140 }) catch |err| {
4241 comp.setMiscFailure(
4342 .libunwind,
......@@ -102,18 +101,18 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
102101
103102 switch (Compilation.classifyFileExt(unwind_src)) {
104103 .c => {
105 try cflags.append("-std=c17");
104 try cflags.appendSlice(&.{
105 "-std=c99",
106 "-fexceptions",
107 });
106108 },
107109 .cpp => {
108 try cflags.appendSlice(&[_][]const u8{
109 "-std=c++17",
110 "-fno-rtti",
111 });
110 try cflags.append("-fno-exceptions");
111 try cflags.append("-fno-rtti");
112112 },
113113 .assembly_with_cpp => {},
114 else => unreachable, // You can see the entire list of files just above.
114 else => unreachable, // See `unwind_src_list`.
115115 }
116 try cflags.append("-fno-exceptions");
117116 try cflags.append("-I");
118117 try cflags.append(try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libunwind", "include" }));
119118 try cflags.append("-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS");