[cfe-commits] [PATCH] fix dynamic object linker for ARM GNUEABIHF
Jiangning Liu
jiangning.liu at arm.com
Thu Jul 26 01:34:20 PDT 2012
PING... Who can help to review this piece of code change?
Thanks,
-Jiangning
> -----Original Message-----
> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
> bounces at cs.uiuc.edu] On Behalf Of Jiangning Liu
> Sent: Tuesday, July 17, 2012 6:04 PM
> To: cfe-commits at cs.uiuc.edu
> Subject: [cfe-commits] [PATCH] fix dynamic object linker for ARM
> GNUEABIHF
>
> Hi,
>
> The command line options passed to GNU ld, that are generated by clang,
> should make difference for ARM soft float and hard float. For hard float,
> we should use "-dynamic-linker /lib/ld-linux-armhf.so", while for softfp,
> we should use "-dynamic-linker /lib/ld-linux.so" instead. This patch is
> to fix this problem.
>
> Thanks,
> -Jiangning
>
> diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index
> 7a365c0..2960690 100755
> --- a/lib/Driver/Tools.cpp
> +++ b/lib/Driver/Tools.cpp
> @@ -5489,8 +5489,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
> 89f3bc3..a6831b6 100644
> --- a/test/Driver/linux-ld.c
> +++ b/test/Driver/linux-ld.c
> @@ -219,6 +219,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.
More information about the cfe-commits
mailing list