forked from OSchip/llvm-project
Use -mno-implicit-float by default for kernel/kext code. <rdar://13177960>
Apple's kernel engineers have been expecting this behavior even though we've never implemented it before, as far as I can tell. In recent months, clang has gotten better at using vector instructions to optimize memcpy-like operations, and that has exposed problems when vector/floating-point instructions are used in kexts that don't support that. This behavior also matches what Apple's GCC did for PowerPC targets. llvm-svn: 174838
This commit is contained in:
parent
dc9e6085c4
commit
2616e2ec85
|
@ -1200,10 +1200,18 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
|
|||
Args.hasArg(options::OPT_fapple_kext))
|
||||
CmdArgs.push_back("-disable-red-zone");
|
||||
|
||||
if (Args.hasFlag(options::OPT_msoft_float,
|
||||
options::OPT_mno_soft_float,
|
||||
false) ||
|
||||
Args.hasArg(options::OPT_mno_implicit_float))
|
||||
// Default to avoid implicit floating-point for kernel/kext code, but allow
|
||||
// that to be overridden with -mno-soft-float.
|
||||
bool NoImplicitFloat = (Args.hasArg(options::OPT_mkernel) ||
|
||||
Args.hasArg(options::OPT_fapple_kext));
|
||||
if (Arg *A = Args.getLastArg(options::OPT_msoft_float,
|
||||
options::OPT_mno_soft_float,
|
||||
options::OPT_mno_implicit_float)) {
|
||||
const Option &O = A->getOption();
|
||||
NoImplicitFloat = (O.matches(options::OPT_mno_implicit_float) ||
|
||||
O.matches(options::OPT_msoft_float));
|
||||
}
|
||||
if (NoImplicitFloat)
|
||||
CmdArgs.push_back("-no-implicit-float");
|
||||
|
||||
if (const char *CPUName = getX86TargetCPU(Args, getToolChain().getTriple())) {
|
||||
|
|
|
@ -10,5 +10,11 @@
|
|||
// RUN: %clang -target i386-apple-darwin9 -### -S -mno-implicit-float %s 2> %t.log
|
||||
// RUN: grep '"-no-implicit-float"' %t.log
|
||||
|
||||
// RUN: %clang -target i386-apple-darwin9 -### -S -mkernel %s 2> %t.log
|
||||
// RUN: grep '"-no-implicit-float"' %t.log
|
||||
|
||||
// RUN: %clang -target i386-apple-darwin9 -### -S -mkernel -mno-soft-float %s 2> %t.log
|
||||
// RUN: grep '"-no-implicit-float"' %t.log | count 0
|
||||
|
||||
// RUN: %clang -target armv7-apple-darwin10 -### -S -mno-implicit-float %s 2> %t.log
|
||||
// RUN: grep '"-no-implicit-float"' %t.log
|
||||
|
|
Loading…
Reference in New Issue