Skip to content

Commit 7401f06

Browse files
committed
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.
1 parent f0feda8 commit 7401f06

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/Compilation.zig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,6 @@ crt_files: std.StringHashMapUnmanaged(CrtFile) = .empty,
259259
/// Null means only show snippet on first error.
260260
reference_trace: ?u32 = null,
261261

262-
libcxx_abi_version: libcxx.AbiVersion = libcxx.AbiVersion.default,
263-
264262
/// This mutex guards all `Compilation` mutable state.
265263
/// Disabled in single-threaded mode because the thread pool spawns in the same thread.
266264
mutex: if (builtin.single_threaded) struct {
@@ -1171,7 +1169,6 @@ pub const CreateOptions = struct {
11711169
force_load_objc: bool = false,
11721170
/// Whether local symbols should be discarded from the symbol table.
11731171
discard_local_symbols: bool = false,
1174-
libcxx_abi_version: libcxx.AbiVersion = libcxx.AbiVersion.default,
11751172
/// (Windows) PDB source path prefix to instruct the linker how to resolve relative
11761173
/// paths when consolidating CodeView streams into a single PDB file.
11771174
pdb_source_path: ?[]const u8 = null,
@@ -1555,7 +1552,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
15551552
.debug_compiler_runtime_libs = options.debug_compiler_runtime_libs,
15561553
.debug_compile_errors = options.debug_compile_errors,
15571554
.incremental = options.incremental,
1558-
.libcxx_abi_version = options.libcxx_abi_version,
15591555
.root_name = root_name,
15601556
.sysroot = sysroot,
15611557
.windows_libs = windows_libs,

src/libcxx.zig

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ const build_options = @import("build_options");
88
const trace = @import("tracy.zig").trace;
99
const Module = @import("Package/Module.zig");
1010

11-
pub const AbiVersion = enum(u2) {
12-
@"1" = 1,
13-
@"2" = 2,
14-
15-
pub const default: AbiVersion = .@"1";
16-
};
17-
1811
const libcxxabi_files = [_][]const u8{
1912
"src/abort_message.cpp",
2013
"src/cxa_aux_runtime.cpp",
@@ -535,11 +528,12 @@ pub fn addCxxArgs(
535528
const target = comp.getTarget();
536529
const optimize_mode = comp.compilerRtOptMode();
537530

531+
const abi_version: u2 = if (target.os.tag == .emscripten) 2 else 1;
538532
try cflags.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{
539-
@intFromEnum(comp.libcxx_abi_version),
533+
abi_version,
540534
}));
541535
try cflags.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{
542-
@intFromEnum(comp.libcxx_abi_version),
536+
abi_version,
543537
}));
544538
try cflags.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_HAS_{s}THREADS", .{
545539
if (!comp.config.any_non_single_threaded) "NO_" else "",

0 commit comments

Comments
 (0)