mirror of git://sourceware.org/git/glibc.git
i686: Do not build ifunc tests if compiler does not generate supported relocations
clang with --target i668 might not produce supported relocations that ld.bfd can use for -static-pie without -fPIC, which are used on some tests. Disable them for now.
This commit is contained in:
parent
0bdc79d55e
commit
73f106d247
|
@ -148,7 +148,7 @@ AC_SUBST(NM)
|
|||
])
|
||||
|
||||
dnl Run a static link test with -nostdlib -nostartfiles.
|
||||
dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
|
||||
dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
|
||||
AC_DEFUN([LIBC_TRY_LINK_STATIC],
|
||||
[cat > conftest.c <<EOF
|
||||
int _start (void) { return 0; }
|
||||
|
@ -156,9 +156,9 @@ int __start (void) { return 0; }
|
|||
$1
|
||||
EOF
|
||||
AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
|
||||
conftest.c -static -nostartfiles -nostdlib
|
||||
conftest.c $2 -static -nostartfiles -nostdlib
|
||||
1>&AS_MESSAGE_LOG_FD])],
|
||||
[$2], [$3])
|
||||
[$3], [$4])
|
||||
rm -f conftest*])
|
||||
|
||||
dnl Test a compiler option or options with an empty input file.
|
||||
|
|
|
@ -8885,6 +8885,7 @@ libc_cv_localstatedir=$localstatedir
|
|||
libc_cv_gcc_unwind_find_fde=no
|
||||
libc_cv_idn=no
|
||||
pthread_in_libc=yes
|
||||
libc_cv_ifunc_static_pie=yes
|
||||
|
||||
# Iterate over all the sysdep directories we will use, running their
|
||||
# configure fragments.
|
||||
|
@ -8900,6 +8901,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
|
|||
fi
|
||||
done
|
||||
|
||||
config_vars="$config_vars
|
||||
ifunc-static-pie = $libc_cv_ifunc_static_pie"
|
||||
|
||||
if test x"$build_mathvec" = xnotset; then
|
||||
build_mathvec=no
|
||||
fi
|
||||
|
|
|
@ -1922,6 +1922,7 @@ libc_cv_localstatedir=$localstatedir
|
|||
libc_cv_gcc_unwind_find_fde=no
|
||||
libc_cv_idn=no
|
||||
pthread_in_libc=yes
|
||||
libc_cv_ifunc_static_pie=yes
|
||||
|
||||
# Iterate over all the sysdep directories we will use, running their
|
||||
# configure fragments.
|
||||
|
@ -1936,6 +1937,8 @@ for dir in $sysnames; do
|
|||
fi
|
||||
done
|
||||
|
||||
LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
|
||||
|
||||
if test x"$build_mathvec" = xnotset; then
|
||||
build_mathvec=no
|
||||
fi
|
||||
|
|
18
elf/Makefile
18
elf/Makefile
|
@ -1211,16 +1211,20 @@ tests += $(tests-static)
|
|||
ifeq (yes,$(have-ifunc))
|
||||
tests-ifuncstatic := \
|
||||
ifuncmain1picstatic \
|
||||
ifuncmain1static \
|
||||
ifuncmain2picstatic \
|
||||
ifuncmain2static \
|
||||
ifuncmain4picstatic \
|
||||
ifuncmain4static \
|
||||
ifuncmain5picstatic \
|
||||
ifuncmain5static \
|
||||
# tests-ifuncstatic
|
||||
ifeq (yes,$(ifunc-static-pie))
|
||||
tests-ifuncstatic += \
|
||||
ifuncmain1static \
|
||||
ifuncmain4static \
|
||||
ifuncmain7picstatic \
|
||||
ifuncmain7static \
|
||||
# tests-ifuncstatic
|
||||
endif
|
||||
ifeq (yes,$(have-gcc-ifunc))
|
||||
tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
|
||||
endif
|
||||
|
@ -1240,11 +1244,15 @@ tests-internal += \
|
|||
ifuncmain2 \
|
||||
ifuncmain2pic \
|
||||
ifuncmain3 \
|
||||
ifuncmain4 \
|
||||
ifuncmain5staticpic \
|
||||
# tests-internal
|
||||
ifeq (yes,$(ifunc-static-pie))
|
||||
tests-internal += \
|
||||
ifuncmain4 \
|
||||
ifuncmain7 \
|
||||
ifuncmain7pic \
|
||||
# tests-internal
|
||||
endif
|
||||
ifeq (no,$(with-lld))
|
||||
tests-internal += \
|
||||
ifuncmain1 \
|
||||
|
@ -1273,9 +1281,13 @@ ifunc-pie-tests = \
|
|||
ifuncmain1pie \
|
||||
ifuncmain1staticpie \
|
||||
ifuncmain1vispie \
|
||||
# ifunc-pie-tests
|
||||
ifeq (yes,$(ifunc-static-pie))
|
||||
ifunc-pie-tests += \
|
||||
ifuncmain6pie \
|
||||
ifuncmain7pie \
|
||||
# ifunc-pie-tests
|
||||
endif
|
||||
ifeq (yes,$(have-gcc-ifunc))
|
||||
ifunc-pie-tests += ifuncmain9pie
|
||||
endif
|
||||
|
|
|
@ -90,6 +90,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
|
|||
fi
|
||||
fi
|
||||
|
||||
if test "$libc_cv_static_pie" == "yes"; then
|
||||
cat > conftest.c <<EOF
|
||||
int _start (void) { return 0; }
|
||||
int __start (void) { return 0; }
|
||||
int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
|
||||
void *
|
||||
foo_ifunc (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int main (void)
|
||||
{
|
||||
return foo ();
|
||||
}
|
||||
EOF
|
||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
|
||||
conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
|
||||
1>&5'
|
||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; }
|
||||
then :
|
||||
libc_cv_ifunc_static_pie=yes
|
||||
else $as_nop
|
||||
libc_cv_ifunc_static_pie=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
|
||||
if test x"$multi_arch" != xno; then
|
||||
printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
|
||||
|
||||
|
|
|
@ -58,6 +58,21 @@ rm -f conftest*])
|
|||
fi
|
||||
fi
|
||||
|
||||
if test "$libc_cv_static_pie" == "yes"; then
|
||||
LIBC_TRY_LINK_STATIC([dnl
|
||||
int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
|
||||
void *
|
||||
foo_ifunc (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int main (void)
|
||||
{
|
||||
return foo ();
|
||||
}],
|
||||
[-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
|
||||
fi
|
||||
|
||||
dnl When multi-arch is enabled, all external functions must be called
|
||||
dnl via PIC PLT in PIE, which requires setting up EBX register.
|
||||
if test x"$multi_arch" != xno; then
|
||||
|
|
Loading…
Reference in New Issue