aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2021-12-08 11:21:26 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2021-12-13 08:08:59 +0530
commit23645707f12f2dd9d80b51effb2d9618a7b65565 (patch)
tree3c02ef1768200f574de3f62d3acb76b6d0b77264 /configure
parent556a6126f8764bc66d03368b5ac3e26631556559 (diff)
downloadglibc-23645707f12f2dd9d80b51effb2d9618a7b65565.tar
glibc-23645707f12f2dd9d80b51effb2d9618a7b65565.tar.gz
glibc-23645707f12f2dd9d80b51effb2d9618a7b65565.tar.bz2
glibc-23645707f12f2dd9d80b51effb2d9618a7b65565.zip
Replace --enable-static-pie with --disable-default-pie
Build glibc programs and tests as PIE by default and enable static-pie automatically if the architecture and toolchain supports it. Also add a new configuration option --disable-default-pie to prevent building programs as PIE. Only the following architectures now have PIE disabled by default because they do not work at the moment. hppa, ia64, alpha and csky don't work because the linker is unable to handle a pcrel relocation generated from PIE objects. The microblaze compiler is currently failing with an ICE. GNU hurd tries to enable static-pie, which does not work and hence fails. All these targets have default PIE disabled at the moment and I have left it to the target maintainers to enable PIE on their targets. build-many-glibcs runs clean for all targets. I also tested x86_64 on Fedora and Ubuntu, to verify that the default build as well as --disable-default-pie work as expected with both system toolchains. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure83
1 files changed, 52 insertions, 31 deletions
diff --git a/configure b/configure
index e4d013907c..954bae803e 100755
--- a/configure
+++ b/configure
@@ -596,9 +596,6 @@ DEFINES
static_nss
profile
libc_cv_multidir
-libc_cv_pie_default
-libc_cv_cc_pie_default
-libc_cv_pic_default
shared
static
ldd_rewrite_script
@@ -768,7 +765,7 @@ with_timeoutfactor
enable_sanity_checks
enable_shared
enable_profile
-enable_static_pie
+enable_default_pie
enable_timezone_tools
enable_hardcoded_path_in_tests
enable_hidden_plt
@@ -1424,8 +1421,8 @@ Optional Features:
in special situations) [default=yes]
--enable-shared build shared library [default=yes if GNU ld]
--enable-profile build profiled library [default=no]
- --enable-static-pie enable static PIE support and use it in the
- testsuite [default=no]
+ --disable-default-pie Do not build glibc programs and the testsuite as PIE
+ [default=no]
--disable-timezone-tools
do not install timezone tools [default=install]
--enable-hardcoded-path-in-tests
@@ -3424,11 +3421,11 @@ else
profile=no
fi
-# Check whether --enable-static-pie was given.
-if test "${enable_static_pie+set}" = set; then :
- enableval=$enable_static_pie; static_pie=$enableval
+# Check whether --enable-default-pie was given.
+if test "${enable_default_pie+set}" = set; then :
+ enableval=$enable_default_pie; default_pie=$enableval
else
- static_pie=no
+ default_pie=yes
fi
# Check whether --enable-timezone-tools was given.
@@ -6975,7 +6972,8 @@ rm -f conftest.*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pic_default" >&5
$as_echo "$libc_cv_pic_default" >&6; }
-
+config_vars="$config_vars
+build-pic-default = $libc_cv_pic_default"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fPIE is default" >&5
$as_echo_n "checking whether -fPIE is default... " >&6; }
@@ -6995,17 +6993,37 @@ rm -f conftest.*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_pie_default" >&5
$as_echo "$libc_cv_cc_pie_default" >&6; }
-libc_cv_pie_default=$libc_cv_cc_pie_default
-
-
-
-# Set the `multidir' variable by grabbing the variable from the compiler.
-# We do it once and save the result in a generated makefile.
-libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
-
+config_vars="$config_vars
+cc-pie-default = $libc_cv_cc_pie_default"
-if test "$static_pie" = yes; then
- # Check target support for static PIE
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can build programs as PIE" >&5
+$as_echo_n "checking if we can build programs as PIE... " >&6; }
+if test "x$default_pie" != xno; then
+ # Disable build-pie-default if target does not support it.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef PIE_UNSUPPORTED
+# error PIE is not supported
+#endif
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libc_cv_pie_default=yes
+else
+ libc_cv_pie_default=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_pie_default" >&5
+$as_echo "$libc_cv_pie_default" >&6; }
+config_vars="$config_vars
+build-pie-default = $libc_cv_pie_default"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can build static PIE programs" >&5
+$as_echo_n "checking if we can build static PIE programs... " >&6; }
+libc_cv_static_pie=$libc_cv_pie_default
+if test "x$libc_cv_pie_default" != xno \
+ -a "$libc_cv_no_dynamic_linker" = yes; then
+ # Enable static-pie if available
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef SUPPORT_STATIC_PIE
@@ -7013,22 +7031,25 @@ if test "$static_pie" = yes; then
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
-
+ libc_cv_static_pie=yes
else
- as_fn_error $? "the architecture does not support static PIE" "$LINENO" 5
+ libc_cv_static_pie=no
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
- fi
- # Default to PIE.
- libc_cv_pie_default=yes
- $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
+ if test "$libc_cv_static_pie" = "yes"; then
+ $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
+ fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_static_pie" >&5
+$as_echo "$libc_cv_static_pie" >&6; }
config_vars="$config_vars
-enable-static-pie = $static_pie"
+enable-static-pie = $libc_cv_static_pie"
+
+# Set the `multidir' variable by grabbing the variable from the compiler.
+# We do it once and save the result in a generated makefile.
+libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
+