]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
configure.ac: Add --enable-indirect-function option.
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 29 Sep 2010 14:58:52 +0000 (14:58 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 29 Sep 2010 14:58:52 +0000 (14:58 +0000)
* 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

gcc/ChangeLog
gcc/config.gcc
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/doc/install.texi
gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports-dg.exp
gcc/testsuite/lib/target-supports.exp
gcc/varasm.c

index 50d67de1e775533dc2a156b46aff5df70f3e87c4..096c59d380aa661e7a0ec1956b271545e9aca467 100644 (file)
@@ -1,3 +1,13 @@
+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>
 
        * doc/options.texi (Variable, Var, Init): Update documentation
index c504249cefd8b37146b4fe67adcc3d95530004f0..6558a996250bc09897f2e691ec195177d422644f 100644 (file)
 #                      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
index 574c033e894c567c03cd42e84e7ed3ff2aeae433..3925a111e186531a4a6526b466863eff03c74b86 100644 (file)
 /* 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
index b7a1c111e744f3a3e971664223b79e0376f6bc70..e01097cb0698297f61e8e330afefd1285e1d33f5 100755 (executable)
@@ -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
 
index e9a86149d8ee2ce53fe97ef58524f3afc7e262cd..a83a227f19de8ae9e572980b8e9e991d69b30087 100644 (file)
@@ -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
index 58dc226af768e6fa92616c71a14d19667ca341ca..5cb047e50a68dde3b9977ca192c9ebfdbf17987d 100644 (file)
@@ -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.
index cc0237bffe63d974621782d7ac8cb55544f571d2..76ae3a1eff38eacda151545ca192b98462efd02b 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * gcc.dg/stack-usage-1.c (SIZE): Adjust for avr.
index ac5e8725addd7b7bee71bfbe71c3ce3f2679557f..257c68e3bdbc912de75ce2b38573659f6b4f5bce 100644 (file)
@@ -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"]
     }
index e2174b71dee7f89f1181d10d80029347e7fa8a64..35798a092c2b7c5aad8fe3f7446ae050e571fed3 100644 (file)
@@ -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
index bc314940347e69a3dfc07a3aed1b472160f58397..5f9ec9001cb88d3bfca9e462672cce791cdc537d 100644 (file)
@@ -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);