public inbox for gcc-regression@sourceware.org
help / color / mirror / Atom feed
* [TCWG CI] 433.milc grew in size by 7% after glibc: Replace --enable-static-pie with --disable-default-pie
@ 2021-12-14 10:20 ci_notify
       [not found] ` <8756F5EE-E78A-43B9-ADC7-12CCA64F5EF1@linaro.org>
  0 siblings, 1 reply; 2+ messages in thread
From: ci_notify @ 2021-12-14 10:20 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gcc-regression

After glibc commit 23645707f12f2dd9d80b51effb2d9618a7b65565
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>

    Replace --enable-static-pie with --disable-default-pie

the following benchmarks grew in size by more than 1%:
- 433.milc grew in size by 7% from 61554 to 65702 bytes
- 450.soplex grew in size by 2% from 207236 to 211380 bytes

Below reproducer instructions can be used to re-build both "first_bad" and "last_good" cross-toolchains used in this bisection.  Naturally, the scripts will fail when triggerring benchmarking jobs if you don't have access to Linaro TCWG CI.

For your convenience, we have uploaded tarballs with pre-processed source and assembly files at:
- First_bad save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-23645707f12f2dd9d80b51effb2d9618a7b65565/save-temps/
- Last_good save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-556a6126f8764bc66d03368b5ac3e26631556559/save-temps/
- Baseline save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-baseline/save-temps/

Configuration:
- Benchmark: SPEC CPU2006
- Toolchain: GCC + Glibc + GNU Linker
- Version: all components were built from their tip of trunk
- Target: aarch64-linux-gnu
- Compiler flags: -Os -flto
- Hardware: APM Mustang 8x X-Gene1

This benchmarking CI is work-in-progress, and we welcome feedback and suggestions at linaro-toolchain@lists.linaro.org .  In our improvement plans is to add support for SPEC CPU2017 benchmarks and provide "perf report/annotate" data behind these reports.

THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.

This commit has regressed these CI configurations:
 - tcwg_bmk_gnu_apm/gnu-master-aarch64-spec2k6-Os_LTO

First_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-23645707f12f2dd9d80b51effb2d9618a7b65565/
Last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-556a6126f8764bc66d03368b5ac3e26631556559/
Baseline build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-baseline/
Even more details: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/

Reproduce builds:
<cut>
mkdir investigate-glibc-23645707f12f2dd9d80b51effb2d9618a7b65565
cd investigate-glibc-23645707f12f2dd9d80b51effb2d9618a7b65565

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/manifests/build-baseline.sh --fail
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/manifests/build-parameters.sh --fail
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/test.sh --fail
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh

# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /glibc/ ./ ./bisect/baseline/

cd glibc

# Reproduce first_bad build
git checkout --detach 23645707f12f2dd9d80b51effb2d9618a7b65565
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach 556a6126f8764bc66d03368b5ac3e26631556559
../artifacts/test.sh

cd ..
</cut>

Full commit (up to 1000 lines):
<cut>
commit 23645707f12f2dd9d80b51effb2d9618a7b65565
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Wed Dec 8 11:21:26 2021 +0530

    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>
---
 INSTALL                         | 18 ++++-----
 Makeconfig                      | 21 +++++++----
 NEWS                            | 13 +++++++
 config.h.in                     |  3 ++
 config.make.in                  |  3 --
 configure                       | 83 ++++++++++++++++++++++++++---------------
 configure.ac                    | 56 +++++++++++++++------------
 manual/install.texi             | 16 ++++----
 scripts/build-many-glibcs.py    | 13 ++++---
 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 +
 22 files changed, 205 insertions(+), 90 deletions(-)

diff --git a/INSTALL b/INSTALL
index 899d7f1ed7..331d405e56 100644
--- a/INSTALL
+++ b/INSTALL
@@ -116,16 +116,14 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
      systems support shared libraries; you need ELF support and
      (currently) the GNU linker.
 
-'--enable-static-pie'
-     Enable static position independent executable (static PIE) support.
-     Static PIE is similar to static executable, but can be loaded at
-     any address without help from a dynamic linker.  All static
-     programs as well as static tests are built as static PIE, except
-     for those marked with no-pie.  The resulting glibc can be used with
-     the GCC option, -static-pie, which is available with GCC 8 or
-     above, to create static PIE. This option also implies that glibc
-     programs and tests are created as dynamic position independent
-     executables (PIE) by default.
+'--disable-default-pie'
+     Don't build glibc programs and the testsuite as position
+     independent executables (PIE). By default, glibc programs and tests
+     are created as position independent executables on targets that
+     support it.  If the toolchain and architecture support it, static
+     executables are built as static PIE and the resulting glibc can be
+     used with the GCC option, -static-pie, which is available with GCC
+     8 or above, to create static PIE.
 
 '--enable-cet'
 '--enable-cet=permissive'
diff --git a/Makeconfig b/Makeconfig
index 3fa2f13003..775bf12b65 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1,4 +1,5 @@
 # Copyright (C) 1991-2021 Free Software Foundation, Inc.
+# Copyright (C) The GNU Toolchain Authors.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -376,19 +377,24 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
 LDFLAGS-rtld += $(hashstyle-LDFLAGS)
 endif
 
-ifeq (yes,$(enable-static-pie))
+ifeq (no,$(build-pie-default))
+pie-default = $(no-pie-ccflag)
+else # build-pie-default
 pic-default = -DPIC
 # Compile libc.a and libc_p.a with -fPIE/-fpie for static PIE.
 pie-default = $(pie-ccflag)
+
+ifeq (yes,$(enable-static-pie))
 ifeq (yes,$(have-static-pie))
-default-pie-ldflag = -static-pie
+static-pie-ldflag = -static-pie
 else
 # Static PIE can't have dynamic relocations in read-only segments since
 # static PIE is mapped into memory by kernel.  --eh-frame-hdr is needed
 # for PIE to support exception.
-default-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
-endif
-endif
+static-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
+endif # have-static-pie
+endif # enable-static-pie
+endif # build-pie-default
 
 # If lazy relocations are disabled, add the -z now flag.  Use
 # LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
@@ -444,7 +450,7 @@ endif
 # Command for statically linking programs with the C library.
 ifndef +link-static
 +link-static-before-inputs = -nostdlib -nostartfiles -static \
-	      $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
+	      $(if $($(@F)-no-pie),$(no-pie-ldflag),$(static-pie-ldflag)) \
 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
 	      $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
 	      $(+preinit) $(+prectorT)
@@ -479,7 +485,7 @@ ifeq (yes,$(build-pie-default))
 +link-tests-after-inputs = $(link-libc-tests) $(+link-pie-after-libc)
 +link-printers-tests = $(+link-pie-printers-tests)
 else  # not build-pie-default
-+link-before-inputs = -nostdlib -nostartfiles \
++link-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \
 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
 	      $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
 	      $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
@@ -1040,6 +1046,7 @@ PIC-ccflag = -fPIC
 endif
 # This can be changed by a sysdep makefile
 pie-ccflag = -fpie
+no-pie-ccflag = -fno-pie
 # This one should always stay like this unless there is a very good reason.
 PIE-ccflag = -fPIE
 ifeq (yes,$(build-profile))
diff --git a/NEWS b/NEWS
index bf2b6846fc..d864a7b9d8 100644
--- a/NEWS
+++ b/NEWS
@@ -86,6 +86,15 @@ Major new features:
 * A symbolic link to the dynamic linker is now installed under
   /usr/bin/ld.so (or more precisely, '${bindir}/ld.so').
 
+* All programs and the testsuite in glibc are now built as position independent
+  executables (PIE) by default on toolchains and architectures that support it.
+  Further, if the toolchain and architecture supports it, even static programs
+  are built as PIE and the resultant glibc can be used to build static PIE
+  executables.  A new option --disable-default-pie has been added to disable
+  this behavior and get a non-PIE build.  This option replaces
+  --enable-static-pie, which no longer has any effect on the build
+  configuration.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The r_version update in the debugger interface makes the glibc binary
@@ -98,6 +107,10 @@ Deprecated and removed features, and other changes affecting compatibility:
 
 * Intel MPX support (lazy PLT, ld.so profile, and LD_AUDIT) has been removed.
 
+* The --enable-static-pie option is no longer available.  The glibc build
+  configuration script now automatically detects static-pie support in the
+  toolchain and architecture and enables it if available.
+
 Changes to build and runtime requirements:
 
   [Add changes to build and runtime requirements here]
diff --git a/config.h.in b/config.h.in
index 2f5124684e..82ade1cec4 100644
--- a/config.h.in
+++ b/config.h.in
@@ -268,6 +268,9 @@
 /* Build glibc with tunables support.  */
 #define HAVE_TUNABLES 0
 
+/* Define if PIE is unsupported.  */
+#undef PIE_UNSUPPORTED
+
 /* Define if static PIE is supported.  */
 #undef SUPPORT_STATIC_PIE
 
diff --git a/config.make.in b/config.make.in
index cbf59114b0..e8630a8d0c 100644
--- a/config.make.in
+++ b/config.make.in
@@ -90,9 +90,6 @@ static-nss-crypt = @libc_cv_static_nss_crypt@
 
 # Configuration options.
 build-shared = @shared@
-build-pic-default= @libc_cv_pic_default@
-build-pie-default= @libc_cv_pie_default@
-cc-pie-default= @libc_cv_cc_pie_default@
 build-profile = @profile@
 build-static-nss = @static_nss@
 cross-compiling = @cross_compiling@
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`
+
 
 
 
