This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [WIP] glibc: Use /lib/ld-linux-armhf.so.3 for ARM's -mfloat-abi=hard ABI.


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]