This is the mail archive of the mailing list for the glibc 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]

[PATCH 1/2] glibc-ports: Use /lib/ as the dynamiclinker for the ARM hard-float ABI.

The dynamic linker name should be /lib/ when
compiling glibc with a compiler and flags that would cause the ARM
hard-float ABI to be selected. The following patch implements the
selection of the correct dynamic linker name for ARM given the new
alternate name for the hard-float ABI.

The compiler defines __ARM_PCS_VFP when the hard-float ABI is being
used. The sysdeps/arm/ check sets HAVE_ARM_PCS_VFP when it
detects that the compiler *and* flags would select the hard-float ABI.
The shlib-versions file then uses %ifdef HAVE_ARM_PCS_VFP to select
the alternate dynamic linker; we can do this because shlib-versions is
handled by the implicit rule which uses -include to include
include/libc-symbols.h which in turn includes config.h. The file
shlib-versions is run through sed to convert the %ifdef into #ifdef,
and cpp does the final processing.

Interestingly the patch *could* have been a one-line change to add
%ifdef __ARM_PCS_VFP, but this is not possible since the implicit rule
that runs cpp also adds -undef which removes all of the compiler
builtin defines. Trying to remove the -undef is difficult because the
implicit rule is used in contexts where the compiler builtin defines
should not be present. Adding a new implicit rule in the makefile just
for shlib-versions processing was, in my opinion, less clear than this
current patch.

This patch is significantly better than original WIP patch which added
an additional sysdep directory with an alternate shlib-versions file.
By adding an alternate directory you must also mirror the structure of
all the sub-machine (armv7 and armv6t2) directories and include
Implies to add them back into the build.

Tested by building a multilib'd compiler and compiling glibc for at
least the soft-float (armv5te) and hard-float (armv7-a) cases, and
verifying that glibc installs the correct dynamic loader in each case.

Testing requires a recent gcc with Michael Hope and Richard Earnshaw's
final patches to default to the original soft-float loader or select
the new hard-float loader if -mfloat-abi=hard is used (see

I additionally tested some compatibility cases where an old toolchain
was used to build an application and run it against the new sysroot
with a compat symlink e.g. -> and ->, and everything worked as expected.

OK to commit?

2012-05-06  Carlos O'Donell  <>
	    Khem Raj <>

	* sysdeps/arm/ Set libc_cv_arm_pcs_vfp.
	If libc_cv_arm_pcs_vfp equals yes then define HAVE_ARM_PCS_VFP.
	* sysdeps/arm/configure: Regenerate.
	* sysdeps/arm/shlib-versions: If HAVE_ARM_PCS_VFP is defined
	then use ld=/lib/

diff --git a/sysdeps/arm/ b/sysdeps/arm/
index 706add2..60d4093 100644
--- a/sysdeps/arm/
+++ b/sysdeps/arm/
@@ -49,3 +49,28 @@ EOF
 if test $libc_cv_asm_cfi_directive_sections != yes; then
   AC_MSG_ERROR([need .cfi_sections in this configuration])
+AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI],
+  [libc_cv_arm_pcs_vfp],
+  [archcppflag=`echo "" |
+       $CC $CFLAGS $CPPFLAGS -E -dM - |
+       grep __ARM_PCS_VFP |
+       sed -e 's/^#define //' -e 's/ .*//'`
+  # We check to see if the compiler and flags are
+  # selecting the hard-float ABI and if they are then
+  # we set libc_cv_arm_pcs_vfp to yes which causes
+  # HAVE_ARM_PCS_VFP to be defined in config.h and
+  # in include/libc-symbols.h and thus availabile to
+  # shlib-versions to select the appropriate name for
+  # the dynamic linker via %ifdef.
+  case x$archcppflag in
+  x__ARM_PCS_VFP)
+    libc_cv_arm_pcs_vfp=yes
+    ;;
+  *)
+    libc_cv_arm_pcs_vfp=no
+    ;;
+  esac])
+if test $libc_cv_arm_pcs_vfp = yes; then
diff --git a/sysdeps/arm/shlib-versions b/sysdeps/arm/shlib-versions
index 626d58b..d500166 100644
--- a/sysdeps/arm/shlib-versions
+++ b/sysdeps/arm/shlib-versions
@@ -1,3 +1,9 @@
 arm.*-.*-linux-gnueabi.*       DEFAULT                 GLIBC_2.4

+# The EABI-derived hard-float ABI uses a new dynamic linker.
+# The EABI-derived soft-float ABI continues to use

- Updated "Regeneration" with instructions on regenerating the
configure fragment for ports machines.


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