r174838 - Use -mno-implicit-float by default for kernel/kext code. <rdar://13177960>
Bob Wilson
bob.wilson at apple.com
Sun Feb 10 08:01:41 PST 2013
Author: bwilson
Date: Sun Feb 10 10:01:41 2013
New Revision: 174838
URL: http://llvm.org/viewvc/llvm-project?rev=174838&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/flags.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=174838&r1=174837&r2=174838&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Feb 10 10:01:41 2013
@@ -1200,10 +1200,18 @@ void Clang::AddX86TargetArgs(const ArgLi
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())) {
Modified: cfe/trunk/test/Driver/flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/flags.c?rev=174838&r1=174837&r2=174838&view=diff
==============================================================================
--- cfe/trunk/test/Driver/flags.c (original)
+++ cfe/trunk/test/Driver/flags.c Sun Feb 10 10:01:41 2013
@@ -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
More information about the cfe-commits
mailing list