[PATCH] ARM: Use different linker path for hardfloat ABI

Michael Hope michael.hope at linaro.org
Tue Apr 3 03:29:06 UTC 2012

On 3 April 2012 09:06, dann frazier <dann.frazier at canonical.com> wrote:
> On Fri, Mar 30, 2012 at 06:52:34PM +0100, Richard Earnshaw wrote:
>> On 29/03/12 20:34, dann frazier wrote:
>> > This is an updated version of a patch Debian and Ubuntu are using to
>> > use an alternate linker path for hardfloat binaries. The difference
>> > with this one is that it covers the case where no float flag
>> > was passed in, defaulting to the softfloat path.

Hi Dann.  The change should be in the EABI specific linux-eabi.h
instead of the shared/OABI linux-elf.h.  It breaks support for uClibc
and Bionic by always using the GLIBC loader in hard float mode.  The
final line in the spec is missing a '=hard' and always adds

How about:

2012-04-03  Michael Hope  <michael.hope at linaro.org>

       * config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define.
       (GLIBC_DYNAMIC_LINKER): Redefine to use the hard float loader.

diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 80bd825..8498472 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -62,7 +62,12 @@
 /* Use ld-linux.so.3 so that it will be possible to run "classic"
    GNU/Linux binaries on an EABI system.  */
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
+   "%{mhard-float:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
+    %{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
+    %{!mfloat-abi=hard:%{!mhard-float:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "}}"

 /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
    use the GNU/Linux version, not the generic BPABI version.  */

which works for the following test cases:
 gcc -mhard-float foo.c => /lib/arm-linux-gnueabihf/ld-linux.so.3
 gcc -mfloat-abi=hard foo.c => /lib/arm-linux-gnueabihf/ld-linux.so.3
 gcc -msoft-float foo.c => /lib/ld-linux.so.3
 gcc -mfloat-abi=softfp foo.c => /lib/ld-linux.so.3
 gcc -mbionic => /system/bin/linker
 gcc -mbionic -mhard-float => /system/bin/linker
 gcc -muclibc => /lib/ld-uClibc.so.0
 gcc -muclibc -mhard-float => /lib/ld-uClibc.so.0

-- Michael

More information about the cross-distro mailing list