From 06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 26 Apr 2024 15:33:29 -0700 Subject: libcxx: update to LLVM 18 release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42 This adds the flag `-D_LIBCPP_HARDENING_MODE` which is determined based on the Zig optimization mode. This commit also fixes libunwind, libcxx, and libcxxabi to properly report sub compilation errors. --- src/Compilation.zig | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index fa9331eae5..95a3b8cc3a 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -3590,39 +3590,42 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v const named_frame = tracy.namedFrame("libunwind"); defer named_frame.end(); - libunwind.buildStaticLib(comp, prog_node) catch |err| { - // TODO Surface more error details. - comp.lockAndSetMiscFailure( + libunwind.buildStaticLib(comp, prog_node) catch |err| switch (err) { + error.OutOfMemory => return error.OutOfMemory, + error.SubCompilationFailed => return, // error reported already + else => comp.lockAndSetMiscFailure( .libunwind, "unable to build libunwind: {s}", .{@errorName(err)}, - ); + ), }; }, .libcxx => { const named_frame = tracy.namedFrame("libcxx"); defer named_frame.end(); - libcxx.buildLibCXX(comp, prog_node) catch |err| { - // TODO Surface more error details. - comp.lockAndSetMiscFailure( + libcxx.buildLibCXX(comp, prog_node) catch |err| switch (err) { + error.OutOfMemory => return error.OutOfMemory, + error.SubCompilationFailed => return, // error reported already + else => comp.lockAndSetMiscFailure( .libcxx, "unable to build libcxx: {s}", .{@errorName(err)}, - ); + ), }; }, .libcxxabi => { const named_frame = tracy.namedFrame("libcxxabi"); defer named_frame.end(); - libcxx.buildLibCXXABI(comp, prog_node) catch |err| { - // TODO Surface more error details. - comp.lockAndSetMiscFailure( + libcxx.buildLibCXXABI(comp, prog_node) catch |err| switch (err) { + error.OutOfMemory => return error.OutOfMemory, + error.SubCompilationFailed => return, // error reported already + else => comp.lockAndSetMiscFailure( .libcxxabi, "unable to build libcxxabi: {s}", .{@errorName(err)}, - ); + ), }; }, .libtsan => { @@ -5159,6 +5162,8 @@ pub fn addCCArgs( try argv.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ @intFromEnum(comp.libcxx_abi_version), })); + + try argv.append(libcxx.hardeningModeFlag(mod.optimize_mode)); } if (comp.config.link_libunwind) { -- cgit v1.2.3 From fb948fbacc282c8e5354ae47eba79b8a38e6fe68 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 28 Apr 2024 21:51:41 -0700 Subject: zig cc: -Wno-overriding-t-option was renamed in LLVM commit 1c66d08b0137cef7761b8220d3b7cb7833f57cdb --- src/Compilation.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 95a3b8cc3a..2497081a5e 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -5278,7 +5278,7 @@ pub fn addCCArgs( // version as well as the -mmacosx-version-min argument. // Zig provides the correct value in both places, so it // doesn't matter which one gets overridden. - argv.appendAssumeCapacity("-Wno-overriding-t-option"); + argv.appendAssumeCapacity("-Wno-overriding-option"); }, .ios, .tvos, .watchos => switch (target.cpu.arch) { // Pass the proper -m-version-min argument for darwin. -- cgit v1.2.3