aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-11-28 09:44:49 -0800
committerMike Frysinger <vapier@gentoo.org>2017-02-09 11:18:45 -0500
commit27a54a0980cb30f7d3fd930d540c8cd10e2cccd0 (patch)
treea299b3d8403fdded35a13a31fb47957287f1432b
parent20f534e0abd81149c71cef082c8c058bb9d953af (diff)
downloadglibc-27a54a0980cb30f7d3fd930d540c8cd10e2cccd0.tar
glibc-27a54a0980cb30f7d3fd930d540c8cd10e2cccd0.tar.gz
glibc-27a54a0980cb30f7d3fd930d540c8cd10e2cccd0.tar.bz2
glibc-27a54a0980cb30f7d3fd930d540c8cd10e2cccd0.zip
X86_64: Don't use PLT nor GOT in static archives [BZ #20750]
There is no need to use PLT nor GOT in static archives to branch to a function, regardless whether static archives is compiled with PIC or not. When static archives are used to create dynamic executable, PLT/GOT may be used. The resulting executable still works correctly. [BZ #20750] * sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead of PIC. (cherry picked from commit c9070e6305c08365c5f8b604bdca39c699d70cfa) (cherry picked from commit d012ea850680a2a94959f1c5136502a0f712b30a)
-rw-r--r--sysdeps/x86_64/sysdep.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h
index 75ac747be8..4b67fa80c1 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 static archives, branch to target directly. */
# define JUMPTARGET(name) name
#endif