]> granicus.if.org Git - clang/commitdiff
Call powerpc-darwin external tools with -arch ppc.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 28 Aug 2014 21:23:05 +0000 (21:23 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 28 Aug 2014 21:23:05 +0000 (21:23 +0000)
With this patch we call external tools for powerpc-darwin with "-arch ppc"
instead of "-arch powerpc", so as to be compatible with the cctools assembler
and ld64 linker.

Patch by Stephen Drake!

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

lib/Driver/ToolChains.cpp
lib/Driver/Tools.cpp
test/Driver/darwin-arch-default.c

index 2f4711563c8a01b9fe3f839b25c8490e109a2803..f18b6feb68e754bc0d6110dee348f2eaa5cca50e 100644 (file)
@@ -156,7 +156,7 @@ static bool isSoftFloatABI(const ArgList &Args) {
 StringRef MachO::getMachOArchName(const ArgList &Args) const {
   switch (getTriple().getArch()) {
   default:
-    return getArchName();
+    return getDefaultUniversalArchName();
 
   case llvm::Triple::aarch64:
     return "arm64";
index de64d934f988647aeb814b9dcc7babaab87f499d..d751ca9a1157fb190bea680fcbc86c8e54a16def 100644 (file)
@@ -4952,19 +4952,10 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
   RenderExtraToolArgs(JA, CmdArgs);
 
   // If using a driver driver, force the arch.
-  llvm::Triple::ArchType Arch = getToolChain().getArch();
   if (getToolChain().getTriple().isOSDarwin()) {
     CmdArgs.push_back("-arch");
-
-    // FIXME: Remove these special cases.
-    if (Arch == llvm::Triple::ppc)
-      CmdArgs.push_back("ppc");
-    else if (Arch == llvm::Triple::ppc64)
-      CmdArgs.push_back("ppc64");
-    else if (Arch == llvm::Triple::ppc64le)
-      CmdArgs.push_back("ppc64le");
-    else
-      CmdArgs.push_back(Args.MakeArgString(getToolChain().getArchName()));
+    CmdArgs.push_back(
+      Args.MakeArgString(getToolChain().getDefaultUniversalArchName()));
   }
 
   // Try to force gcc to match the tool chain we want, if we recognize
@@ -4972,6 +4963,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
   //
   // FIXME: The triple class should directly provide the information we want
   // here.
+  llvm::Triple::ArchType Arch = getToolChain().getArch();
   if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc)
     CmdArgs.push_back("-m32");
   else if (Arch == llvm::Triple::x86_64 || Arch == llvm::Triple::ppc64 ||
index 60bf61de8a34544032a307bc0cc79ea4bf751431..e7e5e89ed0855a432d2b524dada93650476acd36 100644 (file)
@@ -2,6 +2,42 @@
 //
 // RUN: %clang -target powerpc-apple-darwin8 -### \
 // RUN:   -ccc-print-phases %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-POWERPC < %t %s
+// RUN: FileCheck --check-prefix=CHECK-BIND-PPC < %t %s
 //
-// CHECK-POWERPC: bind-arch, "ppc"
+// CHECK-BIND-PPC: bind-arch, "ppc"
+//
+// RUN: %clang -target powerpc64-apple-darwin8 -### \
+// RUN:   -ccc-print-phases %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-BIND-PPC64 < %t %s
+//
+// CHECK-BIND-PPC64: bind-arch, "ppc64"
+
+// Check that the correct arch name is passed to the external assembler
+//
+// RUN: %clang -target powerpc-apple-darwin8 -### \
+// RUN:   -no-integrated-as -c %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-AS-PPC < %t %s
+//
+// CHECK-AS-PPC: {{as(.exe)?"}}
+// CHECK-AS-PPC: "-arch" "ppc"
+//
+// RUN: %clang -target powerpc64-apple-darwin8 -### \
+// RUN:   -no-integrated-as -c %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-AS-PPC64 < %t %s
+//
+// CHECK-AS-PPC64: {{as(.exe)?"}}
+// CHECK-AS-PPC64: "-arch" "ppc64"
+
+// Check that the correct arch name is passed to the external linker
+//
+// RUN: %clang -target powerpc-apple-darwin8 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-LD-PPC < %t %s
+//
+// CHECK-LD-PPC: {{ld(.exe)?"}}
+// CHECK-LD-PPC: "-arch" "ppc"
+//
+// RUN: %clang -target powerpc64-apple-darwin8 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-LD-PPC64 < %t %s
+//
+// CHECK-LD-PPC64: {{ld(.exe)?"}}
+// CHECK-LD-PPC64: "-arch" "ppc64"