From ebb300b24427606d99c2808b0f204ed6ce77fa3e Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Wed, 14 Sep 2011 01:29:01 +0000 Subject: * 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. --- gold/configure | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 141 insertions(+), 12 deletions(-) (limited to 'gold/configure') diff --git a/gold/configure b/gold/configure index b882223..e0a91f8 100755 --- a/gold/configure +++ b/gold/configure @@ -602,6 +602,8 @@ LFS_CFLAGS WARN_CXXFLAGS NO_WERROR WARN_CFLAGS +IFUNC_STATIC_FALSE +IFUNC_STATIC_TRUE IFUNC_FALSE IFUNC_TRUE RANDOM_SEED_CFLAGS @@ -671,6 +673,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +NM TARGETOBJS DEFAULT_TARGET_X86_64_FALSE DEFAULT_TARGET_X86_64_TRUE @@ -3526,6 +3529,99 @@ cat >>confdefs.h <<_ACEOF _ACEOF +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args. +set dummy ${ac_tool_prefix}nm; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NM+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + ac_cv_prog_NM="$NM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NM="${ac_tool_prefix}nm" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NM=$ac_cv_prog_NM +if test -n "$NM"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5 +$as_echo "$NM" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NM"; then + ac_ct_NM=$NM + # Extract the first word of "nm", so it can be a program name with args. +set dummy nm; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_NM+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NM"; then + ac_cv_prog_ac_ct_NM="$ac_ct_NM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NM="nm" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NM=$ac_cv_prog_ac_ct_NM +if test -n "$ac_ct_NM"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NM" >&5 +$as_echo "$ac_ct_NM" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NM" = x; then + NM="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NM=$ac_ct_NM + fi +else + NM="$ac_cv_prog_NM" +fi + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6381,12 +6477,14 @@ if test "$gold_cv_c_random_seed" = "yes"; then fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glibc >= 2.11" >&5 -$as_echo_n "checking for glibc >= 2.11... " >&6; } -if test "${gold_cv_lib_glibc2_11+set}" = set; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glibc ifunc support" >&5 +$as_echo_n "checking for glibc ifunc support... " >&6; } +if test "${gold_cv_lib_glibc_ifunc+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -static" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6395,20 +6493,39 @@ error #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11) error #endif -__asm__(".type foo, %gnu_indirect_function"); +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; } +int +main () +{ +invoke(); + ; + return 0; +} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gold_cv_lib_glibc2_11=yes +if ac_fn_c_try_link "$LINENO"; then : + +if ${NM} conftest$EXEEXT | grep "__rela\?_iplt_start" >/dev/null 2>&1; then + gold_cv_lib_glibc_ifunc=both else - gold_cv_lib_glibc2_11=no + gold_cv_lib_glibc_ifunc=dyn fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + gold_cv_lib_glibc_ifunc=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LDFLAGS="$save_LDFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gold_cv_lib_glibc2_11" >&5 -$as_echo "$gold_cv_lib_glibc2_11" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gold_cv_lib_glibc_ifunc" >&5 +$as_echo "$gold_cv_lib_glibc_ifunc" >&6; } - if test "$gold_cv_lib_glibc2_11" = "yes"; then + if test "$gold_cv_lib_glibc_ifunc" != "no"; then IFUNC_TRUE= IFUNC_FALSE='#' else @@ -6416,6 +6533,14 @@ else IFUNC_FALSE= fi + if test "$gold_cv_lib_glibc_ifunc" = "both"; then + IFUNC_STATIC_TRUE= + IFUNC_STATIC_FALSE='#' +else + IFUNC_STATIC_TRUE='#' + IFUNC_STATIC_FALSE= +fi + GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" @@ -7353,6 +7478,10 @@ if test -z "${IFUNC_TRUE}" && test -z "${IFUNC_FALSE}"; then as_fn_error "conditional \"IFUNC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${IFUNC_STATIC_TRUE}" && test -z "${IFUNC_STATIC_FALSE}"; then + as_fn_error "conditional \"IFUNC_STATIC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${HAVE_ZLIB_TRUE}" && test -z "${HAVE_ZLIB_FALSE}"; then as_fn_error "conditional \"HAVE_ZLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 -- cgit v1.1