authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-04 12:25:05+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-05 07:25:25+02:00
log566e4ab6b19fb8075dd591968eeb4cad53679cfd
tree630d39611175a8d39375483236a94dd26ebbc15a
parent7b45bd3c09e04edbd5bdd8a443e0ae3757b1a709
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

compiler: Set libc++ ABI version to 2 for Emscripten.

It remains 1 everywhere else. Also remove some code that allowed setting the libc++ ABI version on the Compilation since there are no current plans to actually expose this in the CLI.

2 files changed, 3 insertions(+), 13 deletions(-)

src/Compilation.zig-4
...@@ -259,8 +259,6 @@ crt_files: std.StringHashMapUnmanaged(CrtFile) = .empty,...@@ -259,8 +259,6 @@ crt_files: std.StringHashMapUnmanaged(CrtFile) = .empty,
259/// Null means only show snippet on first error.259/// Null means only show snippet on first error.
260reference_trace: ?u32 = null,260reference_trace: ?u32 = null,
261261
262libcxx_abi_version: libcxx.AbiVersion = libcxx.AbiVersion.default,
263
264/// This mutex guards all `Compilation` mutable state.262/// This mutex guards all `Compilation` mutable state.
265/// Disabled in single-threaded mode because the thread pool spawns in the same thread.263/// Disabled in single-threaded mode because the thread pool spawns in the same thread.
266mutex: if (builtin.single_threaded) struct {264mutex: if (builtin.single_threaded) struct {
...@@ -1172,7 +1170,6 @@ pub const CreateOptions = struct {...@@ -1172,7 +1170,6 @@ pub const CreateOptions = struct {
1172 force_load_objc: bool = false,1170 force_load_objc: bool = false,
1173 /// Whether local symbols should be discarded from the symbol table.1171 /// Whether local symbols should be discarded from the symbol table.
1174 discard_local_symbols: bool = false,1172 discard_local_symbols: bool = false,
1175 libcxx_abi_version: libcxx.AbiVersion = libcxx.AbiVersion.default,
1176 /// (Windows) PDB source path prefix to instruct the linker how to resolve relative1173 /// (Windows) PDB source path prefix to instruct the linker how to resolve relative
1177 /// paths when consolidating CodeView streams into a single PDB file.1174 /// paths when consolidating CodeView streams into a single PDB file.
1178 pdb_source_path: ?[]const u8 = null,1175 pdb_source_path: ?[]const u8 = null,
...@@ -1545,7 +1542,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil...@@ -1545,7 +1542,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
1545 .debug_compiler_runtime_libs = options.debug_compiler_runtime_libs,1542 .debug_compiler_runtime_libs = options.debug_compiler_runtime_libs,
1546 .debug_compile_errors = options.debug_compile_errors,1543 .debug_compile_errors = options.debug_compile_errors,
1547 .incremental = options.incremental,1544 .incremental = options.incremental,
1548 .libcxx_abi_version = options.libcxx_abi_version,
1549 .root_name = root_name,1545 .root_name = root_name,
1550 .sysroot = sysroot,1546 .sysroot = sysroot,
1551 .windows_libs = windows_libs,1547 .windows_libs = windows_libs,
src/libcxx.zig+3-9
...@@ -8,13 +8,6 @@ const build_options = @import("build_options");...@@ -8,13 +8,6 @@ const build_options = @import("build_options");
8const trace = @import("tracy.zig").trace;8const trace = @import("tracy.zig").trace;
9const Module = @import("Package/Module.zig");9const Module = @import("Package/Module.zig");
1010
11pub const AbiVersion = enum(u2) {
12 @"1" = 1,
13 @"2" = 2,
14
15 pub const default: AbiVersion = .@"1";
16};
17
18const libcxxabi_files = [_][]const u8{11const libcxxabi_files = [_][]const u8{
19 "src/abort_message.cpp",12 "src/abort_message.cpp",
20 "src/cxa_aux_runtime.cpp",13 "src/cxa_aux_runtime.cpp",
...@@ -145,11 +138,12 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!...@@ -145,11 +138,12 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
145 const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" });138 const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" });
146 const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" });139 const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" });
147 const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" });140 const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" });
141 const abi_version: u2 = if (target.os.tag == .emscripten) 2 else 1;
148 const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{142 const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{
149 @intFromEnum(comp.libcxx_abi_version),143 abi_version,
150 });144 });
151 const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{145 const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{
152 @intFromEnum(comp.libcxx_abi_version),146 abi_version,
153 });147 });
154148
155 const optimize_mode = comp.compilerRtOptMode();149 const optimize_mode = comp.compilerRtOptMode();