]> granicus.if.org Git - clang/commitdiff
Driver/Darwin: Honor -Xarch_FOO when the arch matches either the toolchain or
authorDaniel Dunbar <daniel@zuster.org>
Tue, 21 Jun 2011 00:20:17 +0000 (00:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 21 Jun 2011 00:20:17 +0000 (00:20 +0000)
the architecture being bound.
 - Fixes things like -Xarch_armv7.

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

lib/Driver/ToolChains.cpp
test/Driver/darwin-xarch.c

index 53ef72295dbb8ca9a5b940b65cb76681f47c4186..e9bea426ae090dec372e732c9436c9f02fe714d7 100644 (file)
@@ -682,8 +682,13 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
     Arg *A = *it;
 
     if (A->getOption().matches(options::OPT_Xarch__)) {
+      // Skip this argument unless the architecture matches either the toolchain
+      // triple arch, or the arch being bound.
+      //
       // FIXME: Canonicalize name.
-      if (getArchName() != A->getValue(Args, 0))
+      llvm::StringRef XarchArch = A->getValue(Args, 0);
+      if (!(XarchArch == getArchName()  ||
+            (BoundArch && XarchArch == BoundArch)))
         continue;
 
       Arg *OriginalArg = A;
index d16d5318f7f8d9ea6e09f46bd03b34b8103c2a47..4c6689cef0fc2128771c2724099577740eab7911 100644 (file)
@@ -12,3 +12,9 @@
 // RUN: FileCheck --check-prefix=CHECK-LINK < %t %s
 //
 // CHECK-LINK: ld{{.*}} "-arch" "i386"{{.*}} "-some-linker-arg"
+
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### \
+// RUN:   -arch armv7 -Xarch_armv7 -Wl,-some-linker-arg -filelist X 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ARMV7-LINK < %t %s
+//
+// CHECK-ARMV7-LINK: ld{{.*}} "-arch" "armv7"{{.*}} "-some-linker-arg"