Commit f6c5fbfd by Nathan Sidwell Committed by Nathan Sidwell

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
parent f0036cca
2010-09-29 Nathan Sidwell <nathan@codesourcery.com>
* 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 <joseph@codesourcery.com> 2010-09-29 Joseph Myers <joseph@codesourcery.com>
* doc/options.texi (Variable, Var, Init): Update documentation * doc/options.texi (Variable, Var, Init): Update documentation
...@@ -45,6 +45,16 @@ ...@@ -45,6 +45,16 @@
# default value of $default_use_cxa_atexit is set to # default value of $default_use_cxa_atexit is set to
# "no" except for targets which are known to be OK. # "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 # gas_flag Either yes or no depending on whether GNU as was
# requested. # requested.
# #
...@@ -205,6 +215,7 @@ thread_file= ...@@ -205,6 +215,7 @@ thread_file=
gas="$gas_flag" gas="$gas_flag"
gnu_ld="$gnu_ld_flag" gnu_ld="$gnu_ld_flag"
default_use_cxa_atexit=no default_use_cxa_atexit=no
default_gnu_indirect_function=no
target_gtfiles= target_gtfiles=
need_64bit_hwint= need_64bit_hwint=
need_64bit_isa= need_64bit_isa=
...@@ -1192,6 +1203,8 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i ...@@ -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" tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h"
case ${target} in case ${target} in
i[34567]86-*-linux*) i[34567]86-*-linux*)
# Assume modern glibc
default_gnu_indirect_function=yes
if test x$enable_targets = xall; then if test x$enable_targets = xall; then
tm_file="${tm_file} i386/x86-64.h i386/linux64.h" tm_file="${tm_file} i386/x86-64.h i386/linux64.h"
tm_defines="${tm_defines} TARGET_BI_ARCH=1" tm_defines="${tm_defines} TARGET_BI_ARCH=1"
...@@ -1227,6 +1240,8 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu) ...@@ -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 \ 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" i386/x86-64.h i386/linux64.h"
case ${target} in 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-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;;
x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;; x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;;
esac esac
......
...@@ -959,8 +959,8 @@ ...@@ -959,8 +959,8 @@
/* Define if your assembler and linker support .hidden. */ /* Define if your assembler and linker support .hidden. */
#undef HAVE_GAS_HIDDEN #undef HAVE_GAS_HIDDEN
/* Define if your assembler supports indirect function type. */ /* Define if your system supports gnu indirect functions. */
#undef HAVE_GAS_INDIRECT_FUNCTION #undef HAVE_GNU_INDIRECT_FUNCTION
/* Define if your assembler supports .lcomm with an alignment field. */ /* Define if your assembler supports .lcomm with an alignment field. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
......
...@@ -903,6 +903,7 @@ with_pic ...@@ -903,6 +903,7 @@ with_pic
enable_fast_install enable_fast_install
enable_libtool_lock enable_libtool_lock
with_plugin_ld with_plugin_ld
enable_gnu_indirect_function
enable_comdat enable_comdat
enable_gnu_unique_object enable_gnu_unique_object
enable_linker_build_id enable_linker_build_id
...@@ -1608,6 +1609,9 @@ Optional Features: ...@@ -1608,6 +1609,9 @@ Optional Features:
--enable-fast-install[=PKGS] --enable-fast-install[=PKGS]
optimize for fast installation [default=yes] optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds) --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-comdat enable COMDAT group support
--enable-gnu-unique-object enable the use of the @gnu_unique_object ELF extension on --enable-gnu-unique-object enable the use of the @gnu_unique_object ELF extension on
glibc systems glibc systems
...@@ -17123,7 +17127,7 @@ else ...@@ -17123,7 +17127,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 17126 "configure" #line 17130 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -17229,7 +17233,7 @@ else ...@@ -17229,7 +17233,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 17232 "configure" #line 17236 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -21316,42 +21320,20 @@ $as_echo "$gcc_cv_as_hidden" >&6; } ...@@ -21316,42 +21320,20 @@ $as_echo "$gcc_cv_as_hidden" >&6; }
# gnu_indirect_function type is an extension proposed at # gnu_indirect_function type is an extension proposed at
# http://groups.google/com/group/generic-abi/files. It allows dynamic runtime # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime
# selection of function implementation # selection of function implementation
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for gnu_indirect_function" >&5 # Check whether --enable-gnu-indirect-function was given.
$as_echo_n "checking assembler for gnu_indirect_function... " >&6; } if test "${enable_gnu_indirect_function+set}" = set; then :
if test "${gcc_cv_as_indirect_function+set}" = set; then : enableval=$enable_gnu_indirect_function; case $enable_gnu_indirect_function in
$as_echo_n "(cached) " >&6 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 else
gcc_cv_as_indirect_function=no enable_gnu_indirect_function="$default_gnu_indirect_function"
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
fi 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 fi
......
...@@ -2151,14 +2151,18 @@ esac]) ...@@ -2151,14 +2151,18 @@ esac])
# gnu_indirect_function type is an extension proposed at # gnu_indirect_function type is an extension proposed at
# http://groups.google/com/group/generic-abi/files. It allows dynamic runtime # http://groups.google/com/group/generic-abi/files. It allows dynamic runtime
# selection of function implementation # selection of function implementation
gcc_GAS_CHECK_FEATURE(gnu_indirect_function, gcc_cv_as_indirect_function, AC_ARG_ENABLE(gnu-indirect-function,
[elf,2,20,1],, [AS_HELP_STRING([--enable-gnu-indirect-function],
[ .type Foo, @gnu_indirect_function [enable the use of the @gnu_indirect_function to glibc systems])],
Foo:]) [case $enable_gnu_indirect_function in
GCC_TARGET_TEMPLATE([HAVE_GAS_INDIRECT_FUNCTION]) yes | no) ;;
if test $gcc_cv_as_indirect_function = yes ; then *) AC_MSG_ERROR(['$enable_gnu_indirect_function' is an invalid value for --enable-gnu-indirect-function.
AC_DEFINE(HAVE_GAS_INDIRECT_FUNCTION, 1, Valid choices are 'yes' and 'no'.]) ;;
[Define if your assembler supports indirect function type.]) 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 fi
changequote(,)dnl changequote(,)dnl
......
...@@ -1229,6 +1229,10 @@ destructors, but requires __cxa_atexit in libc. This option is currently ...@@ -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 only available on systems with GNU libc. When enabled, this will cause
@option{-fuse-cxa-atexit} to be passed by default. @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 @item --enable-target-optspace
Specify that target Specify that target
libraries should be optimized for code space instead of code speed. libraries should be optimized for code space instead of code speed.
......
2010-09-29 Nathan Sidwell <nathan@codesourcery.com>
* 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 <gingold@adacore.com> 2010-09-29 Tristan Gingold <gingold@adacore.com>
* gcc.dg/stack-usage-1.c (SIZE): Adjust for avr. * gcc.dg/stack-usage-1.c (SIZE): Adjust for avr.
......
...@@ -94,12 +94,7 @@ proc dg-require-alias { args } { ...@@ -94,12 +94,7 @@ proc dg-require-alias { args } {
# test. # test.
proc dg-require-ifunc { args } { proc dg-require-ifunc { args } {
set ifunc_available [ check_ifunc_available ] if { ![ check_ifunc_available ] } {
if { $ifunc_available == -1 } {
upvar name name
unresolved "$name"
}
if { $ifunc_available < 2 } {
upvar dg-do-what dg-do-what upvar dg-do-what dg-do-what
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
} }
......
...@@ -372,12 +372,10 @@ proc check_alias_available { } { ...@@ -372,12 +372,10 @@ proc check_alias_available { } {
# proc check_ifunc_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 # Returns 1 if the target supports ifunc. Returns 0 if the target
# only supports weak aliased. Returns 0 if the target does not # does not support ifunc.
# support aliases at all. Returns -1 if support for aliases could not
# be determined.
proc check_ifunc_available { } { proc check_ifunc_available { } {
global ifunc_available_saved global ifunc_available_saved
...@@ -390,26 +388,19 @@ proc check_ifunc_available { } { ...@@ -390,26 +388,19 @@ proc check_ifunc_available { } {
set obj ifunc[pid].o set obj ifunc[pid].o
verbose "check_ifunc_available compiling testfile $src" 2 verbose "check_ifunc_available compiling testfile $src" 2
set f [open $src "w"] set f [open $src "w"]
# Compile a small test program. The definition of "g" is puts $f "#endif"
# necessary to keep the Solaris assembler from complaining puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif"
# about the program. puts $f "void g() {}"
puts $f "#ifdef __cplusplus\nextern \"C\"\n#endif\n" puts $f "void f() __attribute__((ifunc(\"g\")));"
puts $f "void g() {} void f() __attribute__((ifunc(\"g\")));"
close $f close $f
set lines [${tool}_target_compile $src $obj object ""] set lines [${tool}_target_compile $src $obj object ""]
file delete $src file delete $src
remote_file build delete $obj remote_file build delete $obj
if [string match "" $lines] then { if [string match "" $lines] then {
# No error messages, everything is OK. set ifunc_available_saved 1
set ifunc_available_saved 2
} else { } else {
if [regexp "ifunc is not supported" $lines] { set ifunc_available_saved 0
verbose "check_ifunc_available target does not support ifunc" 2
set ifunc_available_saved 0
} else {
set ifunc_available_saved -1
}
} }
verbose "check_ifunc_available returning $ifunc_available_saved" 2 verbose "check_ifunc_available returning $ifunc_available_saved" 2
......
...@@ -5364,7 +5364,7 @@ do_assemble_alias (tree decl, tree target) ...@@ -5364,7 +5364,7 @@ do_assemble_alias (tree decl, tree target)
} }
if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl))) 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_OUTPUT_TYPE_DIRECTIVE
(asm_out_file, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), (asm_out_file, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
IFUNC_ASM_TYPE); IFUNC_ASM_TYPE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment