]> granicus.if.org Git - clang/commitdiff
Reject -mkernel for i386/Darwin C++ code; fall back to llvm-gcc instead.
authorBob Wilson <bob.wilson@apple.com>
Sat, 13 Aug 2011 23:48:55 +0000 (23:48 +0000)
committerBob Wilson <bob.wilson@apple.com>
Sat, 13 Aug 2011 23:48:55 +0000 (23:48 +0000)
Since -mkernel implies -fapple-kext, this just extends the current behavior
for -fapple-kext to apply for -mkernel as well.  Radar 9933387.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137566 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp
lib/Driver/Tools.cpp
test/Driver/apple-kext-i386.cpp

index f34423b278b0452a208e6931dea3d829525f9f3f..9344b65247511383ed574b0c3c3e76547d0eb8d6 100644 (file)
@@ -211,7 +211,8 @@ Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA,
         types::isCXX(Inputs[0]->getType()) &&
         getTriple().getOS() == llvm::Triple::Darwin &&
         getTriple().getArch() == llvm::Triple::x86 &&
-        C.getArgs().getLastArg(options::OPT_fapple_kext))
+        (C.getArgs().getLastArg(options::OPT_fapple_kext) ||
+         C.getArgs().getLastArg(options::OPT_mkernel)))
       Key = JA.getKind();
     else
       Key = Action::AnalyzeJobClass;
index 59e024e7a3541567d1bafe29130b74a19c557a87..ecfb4fef6f68a261a0797d2922ad7420d1a17877 100644 (file)
@@ -1370,7 +1370,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     if (types::isCXX(InputType) &&
         getToolChain().getTriple().getOS() == llvm::Triple::Darwin &&
         getToolChain().getTriple().getArch() == llvm::Triple::x86) {
-      if ((Unsupported = Args.getLastArg(options::OPT_fapple_kext)))
+      if ((Unsupported = Args.getLastArg(options::OPT_fapple_kext)) ||
+          (Unsupported = Args.getLastArg(options::OPT_mkernel)))
         D.Diag(diag::err_drv_clang_unsupported_opt_cxx_darwin_i386)
           << Unsupported->getOption().getName();
     }
index dc4e6a641f0dcdb28bdec036709f55c586b24e9c..8f4d4980a49022628b7e908d8f81106354efc82e 100644 (file)
@@ -7,3 +7,10 @@
 
 // CHECK: cc1plus"
 // CHECK: "-fapple-kext"
+
+// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
+// RUN:   -mkernel -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-MKERNEL < %t %s
+
+// CHECK-MKERNEL: cc1plus"
+// CHECK-MKERNEL: "-mkernel"