From 374cef32ac36d956f75ccc6416872498bbe66e82 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 20 Jan 2021 12:26:31 +0000 Subject: configure: Check for static PIE support Add SUPPORT_STATIC_PIE that targets can define if they support static PIE. This requires PI_STATIC_AND_HIDDEN support and various linker features as described in commit 9d7a3741c9e59eba87fb3ca6b9f979befce07826 Add --enable-static-pie configure option to build static PIE [BZ #19574] Currently defined on x86_64, i386 and aarch64 where static PIE is known to work. Reviewed-by: Adhemerval Zanella --- configure | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 49f7b32..1dc3af6 100755 --- a/configure +++ b/configure @@ -6814,6 +6814,19 @@ libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory` if test "$static_pie" = yes; then + # Check target support for static PIE + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef SUPPORT_STATIC_PIE +# error static PIE is not supported +#endif +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + as_fn_error $? "the architecture does not support static PIE" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # The linker must support --no-dynamic-linker. if test "$libc_cv_no_dynamic_linker" != yes; then as_fn_error $? "linker support for --no-dynamic-linker needed" "$LINENO" 5 -- cgit v1.1