diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-01 15:52:54 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-01 15:52:54 -0700 |
| commit | c89dd15e1be4959800dc7092d7dd4375253db7bc (patch) | |
| tree | ca184ae53592efa21e67128a5f891d642d7f1118 /src/libcxx.zig | |
| parent | 5466e87fce581f2ef90ac23bb80b1dbc05836fc6 (diff) | |
| parent | 2360f8c490f3ec684ed64ff28e8c1fade249070b (diff) | |
| download | zig-c89dd15e1be4959800dc7092d7dd4375253db7bc.tar.gz zig-c89dd15e1be4959800dc7092d7dd4375253db7bc.zip | |
Merge remote-tracking branch 'origin/master' into llvm14
Diffstat (limited to 'src/libcxx.zig')
| -rw-r--r-- | src/libcxx.zig | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/libcxx.zig b/src/libcxx.zig index b2974e24c9..a5ab242339 100644 --- a/src/libcxx.zig +++ b/src/libcxx.zig @@ -128,6 +128,12 @@ pub fn buildLibCXX(comp: *Compilation) !void { continue; if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos) continue; + if (comp.bin_file.options.single_threaded) { + if (std.mem.startsWith(u8, cxx_src, "src/support/win32/thread_win32.cpp")) { + continue; + } + try cflags.append("-D_LIBCPP_HAS_NO_THREADS"); + } try cflags.append("-DNDEBUG"); try cflags.append("-D_LIBCPP_BUILDING_LIBRARY"); @@ -145,8 +151,7 @@ pub fn buildLibCXX(comp: *Compilation) !void { } if (target.os.tag == .wasi) { - // WASI doesn't support thread and exception yet. - try cflags.append("-D_LIBCPP_HAS_NO_THREADS"); + // WASI doesn't support exceptions yet. try cflags.append("-fno-exceptions"); } @@ -264,13 +269,20 @@ pub fn buildLibCXXABI(comp: *Compilation) !void { var cflags = std.ArrayList([]const u8).init(arena); if (target.os.tag == .wasi) { - // WASI doesn't support thread and exception yet. - if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_thread_atexit.cpp") or - std.mem.startsWith(u8, cxxabi_src, "src/cxa_exception.cpp") or + // WASI doesn't support exceptions yet. + if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_exception.cpp") or std.mem.startsWith(u8, cxxabi_src, "src/cxa_personality.cpp")) continue; - try cflags.append("-D_LIBCXXABI_HAS_NO_THREADS"); try cflags.append("-fno-exceptions"); + } + + // WASM targets are single threaded. + if (comp.bin_file.options.single_threaded) { + if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_thread_atexit.cpp")) { + continue; + } + try cflags.append("-D_LIBCXXABI_HAS_NO_THREADS"); + try cflags.append("-D_LIBCPP_HAS_NO_THREADS"); } else { try cflags.append("-DHAVE___CXA_THREAD_ATEXIT_IMPL"); } |
