Hi,
When using -no-integrated-as, the darwin driver passes -Q to the assembler to use a non-clang system assembler. Older dev-tools' assemblers on Mac OS X (xcode 3.x and earlier) don't understand this option; they are pre-clang. The attached patch suppresses -Q on darwin10 and earlier. The more correct thing to do is to detect assembler version and traits, which isn't done anywhere else presently, so assuming OS/tool version pairing is the Next Most Reasonable Thing (TM). Although the trend is moving towards -integrated-as as the default in more configurations, I do want to keep -no-integrated-as working as a way to validate against older darwins' toolchains.

Comments?  Ok to commit?

David

--
David Fang
http://www.csl.cornell.edu/~fang/
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 187ed38..e0410cc 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -4631,8 +4631,14 @@ void darwin::Assemble::ConstructJob(Compilation &C, 
const JobAction &JA,
 
   // If -no_integrated_as is used add -Q to the darwin assember driver to make
   // sure it runs its system assembler not clang's integrated assembler.
-  if (Args.hasArg(options::OPT_no_integrated_as))
-    CmdArgs.push_back("-Q");
+  // Applicable to darwin11+ and Xcode 4+.  darwin<10 lacked integrated-as.
+  // FIXME: it would be better if option support were detected in 
+  // the chosen assembler.
+  if (Args.hasArg(options::OPT_no_integrated_as)) {
+    const llvm::Triple& t(getToolChain().getTriple());
+    if (!(t.isMacOSX() && t.isMacOSXVersionLT(10, 7)))
+      CmdArgs.push_back("-Q");
+  }
 
   // Forward -g, assuming we are dealing with an actual assembly file.
   if (SourceAction->getType() == types::TY_Asm ||
diff --git a/test/Driver/darwin-as.c b/test/Driver/darwin-as.c
index 58c850e..e35391e 100644
--- a/test/Driver/darwin-as.c
+++ b/test/Driver/darwin-as.c
@@ -1,16 +1,22 @@
 // RUN: %clang -target i386-apple-darwin10 -### -x assembler -c %s \
 // RUN:   -no-integrated-as -static -dynamic 2>%t
+// RUN: FileCheck -check-prefix=CHECK-STATIC_AND_DYNAMIC-32-DARWIN10 
--input-file %t %s
+//
+// CHECK-STATIC_AND_DYNAMIC-32-DARWIN10: as{{(.exe)?}}" "-arch" "i386" 
"-force_cpusubtype_ALL" "-static" "-o"
+
+// RUN: %clang -target i386-apple-darwin11 -### -x assembler -c %s \
+// RUN:   -no-integrated-as -static -dynamic 2>%t
 // RUN: FileCheck -check-prefix=CHECK-STATIC_AND_DYNAMIC-32 --input-file %t %s
 //
 // CHECK-STATIC_AND_DYNAMIC-32: as{{(.exe)?}}" "-Q" "-arch" "i386" 
"-force_cpusubtype_ALL" "-static" "-o"
 
-// RUN: %clang -target x86_64-apple-darwin10 -### -x assembler -c %s \
+// RUN: %clang -target x86_64-apple-darwin11 -### -x assembler -c %s \
 // RUN:   -no-integrated-as -static 2>%t
 // RUN: FileCheck -check-prefix=CHECK-STATIC-64 --input-file %t %s
 //
 // CHECK-STATIC-64: as{{(.exe)?}}" "-Q" "-arch" "x86_64" 
"-force_cpusubtype_ALL" "-o"
 
-// RUN: %clang -target x86_64-apple-darwin10 -### \
+// RUN: %clang -target x86_64-apple-darwin11 -### \
 // RUN:   -arch armv6 -no-integrated-as -x assembler -c %s 2>%t
 // RUN: FileCheck -check-prefix=CHECK-ARMV6 --input-file %t %s
 //
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to