This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] x86: Don't use apply_irel in static PIE


On x86, since _dl_relocate_static_pie also processes IFUNC relocations,
there is no need to call apply_irel.

Tested on i686 and x86-64.

	* csu/libc-start.c (apply_irel): Add unused attribute.
	* sysdeps/x86/libc-start.h (ARCH_SETUP_IREL): Defined as empty
	for static PIE.
---
 csu/libc-start.c         | 1 +
 sysdeps/x86/libc-start.h | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/csu/libc-start.c b/csu/libc-start.c
index 5d9c3675fa..07be05f1e9 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -66,6 +66,7 @@ uintptr_t __pointer_chk_guard_local
 # endif
 
 static void
+__attribute__ ((unused))
 apply_irel (void)
 {
 # ifdef IREL
diff --git a/sysdeps/x86/libc-start.h b/sysdeps/x86/libc-start.h
index c76b1d917f..e544867c1d 100644
--- a/sysdeps/x86/libc-start.h
+++ b/sysdeps/x86/libc-start.h
@@ -17,7 +17,12 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef SHARED
-# define ARCH_SETUP_IREL() apply_irel ()
+# if ENABLE_STATIC_PIE
+/* NB: x86 doesn't use apply_irel in static PIE.  */
+#  define ARCH_SETUP_IREL()
+# else
+#  define ARCH_SETUP_IREL() apply_irel ()
+# endif
 # define ARCH_APPLY_IREL()
 # ifndef ARCH_SETUP_TLS
 #  define ARCH_SETUP_TLS() __libc_setup_tls ()
-- 
2.20.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]