aboutsummaryrefslogtreecommitdiff
path: root/gold/configure.ac
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-09-14 01:29:01 +0000
committerCary Coutant <ccoutant@google.com>2011-09-14 01:29:01 +0000
commitebb300b24427606d99c2808b0f204ed6ce77fa3e (patch)
treeabb98c84674c47702d5bc8f0628da6608bae5877 /gold/configure.ac
parent1206d0d51475805105f990eaa2a02e2a7699aa80 (diff)
downloadgdb-ebb300b24427606d99c2808b0f204ed6ce77fa3e.zip
gdb-ebb300b24427606d99c2808b0f204ed6ce77fa3e.tar.gz
gdb-ebb300b24427606d99c2808b0f204ed6ce77fa3e.tar.bz2
* configure.ac: Check for glibc support for gnu_indirect_function
support with static linking, setting automake conditional IFUNC_STATIC. * Makefile.in: Regenerate. * configure: Regenerate. * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static) (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check for IFUNC_STATIC. * testsuite/Makefile.in: Regenerate.
Diffstat (limited to 'gold/configure.ac')
-rw-r--r--gold/configure.ac27
1 files changed, 22 insertions, 5 deletions
diff --git a/gold/configure.ac b/gold/configure.ac
index 949c8c3..685e85b 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -238,6 +238,8 @@ AC_DEFINE_UNQUOTED(GOLD_DEFAULT_BIG_ENDIAN, $default_big_endian,
AC_DEFINE_UNQUOTED(GOLD_DEFAULT_OSABI, $default_osabi,
[Default OSABI code])
+AC_CHECK_TOOL(NM, nm)
+
AC_PROG_CC
AC_PROG_CXX
AC_PROG_YACC
@@ -374,18 +376,33 @@ AC_SUBST(RANDOM_SEED_CFLAGS)
dnl On GNU/Linux ifunc is supported by the dynamic linker in glibc
dnl 2.11 or later, and by binutils 2.20.1 or later.
-AC_CACHE_CHECK([for glibc >= 2.11], [gold_cv_lib_glibc2_11],
-[AC_COMPILE_IFELSE([
+AC_CACHE_CHECK([for glibc ifunc support], [gold_cv_lib_glibc_ifunc],
+[save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -static"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <features.h>
#if !defined __GLIBC__
error
#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11)
error
#endif
-__asm__(".type foo, %gnu_indirect_function");
-], [gold_cv_lib_glibc2_11=yes], [gold_cv_lib_glibc2_11=no])])
+void func (void) { }
+void invoke (void);
+__asm__(".type invoke, %gnu_indirect_function");
+typedef void (*funcptr) (void);
+funcptr dispatch (void) __asm__ ("invoke");
+funcptr dispatch (void) { return &func; }]],
+[[invoke();]])
+], [
+if ${NM} conftest$EXEEXT | grep "__rela\?_iplt_start" >/dev/null 2>&1; then
+ gold_cv_lib_glibc_ifunc=both
+else
+ gold_cv_lib_glibc_ifunc=dyn
+fi], [gold_cv_lib_glibc_ifunc=no])
+LDFLAGS="$save_LDFLAGS"])
-AM_CONDITIONAL(IFUNC, test "$gold_cv_lib_glibc2_11" = "yes")
+AM_CONDITIONAL(IFUNC, test "$gold_cv_lib_glibc_ifunc" != "no")
+AM_CONDITIONAL(IFUNC_STATIC, test "$gold_cv_lib_glibc_ifunc" = "both")
AM_BINUTILS_WARNINGS