From: Nathan Sidwell Date: Wed, 29 Sep 2010 14:58:52 +0000 (+0000) Subject: configure.ac: Add --enable-indirect-function option. X-Git-Tag: releases/gcc-4.6.0~4050 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6c5fbfdd5f83a1943ffb20c5ec49b78601b1dd5;p=thirdparty%2Fgcc.git configure.ac: Add --enable-indirect-function option. * configure.ac: Add --enable-indirect-function option. * config.gcc: Add default_gnu_indirect_function. * config.in (HAVE_GAS_INDIRECT_FUNCTION): Rename to ... (HAVE_GNU_INDIRECT_FUNCTION): ... this. * varasm.c (do_assemble_alias): Adjust for macto name change. * configure: Rebuilt. * doc/install.texi: Document --enable-indirect-function. testsuite/ * lib/target-supports-dg.exp (dg-require-ifunc): Remove extraneous alias checking. * lib/target-supports.exp (check_ifunc_available): Likewise. From-SVN: r164725 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50d67de1e775..096c59d380aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2010-09-29 Nathan Sidwell + + * configure.ac: Add --enable-indirect-function option. + * config.gcc: Add default_gnu_indirect_function. + * config.in (HAVE_GAS_INDIRECT_FUNCTION): Rename to ... + (HAVE_GNU_INDIRECT_FUNCTION): ... this. + * varasm.c (do_assemble_alias): Adjust for macto name change. + * configure: Rebuilt. + * doc/install.texi: Document --enable-indirect-function. + 2010-09-29 Joseph Myers * doc/options.texi (Variable, Var, Init): Update documentation diff --git a/gcc/config.gcc b/gcc/config.gcc index c504249cefd8..6558a996250b 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -45,6 +45,16 @@ # default value of $default_use_cxa_atexit is set to # "no" except for targets which are known to be OK. # +# default_gnu_indirect_function +# The default value for the $enable_gnu_indirect_function +# variable. enable_gnu_indirect_function relies +# upon the presence of a non-standard gnu ifunc support +# in the assembler, linker and dynamic linker. +# Since not all libraries provide the dynamic linking +# support, the default value of +# $default_gnu_indirect_function is set to +# "no" except for targets which are known to be OK. +# # gas_flag Either yes or no depending on whether GNU as was # requested. # @@ -205,6 +215,7 @@ thread_file= gas="$gas_flag" gnu_ld="$gnu_ld_flag" default_use_cxa_atexit=no +default_gnu_indirect_function=no target_gtfiles= need_64bit_hwint= need_64bit_isa= @@ -1192,6 +1203,8 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h" case ${target} in i[34567]86-*-linux*) + # Assume modern glibc + default_gnu_indirect_function=yes if test x$enable_targets = xall; then tm_file="${tm_file} i386/x86-64.h i386/linux64.h" tm_defines="${tm_defines} TARGET_BI_ARCH=1" @@ -1227,6 +1240,8 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h \ i386/x86-64.h i386/linux64.h" case ${target} in + x86_64-*-linux*) + default_gnu_indirect_function=glibc-2011 ;; x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;; x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;; esac diff --git a/gcc/config.in b/gcc/config.in index 574c033e894c..3925a111e186 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -959,8 +959,8 @@ /* Define if your assembler and linker support .hidden. */ #undef HAVE_GAS_HIDDEN -/* Define if your assembler supports indirect function type. */ -#undef HAVE_GAS_INDIRECT_FUNCTION +/* Define if your system supports gnu indirect functions. */ +#undef HAVE_GNU_INDIRECT_FUNCTION /* Define if your assembler supports .lcomm with an alignment field. */ #ifndef USED_FOR_TARGET diff --git a/gcc/configure b/gcc/configure index b7a1c111e744..e01097cb0698 100755 --- a/gcc/configure +++ b/gcc/configure @@ -903,6 +903,7 @@ with_pic enable_fast_install enable_libtool_lock with_plugin_ld +enable_gnu_indirect_function enable_comdat enable_gnu_unique_object enable_linker_build_id @@ -1608,6 +1609,9 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-gnu-indirect-function + enable the use of the @gnu_indirect_function to + glibc systems --enable-comdat enable COMDAT group support --enable-gnu-unique-object enable the use of the @gnu_unique_object ELF extension on glibc systems @@ -17123,7 +17127,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17126 "configure" +#line 17130 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17229,7 +17233,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17232 "configure" +#line 17236 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21316,42 +21320,20 @@ $as_echo "$gcc_cv_as_hidden" >&6; } # gnu_indirect_function type is an extension proposed at # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime # selection of function implementation -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for gnu_indirect_function" >&5 -$as_echo_n "checking assembler for gnu_indirect_function... " >&6; } -if test "${gcc_cv_as_indirect_function+set}" = set; then : - $as_echo_n "(cached) " >&6 +# Check whether --enable-gnu-indirect-function was given. +if test "${enable_gnu_indirect_function+set}" = set; then : + enableval=$enable_gnu_indirect_function; case $enable_gnu_indirect_function in + yes | no) ;; + *) as_fn_error "'$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function. +Valid choices are 'yes' and 'no'." "$LINENO" 5 ;; + esac else - gcc_cv_as_indirect_function=no - if test $in_tree_gas = yes; then - if test $in_tree_gas_is_elf = yes \ - && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 20 \) \* 1000 + 1` - then gcc_cv_as_indirect_function=yes -fi - elif test x$gcc_cv_as != x; then - echo ' .type Foo, @gnu_indirect_function -Foo:' > conftest.s - if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; } - then - gcc_cv_as_indirect_function=yes - else - echo "configure: failed program was" >&5 - cat conftest.s >&5 - fi - rm -f conftest.o conftest.s - fi + enable_gnu_indirect_function="$default_gnu_indirect_function" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_indirect_function" >&5 -$as_echo "$gcc_cv_as_indirect_function" >&6; } - -if test $gcc_cv_as_indirect_function = yes ; then +if test x$enable_gnu_indirect_function = xyes; then -$as_echo "#define HAVE_GAS_INDIRECT_FUNCTION 1" >>confdefs.h +$as_echo "#define HAVE_GNU_INDIRECT_FUNCTION 1" >>confdefs.h fi diff --git a/gcc/configure.ac b/gcc/configure.ac index e9a86149d8ee..a83a227f19de 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2151,14 +2151,18 @@ esac]) # gnu_indirect_function type is an extension proposed at # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime # selection of function implementation -gcc_GAS_CHECK_FEATURE(gnu_indirect_function, gcc_cv_as_indirect_function, - [elf,2,20,1],, -[ .type Foo, @gnu_indirect_function -Foo:]) -GCC_TARGET_TEMPLATE([HAVE_GAS_INDIRECT_FUNCTION]) -if test $gcc_cv_as_indirect_function = yes ; then - AC_DEFINE(HAVE_GAS_INDIRECT_FUNCTION, 1, - [Define if your assembler supports indirect function type.]) +AC_ARG_ENABLE(gnu-indirect-function, + [AS_HELP_STRING([--enable-gnu-indirect-function], + [enable the use of the @gnu_indirect_function to glibc systems])], + [case $enable_gnu_indirect_function in + yes | no) ;; + *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function. +Valid choices are 'yes' and 'no'.]) ;; + esac], + [enable_gnu_indirect_function="$default_gnu_indirect_function"]) +if test x$enable_gnu_indirect_function = xyes; then + AC_DEFINE(HAVE_GNU_INDIRECT_FUNCTION, 1, + [Define if your system supports gnu indirect functions.]) fi changequote(,)dnl diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 58dc226af768..5cb047e50a68 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1229,6 +1229,10 @@ destructors, but requires __cxa_atexit in libc. This option is currently only available on systems with GNU libc. When enabled, this will cause @option{-fuse-cxa-atexit} to be passed by default. +@item --enable-indirect-function +Define if you want to enable the @code{ifunc} attribute. This option is +currently only available on systems with GNU libc on certain targets. + @item --enable-target-optspace Specify that target libraries should be optimized for code space instead of code speed. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cc0237bffe63..76ae3a1eff38 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-09-29 Nathan Sidwell + + * lib/target-supports-dg.exp (dg-require-ifunc): Remove extraneous + alias checking. + * lib/target-supports.exp (check_ifunc_available): Likewise. + 2010-09-29 Tristan Gingold * gcc.dg/stack-usage-1.c (SIZE): Adjust for avr. diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index ac5e8725addd..257c68e3bdbc 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -94,12 +94,7 @@ proc dg-require-alias { args } { # test. proc dg-require-ifunc { args } { - set ifunc_available [ check_ifunc_available ] - if { $ifunc_available == -1 } { - upvar name name - unresolved "$name" - } - if { $ifunc_available < 2 } { + if { ![ check_ifunc_available ] } { upvar dg-do-what dg-do-what set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index e2174b71dee7..35798a092c2b 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -372,12 +372,10 @@ proc check_alias_available { } { # proc check_ifunc_available { } ############################### -# Determine if the target toolchain supports the alias attribute. +# Determine if the target toolchain supports the ifunc attribute. -# Returns 2 if the target supports aliases. Returns 1 if the target -# only supports weak aliased. Returns 0 if the target does not -# support aliases at all. Returns -1 if support for aliases could not -# be determined. +# Returns 1 if the target supports ifunc. Returns 0 if the target +# does not support ifunc. proc check_ifunc_available { } { global ifunc_available_saved @@ -390,26 +388,19 @@ proc check_ifunc_available { } { set obj ifunc[pid].o verbose "check_ifunc_available compiling testfile $src" 2 set f [open $src "w"] - # Compile a small test program. The definition of "g" is - # necessary to keep the Solaris assembler from complaining - # about the program. - puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n" - puts $f "void g() {} void f() __attribute__((ifunc(\"g\")));" + puts $f "#endif" + puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif" + puts $f "void g() {}" + puts $f "void f() __attribute__((ifunc(\"g\")));" close $f set lines [${tool}_target_compile $src $obj object ""] file delete $src remote_file build delete $obj if [string match "" $lines] then { - # No error messages, everything is OK. - set ifunc_available_saved 2 + set ifunc_available_saved 1 } else { - if [regexp "ifunc is not supported" $lines] { - verbose "check_ifunc_available target does not support ifunc" 2 - set ifunc_available_saved 0 - } else { - set ifunc_available_saved -1 - } + set ifunc_available_saved 0 } verbose "check_ifunc_available returning $ifunc_available_saved" 2 diff --git a/gcc/varasm.c b/gcc/varasm.c index bc314940347e..5f9ec9001cb8 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -5364,7 +5364,7 @@ do_assemble_alias (tree decl, tree target) } if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl))) { -#if defined (ASM_OUTPUT_TYPE_DIRECTIVE) && HAVE_GAS_INDIRECT_FUNCTION +#if defined (ASM_OUTPUT_TYPE_DIRECTIVE) && HAVE_GNU_INDIRECT_FUNCTION ASM_OUTPUT_TYPE_DIRECTIVE (asm_out_file, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), IFUNC_ASM_TYPE);