]> granicus.if.org Git - clang/commitdiff
Only override the target architecture on -m32 and friends if it is
authorJoerg Sonnenberger <joerg@bec.de>
Wed, 10 Sep 2014 21:25:37 +0000 (21:25 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Wed, 10 Sep 2014 21:25:37 +0000 (21:25 +0000)
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.

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

lib/Driver/Driver.cpp
test/Driver/biarch.c [new file with mode: 0644]

index e2e6abceef0ecdc468253c160d4118b3124432dd..647d2ca2b3739b64e2d991edf11b9e5983ebe2f0 100644 (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);
   }
 
diff --git a/test/Driver/biarch.c b/test/Driver/biarch.c
new file mode 100644 (file)
index 0000000..1f0982e
--- /dev/null
@@ -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