From: Jiangning Liu Date: Mon, 30 Jul 2012 11:05:56 +0000 (+0000) Subject: Fix dynamic object linker for ARM GNUEABIHF. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6cc9dc8403c4a8838f4f932e43402090cfe70d98;p=clang Fix dynamic object linker for ARM GNUEABIHF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160958 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 54f209d7d9..e13f709185 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -5516,8 +5516,12 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA, else if (ToolChain.getArch() == llvm::Triple::x86) CmdArgs.push_back("/lib/ld-linux.so.2"); else if (ToolChain.getArch() == llvm::Triple::arm || - ToolChain.getArch() == llvm::Triple::thumb) - CmdArgs.push_back("/lib/ld-linux.so.3"); + ToolChain.getArch() == llvm::Triple::thumb) { + if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) + CmdArgs.push_back("/lib/ld-linux-armhf.so.3"); + else + CmdArgs.push_back("/lib/ld-linux.so.3"); + } else if (ToolChain.getArch() == llvm::Triple::mips || ToolChain.getArch() == llvm::Triple::mipsel) CmdArgs.push_back("/lib/ld.so.1"); diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index a9decfdf4e..cf219105d2 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -186,6 +186,21 @@ // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64" // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64" // +// Check dynamic-linker for different archs +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-gnueabi \ +// RUN: | FileCheck --check-prefix=CHECK-ARM %s +// CHECK-ARM: "{{.*}}ld{{(.exe)?}}" +// CHECK-ARM: "-m" "armelf_linux_eabi" +// CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3" +// +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-gnueabihf \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-HF %s +// CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}" +// CHECK-ARM-HF: "-m" "armelf_linux_eabi" +// CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3" +// // 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.