public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: libc-alpha@sourceware.org
Subject: [PATCH v2 1/4] configure: Require PI_STATIC_AND_HIDDEN for static pie
Date: Fri,  8 Jan 2021 16:19:51 +0000	[thread overview]
Message-ID: <0025e4350c3001b6721552aa8d5bc64711d028b9.1610121077.git.szabolcs.nagy@arm.com> (raw)
In-Reply-To: <cover.1610121077.git.szabolcs.nagy@arm.com>

The glibc static pie self relocation code relies on that local
symbols can be accessed without dynamic relocations in position
independent code.
---
 configure    | 14 ++++++++++++++
 configure.ac |  5 +++++
 2 files changed, 19 insertions(+)

diff --git a/configure b/configure
index 6a35553805..e9d88f007c 100755
--- a/configure
+++ b/configure
@@ -6837,6 +6837,20 @@ if test "$static_pie" = yes; then
   if test "$libc_cv_no_dynamic_linker" != yes; then
     as_fn_error $? "linker support for --no-dynamic-linker needed" "$LINENO" 5
   fi
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef PI_STATIC_AND_HIDDEN
+# error static pie depends on PI_STATIC_AND_HIDDEN
+#endif
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  as_fn_error $? "the target does not support static pie" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
   # Default to PIE.
   libc_cv_pie_default=yes
   $as_echo "#define ENABLE_STATIC_PIE 1" >>confdefs.h
diff --git a/configure.ac b/configure.ac
index 43cfac9d48..aead4c44d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1846,6 +1846,11 @@ if test "$static_pie" = yes; then
   if test "$libc_cv_no_dynamic_linker" != yes; then
     AC_MSG_ERROR([linker support for --no-dynamic-linker needed])
   fi
+
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef PI_STATIC_AND_HIDDEN
+# error static pie depends on PI_STATIC_AND_HIDDEN
+#endif]])], , AC_MSG_ERROR([the target does not support static pie]))
+
   # Default to PIE.
   libc_cv_pie_default=yes
   AC_DEFINE(ENABLE_STATIC_PIE)
-- 
2.17.1


  reply	other threads:[~2021-01-08 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 16:19 [PATCH v2 0/4] fix ifunc with static pie [BZ #27072] Szabolcs Nagy
2021-01-08 16:19 ` Szabolcs Nagy [this message]
2021-01-08 16:20 ` [PATCH v2 2/4] Make libc symbols hidden in static PIE Szabolcs Nagy
2021-01-08 16:20 ` [PATCH v2 3/4] elf: Avoid RELATIVE relocs in __tunables_init Szabolcs Nagy
2021-01-08 17:59   ` Adhemerval Zanella
2021-01-08 18:22     ` Siddhesh Poyarekar
2021-01-08 18:25       ` Adhemerval Zanella
2021-01-11 10:56     ` Szabolcs Nagy
2021-01-11 12:13       ` Adhemerval Zanella
2021-01-08 16:20 ` [PATCH v2 4/4] csu: Move static pie self relocation later [BZ #27072] Szabolcs Nagy
2021-01-08 17:04 ` [PATCH v2 0/4] fix ifunc with static pie " H.J. Lu
2021-01-11 10:50   ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0025e4350c3001b6721552aa8d5bc64711d028b9.1610121077.git.szabolcs.nagy@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).