This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] ARM: Use different linker path for hardfloat ABI
- From: Michael Hope <michael dot hope at linaro dot org>
- To: dann frazier <dann dot frazier at canonical dot com>
- Cc: Richard Earnshaw <rearnsha at arm dot com>, "cross-distro at lists dot linaro dot org" <cross-distro at lists dot linaro dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 3 Apr 2012 15:29:06 +1200
- Subject: Re: [PATCH] ARM: Use different linker path for hardfloat ABI
- References: <20120329193401.GA14860@dannf.org> <4F75F2E2.3030909@arm.com> <20120402210653.GC28152@dannf.org>
On 3 April 2012 09:06, dann frazier <dann.frazier@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
/lib/ld-linux.so.3.
How about:
2012-04-03 Michael Hope <michael.hope@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. */
#undef GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT
"/lib/arm-linux-gnueabihf/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER \
+ "%{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