diff --git a/configure.ac b/configure.ac
index a91a7f399c..277d3527d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,11 +186,11 @@ AC_ARG_ENABLE([profile],
 			     [build profiled library @<:@default=no@:>@]),
 	      [profile=$enableval],
 	      [profile=no])
-AC_ARG_ENABLE([static-pie],
-	      AS_HELP_STRING([--enable-static-pie],
-			     [enable static PIE support and use it in the testsuite @<:@default=no@:>@]),
-	      [static_pie=$enableval],
-	      [static_pie=no])
+AC_ARG_ENABLE([default-pie],
+	      AS_HELP_STRING([--disable-default-pie],
+			     [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
+	      [default_pie=$enableval],
+	      [default_pie=yes])
 AC_ARG_ENABLE([timezone-tools],
 	      AS_HELP_STRING([--disable-timezone-tools],
 			     [do not install timezone tools @<:@default=install@:>@]),
@@ -1846,7 +1846,7 @@ if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
   libc_cv_pic_default=no
 fi
 rm -f conftest.*])
-AC_SUBST(libc_cv_pic_default)
+LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
 
 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
 [libc_cv_cc_pie_default=yes
@@ -1859,30 +1859,38 @@ if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
   libc_cv_cc_pie_default=no
 fi
 rm -f conftest.*])
