Only override the target architecture on -m32 and friends if it is

actually different. Fixes a surprising link error with nodejs on rpi,
where armv6-netbsd-eabihf turned into armv5e-netbsd-eabihf, which
doesn't lacks the necessary VFP support.

llvm-svn: 217546
This commit is contained in:
Joerg Sonnenberger 2014-09-10 21:25:37 +00:00
parent 8123630a21
commit b7e0ac6253
2 changed files with 42 additions and 1 deletions

View File

@ -1947,7 +1947,7 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple,
Target.setEnvironment(llvm::Triple::CODE16);
}
if (AT != llvm::Triple::UnknownArch)
if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
Target.setArch(AT);
}

View File

@ -0,0 +1,41 @@
// RUN: %clang -target i386--netbsd -m32 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "i386--netbsd"' %t
// RUN: %clang -target i386--netbsd -m64 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "x86_64--netbsd"' %t
// RUN: %clang -target x86_64--netbsd -m32 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "i386--netbsd"' %t
// RUN: %clang -target x86_64--netbsd -m64 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "x86_64--netbsd"' %t
// RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "armv6--netbsd-eabihf"' %t
// RUN: %clang -target sparcv9--netbsd -m32 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "sparc--netbsd"' %t
// RUN: %clang -target sparcv9--netbsd -m64 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
// RUN: %clang -target sparc64--netbsd -m64 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "sparc64--netbsd"' %t
// RUN: %clang -target sparc--netbsd -m32 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "sparc--netbsd"' %t
// RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t
// RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t
// RUN: %clang -target mips64--netbsd -m64 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "mips64--netbsd"' %t
// RUN: %clang -target mips--netbsd -m32 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t
// RUN: %clang -target mips--netbsd -m64 %s -### 2> %t
// RUN: grep '"-cc1" "-triple" "mips64--netbsd"' %t