aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac33
1 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 9938ab0..a64aeb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -634,6 +634,30 @@ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
fi
rm -f conftest*])
+# Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
+AC_CACHE_CHECK([for gcc attribute ifunc support],
+ libc_cv_gcc_indirect_function, [dnl
+cat > conftest.c <<EOF
+extern int func (int);
+int used_func (int a)
+{
+ return a;
+}
+static void *resolver ()
+{
+ return &used_func;
+}
+extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
+EOF
+libc_cv_gcc_indirect_function=no
+if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
+ 2>&AS_MESSAGE_LOG_FD ; then
+ if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
+ libc_cv_gcc_indirect_function=yes
+ fi
+fi
+rm -f conftest*])
+
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])
@@ -641,6 +665,11 @@ if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
multi_arch=no
fi
fi
+if test x"$libc_cv_gcc_indirect_function" != xyes &&
+ test x"$multi_arch" = xyes; then
+ AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
+Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
+fi
multi_arch_d=
if test x"$multi_arch" != xno; then
multi_arch_d=/multiarch
@@ -1782,6 +1811,10 @@ if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
AC_DEFINE(HAVE_IFUNC)
fi
+if test x"$libc_cv_gcc_indirect_function" = xyes; then
+ AC_DEFINE(HAVE_GCC_IFUNC)
+fi
+
# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
# configure fragment can override the value to prevent this AC_DEFINE.
AC_SUBST(use_nscd)