From 3997828a6176203b25b541c6e450f5e4bda82ce4 Mon Sep 17 00:00:00 2001 From: Alexander Slesarev Date: Sun, 31 Oct 2021 22:36:30 -0600 Subject: Added _LIBCPP_HAS_NO_THREADS for single_threaded binaries linked with libcxx. Fixed single-threaded mode for Windows. --- src/Compilation.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 9126289804..3eb527b612 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1180,6 +1180,15 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { if (must_single_thread and !single_threaded) { return error.TargetRequiresSingleThreaded; } + if (!single_threaded and options.link_libcpp) { + if (options.target.cpu.arch.isARM()) { + log.warn( + \\libc++ does not work on multi-threaded ARM yet. + \\For more details: https://github.com/ziglang/zig/issues/6573 + , .{}); + return error.TargetRequiresSingleThreaded; + } + } const llvm_cpu_features: ?[*:0]const u8 = if (build_options.have_llvm and use_llvm) blk: { var buf = std.ArrayList(u8).init(arena); @@ -3803,6 +3812,10 @@ pub fn addCCArgs( try argv.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); try argv.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); try argv.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS"); + + if (comp.bin_file.options.single_threaded) { + try argv.append("-D_LIBCPP_HAS_NO_THREADS"); + } else {} } if (comp.bin_file.options.link_libunwind) { -- cgit v1.2.3