This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Don't use PLT nor GOT in libc.a [BZ #20750]
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Fri, 4 Nov 2016 10:47:39 -0700
- Subject: [PATCH] Don't use PLT nor GOT in libc.a [BZ #20750]
- Authentication-results: sourceware.org; auth=none
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
There is no need to use PLT nor GOT in libc.a to branch to a function,
regardless whether libc.a is compiled with PIC or not.
Tested on x86-64. OK for master?
H.J.
---
[BZ #20750]
* sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead
of PIC.
---
sysdeps/x86_64/sysdep.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h
index 75ac747..fd25c90 100644
--- a/sysdeps/x86_64/sysdep.h
+++ b/sysdeps/x86_64/sysdep.h
@@ -89,13 +89,14 @@ lose: \
END (name)
#undef JUMPTARGET
-#ifdef PIC
+#ifdef SHARED
# ifdef BIND_NOW
# define JUMPTARGET(name) *name##@GOTPCREL(%rip)
# else
# define JUMPTARGET(name) name##@PLT
# endif
#else
+/* For libc.a, we want to branch to target directly. */
# define JUMPTARGET(name) name
#endif
--
2.7.4