about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386')
-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