freebsd-dev/contrib/llvm/patches/patch-r262262-clang-r198923-sparc.diff
Dimitry Andric a1f8ad145e Add separate patch files for all the customizations we have currently
applied to our copy of llvm/clang.  These can be applied in alphabetical
order to a pristine llvm/clang 3.4 release source tree, to result in the
same version used in FreeBSD.

This is intended to clearly document all the changes until now, which
mostly consist of cherry pickings from the respective upstream trunks,
plus a number of hand-written FreeBSD-specific ones.  Hopefully those
can eventually be cleaned up and sent upstream too.

MFC after:	1 week
X-MFC-With:	r263313
2014-03-18 22:07:45 +00:00

50 lines
2.1 KiB
Diff

Pull in r198923 from upstream clang trunk (by Jakob Stoklund Olesen):
Use the right dynamic linker for SPARC Linux executables.
Introduced here: http://svn.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 \