From: Ulrich Weigand Date: Fri, 20 Jun 2014 14:19:02 +0000 (+0000) Subject: [PowerPC] Fix ELF interpreter name for powerpc64le-linux X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68e902c36033351942b12c6c29ed950f8cdd5606;p=platform%2Fupstream%2Fllvm.git [PowerPC] Fix ELF interpreter name for powerpc64le-linux On PowerPC LE the system uses the /lib64/ld64.so.2 dynamic linker name instead of /lib64/ld64.so.1 (to indicate the ELFv2 ABI version). This fixes the clang driver to pass the appropriate -dynamic-linker setting, and adds some more tests to linux-ld.c. llvm-svn: 211360 --- diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 2f86621..a86f06a 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -6917,9 +6917,10 @@ static StringRef getLinuxDynamicLinker(const ArgList &Args, } else if (ToolChain.getArch() == llvm::Triple::ppc) return "/lib/ld.so.1"; else if (ToolChain.getArch() == llvm::Triple::ppc64 || - ToolChain.getArch() == llvm::Triple::ppc64le || ToolChain.getArch() == llvm::Triple::systemz) return "/lib64/ld64.so.1"; + else if (ToolChain.getArch() == llvm::Triple::ppc64le) + return "/lib64/ld64.so.2"; else if (ToolChain.getArch() == llvm::Triple::sparcv9) return "/lib64/ld-linux.so.2"; else diff --git a/clang/test/Driver/Inputs/ubuntu_14.04_multiarch_tree/usr/lib/powerpc64le-linux-gnu/crt1.o b/clang/test/Driver/Inputs/ubuntu_14.04_multiarch_tree/usr/lib/powerpc64le-linux-gnu/crt1.o new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/ubuntu_14.04_multiarch_tree/usr/lib/powerpc64le-linux-gnu/crti.o b/clang/test/Driver/Inputs/ubuntu_14.04_multiarch_tree/usr/lib/powerpc64le-linux-gnu/crti.o new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/ubuntu_14.04_multiarch_tree/usr/lib/powerpc64le-linux-gnu/crtn.o b/clang/test/Driver/Inputs/ubuntu_14.04_multiarch_tree/usr/lib/powerpc64le-linux-gnu/crtn.o new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c index c4a2e83..769be3c 100644 --- a/clang/test/Driver/linux-ld.c +++ b/clang/test/Driver/linux-ld.c @@ -347,6 +347,23 @@ // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtend.o" // CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crtn.o" // +// Check Ubuntu 14.04 on powerpc64le. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=powerpc64le-unknown-linux-gnu \ +// RUN: --sysroot=%S/Inputs/ubuntu_14.04_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-14-04-PPC64LE %s +// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crt1.o" +// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crti.o" +// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtbegin.o" +// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8" +// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu" +// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/lib/powerpc64le-linux-gnu" +// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/powerpc64le-linux-gnu" +// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../.." +// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtend.o" +// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crtn.o" +// // Check fedora 18 on arm. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=armv7-unknown-linux-gnueabihf \ @@ -422,6 +439,13 @@ // CHECK-ARM-HF: "-m" "armelf_linux_eabi" // CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3" // +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=powerpc64le-linux-gnu \ +// RUN: | FileCheck --check-prefix=CHECK-PPC64LE %s +// CHECK-PPC64LE: "{{.*}}ld{{(.exe)?}}" +// CHECK-PPC64LE: "-m" "elf64lppc" +// CHECK-PPC64LE: "-dynamic-linker" "{{.*}}/lib64/ld64.so.2" +// // Check that we do not pass --hash-style=gnu and --hash-style=both to linker // and provide correct path to the dynamic linker and emulation mode when build // for MIPS platforms.