diff options
Diffstat (limited to 'libc/configure.in')
-rw-r--r-- | libc/configure.in | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/libc/configure.in b/libc/configure.in index f9f908ad6..95f562a0e 100644 --- a/libc/configure.in +++ b/libc/configure.in @@ -23,6 +23,7 @@ AC_SUBST(cross_compiling) AC_PROG_CPP # We need the C++ compiler only for testing. AC_PROG_CXX +AC_CHECK_TOOL(READELF, readelf, false) if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then AC_MSG_ERROR([you must configure in a separate build directory]) @@ -571,17 +572,28 @@ if test "$base_machine" = "i386"; then AC_DEFINE(USE_REGPARMS) fi -# For the multi-arch option we need support in the assembler. -AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support], - libc_cv_asm_gnu_indirect_function, [dnl +# For the multi-arch option we need support in the assembler & linker. +AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support], + libc_cv_ld_gnu_indirect_function, [dnl cat > conftest.s <<EOF .type foo,%gnu_indirect_function +foo: +.globl _start +_start: +.globl __start +__start: +.data +.long foo EOF -if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; -then - libc_cv_asm_gnu_indirect_function=yes -else - libc_cv_asm_gnu_indirect_function=no +libc_cv_ld_gnu_indirect_function=no +if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ + -nostartfiles -nostdlib \ + -o conftest conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then + # 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 rm -f conftest*]) @@ -601,7 +613,7 @@ else AC_MSG_RESULT(yes) 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 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support]) else @@ -958,7 +970,6 @@ AC_CHECK_PROG_VER(AWK, gawk, --version, [GNU Awk[^0-9]*\([0-9][0-9.]*\)], [[3-9].*], critic_missing="$critic_missing gawk") -AC_CHECK_TOOL(READELF, readelf, false) AC_CHECK_TOOL(NM, nm, false) AC_CHECK_PROGS(AUTOCONF, autoconf, no) @@ -1001,10 +1012,9 @@ if test -n "$sysheaders"; then -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" if test -n "$CXX"; then CXX_SYSINCLUDES= - cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` && cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` && - cxxplus=`$CXX -print-prog-name=cc1plus` - cxxheaders=`$cxxplus -v /dev/null 2>&1 | sed -n '/ \//{p;q;}' | sed 's/ //'` + cxxheaders=`$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \ + | sed -n -e '1,/#include/d' -e '/^ \//{p;q;}' | sed 's/ //'` test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" && CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \ -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward" @@ -1040,7 +1050,7 @@ AC_MSG_ERROR([ fi AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl -if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then +if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then libc_cv_gcc_static_libgcc= else libc_cv_gcc_static_libgcc=-static-libgcc @@ -1410,7 +1420,7 @@ AC_CACHE_CHECK(for libunwind-support in compiler, int main (void) { return 0; } EOF if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \ - conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then + conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then libc_cv_cc_with_libunwind=yes else libc_cv_cc_with_libunwind=no @@ -1560,7 +1570,7 @@ void foo (void) { } EOF if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \ - && grep -q .note.GNU-stack conftest.s \ + && grep .note.GNU-stack conftest.s >/dev/null \ && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD]) then @@ -2146,6 +2156,12 @@ if test x$libc_cv_gcc_unwind_find_fde = xyes; then fi AC_SUBST(libc_cv_gcc_unwind_find_fde) +# A sysdeps configure fragment can reset this if IFUNC is not actually +# usable even though the assembler knows how to generate the symbol type. +if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then + AC_DEFINE(HAVE_IFUNC) +fi + # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps # configure fragment can override the value to prevent this AC_DEFINE. AC_SUBST(use_nscd) @@ -2219,18 +2235,12 @@ AC_SUBST(DEFINES) dnl See sysdeps/mach/configure.in for this variable. AC_SUBST(mach_interface_list) -if test "`(cd $srcdir; pwd)`" = "`pwd`"; then - config_makefile= -else - config_makefile=Makefile -fi - VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h` RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h` AC_SUBST(VERSION) AC_SUBST(RELEASE) -AC_CONFIG_FILES([config.make ${config_makefile}]) +AC_CONFIG_FILES([config.make Makefile]) AC_CONFIG_COMMANDS([default],[[ case $CONFIG_FILES in *config.make*) echo "$config_vars" >> config.make;; |