freebsd-skq/contrib/llvm/patches/patch-r262262-clang-r198923-sparc.diff

50 lines
2.1 KiB
Diff
Raw Normal View History

Pull in r198923 from upstream clang trunk (by Jakob Stoklund Olesen):
Use the right dynamic linker for SPARC Linux executables.
Introduced here: http://svnweb.freebsd.org/changeset/base/262262
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp
+++ tools/clang/lib/Driver/Tools.cpp
@@ -6374,7 +6374,8 @@ static StringRef getLinuxDynamicLinker(const ArgLi
const toolchains::Linux &ToolChain) {
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::Android)
return "/system/bin/linker";
- else if (ToolChain.getArch() == llvm::Triple::x86)
+ else if (ToolChain.getArch() == llvm::Triple::x86 ||
+ ToolChain.getArch() == llvm::Triple::sparc)
return "/lib/ld-linux.so.2";
else if (ToolChain.getArch() == llvm::Triple::aarch64)
return "/lib/ld-linux-aarch64.so.1";
@@ -6399,6 +6400,8 @@ static StringRef getLinuxDynamicLinker(const ArgLi
ToolChain.getArch() == llvm::Triple::ppc64le ||
ToolChain.getArch() == llvm::Triple::systemz)
return "/lib64/ld64.so.1";
+ else if (ToolChain.getArch() == llvm::Triple::sparcv9)
+ return "/lib64/ld-linux.so.2";
else
return "/lib64/ld-linux-x86-64.so.2";
}
Index: tools/clang/test/Driver/linux-ld.c
===================================================================
--- tools/clang/test/Driver/linux-ld.c
+++ tools/clang/test/Driver/linux-ld.c
@@ -389,6 +389,7 @@
// RUN: | FileCheck --check-prefix=CHECK-SPARCV8 %s
// CHECK-SPARCV8: "{{.*}}ld{{(.exe)?}}"
// CHECK-SPARCV8: "-m" "elf32_sparc"
+// CHECK-SPARCV8: "-dynamic-linker" "/lib/ld-linux.so.2"
//
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=sparcv9-linux-gnu \
@@ -395,6 +396,7 @@
// RUN: | FileCheck --check-prefix=CHECK-SPARCV9 %s
// CHECK-SPARCV9: "{{.*}}ld{{(.exe)?}}"
// CHECK-SPARCV9: "-m" "elf64_sparc"
+// CHECK-SPARCV9: "-dynamic-linker" "/lib64/ld-linux.so.2"
//
// Thoroughly exercise the Debian multiarch environment.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \