Skip to content

Commit 471c4f8

Browse files
committed
Driver/Darwin: Honor -Xarch_FOO when the arch matches either the toolchain or
the architecture being bound. - Fixes things like -Xarch_armv7. llvm-svn: 133490
1 parent ca6b90d commit 471c4f8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/Driver/ToolChains.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,8 +682,13 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
682682
Arg *A = *it;
683683

684684
if (A->getOption().matches(options::OPT_Xarch__)) {
685+
// Skip this argument unless the architecture matches either the toolchain
686+
// triple arch, or the arch being bound.
687+
//
685688
// FIXME: Canonicalize name.
686-
if (getArchName() != A->getValue(Args, 0))
689+
llvm::StringRef XarchArch = A->getValue(Args, 0);
690+
if (!(XarchArch == getArchName() ||
691+
(BoundArch && XarchArch == BoundArch)))
687692
continue;
688693

689694
Arg *OriginalArg = A;

clang/test/Driver/darwin-xarch.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@
1212
// RUN: FileCheck --check-prefix=CHECK-LINK < %t %s
1313
//
1414
// CHECK-LINK: ld{{.*}} "-arch" "i386"{{.*}} "-some-linker-arg"
15+
16+
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### \
17+
// RUN: -arch armv7 -Xarch_armv7 -Wl,-some-linker-arg -filelist X 2> %t
18+
// RUN: FileCheck --check-prefix=CHECK-ARMV7-LINK < %t %s
19+
//
20+
// CHECK-ARMV7-LINK: ld{{.*}} "-arch" "armv7"{{.*}} "-some-linker-arg"

0 commit comments

Comments
 (0)