aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-10 23:38:44 -0400
committerGitHub <noreply@github.com>2022-05-10 23:38:44 -0400
commitf5edf78eea403c14635a05e1729672cfb50aca89 (patch)
tree1661a15b3ee4427ce6a4286f4c972be49e9f572c /src/Compilation.zig
parent458943e324e81762a9a2aa839d2fa3c851068e6f (diff)
parent45415093c655d30ec226172695248fbf28941667 (diff)
downloadzig-f5edf78eea403c14635a05e1729672cfb50aca89.tar.gz
zig-f5edf78eea403c14635a05e1729672cfb50aca89.zip
Merge pull request #10143 from nuald/single-threaded-cpp1
Normalized C++ compilation options for single-threaded targets
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 9126289804..5e4ab0ec12 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");
+ }
}
if (comp.bin_file.options.link_libunwind) {