aboutsummaryrefslogtreecommitdiff
path: root/src/target.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-10-24 19:43:56 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-10-24 19:43:56 -0400
commitad438a95c528c4a2013e3e7fb99ea9a260143eb3 (patch)
tree7d4daebb99dd0d1fbc9b324f0416b9bc86008f70 /src/target.cpp
parentf8bd1cd3b11802d3566d287167d79d3cfc3ef41d (diff)
downloadzig-ad438a95c528c4a2013e3e7fb99ea9a260143eb3.tar.gz
zig-ad438a95c528c4a2013e3e7fb99ea9a260143eb3.zip
avoid passing -march=native when not supported
Clang does not support -march=native for all targets. Arguably it should always work, but in reality it gives: error: the clang compiler does not support '-march=native' If we move CPU detection logic into Zig itelf, we will not need this, instead we will always pass target features and CPU configuration explicitly. For now, we simply avoid passing the flag when it is known to not be supported.
Diffstat (limited to 'src/target.cpp')
-rw-r--r--src/target.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/target.cpp b/src/target.cpp
index 1cab9253a0..9af42b7d9d 100644
--- a/src/target.cpp
+++ b/src/target.cpp
@@ -1583,9 +1583,19 @@ bool target_os_requires_libc(Os os) {
}
bool target_supports_fpic(const ZigTarget *target) {
- // This is not whether the target supports Position Independent Code, but whether the -fPIC
- // C compiler argument is valid.
- return target->os != OsWindows;
+ // This is not whether the target supports Position Independent Code, but whether the -fPIC
+ // C compiler argument is valid.
+ return target->os != OsWindows;
+}
+
+bool target_supports_clang_march_native(const ZigTarget *target) {
+ // Whether clang supports -march=native on this target.
+ // Arguably it should always work, but in reality it gives:
+ // error: the clang compiler does not support '-march=native'
+ // If we move CPU detection logic into Zig itelf, we will not need this,
+ // instead we will always pass target features and CPU configuration explicitly.
+ return target->arch != ZigLLVM_aarch64 &&
+ target->arch != ZigLLVM_aarch64_be;
}
bool target_supports_stack_probing(const ZigTarget *target) {