]> granicus.if.org Git - clang/commitdiff
If -ccc-host-triple i386-pc-win32-macho or -ccc-host-triple
authorChad Rosier <mcrosier@apple.com>
Wed, 20 Jul 2011 19:14:30 +0000 (19:14 +0000)
committerChad Rosier <mcrosier@apple.com>
Wed, 20 Jul 2011 19:14:30 +0000 (19:14 +0000)
x86_64-pc-win32-macho is used in conjunction with -no-integrated-as go ahead and
use the Darwin system assembler.
rdar://9785470

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

lib/Driver/ToolChains.cpp
test/Driver/ccc-host-triple-no-integrated-as.c [new file with mode: 0644]

index 1619ef8f84a96b155b27753fa610e0a7c7111959..8b5b2ec9b01f56e4496dfc3945274f3b772a0d9f 100644 (file)
@@ -1752,6 +1752,10 @@ Tool &Windows::SelectTool(const Compilation &C, const JobAction &JA,
   else
     Key = JA.getKind();
 
+  bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as,
+                                             options::OPT_no_integrated_as,
+                                             IsIntegratedAssemblerDefault());
+
   Tool *&T = Tools[Key];
   if (!T) {
     switch (Key) {
@@ -1766,7 +1770,11 @@ Tool &Windows::SelectTool(const Compilation &C, const JobAction &JA,
     case Action::CompileJobClass:
       T = new tools::Clang(*this); break;
     case Action::AssembleJobClass:
-      T = new tools::ClangAs(*this); break;
+      if (!UseIntegratedAs && getTriple().getEnvironment() == llvm::Triple::MachO)
+        T = new tools::darwin::Assemble(*this);
+      else
+        T = new tools::ClangAs(*this);
+      break;
     case Action::LinkJobClass:
       T = new tools::visualstudio::Link(*this); break;
     }
diff --git a/test/Driver/ccc-host-triple-no-integrated-as.c b/test/Driver/ccc-host-triple-no-integrated-as.c
new file mode 100644 (file)
index 0000000..ff0f396
--- /dev/null
@@ -0,0 +1,20 @@
+// Check that -no-integrated-as works when -ccc-host-triple i386-pc-win32-macho or
+// -ccc-host-triple x86_64-pc-win32-macho is specified.
+
+// RUN: %clang -### -c -ccc-host-triple i386-pc-win32-macho -no-integrated-as %s 2> %t1
+// RUN: FileCheck -check-prefix=X86 < %t1 %s
+// RUN: %clang -### -c -ccc-host-triple x86_64-pc-win32-macho -no-integrated-as %s 2> %t2
+// RUN: FileCheck -check-prefix=X86_64 < %t2 %s
+//
+// X86: "-cc1"
+// X86-NOT: "-cc1as"
+// X86: "-arch"
+// X86: "i386"
+//
+// X86_64: "-cc1"
+// X86_64-NOT: "-cc1as"
+// X86_64: "-arch"
+// X86_64: "x86_64"
+
+
+