freebsd-skq/contrib/llvm/patches/patch-r262262-clang-r198911-sparc.diff
Dimitry Andric a426b286c8 Add the clang patch for r265477. While here, add a description to the
patch for r263619, and unify all the URLs to point to svnweb.
2014-05-24 22:27:31 +00:00

47 lines
1.9 KiB
Diff

Pull in r198911 from upstream clang trunk (by Jakob Stoklund Olesen):
Pass -32/-64 to the assembler when building for sparc/sparc64.
Introduced here: http://svnweb.freebsd.org/changeset/base/262262
Index: tools/clang/test/Driver/linux-as.c
===================================================================
--- tools/clang/test/Driver/linux-as.c
+++ tools/clang/test/Driver/linux-as.c
@@ -60,6 +60,20 @@
// RUN: | FileCheck -check-prefix=CHECK-PPC-NO-MCPU %s
// CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu"
//
+// RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s
+// CHECK-SPARCV9: as
+// CHECK-SPARCV9: -64
+// CHECK-SPARCV9: -o
+//
+// RUN: %clang -target sparc-linux -mcpu=invalid-cpu -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-SPARCV8 %s
+// CHECK-SPARCV8: as
+// CHECK-SPARCV8: -32
+// CHECK-SPARCV8: -o
+//
// RUN: %clang -target s390x-linux -### -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-Z-DEFAULT-ARCH %s
// CHECK-Z-DEFAULT-ARCH: as{{.*}} "-march=z10"
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp
+++ tools/clang/lib/Driver/Tools.cpp
@@ -6226,6 +6226,10 @@ void gnutools::Assemble::ConstructJob(Compilation
CmdArgs.push_back("-a64");
CmdArgs.push_back("-mppc64le");
CmdArgs.push_back("-many");
+ } else if (getToolChain().getArch() == llvm::Triple::sparc) {
+ CmdArgs.push_back("-32");
+ } else if (getToolChain().getArch() == llvm::Triple::sparcv9) {
+ CmdArgs.push_back("-64");
} else if (getToolChain().getArch() == llvm::Triple::arm) {
StringRef MArch = getToolChain().getArchName();
if (MArch == "armv7" || MArch == "armv7a" || MArch == "armv7-a")