about summary refs log tree commit diff
path: root/configure.in
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-10-22 23:40:42 -0400
committerMike Frysinger <vapier@gentoo.org>2012-10-24 17:01:13 -0400
commit0cae3f4b033e441d820f4521fa5736e4e6e4d713 (patch)
tree6dcd02609d8d6100a9950924817db601d9815b10 /configure.in
parentde2b6422c641490b92b3130a519693166323423c (diff)
downloadglibc-0cae3f4b033e441d820f4521fa5736e4e6e4d713.tar.gz
glibc-0cae3f4b033e441d820f4521fa5736e4e6e4d713.tar.xz
glibc-0cae3f4b033e441d820f4521fa5736e4e6e4d713.zip
change ifunc assembly test to a link test
The test currently tests the binutils frontend support which passes for
all versions of binutils we currently require (2.20+).  It doesn't test
the backend which is required for ifunc to actually work, and which most
targets don't yet support.

Change the assembly code so that when we link it, we get a file that has
ifunc relocations if the backend supports it.  That way we can test to
see if binutils supports everything we need.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in31
1 files changed, 21 insertions, 10 deletions
diff --git a/configure.in b/configure.in
index b3fab3772b..4f7bc09842 100644
--- a/configure.in
+++ b/configure.in
@@ -23,6 +23,7 @@ AC_SUBST(cross_compiling)
 AC_PROG_CPP
 # We need the C++ compiler only for testing.
 AC_PROG_CXX
+AC_CHECK_TOOL(READELF, readelf, false)
 
 if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
   AC_MSG_ERROR([you must configure in a separate build directory])
@@ -566,17 +567,28 @@ if test "$base_machine" = "i386"; then
   AC_DEFINE(USE_REGPARMS)
 fi
 
-# For the multi-arch option we need support in the assembler.
-AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
-	       libc_cv_asm_gnu_indirect_function, [dnl
+# For the multi-arch option we need support in the assembler & linker.
+AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
+	       libc_cv_ld_gnu_indirect_function, [dnl
 cat > conftest.s <<EOF
 .type foo,%gnu_indirect_function
+foo:
+.globl _start
+_start:
+.globl __start
+__start:
+.data
+.long foo
 EOF
-if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
-then
-  libc_cv_asm_gnu_indirect_function=yes
-else
-  libc_cv_asm_gnu_indirect_function=no
+libc_cv_ld_gnu_indirect_function=no
+if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
+	    -nostartfiles -nostdlib \
+	    -o conftest conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
+  # Do a link to see if the backend supports IFUNC relocs.
+  $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
+  LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
+    libc_cv_ld_gnu_indirect_function=yes
+  }
 fi
 rm -f conftest*])
 
@@ -596,7 +608,7 @@ else
   AC_MSG_RESULT(yes)
 fi
 
-if test x"$libc_cv_asm_gnu_indirect_function" != xyes; then
+if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
   if test x"$multi_arch" = xyes; then
     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
   else
@@ -930,7 +942,6 @@ AC_CHECK_PROG_VER(AWK, gawk, --version,
   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
   [[3-9].*], critic_missing="$critic_missing gawk")
 
-AC_CHECK_TOOL(READELF, readelf, false)
 AC_CHECK_TOOL(NM, nm, false)
 
 AC_CHECK_PROGS(AUTOCONF, autoconf, no)