aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-08-22 16:27:15 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-09 10:29:18 -0300
commit5e3f17afa6350ac47cc0d349d240cc00f1172b94 (patch)
tree29828c3780ec64ffed92b2c64660ac76d4687942 /sysdeps
parent5ca2ccf69a403bcf6a2f218adeda552daaaaaf7c (diff)
downloadglibc-5e3f17afa6350ac47cc0d349d240cc00f1172b94.tar
glibc-5e3f17afa6350ac47cc0d349d240cc00f1172b94.tar.gz
glibc-5e3f17afa6350ac47cc0d349d240cc00f1172b94.tar.bz2
glibc-5e3f17afa6350ac47cc0d349d240cc00f1172b94.zip
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.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/configure31
-rw-r--r--sysdeps/i386/configure.ac15
2 files changed, 46 insertions, 0 deletions
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 84656cef6e..d10a9b6fd0 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -89,6 +89,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
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 7f68e6210a..d61ab42927 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -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