change ifunc assembly test to a link test
The test currently tests the binutils frontend support which passes for all versions of binutils we currently require (2.20+). It doesn't test the backend which is required for ifunc to actually work, and which most targets don't yet support. Change the assembly code so that when we link it, we get a file that has ifunc relocations if the backend supports it. That way we can test to see if binutils supports everything we need. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
de2b6422c6
commit
0cae3f4b03
|
@ -1,3 +1,10 @@
|
||||||
|
2012-10-24 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
* configure.in: Move READELF check to start of file.
|
||||||
|
(libc_cv_ld_gnu_indirect_function): Change to a link test. Rename from
|
||||||
|
libc_cv_asm_gnu_indirect_function in the process.
|
||||||
|
* configure: Regenerated.
|
||||||
|
|
||||||
2012-10-24 Mike Frysinger <vapier@gentoo.org>
|
2012-10-24 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* configure.in (libc_cv_gcc_static_libgcc): Drop -q flag to grep and
|
* configure.in (libc_cv_gcc_static_libgcc): Drop -q flag to grep and
|
||||||
|
|
|
@ -631,7 +631,6 @@ CXX_SYSINCLUDES
|
||||||
SYSINCLUDES
|
SYSINCLUDES
|
||||||
AUTOCONF
|
AUTOCONF
|
||||||
NM
|
NM
|
||||||
READELF
|
|
||||||
AWK
|
AWK
|
||||||
SED
|
SED
|
||||||
MAKEINFO
|
MAKEINFO
|
||||||
|
@ -664,6 +663,7 @@ oldest_abi
|
||||||
use_default_link
|
use_default_link
|
||||||
sysheaders
|
sysheaders
|
||||||
with_fp
|
with_fp
|
||||||
|
READELF
|
||||||
ac_ct_CXX
|
ac_ct_CXX
|
||||||
CXXFLAGS
|
CXXFLAGS
|
||||||
CXX
|
CXX
|
||||||
|
@ -3397,6 +3397,98 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
if test -n "$ac_tool_prefix"; then
|
||||||
|
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
|
||||||
|
set dummy ${ac_tool_prefix}readelf; ac_word=$2
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||||
|
$as_echo_n "checking for $ac_word... " >&6; }
|
||||||
|
if ${ac_cv_prog_READELF+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
if test -n "$READELF"; then
|
||||||
|
ac_cv_prog_READELF="$READELF" # 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_READELF="${ac_tool_prefix}readelf"
|
||||||
|
$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
|
||||||
|
READELF=$ac_cv_prog_READELF
|
||||||
|
if test -n "$READELF"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
|
||||||
|
$as_echo "$READELF" >&6; }
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test -z "$ac_cv_prog_READELF"; then
|
||||||
|
ac_ct_READELF=$READELF
|
||||||
|
# Extract the first word of "readelf", so it can be a program name with args.
|
||||||
|
set dummy readelf; ac_word=$2
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||||
|
$as_echo_n "checking for $ac_word... " >&6; }
|
||||||
|
if ${ac_cv_prog_ac_ct_READELF+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
if test -n "$ac_ct_READELF"; then
|
||||||
|
ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # 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_READELF="readelf"
|
||||||
|
$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_READELF=$ac_cv_prog_ac_ct_READELF
|
||||||
|
if test -n "$ac_ct_READELF"; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
|
||||||
|
$as_echo "$ac_ct_READELF" >&6; }
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$ac_ct_READELF" = x; then
|
||||||
|
READELF="false"
|
||||||
|
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
|
||||||
|
READELF=$ac_ct_READELF
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
READELF="$ac_cv_prog_READELF"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
|
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
|
||||||
as_fn_error $? "you must configure in a separate build directory" "$LINENO" 5
|
as_fn_error $? "you must configure in a separate build directory" "$LINENO" 5
|
||||||
|
@ -4053,25 +4145,36 @@ if test "$base_machine" = "i386"; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For the multi-arch option we need support in the assembler.
|
# For the multi-arch option we need support in the assembler & linker.
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler gnu_indirect_function symbol type support" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler and linker STT_GNU_IFUNC support" >&5
|
||||||
$as_echo_n "checking for assembler gnu_indirect_function symbol type support... " >&6; }
|
$as_echo_n "checking for assembler and linker STT_GNU_IFUNC support... " >&6; }
|
||||||
if ${libc_cv_asm_gnu_indirect_function+:} false; then :
|
if ${libc_cv_ld_gnu_indirect_function+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
cat > conftest.s <<EOF
|
cat > conftest.s <<EOF
|
||||||
.type foo,%gnu_indirect_function
|
.type foo,%gnu_indirect_function
|
||||||
|
foo:
|
||||||
|
.globl _start
|
||||||
|
_start:
|
||||||
|
.globl __start
|
||||||
|
__start:
|
||||||
|
.data
|
||||||
|
.long foo
|
||||||
EOF
|
EOF
|
||||||
if ${CC-cc} -c $ASFLAGS conftest.s 1>&5 2>&5;
|
libc_cv_ld_gnu_indirect_function=no
|
||||||
then
|
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
|
||||||
libc_cv_asm_gnu_indirect_function=yes
|
-nostartfiles -nostdlib \
|
||||||
else
|
-o conftest conftest.s 1>&5 2>&5; then
|
||||||
libc_cv_asm_gnu_indirect_function=no
|
# Do a link to see if the backend supports IFUNC relocs.
|
||||||
|
$READELF -r conftest 1>&5
|
||||||
|
LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
|
||||||
|
libc_cv_ld_gnu_indirect_function=yes
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_gnu_indirect_function" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ld_gnu_indirect_function" >&5
|
||||||
$as_echo "$libc_cv_asm_gnu_indirect_function" >&6; }
|
$as_echo "$libc_cv_ld_gnu_indirect_function" >&6; }
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .text pseudo-op must be used" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .text pseudo-op must be used" >&5
|
||||||
$as_echo_n "checking whether .text pseudo-op must be used... " >&6; }
|
$as_echo_n "checking whether .text pseudo-op must be used... " >&6; }
|
||||||
|
@ -4101,7 +4204,7 @@ else
|
||||||
$as_echo "yes" >&6; }
|
$as_echo "yes" >&6; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$libc_cv_asm_gnu_indirect_function" != xyes; then
|
if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
|
||||||
if test x"$multi_arch" = xyes; then
|
if test x"$multi_arch" = xyes; then
|
||||||
as_fn_error $? "--enable-multi-arch support requires assembler and linker support" "$LINENO" 5
|
as_fn_error $? "--enable-multi-arch support requires assembler and linker support" "$LINENO" 5
|
||||||
else
|
else
|
||||||
|
@ -5065,98 +5168,6 @@ if test $ac_verc_fail = yes; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test -n "$ac_tool_prefix"; then
|
|
||||||
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
|
|
||||||
set dummy ${ac_tool_prefix}readelf; ac_word=$2
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
|
||||||
$as_echo_n "checking for $ac_word... " >&6; }
|
|
||||||
if ${ac_cv_prog_READELF+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
if test -n "$READELF"; then
|
|
||||||
ac_cv_prog_READELF="$READELF" # 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_READELF="${ac_tool_prefix}readelf"
|
|
||||||
$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
|
|
||||||
READELF=$ac_cv_prog_READELF
|
|
||||||
if test -n "$READELF"; then
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
|
|
||||||
$as_echo "$READELF" >&6; }
|
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
|
||||||
if test -z "$ac_cv_prog_READELF"; then
|
|
||||||
ac_ct_READELF=$READELF
|
|
||||||
# Extract the first word of "readelf", so it can be a program name with args.
|
|
||||||
set dummy readelf; ac_word=$2
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
|
||||||
$as_echo_n "checking for $ac_word... " >&6; }
|
|
||||||
if ${ac_cv_prog_ac_ct_READELF+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
if test -n "$ac_ct_READELF"; then
|
|
||||||
ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # 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_READELF="readelf"
|
|
||||||
$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_READELF=$ac_cv_prog_ac_ct_READELF
|
|
||||||
if test -n "$ac_ct_READELF"; then
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
|
|
||||||
$as_echo "$ac_ct_READELF" >&6; }
|
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
|
||||||
$as_echo "no" >&6; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$ac_ct_READELF" = x; then
|
|
||||||
READELF="false"
|
|
||||||
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
|
|
||||||
READELF=$ac_ct_READELF
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
READELF="$ac_cv_prog_READELF"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$ac_tool_prefix"; then
|
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.
|
# 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
|
set dummy ${ac_tool_prefix}nm; ac_word=$2
|
||||||
|
|
31
configure.in
31
configure.in
|
@ -23,6 +23,7 @@ AC_SUBST(cross_compiling)
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
# We need the C++ compiler only for testing.
|
# We need the C++ compiler only for testing.
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
AC_CHECK_TOOL(READELF, readelf, false)
|
||||||
|
|
||||||
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
|
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
|
||||||
AC_MSG_ERROR([you must configure in a separate build directory])
|
AC_MSG_ERROR([you must configure in a separate build directory])
|
||||||
|
@ -566,17 +567,28 @@ if test "$base_machine" = "i386"; then
|
||||||
AC_DEFINE(USE_REGPARMS)
|
AC_DEFINE(USE_REGPARMS)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For the multi-arch option we need support in the assembler.
|
# For the multi-arch option we need support in the assembler & linker.
|
||||||
AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
|
AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
|
||||||
libc_cv_asm_gnu_indirect_function, [dnl
|
libc_cv_ld_gnu_indirect_function, [dnl
|
||||||
cat > conftest.s <<EOF
|
cat > conftest.s <<EOF
|
||||||
.type foo,%gnu_indirect_function
|
.type foo,%gnu_indirect_function
|
||||||
|
foo:
|
||||||
|
.globl _start
|
||||||
|
_start:
|
||||||
|
.globl __start
|
||||||
|
__start:
|
||||||
|
.data
|
||||||
|
.long foo
|
||||||
EOF
|
EOF
|
||||||
if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
|
libc_cv_ld_gnu_indirect_function=no
|
||||||
then
|
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
|
||||||
libc_cv_asm_gnu_indirect_function=yes
|
-nostartfiles -nostdlib \
|
||||||
else
|
-o conftest conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
|
||||||
libc_cv_asm_gnu_indirect_function=no
|
# Do a link to see if the backend supports IFUNC relocs.
|
||||||
|
$READELF -r conftest 1>&AS_MESSAGE_LOG_FD
|
||||||
|
LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
|
||||||
|
libc_cv_ld_gnu_indirect_function=yes
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
rm -f conftest*])
|
rm -f conftest*])
|
||||||
|
|
||||||
|
@ -596,7 +608,7 @@ else
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$libc_cv_asm_gnu_indirect_function" != xyes; then
|
if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
|
||||||
if test x"$multi_arch" = xyes; then
|
if test x"$multi_arch" = xyes; then
|
||||||
AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
|
AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
|
||||||
else
|
else
|
||||||
|
@ -930,7 +942,6 @@ AC_CHECK_PROG_VER(AWK, gawk, --version,
|
||||||
[GNU Awk[^0-9]*\([0-9][0-9.]*\)],
|
[GNU Awk[^0-9]*\([0-9][0-9.]*\)],
|
||||||
[[3-9].*], critic_missing="$critic_missing gawk")
|
[[3-9].*], critic_missing="$critic_missing gawk")
|
||||||
|
|
||||||
AC_CHECK_TOOL(READELF, readelf, false)
|
|
||||||
AC_CHECK_TOOL(NM, nm, false)
|
AC_CHECK_TOOL(NM, nm, false)
|
||||||
|
|
||||||
AC_CHECK_PROGS(AUTOCONF, autoconf, no)
|
AC_CHECK_PROGS(AUTOCONF, autoconf, no)
|
||||||
|
|
Loading…
Reference in New Issue