[cfe-commits] r127903 - in /cfe/trunk: lib/Driver/ToolChains.cpp test/Driver/apple-kext-i386.cpp

Daniel Dunbar daniel at zuster.org
Fri Mar 18 13:14:03 PDT 2011


Author: ddunbar
Date: Fri Mar 18 15:14:03 2011
New Revision: 127903

URL: http://llvm.org/viewvc/llvm-project?rev=127903&view=rev
Log:
Driver/Darwin: Transparently fallback when compiling i386 -fapple-kext code, we
don't support the ABI yet.

Added:
    cfe/trunk/test/Driver/apple-kext-i386.cpp
Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=127903&r1=127902&r2=127903&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Mar 18 15:14:03 2011
@@ -172,9 +172,18 @@
 Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA,
                          const ActionList &Inputs) const {
   Action::ActionClass Key;
-  if (getDriver().ShouldUseClangCompiler(C, JA, getTriple()))
-    Key = Action::AnalyzeJobClass;
-  else
+
+  if (getDriver().ShouldUseClangCompiler(C, JA, getTriple())) {
+    // Fallback to llvm-gcc for i386 kext compiles, we don't support that ABI.
+    if (Inputs.size() == 1 &&
+        types::isCXX(Inputs[0]->getType()) &&
+        getTriple().getOS() == llvm::Triple::Darwin &&
+        getTriple().getArch() == llvm::Triple::x86 &&
+        C.getArgs().getLastArg(options::OPT_fapple_kext))
+      Key = JA.getKind();
+    else
+      Key = Action::AnalyzeJobClass;
+  } else
     Key = JA.getKind();
 
   // FIXME: This doesn't belong here, but ideally we will support static soon

Added: cfe/trunk/test/Driver/apple-kext-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/apple-kext-i386.cpp?rev=127903&view=auto
==============================================================================
--- cfe/trunk/test/Driver/apple-kext-i386.cpp (added)
+++ cfe/trunk/test/Driver/apple-kext-i386.cpp Fri Mar 18 15:14:03 2011
@@ -0,0 +1,9 @@
+// Check that we transparently fallback to llvm-gcc for i386 kexts, we don't
+// support the ABI they use (yet).
+
+// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
+// RUN:   -fapple-kext -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK < %t %s
+
+// CHECK: cc1plus"
+// CHECK: "-fapple-kext"





More information about the cfe-commits mailing list