diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-04-26 15:33:29 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-05-08 19:37:29 -0700 |
| commit | 06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76 (patch) | |
| tree | 1316711b92a43dd5c599e425b8693fa8e1e0c0b7 /src/Compilation.zig | |
| parent | bc6ebc6f2597fda1f98842c6f545751fef2a5334 (diff) | |
| download | zig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.tar.gz zig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.zip | |
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.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 29 |
1 files changed, 17 insertions, 12 deletions
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) { |
