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.
This commit is contained in:
Andrew Kelley
2019-10-24 19:43:56 -04:00
parent f8bd1cd3b1
commit ad438a95c5
3 changed files with 17 additions and 4 deletions

View File

@@ -8762,7 +8762,9 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa
}
if (g->zig_target->is_native) {
args.append("-march=native");
if (target_supports_clang_march_native(g->zig_target)) {
args.append("-march=native");
}
} else {
args.append("-target");
args.append(buf_ptr(&g->llvm_triple_str));