This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [WIP] glibc: Use /lib/ld-linux-armhf.so.3 for ARM's -mfloat-abi=hard ABI.
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Roland McGrath <roland at hack dot frob dot com>, "Carlos O'Donell" <carlos_odonell at mentor dot com>, Andrew Haley <aph at redhat dot com>, libc-ports at sourceware dot org, steve dot mcintyre at linaro dot org, michael dot hope at linaro dot org
- Date: Sat, 5 May 2012 22:18:28 -0400
- Subject: Re: [WIP] glibc: Use /lib/ld-linux-armhf.so.3 for ARM's -mfloat-abi=hard ABI.
- References: <4F886201.3040200@redhat.com> <4F886277.6000006@redhat.com> <20120413173512.5D52B2C074@topped-with-meat.com> <CADZpyiyr3d8VrBwp_WQyg1H_=w-8hyHw82Vck6U2kv49JtFxPg@mail.gmail.com> <4F9515D5.60804@redhat.com> <4F99B990.7020300@mentor.com> <Pine.LNX.4.64.1204262155510.30855@digraph.polyomino.org.uk> <20120426220656.0CC302C0D3@topped-with-meat.com> <CADZpyiw=iR9DURWUwY81FS-miA+gFNQdsK7Fkgo_GJAPzJ11+g@mail.gmail.com> <CADZpyiwSnQmxsYRMW0zu2uusoq2xf4mVhTjZHUNs+aTq3herPg@mail.gmail.com> <Pine.LNX.4.64.1205052316420.3843@digraph.polyomino.org.uk>
On Sat, May 5, 2012 at 7:17 PM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> On Sat, 5 May 2012, Carlos O'Donell wrote:
>
>> Except that this idea doesn't work because the implicit rule uses
>> -undef and I didn't notice that.
>>
>> Therefore __ARM_PCS_VFP is *never* defined.
>>
>> Thoughts?
>
> That suggests going back to a preconfigure test (testing whether
> __ARM_PCS_VFP is defined) to select appropriate sysdeps directories with
> different shlib-versions files.
The maintainability of a %ifdef solution seems far superior.
Not having to duplicate directories with Implies is a win.
What about something like this then?
This is against 2.15, but it would be similar for trunk.
* Define HAVE_ARM_PCS_VFP in config.h.in
* In preconfigure set HAVE_ARM_PCS_VFP if we detect __ARM_PCS_VFP
defined by the compiler.
* The header include/libc-symbols.h includes config.h therefore during
shlib-version processing we have access to all the symbols that were
in config.h
* Thus shlib-version correctly defines the dynamic linker based on
gcc's definition of HAVE_ARM_PCS_VFP.
glibc/
Index: config.h.in
===================================================================
--- config.h.in (revision 370191)
+++ config.h.in (working copy)
@@ -236,4 +236,7 @@
#define HAVE_REGEX 1
+/* The ARM hard-float ABI is being used. */
+#undef HAVE_ARM_PCS_VFP
+
#endif
===
glibc-ports/
Index: sysdeps/arm/preconfigure
===================================================================
--- sysdeps/arm/preconfigure (revision 370191)
+++ sysdeps/arm/preconfigure (working copy)
@@ -35,6 +35,24 @@
;;
esac
+ # We check to see if the compiler and flags are
+ # selecting the hard-float ABI and if they are then
+ # we define ARM_PCS_VFP which is later used by
+ # shlib-versions to select the appropriate name for
+ # the dynamic linker.
+ archcppflag=`echo "" |
+ $CC $CFLAGS $CPPFLAGS -E -dM - |
+ grep __ARM_PCS_VFP |
+ sed -e 's/^#define //' -e 's/ .*//'`
+ case x$archcppflag in
+ x__ARM_PCS_VFP)
+ echo "Found compiler is configured for ARM hard-float ABI"
+ echo "#define HAVE_ARM_PCS_VFP 1" >> confdefs.h
+ ;;
+ *)
+ ;;
+ esac
+
machine=arm/eabi/$machine
if [ "${CFLAGS+set}" != "set" ]; then
CFLAGS="-g -O2"
Index: sysdeps/arm/shlib-versions
===================================================================
--- sysdeps/arm/shlib-versions (revision 370191)
+++ sysdeps/arm/shlib-versions (working copy)
@@ -1,4 +1,12 @@
arm.*-.*-linux-gnueabi.* DEFAULT GLIBC_2.4
+%ifdef HAVE_ARM_PCS_VFP
+# The EABI-derived hard-float ABI uses a new dynamic linker.
+arm.*-.*-linux-gnueabi.* ld=ld-linux-armhf.so.3
+%else
+# The EABI-derived soft-float ABI continues to use ld-linux.so.3.
arm.*-.*-linux-gnueabi.* ld=ld-linux.so.3
+%endif
+
+# The legacy ABI, no longer supported, uses ld-linux.so.2.
arm.*-.*-linux.* ld=ld-linux.so.2
==
I know the ">> confdefs.h" is a bit of hackery, but this solution is
remarkably better than adding a whole new directory level with
Implies.
To tell you the truth at this late hour I can't remember why we're
doing this in preconfigure, why can't this all be in
sysdeps/arm/configure.in where I can use AC_DEFINE?
Comments?
Cheers,
Carlos.