public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/siddhesh/default-pie] TMP: Add unsupported PIE arches
@ 2021-12-07  4:36 Siddhesh Poyarekar
  0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2021-12-07  4:36 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3253e94f0c09bb5d85fc618b6ab7f2b7327ff09d

commit 3253e94f0c09bb5d85fc618b6ab7f2b7327ff09d
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Tue Dec 7 10:05:37 2021 +0530

    TMP: Add unsupported PIE arches
    
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

Diff:
---
 INSTALL                        |  3 ++-
 config.h.in                    |  3 +++
 configure                      | 24 +++++++++++++++++++-----
 configure.ac                   | 14 ++++++++++----
 manual/install.texi            |  3 ++-
 sysdeps/csky/configure         |  6 ++++++
 sysdeps/csky/configure.ac      |  4 ++++
 sysdeps/ia64/configure         |  4 ++++
 sysdeps/ia64/configure.ac      |  3 +++
 sysdeps/mach/hurd/configure    |  5 +++++
 sysdeps/mach/hurd/configure.ac |  4 ++++
 11 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/INSTALL b/INSTALL
index 3f89df2b81..56d2a31dad 100644
--- a/INSTALL
+++ b/INSTALL
@@ -118,7 +118,8 @@ if 'CFLAGS' is specified it must enable optimization.  For example:
      and architecture supports it, static executable 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.
+     static PIE. PIE is not enabled by default on i686 GNU/Hurd, HPPA,
+     IA64, CSKY and Microblaze targets.
 
 '--enable-cet'
 '--enable-cet=permissive'
diff --git a/config.h.in b/config.h.in
index 0a6f57b006..acce608373 100644
--- a/config.h.in
+++ b/config.h.in
@@ -265,6 +265,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/configure b/configure
index c613422722..ae5049afdb 100755
--- a/configure
+++ b/configure
@@ -596,7 +596,6 @@ DEFINES
 static_nss
 profile
 libc_cv_multidir
-libc_cv_pie_default
 shared
 static
 ldd_rewrite_script
@@ -6981,9 +6980,26 @@ $as_echo "$libc_cv_cc_pie_default" >&6; }
 config_vars="$config_vars
 cc-pie-default = $libc_cv_cc_pie_default"
 
-libc_cv_pie_default=$default_pie
+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
+config_vars="$config_vars
+build-pie-default = $libc_cv_pie_default"
 
-if test "x$default_pie" != xno -a "$libc_cv_no_dynamic_linker" = yes; then
+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.  */
@@ -7004,8 +7020,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 config_vars="$config_vars
 enable-static-pie = $libc_cv_static_pie"
-config_vars="$config_vars
-build-pie-default = $libc_cv_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.
diff --git a/configure.ac b/configure.ac
index 356b44aec7..5d59edc9fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1854,9 +1854,16 @@ fi
 rm -f conftest.*])
 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
 
-libc_cv_pie_default=$default_pie
-AC_SUBST(libc_cv_pie_default)
-if test "x$default_pie" != xno -a "$libc_cv_no_dynamic_linker" = yes; then
+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
+LIBC_CONFIG_VAR([build-pie-default], [$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
@@ -1866,7 +1873,6 @@ if test "x$default_pie" != xno -a "$libc_cv_no_dynamic_linker" = yes; then
   fi
 fi
 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
-LIBC_CONFIG_VAR([build-pie-default], [$libc_cv_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.
diff --git a/manual/install.texi b/manual/install.texi
index 5c4d6fc519..dff20fefa1 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -147,7 +147,8 @@ executables (PIE).  By default, glibc programs and tests are created as
 position independent executables.  If the toolchain and architecture supports
 it, static executable 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.
+to create static PIE.  PIE is not enabled by default on i686 GNU/Hurd, HPPA,
+IA64, CSKY and Microblaze targets.
 
 @item --enable-cet
 @itemx --enable-cet=permissive
diff --git a/sysdeps/csky/configure b/sysdeps/csky/configure
index 19acb084fb..08caa633b1 100644
--- a/sysdeps/csky/configure
+++ b/sysdeps/csky/configure
@@ -2,3 +2,9 @@
  # Local configure fragment for sysdeps/csky.
 
 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
+
+
+# PIE builds don't work.
+$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..9613c68338 100644
--- a/sysdeps/csky/configure.ac
+++ b/sysdeps/csky/configure.ac
@@ -2,3 +2,7 @@ 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 don't work.
+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..c13b11d5af 100644
--- a/sysdeps/ia64/configure
+++ b/sysdeps/ia64/configure
@@ -3,4 +3,8 @@
 
 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
 
+
+# PIE builds don't work.
+$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..8f16c49d4d 100644
--- a/sysdeps/ia64/configure.ac
+++ b/sysdeps/ia64/configure.ac
@@ -4,4 +4,7 @@ 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 don't work.
+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..1192a5261d 100644
--- a/sysdeps/mach/hurd/configure
+++ b/sysdeps/mach/hurd/configure
@@ -49,3 +49,8 @@ fi
 
 # Hurd has libpthread as a separate library.
 pthread_in_libc=no
+
+# PIE builds don't work.
+$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..115d809cec 100644
--- a/sysdeps/mach/hurd/configure.ac
+++ b/sysdeps/mach/hurd/configure.ac
@@ -29,3 +29,7 @@ fi
 
 # Hurd has libpthread as a separate library.
 pthread_in_libc=no
+
+# PIE builds don't work.
+AC_DEFINE(PIE_UNSUPPORTED)
+# work around problem with autoconf and empty lines at the end of files


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-07  4:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07  4:36 [glibc/siddhesh/default-pie] TMP: Add unsupported PIE arches Siddhesh Poyarekar

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).