From 23645707f12f2dd9d80b51effb2d9618a7b65565 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 8 Dec 2021 11:21:26 +0530 Subject: 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 Reviewed-by: Adhemerval Zanella --- sysdeps/alpha/configure | 5 +++++ sysdeps/alpha/configure.ac | 4 ++++ sysdeps/csky/configure | 7 +++++++ sysdeps/csky/configure.ac | 5 +++++ sysdeps/hppa/configure | 7 +++++++ sysdeps/hppa/configure.ac | 5 +++++ sysdeps/ia64/configure | 5 +++++ sysdeps/ia64/configure.ac | 4 ++++ sysdeps/mach/hurd/configure | 6 ++++++ sysdeps/mach/hurd/configure.ac | 5 +++++ sysdeps/microblaze/configure | 8 ++++++++ sysdeps/microblaze/configure.ac | 7 +++++++ sysdeps/sparc/Makefile | 1 + 13 files changed, 69 insertions(+) create mode 100755 sysdeps/microblaze/configure create mode 100644 sysdeps/microblaze/configure.ac (limited to 'sysdeps') diff --git a/sysdeps/alpha/configure b/sysdeps/alpha/configure index 464b596..3d665d9 100644 --- a/sysdeps/alpha/configure +++ b/sysdeps/alpha/configure @@ -5,4 +5,9 @@ # symbols in a position independent way. $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h + # work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/alpha/configure.ac b/sysdeps/alpha/configure.ac index 38e52e7..8f9a39e 100644 --- a/sysdeps/alpha/configure.ac +++ b/sysdeps/alpha/configure.ac @@ -4,4 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # With required gcc+binutils, we can always access static and hidden # symbols in a position independent way. AC_DEFINE(PI_STATIC_AND_HIDDEN) + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +AC_DEFINE(PIE_UNSUPPORTED) # work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/csky/configure b/sysdeps/csky/configure index 19acb08..27464eb 100644 --- a/sysdeps/csky/configure +++ b/sysdeps/csky/configure @@ -2,3 +2,10 @@ # Local configure fragment for sysdeps/csky. $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h + + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h + +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/csky/configure.ac b/sysdeps/csky/configure.ac index 5656b66..8e00824 100644 --- a/sysdeps/csky/configure.ac +++ b/sysdeps/csky/configure.ac @@ -2,3 +2,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/csky. AC_DEFINE(PI_STATIC_AND_HIDDEN) + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +AC_DEFINE(PIE_UNSUPPORTED) +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/hppa/configure b/sysdeps/hppa/configure index 2cfe6cb..cf5acf9 100644 --- a/sysdeps/hppa/configure +++ b/sysdeps/hppa/configure @@ -30,3 +30,10 @@ $as_echo "$libc_cv_asm_line_sep" >&6; } cat >>confdefs.h <<_ACEOF #define ASM_LINE_SEP $libc_cv_asm_line_sep _ACEOF + + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h + +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/hppa/configure.ac b/sysdeps/hppa/configure.ac index 1ec417b..3e1c35b 100644 --- a/sysdeps/hppa/configure.ac +++ b/sysdeps/hppa/configure.ac @@ -19,3 +19,8 @@ else fi rm -f conftest*]) AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep) + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +AC_DEFINE(PIE_UNSUPPORTED) +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/ia64/configure b/sysdeps/ia64/configure index 1ef7092..748cb52 100644 --- a/sysdeps/ia64/configure +++ b/sysdeps/ia64/configure @@ -3,4 +3,9 @@ $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h + # work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/ia64/configure.ac b/sysdeps/ia64/configure.ac index 3bae9fc..8e5fba3 100644 --- a/sysdeps/ia64/configure.ac +++ b/sysdeps/ia64/configure.ac @@ -4,4 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. dnl It is always possible to access static and hidden symbols in an dnl position independent way. AC_DEFINE(PI_STATIC_AND_HIDDEN) + +# PIE builds fail on binutils 2.37 and earlier, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28672 +AC_DEFINE(PIE_UNSUPPORTED) # work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/mach/hurd/configure b/sysdeps/mach/hurd/configure index 8d0702a..3303e5d 100644 --- a/sysdeps/mach/hurd/configure +++ b/sysdeps/mach/hurd/configure @@ -49,3 +49,9 @@ fi # Hurd has libpthread as a separate library. pthread_in_libc=no + +# Hurd build needs to be updated to support static pie, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28671 +$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h + +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/mach/hurd/configure.ac b/sysdeps/mach/hurd/configure.ac index 82d085a..022c2ef 100644 --- a/sysdeps/mach/hurd/configure.ac +++ b/sysdeps/mach/hurd/configure.ac @@ -29,3 +29,8 @@ fi # Hurd has libpthread as a separate library. pthread_in_libc=no + +# Hurd build needs to be updated to support static pie, see: +# https://sourceware.org/bugzilla/show_bug.cgi?id=28671 +AC_DEFINE(PIE_UNSUPPORTED) +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/microblaze/configure b/sysdeps/microblaze/configure new file mode 100755 index 0000000..e665256 --- /dev/null +++ b/sysdeps/microblaze/configure @@ -0,0 +1,8 @@ +# This file is generated from configure.ac by Autoconf. DO NOT EDIT! + # Local configure fragment for sysdeps/microblaze. + +# gcc 11.2.1 and earlier crash with an internal compiler error, see: +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103613 +$as_echo "#define PIE_UNSUPPORTED 1" >>confdefs.h + +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/microblaze/configure.ac b/sysdeps/microblaze/configure.ac new file mode 100644 index 0000000..1c58f70 --- /dev/null +++ b/sysdeps/microblaze/configure.ac @@ -0,0 +1,7 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local configure fragment for sysdeps/microblaze. + +# gcc 11.2.1 and earlier crash with an internal compiler error, see: +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103613 +AC_DEFINE(PIE_UNSUPPORTED) +# work around problem with autoconf and empty lines at the end of files diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile index 1be9a3d..12c2c1b 100644 --- a/sysdeps/sparc/Makefile +++ b/sysdeps/sparc/Makefile @@ -2,6 +2,7 @@ long-double-fcts = yes pie-ccflag = -fPIE +no-pie-ccflag = -fno-PIE ifeq ($(subdir),gmon) sysdep_routines += sparc-mcount -- cgit v1.1