mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Compilation: Omit Clang CPU model flags for some targets.
This commit is contained in:
parent
6a364b4a5e
commit
4b78dbe068
@ -5371,10 +5371,12 @@ pub fn addCCArgs(
|
||||
try argv.append(include_dir);
|
||||
}
|
||||
|
||||
if (target.cpu.model.llvm_name) |llvm_name| {
|
||||
try argv.appendSlice(&[_][]const u8{
|
||||
"-Xclang", "-target-cpu", "-Xclang", llvm_name,
|
||||
});
|
||||
if (target_util.clangSupportsTargetCpuArg(target)) {
|
||||
if (target.cpu.model.llvm_name) |llvm_name| {
|
||||
try argv.appendSlice(&[_][]const u8{
|
||||
"-Xclang", "-target-cpu", "-Xclang", llvm_name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// It would be really nice if there was a more compact way to communicate this info to Clang.
|
||||
|
||||
@ -315,6 +315,20 @@ pub fn clangAssemblerSupportsMcpuArg(target: std.Target) bool {
|
||||
};
|
||||
}
|
||||
|
||||
/// Some experimental or poorly-maintained LLVM targets do not properly process CPU models in their
|
||||
/// Clang driver code. For these, we should omit the `-Xclang -target-cpu -Xclang <model>` flags.
|
||||
pub fn clangSupportsTargetCpuArg(target: std.Target) bool {
|
||||
return switch (target.cpu.arch) {
|
||||
.arc,
|
||||
.msp430,
|
||||
.ve,
|
||||
.xcore,
|
||||
.xtensa,
|
||||
=> false,
|
||||
else => true,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn clangSupportsFloatAbiArg(target: std.Target) bool {
|
||||
return switch (target.cpu.arch) {
|
||||
.arm,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user