If -ccc-host-triple i386-pc-win32-macho or -ccc-host-triple
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
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 1619ef8..8b5b2ec 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1752,6 +1752,10 @@
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 @@
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
index 0000000..ff0f396
--- /dev/null
+++ b/test/Driver/ccc-host-triple-no-integrated-as.c
@@ -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"
+
+
+