From e149c95a9e4135360256d4037c6a9718e6c03f97 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 28 Aug 2014 21:23:05 +0000 Subject: [PATCH 1005/1012] Call powerpc-darwin external tools with -arch ppc. 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 (cherry picked from commit 52fc295aad114ea91f4118d5e48fdfa142871704) --- lib/Driver/ToolChains.cpp | 2 +- lib/Driver/Tools.cpp | 14 +++----------- test/Driver/darwin-arch-default.c | 40 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git llvm_release_34/tools/clang/lib/Driver/ToolChains.cpp macports_release_34/tools/clang/lib/Driver/ToolChains.cpp index 4688335..6b2f698 100644 --- llvm_release_34/tools/clang/lib/Driver/ToolChains.cpp +++ macports_release_34/tools/clang/lib/Driver/ToolChains.cpp @@ -137,7 +137,7 @@ static const char *GetArmArchForMCpu(StringRef Value) { StringRef Darwin::getDarwinArchName(const ArgList &Args) const { switch (getTriple().getArch()) { default: - return getArchName(); + return getDefaultUniversalArchName(); case llvm::Triple::thumb: case llvm::Triple::arm: { diff --git llvm_release_34/tools/clang/lib/Driver/Tools.cpp macports_release_34/tools/clang/lib/Driver/Tools.cpp index b013eb5..ca966c5 100644 --- llvm_release_34/tools/clang/lib/Driver/Tools.cpp +++ macports_release_34/tools/clang/lib/Driver/Tools.cpp @@ -4143,19 +4143,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 @@ -4163,6 +4154,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 || diff --git llvm_release_34/tools/clang/test/Driver/darwin-arch-default.c macports_release_34/tools/clang/test/Driver/darwin-arch-default.c index 60bf61d..e7e5e89 100644 --- llvm_release_34/tools/clang/test/Driver/darwin-arch-default.c +++ macports_release_34/tools/clang/test/Driver/darwin-arch-default.c @@ -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" -- 2.10.1