mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
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 9d7a3741c9
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.
This commit is contained in:
parent
1dcd94e2f6
commit
51119c6aa5
@ -259,6 +259,9 @@
|
||||
/* Build glibc with tunables support. */
|
||||
#define HAVE_TUNABLES 0
|
||||
|
||||
/* Define if static PIE is supported. */
|
||||
#undef SUPPORT_STATIC_PIE
|
||||
|
||||
/* Define if static PIE is enabled. */
|
||||
#define ENABLE_STATIC_PIE 0
|
||||
|
||||
|
13
configure
vendored
13
configure
vendored
@ -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
|
||||
|
@ -1831,6 +1831,10 @@ libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
|
||||
AC_SUBST(libc_cv_multidir)
|
||||
|
||||
if test "$static_pie" = yes; then
|
||||
# Check target support for static PIE
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
|
||||
# error static PIE is not supported
|
||||
#endif]])], , AC_MSG_ERROR([the architecture does not support static PIE]))
|
||||
# The linker must support --no-dynamic-linker.
|
||||
if test "$libc_cv_no_dynamic_linker" != yes; then
|
||||
AC_MSG_ERROR([linker support for --no-dynamic-linker needed])
|
||||
|
4
sysdeps/aarch64/configure
vendored
4
sysdeps/aarch64/configure
vendored
@ -6,6 +6,10 @@
|
||||
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
|
||||
|
||||
|
||||
# Static PIE is supported.
|
||||
$as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
|
||||
|
||||
|
||||
# We check to see if the compiler and flags are
|
||||
# selecting the big endian ABI and if they are then
|
||||
# we set libc_cv_aarch64_be to yes which causes
|
||||
|
@ -5,6 +5,9 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
|
||||
# The exception is -mcmodel=large which is unsupported with PIC/PIE.
|
||||
AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
||||
|
||||
# Static PIE is supported.
|
||||
AC_DEFINE(SUPPORT_STATIC_PIE)
|
||||
|
||||
# We check to see if the compiler and flags are
|
||||
# selecting the big endian ABI and if they are then
|
||||
# we set libc_cv_aarch64_be to yes which causes
|
||||
|
3
sysdeps/i386/configure
vendored
3
sysdeps/i386/configure
vendored
@ -117,3 +117,6 @@ if test x"$multi_arch" != xno; then
|
||||
$as_echo "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
$as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
|
||||
|
||||
|
@ -77,3 +77,6 @@ dnl via PIC PLT in PIE, which requires setting up EBX register.
|
||||
if test x"$multi_arch" != xno; then
|
||||
AC_DEFINE(NO_HIDDEN_EXTERN_FUNC_IN_PIE)
|
||||
fi
|
||||
|
||||
dnl Static PIE is supported.
|
||||
AC_DEFINE(SUPPORT_STATIC_PIE)
|
||||
|
3
sysdeps/x86_64/configure
vendored
3
sysdeps/x86_64/configure
vendored
@ -143,5 +143,8 @@ fi
|
||||
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
|
||||
|
||||
|
||||
$as_echo "#define SUPPORT_STATIC_PIE 1" >>confdefs.h
|
||||
|
||||
|
||||
test -n "$critic_missing" && as_fn_error $? "
|
||||
*** $critic_missing" "$LINENO" 5
|
||||
|
@ -82,5 +82,8 @@ dnl It is always possible to access static and hidden symbols in an
|
||||
dnl position independent way.
|
||||
AC_DEFINE(PI_STATIC_AND_HIDDEN)
|
||||
|
||||
dnl Static PIE is supported.
|
||||
AC_DEFINE(SUPPORT_STATIC_PIE)
|
||||
|
||||
test -n "$critic_missing" && AC_MSG_ERROR([
|
||||
*** $critic_missing])
|
||||
|
Loading…
Reference in New Issue
Block a user