]> granicus.if.org Git - clang/commitdiff
Refactor PPC ABI handling to accept and silently ignore -mabi=altivec.
authorEric Christopher <echristo@gmail.com>
Fri, 10 Jul 2015 18:25:54 +0000 (18:25 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 10 Jul 2015 18:25:54 +0000 (18:25 +0000)
All of the ABIs we support are altivec style anyhow and so the option
doesn't make much sense with the modern ABIs. We could make this a more
noisy ignore, but it would break builds for projects that just pass
it along by default because of historical reasons.

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

lib/Driver/Tools.cpp
test/Driver/ppc-abi.c

index c52d7a6ec339afe55934f61d603ac28a9ecd6a3c..38c3d5cdec1460feb560439428bc346666727dd9 100644 (file)
@@ -1272,9 +1272,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
                              ArgStringList &CmdArgs) const {
   // Select the ABI to use.
   const char *ABIName = nullptr;
-  if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
-    ABIName = A->getValue();
-  } else if (getToolChain().getTriple().isOSLinux())
+  if (getToolChain().getTriple().isOSLinux())
     switch (getToolChain().getArch()) {
     case llvm::Triple::ppc64: {
       // When targeting a processor that supports QPX, or if QPX is
@@ -1299,6 +1297,13 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
       break;
     }
 
+  if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
+    // The ppc64 linux abis are all "altivec" abis by default. Accept and ignore
+    // the option if given as we don't have backend support for any targets
+    // that don't use the altivec abi.
+    if (StringRef(A->getValue()) != "altivec")
+      ABIName = A->getValue();
+
   if (ABIName) {
     CmdArgs.push_back("-target-abi");
     CmdArgs.push_back(ABIName);
index 3c7d7f136de7c7fcafe8c219daaaaaebba4a3811..958fd7741669d8279ef77638613557331bd2c6ae 100644 (file)
@@ -21,6 +21,8 @@
 // RUN:   -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
 // RUN:   -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s
+// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
+// RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
 
 // CHECK-ELFv1: "-target-abi" "elfv1"
 // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"