about summary refs log tree commit diff
path: root/sysdeps/arm/configure.ac
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2014-10-22 14:20:35 -0700
committerRoland McGrath <roland@hack.frob.com>2014-10-22 14:20:35 -0700
commit8c2b1ed8bbd20d35314c2a602b903159fa567ffb (patch)
tree4a9e06786fdb32c5558cdae218af3b4ff0b78af6 /sysdeps/arm/configure.ac
parentb5af9297d51a43f96c5be1bafab032184690dd6f (diff)
downloadglibc-8c2b1ed8bbd20d35314c2a602b903159fa567ffb.tar.gz
glibc-8c2b1ed8bbd20d35314c2a602b903159fa567ffb.tar.xz
glibc-8c2b1ed8bbd20d35314c2a602b903159fa567ffb.zip
ARM: Use movw/movt more when available
Diffstat (limited to 'sysdeps/arm/configure.ac')
-rw-r--r--sysdeps/arm/configure.ac44
1 files changed, 42 insertions, 2 deletions
diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
index 86c0c08317..002b8ef365 100644
--- a/sysdeps/arm/configure.ac
+++ b/sysdeps/arm/configure.ac
@@ -17,8 +17,8 @@ dnl it.  Until we do, don't define it.
 AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI],
   [libc_cv_arm_pcs_vfp],
   [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP
-                      yes
-                     #endif
+		      yes
+		     #endif
   ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
 if test $libc_cv_arm_pcs_vfp = yes; then
   AC_DEFINE(HAVE_ARM_PCS_VFP)
@@ -40,6 +40,46 @@ else
   LIBC_CONFIG_VAR([have-arm-tls-desc], [no])
 fi
 
+AC_CACHE_CHECK([whether PC-relative relocs in movw/movt work properly],
+	       libc_cv_arm_pcrel_movw, [
+cat > conftest.s <<\EOF
+	.syntax unified
+	.arm
+	.arch armv7-a
+
+	.text
+	.globl foo
+	.type foo,%function
+foo:	movw r0, #:lower16:symbol - 1f - 8
+	movt r0, #:upper16:symbol - 1f - 8
+1:	add r0, pc
+	@ And now a case with a local symbol.
+	movw r0, #:lower16:3f - 2f - 8
+	movt r0, #:upper16:3f - 2f - 8
+2:	add r0, pc
+	bx lr
+
+.data
+	.globl symbol
+	.hidden symbol
+symbol:	.long 23
+3:	.long 17
+EOF
+libc_cv_arm_pcrel_movw=no
+${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+	 -nostartfiles -nostdlib -shared \
+	 -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD &&
+LC_ALL=C $READELF -dr conftest.so > conftest.dr 2>&AS_MESSAGE_LOG_FD &&
+{
+  cat conftest.dr 1>&AS_MESSAGE_LOG_FD
+  fgrep 'TEXTREL
+R_ARM_NONE' conftest.dr > /dev/null || libc_cv_arm_pcrel_movw=yes
+}
+rm -f conftest*])
+if test $libc_cv_arm_pcrel_movw = yes; then
+  AC_DEFINE([ARM_PCREL_MOVW_OK])
+fi
+
 libc_cv_gcc_unwind_find_fde=no
 
 # Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.ac.