-libc_cv_pie_default=$libc_cv_cc_pie_default
-AC_SUBST(libc_cv_cc_pie_default)
-AC_SUBST(libc_cv_pie_default)
+LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
+
+AC_MSG_CHECKING(if we can build programs as PIE)
+if test "x$default_pie" != xno; then
+  # Disable build-pie-default if target does not support it.
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
+# error PIE is not supported
+#endif]])], [libc_cv_pie_default=yes], [libc_cv_pie_default=no])
+fi
+AC_MSG_RESULT($libc_cv_pie_default)
+LIBC_CONFIG_VAR([build-pie-default], [$libc_cv_pie_default])
+
+AC_MSG_CHECKING(if we can build static PIE programs)
+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
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
+# error static PIE is not supported
+#endif]])], [libc_cv_static_pie=yes], [libc_cv_static_pie=no])
+  if test "$libc_cv_static_pie" = "yes"; then
+    AC_DEFINE(ENABLE_STATIC_PIE)
+  fi
+fi
+AC_MSG_RESULT($libc_cv_static_pie)
+LIBC_CONFIG_VAR([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`
 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])
-  fi
-  # Default to PIE.
-  libc_cv_pie_default=yes
-  AC_DEFINE(ENABLE_STATIC_PIE)
-fi
-LIBC_CONFIG_VAR([enable-static-pie], [$static_pie])
-
 AC_SUBST(profile)
 AC_SUBST(static_nss)
 
diff --git a/manual/install.texi b/manual/install.texi
index fce5155c22..b1afc56f5a 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -146,15 +146,13 @@ Don't build shared libraries even if it is possible.  Not all systems
 support shared libraries; you need ELF support and (currently) the GNU
 linker.
 
-@item --enable-static-pie
-Enable static position independent executable (static PIE) support.
-Static PIE is similar to static executable, but can be loaded at any
-address without help from a dynamic linker.  All static programs as
-well as static tests are built as static PIE, except for those marked
-with no-pie.  The resulting glibc can be used with the GCC option,
--static-pie, which is available with GCC 8 or above, to create static
-PIE.  This option also implies that glibc programs and tests are created
-as dynamic position independent executables (PIE) by default.
+@item --disable-default-pie
+Don't build glibc programs and the testsuite as position independent
+executables (PIE).  By default, glibc programs and tests are created as
+position independent executables on targets that support it.  If the toolchain
+and architecture support it, static executables are built as static PIE and the
+resulting glibc can be used with the GCC option, -static-pie, which is
+available with GCC 8 or above, to create static PIE.
 
 @item --enable-cet
 @itemx --enable-cet=permissive
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 6ae2172956..2f0f435166 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python3
 # Build many configurations of glibc.
 # Copyright (C) 2016-2021 Free Software Foundation, Inc.
+# Copyright (C) The GNU Toolchain Authors.
 # This file is part of the GNU C Library.
 #
 # The GNU C Library is free software; you can redistribute it and/or
@@ -437,15 +438,15 @@ class Context(object):
                                                '--disable-experimental-malloc',
                                                '--disable-build-nscd',
                                                '--disable-nscd']},
-                                      {'variant': 'static-pie',
-                                       'cfg': ['--enable-static-pie']},
-                                      {'variant': 'x32-static-pie',
+                                      {'variant': 'no-pie',
+                                       'cfg': ['--disable-default-pie']},
+                                      {'variant': 'x32-no-pie',
                                        'ccopts': '-mx32',
-                                       'cfg': ['--enable-static-pie']},
-                                      {'variant': 'static-pie',
+                                       'cfg': ['--disable-default-pie']},
+                                      {'variant': 'no-pie',
                                        'arch': 'i686',
                                        'ccopts': '-m32 -march=i686',
-                                       'cfg': ['--enable-static-pie']},
+                                       'cfg': ['--disable-default-pie']},
                                       {'variant': 'disable-multi-arch',
                                        'arch': 'i686',
                                        'ccopts': '-m32 -march=i686',
diff --git a/sysdeps/alpha/configure b/sysdeps/alpha/configure
index 464b596527..3d665d96f2 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 38e52e71ac..8f9a39ed2e 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 19acb084fb..27464eb707 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 5656b665da..8e00824909 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 2cfe6cbea1..cf5acf966d 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 1ec417b947..3e1c35bbd9 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 1ef70921bc..748cb52601 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 3bae9fc5e1..8e5fba32c3 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 8d0702ad43..3303e5dff8 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 82d085af33..022c2eff79 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 0000000000..e6652562d2
--- /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 0000000000..1c58f70a7b
--- /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 1be9a3db2c..12c2c1b085 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
</cut>
>From maxim.kuvyrkov@linaro.org  Tue Dec 14 11:00:57 2021
Return-Path: <maxim.kuvyrkov@linaro.org>
X-Original-To: gcc-regression@gcc.gnu.org
Delivered-To: gcc-regression@gcc.gnu.org
Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com
 [IPv6:2a00:1450:4864:20::22a])
 by sourceware.org (Postfix) with ESMTPS id C39EF3858D28
 for <gcc-regression@gcc.gnu.org>; Tue, 14 Dec 2021 11:00:48 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C39EF3858D28
Received: by mail-lj1-x22a.google.com with SMTP id v15so27807184ljc.0
 for <gcc-regression@gcc.gnu.org>; Tue, 14 Dec 2021 03:00:48 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to;
 bh=GUG3+cIuP+zf9tkJSRQbm1m3HOdeRJyDLiNFoBo7+QE=;
 b=nPDeeNVrXO+Do90UnLY49EHCpSXfLssHea6vT5I/vHxYKMWQXFH1nkDIGuL4JmF1Dr
 R9FJtU0/5A4SyKgteH3EsMtcipqkDVvI2ahJYyh+UQmxTC6k2/ex4DsBCzmQK3ZSfAuQ
 3zKD9tUDFYVh0Dg1F2PePu38qM1zP1oe6BPTDWSkzm8YaOP5ErBnHWzqko6EDyy7k9My
 EyD4GVHO+LPY/m2xqQGC4uzlS4M3QS+wJ3gcJJeoT4BA/5561xSZMPHRMyDgf28zgE05
 qm7BZGxYWfT+9BSmzvgeCLv0baRGefe3yNCwHmleDzVzuPdnu5X0jgLOmSKzez5fQ/Kh
 CZSA==
X-Gm-Message-State: AOAM530K6i2YZ1K39GuwxvxO0gP4egxwc/PIhe8xRL4r/KQjvVJo7Vdw
 fM3gfLWA1uEdeZxp+k/G39au
X-Google-Smtp-Source: ABdhPJwMXn5/GWj0/H/xz8re/c24IpN6pLPE9tAj/7TZWta40cB37llUvOM7q/ASkPLfANL5Knecig==
X-Received: by 2002:a05:651c:216:: with SMTP id
 y22mr4268887ljn.517.1639479647039; 
 Tue, 14 Dec 2021 03:00:47 -0800 (PST)
Received: from [192.168.0.135] ([185.30.228.158])
 by smtp.gmail.com with ESMTPSA id j20sm1791377lfm.136.2021.12.14.03.00.46
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 14 Dec 2021 03:00:46 -0800 (PST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
Subject: Re: [TCWG CI] 433.milc grew in size by 7% after glibc: Replace
 --enable-static-pie with --disable-default-pie
From: Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
In-Reply-To: <1539473712.4384.1639477235390@jenkins.jenkins>
Date: Tue, 14 Dec 2021 14:00:45 +0300
Cc: gcc-regression@gcc.gnu.org,
 Adhemerval Zanella <adhemerval.zanella@linaro.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <8756F5EE-E78A-43B9-ADC7-12CCA64F5EF1@linaro.org>
References: <1539473712.4384.1639477235390@jenkins.jenkins>
To: Siddhesh Poyarekar <siddhesh@sourceware.org>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH,
 KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS,
 TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: gcc-regression@gcc.gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Gcc-regression mailing list <gcc-regression.gcc.gnu.org>
List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=unsubscribe>
List-Archive: <https://gcc.gnu.org/pipermail/gcc-regression/>
List-Post: <mailto:gcc-regression@gcc.gnu.org>
List-Help: <mailto:gcc-regression-request@gcc.gnu.org?subject=help>
List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-regression>,
 <mailto:gcc-regression-request@gcc.gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 14 Dec 2021 11:00:57 -0000

Hi Siddhesh,

Can you fathom any way how this patch could cause 7% increase in code =
size of an executable that is dynamically linked against libc?

I have checked the raw data, and this is not a fluke; 433.milc indeed =
grows from this single patch:
=3D=3D=3D
size:
   text	   data	    bss	    dec	    hex	filename
  61554	   1276	  36480	  99310	  183ee	before
  65702	   1276	  36480	 103458	  19422	after

ls -l:
-rwxr-xr-x 1 maxim.kuvyrkov tcwg-users 83880 Dec 14 09:56 before
-rwxr-xr-x 1 maxim.kuvyrkov tcwg-users 89568 Dec 14 09:03 after
=3D=3D=3D

Looking at symbols in =E2=80=9Cbefore=E2=80=9D and =E2=80=9Cafter=E2=80=9D=
 =E2=80=94 they are all the same and the same size with one exception.  =
The =E2=80=9Cafter=E2=80=9D binary has this additional symbol:
0000000000403780 0000000000000004 T _dl_relocate_static_pie

Any ideas?

This may be a due to a latent bug in binutils uncovered by your patch.  =
But I have no idea where to dig.

Regards,

--
Maxim Kuvyrkov
https://www.linaro.org

> On 14 Dec 2021, at 13:20, ci_notify@linaro.org wrote:
>=20
> After glibc commit 23645707f12f2dd9d80b51effb2d9618a7b65565
> Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
>=20
>    Replace --enable-static-pie with --disable-default-pie
>=20
> the following benchmarks grew in size by more than 1%:
> - 433.milc grew in size by 7% from 61554 to 65702 bytes
> - 450.soplex grew in size by 2% from 207236 to 211380 bytes
>=20
> Below reproducer instructions can be used to re-build both "first_bad" =
and "last_good" cross-toolchains used in this bisection.  Naturally, the =
scripts will fail when triggerring benchmarking jobs if you don't have =
access to Linaro TCWG CI.
>=20
> For your convenience, we have uploaded tarballs with pre-processed =
source and assembly files at:
> - First_bad save-temps: =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/build-23645707f12f2dd9d80b51ef=
fb2d9618a7b65565/save-temps/
> - Last_good save-temps: =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/build-556a6126f8764bc66d03368b=
5ac3e26631556559/save-temps/
> - Baseline save-temps: =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/build-baseline/save-temps/
>=20
> Configuration:
> - Benchmark: SPEC CPU2006
> - Toolchain: GCC + Glibc + GNU Linker
> - Version: all components were built from their tip of trunk
> - Target: aarch64-linux-gnu
> - Compiler flags: -Os -flto
> - Hardware: APM Mustang 8x X-Gene1
>=20
> This benchmarking CI is work-in-progress, and we welcome feedback and =
suggestions at linaro-toolchain@lists.linaro.org .  In our improvement =
plans is to add support for SPEC CPU2017 benchmarks and provide "perf =
report/annotate" data behind these reports.
>=20
> THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, =
REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.
>=20
> This commit has regressed these CI configurations:
> - tcwg_bmk_gnu_apm/gnu-master-aarch64-spec2k6-Os_LTO
>=20
> First_bad build: =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/build-23645707f12f2dd9d80b51ef=
fb2d9618a7b65565/
> Last_good build: =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/build-556a6126f8764bc66d03368b=
5ac3e26631556559/
> Baseline build: =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/build-baseline/
> Even more details: =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/
>=20
> Reproduce builds:
> <cut>
> mkdir investigate-glibc-23645707f12f2dd9d80b51effb2d9618a7b65565
> cd investigate-glibc-23645707f12f2dd9d80b51effb2d9618a7b65565
>=20
> # Fetch scripts
> git clone https://git.linaro.org/toolchain/jenkins-scripts
>=20
> # Fetch manifests and test.sh script
> mkdir -p artifacts/manifests
> curl -o artifacts/manifests/build-baseline.sh =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/manifests/build-baseline.sh =
--fail
> curl -o artifacts/manifests/build-parameters.sh =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/manifests/build-parameters.sh =
--fail
> curl -o artifacts/test.sh =
https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-a=
arch64-spec2k6-Os_LTO/11/artifact/artifacts/test.sh --fail
> chmod +x artifacts/test.sh
>=20
> # Reproduce the baseline build (build all pre-requisites)
> ./jenkins-scripts/tcwg_bmk-build.sh @@ =
artifacts/manifests/build-baseline.sh
>=20
> # Save baseline build state (which is then restored in =
artifacts/test.sh)
> mkdir -p ./bisect
> rsync -a --del --delete-excluded --exclude /bisect/ --exclude =
/artifacts/ --exclude /glibc/ ./ ./bisect/baseline/
>=20
> cd glibc
>=20
> # Reproduce first_bad build
> git checkout --detach 23645707f12f2dd9d80b51effb2d9618a7b65565
> ../artifacts/test.sh
>=20
> # Reproduce last_good build
> git checkout --detach 556a6126f8764bc66d03368b5ac3e26631556559
> ../artifacts/test.sh
>=20
> cd ..
> </cut>
>=20
> Full commit (up to 1000 lines):
> <cut>
> commit 23645707f12f2dd9d80b51effb2d9618a7b65565
> Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
> Date:   Wed Dec 8 11:21:26 2021 +0530
>=20
>    Replace --enable-static-pie with --disable-default-pie
>=20
>    Build glibc programs and tests as PIE by default and enable =
static-pie
>    automatically if the architecture and toolchain supports it.
>=20
>    Also add a new configuration option --disable-default-pie to =
prevent
>    building programs as PIE.
>=20
>    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.
>=20
>    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.
>=20
>    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
>    Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> ---
> INSTALL                         | 18 ++++-----
> Makeconfig                      | 21 +++++++----
> NEWS                            | 13 +++++++
> config.h.in                     |  3 ++
> config.make.in                  |  3 --
> configure                       | 83 =
++++++++++++++++++++++++++---------------
> configure.ac                    | 56 +++++++++++++++------------
> manual/install.texi             | 16 ++++----
> scripts/build-many-glibcs.py    | 13 ++++---
> 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 +
> 22 files changed, 205 insertions(+), 90 deletions(-)
>=20
> diff --git a/INSTALL b/INSTALL
> index 899d7f1ed7..331d405e56 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -116,16 +116,14 @@ if 'CFLAGS' is specified it must enable =
optimization.  For example:
>      systems support shared libraries; you need ELF support and
>      (currently) the GNU linker.
>=20
> -'--enable-static-pie'
> -     Enable static position independent executable (static PIE) =
support.
> -     Static PIE is similar to static executable, but can be loaded at
> -     any address without help from a dynamic linker.  All static
> -     programs as well as static tests are built as static PIE, except
> -     for those marked with no-pie.  The resulting glibc can be used =
with
> -     the GCC option, -static-pie, which is available with GCC 8 or
> -     above, to create static PIE. This option also implies that glibc
> -     programs and tests are created as dynamic position independent
> -     executables (PIE) by default.
> +'--disable-default-pie'
> +     Don't build glibc programs and the testsuite as position
> +     independent executables (PIE). By default, glibc programs and =
tests
> +     are created as position independent executables on targets that
> +     support it.  If the toolchain and architecture support it, =
static
> +     executables are built as static PIE and the resulting glibc can =
be
> +     used with the GCC option, -static-pie, which is available with =
GCC
> +     8 or above, to create static PIE.
>=20
> '--enable-cet'
> '--enable-cet=3Dpermissive'
> diff --git a/Makeconfig b/Makeconfig
> index 3fa2f13003..775bf12b65 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -1,4 +1,5 @@
> # Copyright (C) 1991-2021 Free Software Foundation, Inc.
> +# Copyright (C) The GNU Toolchain Authors.
> # This file is part of the GNU C Library.
>=20
> # The GNU C Library is free software; you can redistribute it and/or
> @@ -376,19 +377,24 @@ LDFLAGS.so +=3D $(hashstyle-LDFLAGS)
> LDFLAGS-rtld +=3D $(hashstyle-LDFLAGS)
> endif
>=20
> -ifeq (yes,$(enable-static-pie))
> +ifeq (no,$(build-pie-default))
> +pie-default =3D $(no-pie-ccflag)
> +else # build-pie-default
> pic-default =3D -DPIC
> # Compile libc.a and libc_p.a with -fPIE/-fpie for static PIE.
> pie-default =3D $(pie-ccflag)
> +
> +ifeq (yes,$(enable-static-pie))
> ifeq (yes,$(have-static-pie))
> -default-pie-ldflag =3D -static-pie
> +static-pie-ldflag =3D -static-pie
> else
> # Static PIE can't have dynamic relocations in read-only segments =
since
> # static PIE is mapped into memory by kernel.  --eh-frame-hdr is =
needed
> # for PIE to support exception.
> -default-pie-ldflag =3D =
-Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
> -endif
> -endif
> +static-pie-ldflag =3D =
-Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
> +endif # have-static-pie
> +endif # enable-static-pie
> +endif # build-pie-default
>=20
> # If lazy relocations are disabled, add the -z now flag.  Use
> # LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
> @@ -444,7 +450,7 @@ endif
> # Command for statically linking programs with the C library.
> ifndef +link-static
> +link-static-before-inputs =3D -nostdlib -nostartfiles -static \
> -	      $(if =
$($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
> +	      $(if =
$($(@F)-no-pie),$(no-pie-ldflag),$(static-pie-ldflag)) \
> 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
> 	      $(firstword $(CRT-$(@F)) =
$(csu-objpfx)$(real-static-start-installed-name)) \
> 	      $(+preinit) $(+prectorT)
> @@ -479,7 +485,7 @@ ifeq (yes,$(build-pie-default))
> +link-tests-after-inputs =3D $(link-libc-tests) =
$(+link-pie-after-libc)
> +link-printers-tests =3D $(+link-pie-printers-tests)
> else  # not build-pie-default
> -+link-before-inputs =3D -nostdlib -nostartfiles \
> ++link-before-inputs =3D -nostdlib -nostartfiles $(no-pie-ldflag) \
> 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
> 	      $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) =
\
> 	      $(firstword $(CRT-$(@F)) =
$(csu-objpfx)$(start-installed-name)) \
> @@ -1040,6 +1046,7 @@ PIC-ccflag =3D -fPIC
> endif
> # This can be changed by a sysdep makefile
> pie-ccflag =3D -fpie
> +no-pie-ccflag =3D -fno-pie
> # This one should always stay like this unless there is a very good =
reason.
> PIE-ccflag =3D -fPIE
> ifeq (yes,$(build-profile))
> diff --git a/NEWS b/NEWS
> index bf2b6846fc..d864a7b9d8 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -86,6 +86,15 @@ Major new features:
> * A symbolic link to the dynamic linker is now installed under
>   /usr/bin/ld.so (or more precisely, '${bindir}/ld.so').
>=20
> +* All programs and the testsuite in glibc are now built as position =
independent
> +  executables (PIE) by default on toolchains and architectures that =
support it.
> +  Further, if the toolchain and architecture supports it, even static =
programs
> +  are built as PIE and the resultant glibc can be used to build =
static PIE
> +  executables.  A new option --disable-default-pie has been added to =
disable
> +  this behavior and get a non-PIE build.  This option replaces
> +  --enable-static-pie, which no longer has any effect on the build
> +  configuration.
> +
> Deprecated and removed features, and other changes affecting =
compatibility:
>=20
> * The r_version update in the debugger interface makes the glibc =
binary
> @@ -98,6 +107,10 @@ Deprecated and removed features, and other changes =
affecting compatibility:
>=20
> * Intel MPX support (lazy PLT, ld.so profile, and LD_AUDIT) has been =
removed.
>=20
> +* The --enable-static-pie option is no longer available.  The glibc =
build
> +  configuration script now automatically detects static-pie support =
in the
> +  toolchain and architecture and enables it if available.
> +
> Changes to build and runtime requirements:
>=20
>   [Add changes to build and runtime requirements here]
> diff --git a/config.h.in b/config.h.in
> index 2f5124684e..82ade1cec4 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -268,6 +268,9 @@
> /* Build glibc with tunables support.  */
> #define HAVE_TUNABLES 0
>=20
> +/* Define if PIE is unsupported.  */
> +#undef PIE_UNSUPPORTED
> +
> /* Define if static PIE is supported.  */
> #undef SUPPORT_STATIC_PIE
>=20
> diff --git a/config.make.in b/config.make.in
> index cbf59114b0..e8630a8d0c 100644
> --- a/config.make.in
> +++ b/config.make.in
> @@ -90,9 +90,6 @@ static-nss-crypt =3D @libc_cv_static_nss_crypt@
>=20
> # Configuration options.
> build-shared =3D @shared@
> -build-pic-default=3D @libc_cv_pic_default@
> -build-pie-default=3D @libc_cv_pie_default@
> -cc-pie-default=3D @libc_cv_cc_pie_default@
> build-profile =3D @profile@
> build-static-nss =3D @static_nss@
> cross-compiling =3D @cross_compiling@
> 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=3Dyes]
>   --enable-shared         build shared library [default=3Dyes if GNU =
ld]
>   --enable-profile        build profiled library [default=3Dno]
> -  --enable-static-pie     enable static PIE support and use it in the
> -                          testsuite [default=3Dno]
> +  --disable-default-pie   Do not build glibc programs and the =
testsuite as PIE
> +                          [default=3Dno]
>   --disable-timezone-tools
>                           do not install timezone tools =
[default=3Dinstall]
>   --enable-hardcoded-path-in-tests
> @@ -3424,11 +3421,11 @@ else
>   profile=3Dno
> fi
>=20
> -# Check whether --enable-static-pie was given.
> -if test "${enable_static_pie+set}" =3D set; then :
> -  enableval=3D$enable_static_pie; static_pie=3D$enableval
> +# Check whether --enable-default-pie was given.
> +if test "${enable_default_pie+set}" =3D set; then :
> +  enableval=3D$enable_default_pie; default_pie=3D$enableval
> else
> -  static_pie=3Dno
> +  default_pie=3Dyes
> fi
>=20
> # 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=3D"$config_vars
> +build-pic-default =3D $libc_cv_pic_default"
>=20
> { $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=3D$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=3D`${CC-cc} $CFLAGS $CPPFLAGS =
-print-multi-directory`
> -
> +config_vars=3D"$config_vars
> +cc-pie-default =3D $libc_cv_cc_pie_default"
>=20
> -if test "$static_pie" =3D 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" !=3D 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=3Dyes
> +else
> +  libc_cv_pie_default=3Dno
> +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=3D"$config_vars
> +build-pie-default =3D $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=3D$libc_cv_pie_default
> +if test "x$libc_cv_pie_default" !=3D xno \
> +   -a "$libc_cv_no_dynamic_linker" =3D 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" =3D yes; then
> #endif
> _ACEOF
> if ac_fn_c_try_compile "$LINENO"; then :
> -
> +  libc_cv_static_pie=3Dyes
> else
> -  as_fn_error $? "the architecture does not support static PIE" =
"$LINENO" 5
> +  libc_cv_static_pie=3Dno
> 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" !=3D yes; then
> -    as_fn_error $? "linker support for --no-dynamic-linker needed" =
"$LINENO" 5
> -  fi
> -  # Default to PIE.
> -  libc_cv_pie_default=3Dyes
> -  $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
> +  if test "$libc_cv_static_pie" =3D "yes"; then
> +    $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
>=20
> +  fi
> fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_static_pie" =
>&5
> +$as_echo "$libc_cv_static_pie" >&6; }
> config_vars=3D"$config_vars
> -enable-static-pie =3D $static_pie"
> +enable-static-pie =3D $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=3D`${CC-cc} $CFLAGS $CPPFLAGS =
-print-multi-directory`
> +
>=20
>=20
>=20
> diff --git a/configure.ac b/configure.ac
> index a91a7f399c..277d3527d2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -186,11 +186,11 @@ AC_ARG_ENABLE([profile],
> 			     [build profiled library =
@<:@default=3Dno@:>@]),
> 	      [profile=3D$enableval],
> 	      [profile=3Dno])
> -AC_ARG_ENABLE([static-pie],
> -	      AS_HELP_STRING([--enable-static-pie],
> -			     [enable static PIE support and use it in =
the testsuite @<:@default=3Dno@:>@]),
> -	      [static_pie=3D$enableval],
> -	      [static_pie=3Dno])
> +AC_ARG_ENABLE([default-pie],
> +	      AS_HELP_STRING([--disable-default-pie],
> +			     [Do not build glibc programs and the =
testsuite as PIE @<:@default=3Dno@:>@]),
> +	      [default_pie=3D$enableval],
> +	      [default_pie=3Dyes])
> AC_ARG_ENABLE([timezone-tools],
> 	      AS_HELP_STRING([--disable-timezone-tools],
> 			     [do not install timezone tools =
@<:@default=3Dinstall@:>@]),
> @@ -1846,7 +1846,7 @@ if eval "${CC-cc} -S conftest.c =
2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
>   libc_cv_pic_default=3Dno
> fi
> rm -f conftest.*])
> -AC_SUBST(libc_cv_pic_default)
> +LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
>=20
> AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
> [libc_cv_cc_pie_default=3Dyes
> @@ -1859,30 +1859,38 @@ if eval "${CC-cc} -S conftest.c =
2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
>   libc_cv_cc_pie_default=3Dno
> fi
> rm -f conftest.*])
> -libc_cv_pie_default=3D$libc_cv_cc_pie_default
> -AC_SUBST(libc_cv_cc_pie_default)
> -AC_SUBST(libc_cv_pie_default)
> +LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
> +
> +AC_MSG_CHECKING(if we can build programs as PIE)
> +if test "x$default_pie" !=3D xno; then
> +  # Disable build-pie-default if target does not support it.
> +  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
> +# error PIE is not supported
> +#endif]])], [libc_cv_pie_default=3Dyes], [libc_cv_pie_default=3Dno])
> +fi
> +AC_MSG_RESULT($libc_cv_pie_default)
> +LIBC_CONFIG_VAR([build-pie-default], [$libc_cv_pie_default])
> +
> +AC_MSG_CHECKING(if we can build static PIE programs)
> +libc_cv_static_pie=3D$libc_cv_pie_default
> +if test "x$libc_cv_pie_default" !=3D xno \
> +   -a "$libc_cv_no_dynamic_linker" =3D yes; then
> +  # Enable static-pie if available
> +  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
> +# error static PIE is not supported
> +#endif]])], [libc_cv_static_pie=3Dyes], [libc_cv_static_pie=3Dno])
> +  if test "$libc_cv_static_pie" =3D "yes"; then
> +    AC_DEFINE(ENABLE_STATIC_PIE)
> +  fi
> +fi
> +AC_MSG_RESULT($libc_cv_static_pie)
> +LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
>=20
> # 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=3D`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
> AC_SUBST(libc_cv_multidir)
>=20
> -if test "$static_pie" =3D 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" !=3D yes; then
> -    AC_MSG_ERROR([linker support for --no-dynamic-linker needed])
> -  fi
> -  # Default to PIE.
> -  libc_cv_pie_default=3Dyes
> -  AC_DEFINE(ENABLE_STATIC_PIE)
> -fi
> -LIBC_CONFIG_VAR([enable-static-pie], [$static_pie])
> -
> AC_SUBST(profile)
> AC_SUBST(static_nss)
>=20
> diff --git a/manual/install.texi b/manual/install.texi
> index fce5155c22..b1afc56f5a 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -146,15 +146,13 @@ Don't build shared libraries even if it is =
possible.  Not all systems
> support shared libraries; you need ELF support and (currently) the GNU
> linker.
>=20
> -@item --enable-static-pie
> -Enable static position independent executable (static PIE) support.
> -Static PIE is similar to static executable, but can be loaded at any
> -address without help from a dynamic linker.  All static programs as
> -well as static tests are built as static PIE, except for those marked
> -with no-pie.  The resulting glibc can be used with the GCC option,
> --static-pie, which is available with GCC 8 or above, to create static
> -PIE.  This option also implies that glibc programs and tests are =
created
> -as dynamic position independent executables (PIE) by default.
> +@item --disable-default-pie
> +Don't build glibc programs and the testsuite as position independent
> +executables (PIE).  By default, glibc programs and tests are created =
as
> +position independent executables on targets that support it.  If the =
toolchain
> +and architecture support it, static executables are built as static =
PIE and the
> +resulting glibc can be used with the GCC option, -static-pie, which =
is
> +available with GCC 8 or above, to create static PIE.
>=20
> @item --enable-cet
> @itemx --enable-cet=3Dpermissive
> diff --git a/scripts/build-many-glibcs.py =
b/scripts/build-many-glibcs.py
> index 6ae2172956..2f0f435166 100755
> --- a/scripts/build-many-glibcs.py
> +++ b/scripts/build-many-glibcs.py
> @@ -1,6 +1,7 @@
> #!/usr/bin/python3
> # Build many configurations of glibc.
> # Copyright (C) 2016-2021 Free Software Foundation, Inc.
> +# Copyright (C) The GNU Toolchain Authors.
> # This file is part of the GNU C Library.
> #
> # The GNU C Library is free software; you can redistribute it and/or
> @@ -437,15 +438,15 @@ class Context(object):
>                                                =
'--disable-experimental-malloc',
>                                                '--disable-build-nscd',
>                                                '--disable-nscd']},
> -                                      {'variant': 'static-pie',
> -                                       'cfg': =
['--enable-static-pie']},
> -                                      {'variant': 'x32-static-pie',
> +                                      {'variant': 'no-pie',
> +                                       'cfg': =
['--disable-default-pie']},
> +                                      {'variant': 'x32-no-pie',
>                                        'ccopts': '-mx32',
> -                                       'cfg': =
['--enable-static-pie']},
> -                                      {'variant': 'static-pie',
> +                                       'cfg': =
['--disable-default-pie']},
> +                                      {'variant': 'no-pie',
>                                        'arch': 'i686',
>                                        'ccopts': '-m32 -march=3Di686',
> -                                       'cfg': =
['--enable-static-pie']},
> +                                       'cfg': =
['--disable-default-pie']},
>                                       {'variant': =
'disable-multi-arch',
>                                        'arch': 'i686',
>                                        'ccopts': '-m32 -march=3Di686',
> diff --git a/sysdeps/alpha/configure b/sysdeps/alpha/configure
> index 464b596527..3d665d96f2 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
>=20
> +
> +# PIE builds fail on binutils 2.37 and earlier, see:
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=3D28672
> +$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 38e52e71ac..8f9a39ed2e 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=3D28672
> +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 19acb084fb..27464eb707 100644
> --- a/sysdeps/csky/configure
> +++ b/sysdeps/csky/configure
> @@ -2,3 +2,10 @@
>  # Local configure fragment for sysdeps/csky.
>=20
> $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=3D28672
> +$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 5656b665da..8e00824909 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.
>=20
> AC_DEFINE(PI_STATIC_AND_HIDDEN)
> +
> +# PIE builds fail on binutils 2.37 and earlier, see:
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=3D28672
> +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 2cfe6cbea1..cf5acf966d 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=3D28672
> +$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 1ec417b947..3e1c35bbd9 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=3D28672
> +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 1ef70921bc..748cb52601 100644
> --- a/sysdeps/ia64/configure
> +++ b/sysdeps/ia64/configure
> @@ -3,4 +3,9 @@
>=20
> $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
>=20
> +
> +# PIE builds fail on binutils 2.37 and earlier, see:
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=3D28672
> +$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 3bae9fc5e1..8e5fba32c3 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=3D28672
> +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 8d0702ad43..3303e5dff8 100644
> --- a/sysdeps/mach/hurd/configure
> +++ b/sysdeps/mach/hurd/configure
> @@ -49,3 +49,9 @@ fi
>=20
> # Hurd has libpthread as a separate library.
> pthread_in_libc=3Dno
> +
> +# Hurd build needs to be updated to support static pie, see:
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=3D28671
> +$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 82d085af33..022c2eff79 100644
> --- a/sysdeps/mach/hurd/configure.ac
> +++ b/sysdeps/mach/hurd/configure.ac
> @@ -29,3 +29,8 @@ fi
>=20
> # Hurd has libpthread as a separate library.
> pthread_in_libc=3Dno
> +
> +# Hurd build needs to be updated to support static pie, see:
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=3D28671
> +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 0000000000..e6652562d2
> --- /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=3D103613
> +$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 0000000000..1c58f70a7b
> --- /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=3D103613
> +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 1be9a3db2c..12c2c1b085 100644
> --- a/sysdeps/sparc/Makefile
> +++ b/sysdeps/sparc/Makefile
> @@ -2,6 +2,7 @@
> long-double-fcts =3D yes
>=20
> pie-ccflag =3D -fPIE
> +no-pie-ccflag =3D -fno-PIE
>=20
> ifeq ($(subdir),gmon)
> sysdep_routines +=3D sparc-mcount
> </cut>



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [TCWG CI] 433.milc grew in size by 7% after glibc: Replace --enable-static-pie with --disable-default-pie
       [not found] ` <8756F5EE-E78A-43B9-ADC7-12CCA64F5EF1@linaro.org>
@ 2021-12-14 11:49   ` Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2021-12-14 11:49 UTC (permalink / raw)
  To: Maxim Kuvyrkov, Siddhesh Poyarekar; +Cc: gcc-regression

Maxim,

Do you have by chance the command or the config you used to build it? 
The _dl_relocate_static_pie is used only on the *static* pie, so it
seems really strange that is being intefering with a dynamic object.

For instance, neither libc.so or libc_noshared.a changes with the
new option:

x86_64-linux-gnu$ size libc.so libc_nonshared.a 
   text    data     bss     dec     hex filename
2126387   20328   54800 2201515  2197ab libc.so
    163       0       0     163      a3 atexit.oS (ex libc_nonshared.a)
    161       0       0     161      a1 at_quick_exit.oS (ex libc_nonshared.a)
    161       0       0     161      a1 pthread_atfork.oS (ex libc_nonshared.a)
    121       0       0     121      79 stack_chk_fail_local.oS (ex libc_nonshared.a)

x86_64-linux-gnu-nopie$ size libc.so libc_nonshared.a
   text    data     bss     dec     hex filename
2126387   20328   54800 2201515  2197ab libc.so
    163       0       0     163      a3 atexit.oS (ex libc_nonshared.a)
    161       0       0     161      a1 at_quick_exit.oS (ex libc_nonshared.a)
    161       0       0     161      a1 pthread_atfork.oS (ex libc_nonshared.a)
    121       0       0     121      79 stack_chk_fail_local.oS (ex libc_nonshared.a)


On 14/12/2021 08:00, Maxim Kuvyrkov wrote:
> Hi Siddhesh,
> 
> Can you fathom any way how this patch could cause 7% increase in code size of an executable that is dynamically linked against libc?
> 
> I have checked the raw data, and this is not a fluke; 433.milc indeed grows from this single patch:
> ===
> size:
>    text	   data	    bss	    dec	    hex	filename
>   61554	   1276	  36480	  99310	  183ee	before
>   65702	   1276	  36480	 103458	  19422	after
> 
> ls -l:
> -rwxr-xr-x 1 maxim.kuvyrkov tcwg-users 83880 Dec 14 09:56 before
> -rwxr-xr-x 1 maxim.kuvyrkov tcwg-users 89568 Dec 14 09:03 after
> ===
> 
> Looking at symbols in “before” and “after” — they are all the same and the same size with one exception.  The “after” binary has this additional symbol:
> 0000000000403780 0000000000000004 T _dl_relocate_static_pie
> 
> Any ideas?
> 
> This may be a due to a latent bug in binutils uncovered by your patch.  But I have no idea where to dig.
> 
> Regards,
> 
> --
> Maxim Kuvyrkov
> https://www.linaro.org
> 
>> On 14 Dec 2021, at 13:20, ci_notify@linaro.org wrote:
>>
>> After glibc commit 23645707f12f2dd9d80b51effb2d9618a7b65565
>> Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
>>
>>    Replace --enable-static-pie with --disable-default-pie
>>
>> the following benchmarks grew in size by more than 1%:
>> - 433.milc grew in size by 7% from 61554 to 65702 bytes
>> - 450.soplex grew in size by 2% from 207236 to 211380 bytes
>>
>> Below reproducer instructions can be used to re-build both "first_bad" and "last_good" cross-toolchains used in this bisection.  Naturally, the scripts will fail when triggerring benchmarking jobs if you don't have access to Linaro TCWG CI.
>>
>> For your convenience, we have uploaded tarballs with pre-processed source and assembly files at:
>> - First_bad save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-23645707f12f2dd9d80b51effb2d9618a7b65565/save-temps/
>> - Last_good save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-556a6126f8764bc66d03368b5ac3e26631556559/save-temps/
>> - Baseline save-temps: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-baseline/save-temps/
>>
>> Configuration:
>> - Benchmark: SPEC CPU2006
>> - Toolchain: GCC + Glibc + GNU Linker
>> - Version: all components were built from their tip of trunk
>> - Target: aarch64-linux-gnu
>> - Compiler flags: -Os -flto
>> - Hardware: APM Mustang 8x X-Gene1
>>
>> This benchmarking CI is work-in-progress, and we welcome feedback and suggestions at linaro-toolchain@lists.linaro.org .  In our improvement plans is to add support for SPEC CPU2017 benchmarks and provide "perf report/annotate" data behind these reports.
>>
>> THIS IS THE END OF INTERESTING STUFF.  BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT.
>>
>> This commit has regressed these CI configurations:
>> - tcwg_bmk_gnu_apm/gnu-master-aarch64-spec2k6-Os_LTO
>>
>> First_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-23645707f12f2dd9d80b51effb2d9618a7b65565/
>> Last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-556a6126f8764bc66d03368b5ac3e26631556559/
>> Baseline build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/build-baseline/
>> Even more details: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/
>>
>> Reproduce builds:
>> <cut>
>> mkdir investigate-glibc-23645707f12f2dd9d80b51effb2d9618a7b65565
>> cd investigate-glibc-23645707f12f2dd9d80b51effb2d9618a7b65565
>>
>> # Fetch scripts
>> git clone https://git.linaro.org/toolchain/jenkins-scripts
>>
>> # Fetch manifests and test.sh script
>> mkdir -p artifacts/manifests
>> curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/manifests/build-baseline.sh --fail
>> curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/manifests/build-parameters.sh --fail
>> curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_apm-gnu-master-aarch64-spec2k6-Os_LTO/11/artifact/artifacts/test.sh --fail
>> chmod +x artifacts/test.sh
>>
>> # Reproduce the baseline build (build all pre-requisites)
>> ./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
>>
>> # Save baseline build state (which is then restored in artifacts/test.sh)
>> mkdir -p ./bisect
>> rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /glibc/ ./ ./bisect/baseline/
>>
>> cd glibc
>>
>> # Reproduce first_bad build
>> git checkout --detach 23645707f12f2dd9d80b51effb2d9618a7b65565
>> ../artifacts/test.sh
>>
>> # Reproduce last_good build
>> git checkout --detach 556a6126f8764bc66d03368b5ac3e26631556559
>> ../artifacts/test.sh
>>
>> cd ..
>> </cut>
>>
>> Full commit (up to 1000 lines):
>> <cut>
>> commit 23645707f12f2dd9d80b51effb2d9618a7b65565
>> Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
>> Date:   Wed Dec 8 11:21:26 2021 +0530
>>
>>    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>
>> ---
>> INSTALL                         | 18 ++++-----
>> Makeconfig                      | 21 +++++++----
>> NEWS                            | 13 +++++++
>> config.h.in                     |  3 ++
>> config.make.in                  |  3 --
>> configure                       | 83 ++++++++++++++++++++++++++---------------
>> configure.ac                    | 56 +++++++++++++++------------
>> manual/install.texi             | 16 ++++----
>> scripts/build-many-glibcs.py    | 13 ++++---
>> 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 +
>> 22 files changed, 205 insertions(+), 90 deletions(-)
>>
>> diff --git a/INSTALL b/INSTALL
>> index 899d7f1ed7..331d405e56 100644
>> --- a/INSTALL
>> +++ b/INSTALL
>> @@ -116,16 +116,14 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
>>      systems support shared libraries; you need ELF support and
>>      (currently) the GNU linker.
>>
>> -'--enable-static-pie'
>> -     Enable static position independent executable (static PIE) support.
>> -     Static PIE is similar to static executable, but can be loaded at
>> -     any address without help from a dynamic linker.  All static
>> -     programs as well as static tests are built as static PIE, except
>> -     for those marked with no-pie.  The resulting glibc can be used with
>> -     the GCC option, -static-pie, which is available with GCC 8 or
>> -     above, to create static PIE. This option also implies that glibc
>> -     programs and tests are created as dynamic position independent
>> -     executables (PIE) by default.
>> +'--disable-default-pie'
>> +     Don't build glibc programs and the testsuite as position
>> +     independent executables (PIE). By default, glibc programs and tests
>> +     are created as position independent executables on targets that
>> +     support it.  If the toolchain and architecture support it, static
>> +     executables are built as static PIE and the resulting glibc can be
>> +     used with the GCC option, -static-pie, which is available with GCC
>> +     8 or above, to create static PIE.
>>
>> '--enable-cet'
>> '--enable-cet=permissive'
>> diff --git a/Makeconfig b/Makeconfig
>> index 3fa2f13003..775bf12b65 100644
>> --- a/Makeconfig
>> +++ b/Makeconfig
>> @@ -1,4 +1,5 @@
>> # Copyright (C) 1991-2021 Free Software Foundation, Inc.
>> +# Copyright (C) The GNU Toolchain Authors.
>> # This file is part of the GNU C Library.
>>
>> # The GNU C Library is free software; you can redistribute it and/or
>> @@ -376,19 +377,24 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
>> LDFLAGS-rtld += $(hashstyle-LDFLAGS)
>> endif
>>
>> -ifeq (yes,$(enable-static-pie))
>> +ifeq (no,$(build-pie-default))
>> +pie-default = $(no-pie-ccflag)
>> +else # build-pie-default
>> pic-default = -DPIC
>> # Compile libc.a and libc_p.a with -fPIE/-fpie for static PIE.
>> pie-default = $(pie-ccflag)
>> +
>> +ifeq (yes,$(enable-static-pie))
>> ifeq (yes,$(have-static-pie))
>> -default-pie-ldflag = -static-pie
>> +static-pie-ldflag = -static-pie
>> else
>> # Static PIE can't have dynamic relocations in read-only segments since
>> # static PIE is mapped into memory by kernel.  --eh-frame-hdr is needed
>> # for PIE to support exception.
>> -default-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
>> -endif
>> -endif
>> +static-pie-ldflag = -Wl,-pie,--no-dynamic-linker,--eh-frame-hdr,-z,text
>> +endif # have-static-pie
>> +endif # enable-static-pie
>> +endif # build-pie-default
>>
>> # If lazy relocations are disabled, add the -z now flag.  Use
>> # LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
>> @@ -444,7 +450,7 @@ endif
>> # Command for statically linking programs with the C library.
>> ifndef +link-static
>> +link-static-before-inputs = -nostdlib -nostartfiles -static \
>> -	      $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \
>> +	      $(if $($(@F)-no-pie),$(no-pie-ldflag),$(static-pie-ldflag)) \
>> 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F))  \
>> 	      $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \
>> 	      $(+preinit) $(+prectorT)
>> @@ -479,7 +485,7 @@ ifeq (yes,$(build-pie-default))
>> +link-tests-after-inputs = $(link-libc-tests) $(+link-pie-after-libc)
>> +link-printers-tests = $(+link-pie-printers-tests)
>> else  # not build-pie-default
>> -+link-before-inputs = -nostdlib -nostartfiles \
>> ++link-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \
>> 	      $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
>> 	      $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
>> 	      $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \
>> @@ -1040,6 +1046,7 @@ PIC-ccflag = -fPIC
>> endif
>> # This can be changed by a sysdep makefile
>> pie-ccflag = -fpie
>> +no-pie-ccflag = -fno-pie
>> # This one should always stay like this unless there is a very good reason.
>> PIE-ccflag = -fPIE
>> ifeq (yes,$(build-profile))
>> diff --git a/NEWS b/NEWS
>> index bf2b6846fc..d864a7b9d8 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -86,6 +86,15 @@ Major new features:
>> * A symbolic link to the dynamic linker is now installed under
>>   /usr/bin/ld.so (or more precisely, '${bindir}/ld.so').
>>
>> +* All programs and the testsuite in glibc are now built as position independent
>> +  executables (PIE) by default on toolchains and architectures that support it.
>> +  Further, if the toolchain and architecture supports it, even static programs
>> +  are built as PIE and the resultant glibc can be used to build static PIE
>> +  executables.  A new option --disable-default-pie has been added to disable
>> +  this behavior and get a non-PIE build.  This option replaces
>> +  --enable-static-pie, which no longer has any effect on the build
>> +  configuration.
>> +
>> Deprecated and removed features, and other changes affecting compatibility:
>>
>> * The r_version update in the debugger interface makes the glibc binary
>> @@ -98,6 +107,10 @@ Deprecated and removed features, and other changes affecting compatibility:
>>
>> * Intel MPX support (lazy PLT, ld.so profile, and LD_AUDIT) has been removed.
>>
>> +* The --enable-static-pie option is no longer available.  The glibc build
>> +  configuration script now automatically detects static-pie support in the
>> +  toolchain and architecture and enables it if available.
>> +
>> Changes to build and runtime requirements:
>>
>>   [Add changes to build and runtime requirements here]
>> diff --git a/config.h.in b/config.h.in
>> index 2f5124684e..82ade1cec4 100644
>> --- a/config.h.in
>> +++ b/config.h.in
>> @@ -268,6 +268,9 @@
>> /* Build glibc with tunables support.  */
>> #define HAVE_TUNABLES 0
>>
>> +/* Define if PIE is unsupported.  */
>> +#undef PIE_UNSUPPORTED
>> +
>> /* Define if static PIE is supported.  */
>> #undef SUPPORT_STATIC_PIE
>>
>> diff --git a/config.make.in b/config.make.in
>> index cbf59114b0..e8630a8d0c 100644
>> --- a/config.make.in
>> +++ b/config.make.in
>> @@ -90,9 +90,6 @@ static-nss-crypt = @libc_cv_static_nss_crypt@
>>
>> # Configuration options.
>> build-shared = @shared@
>> -build-pic-default= @libc_cv_pic_default@
>> -build-pie-default= @libc_cv_pie_default@
>> -cc-pie-default= @libc_cv_cc_pie_default@
>> build-profile = @profile@
>> build-static-nss = @static_nss@
>> cross-compiling = @cross_compiling@
>> 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`
>> +
>>
>>
>>
>> diff --git a/configure.ac b/configure.ac
>> index a91a7f399c..277d3527d2 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -186,11 +186,11 @@ AC_ARG_ENABLE([profile],
>> 			     [build profiled library @<:@default=no@:>@]),
>> 	      [profile=$enableval],
>> 	      [profile=no])
>> -AC_ARG_ENABLE([static-pie],
>> -	      AS_HELP_STRING([--enable-static-pie],
>> -			     [enable static PIE support and use it in the testsuite @<:@default=no@:>@]),
>> -	      [static_pie=$enableval],
>> -	      [static_pie=no])
>> +AC_ARG_ENABLE([default-pie],
>> +	      AS_HELP_STRING([--disable-default-pie],
>> +			     [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
>> +	      [default_pie=$enableval],
>> +	      [default_pie=yes])
>> AC_ARG_ENABLE([timezone-tools],
>> 	      AS_HELP_STRING([--disable-timezone-tools],
>> 			     [do not install timezone tools @<:@default=install@:>@]),
>> @@ -1846,7 +1846,7 @@ if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
>>   libc_cv_pic_default=no
>> fi
>> rm -f conftest.*])
>> -AC_SUBST(libc_cv_pic_default)
>> +LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
>>
>> AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
>> [libc_cv_cc_pie_default=yes
>> @@ -1859,30 +1859,38 @@ if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
>>   libc_cv_cc_pie_default=no
>> fi
>> rm -f conftest.*])
>> -libc_cv_pie_default=$libc_cv_cc_pie_default
>> -AC_SUBST(libc_cv_cc_pie_default)
>> -AC_SUBST(libc_cv_pie_default)
>> +LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
>> +
>> +AC_MSG_CHECKING(if we can build programs as PIE)
>> +if test "x$default_pie" != xno; then
>> +  # Disable build-pie-default if target does not support it.
>> +  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
>> +# error PIE is not supported
>> +#endif]])], [libc_cv_pie_default=yes], [libc_cv_pie_default=no])
>> +fi
>> +AC_MSG_RESULT($libc_cv_pie_default)
>> +LIBC_CONFIG_VAR([build-pie-default], [$libc_cv_pie_default])
>> +
>> +AC_MSG_CHECKING(if we can build static PIE programs)
>> +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
>> +  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
>> +# error static PIE is not supported
>> +#endif]])], [libc_cv_static_pie=yes], [libc_cv_static_pie=no])
>> +  if test "$libc_cv_static_pie" = "yes"; then
>> +    AC_DEFINE(ENABLE_STATIC_PIE)
>> +  fi
>> +fi
>> +AC_MSG_RESULT($libc_cv_static_pie)
>> +LIBC_CONFIG_VAR([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`
>> 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])
>> -  fi
>> -  # Default to PIE.
>> -  libc_cv_pie_default=yes
>> -  AC_DEFINE(ENABLE_STATIC_PIE)
>> -fi
>> -LIBC_CONFIG_VAR([enable-static-pie], [$static_pie])
>> -
>> AC_SUBST(profile)
>> AC_SUBST(static_nss)
>>
>> diff --git a/manual/install.texi b/manual/install.texi
>> index fce5155c22..b1afc56f5a 100644
>> --- a/manual/install.texi
>> +++ b/manual/install.texi
>> @@ -146,15 +146,13 @@ Don't build shared libraries even if it is possible.  Not all systems
>> support shared libraries; you need ELF support and (currently) the GNU
>> linker.
>>
>> -@item --enable-static-pie
>> -Enable static position independent executable (static PIE) support.
>> -Static PIE is similar to static executable, but can be loaded at any
>> -address without help from a dynamic linker.  All static programs as
>> -well as static tests are built as static PIE, except for those marked
>> -with no-pie.  The resulting glibc can be used with the GCC option,
>> --static-pie, which is available with GCC 8 or above, to create static
>> -PIE.  This option also implies that glibc programs and tests are created
>> -as dynamic position independent executables (PIE) by default.
>> +@item --disable-default-pie
>> +Don't build glibc programs and the testsuite as position independent
>> +executables (PIE).  By default, glibc programs and tests are created as
>> +position independent executables on targets that support it.  If the toolchain
>> +and architecture support it, static executables are built as static PIE and the
>> +resulting glibc can be used with the GCC option, -static-pie, which is
>> +available with GCC 8 or above, to create static PIE.
>>
>> @item --enable-cet
>> @itemx --enable-cet=permissive
>> diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
>> index 6ae2172956..2f0f435166 100755
>> --- a/scripts/build-many-glibcs.py
>> +++ b/scripts/build-many-glibcs.py
>> @@ -1,6 +1,7 @@
>> #!/usr/bin/python3
>> # Build many configurations of glibc.
>> # Copyright (C) 2016-2021 Free Software Foundation, Inc.
>> +# Copyright (C) The GNU Toolchain Authors.
>> # This file is part of the GNU C Library.
>> #
>> # The GNU C Library is free software; you can redistribute it and/or
>> @@ -437,15 +438,15 @@ class Context(object):
>>                                                '--disable-experimental-malloc',
>>                                                '--disable-build-nscd',
>>                                                '--disable-nscd']},
>> -                                      {'variant': 'static-pie',
>> -                                       'cfg': ['--enable-static-pie']},
>> -                                      {'variant': 'x32-static-pie',
>> +                                      {'variant': 'no-pie',
>> +                                       'cfg': ['--disable-default-pie']},
>> +                                      {'variant': 'x32-no-pie',
>>                                        'ccopts': '-mx32',
>> -                                       'cfg': ['--enable-static-pie']},
>> -                                      {'variant': 'static-pie',
>> +                                       'cfg': ['--disable-default-pie']},
>> +                                      {'variant': 'no-pie',
>>                                        'arch': 'i686',
>>                                        'ccopts': '-m32 -march=i686',
>> -                                       'cfg': ['--enable-static-pie']},
>> +                                       'cfg': ['--disable-default-pie']},
>>                                       {'variant': 'disable-multi-arch',
>>                                        'arch': 'i686',
>>                                        'ccopts': '-m32 -march=i686',
>> diff --git a/sysdeps/alpha/configure b/sysdeps/alpha/configure
>> index 464b596527..3d665d96f2 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 38e52e71ac..8f9a39ed2e 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 19acb084fb..27464eb707 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 5656b665da..8e00824909 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 2cfe6cbea1..cf5acf966d 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 1ec417b947..3e1c35bbd9 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 1ef70921bc..748cb52601 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 3bae9fc5e1..8e5fba32c3 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 8d0702ad43..3303e5dff8 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 82d085af33..022c2eff79 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 0000000000..e6652562d2
>> --- /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 0000000000..1c58f70a7b
>> --- /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 1be9a3db2c..12c2c1b085 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
>> </cut>
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-14 11:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 10:20 [TCWG CI] 433.milc grew in size by 7% after glibc: Replace --enable-static-pie with --disable-default-pie ci_notify
     [not found] ` <8756F5EE-E78A-43B9-ADC7-12CCA64F5EF1@linaro.org>
2021-12-14 11:49   ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).