aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-05-24 08:44:10 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-05-24 08:44:23 -0700
commit6901def689b5c77465d34f07822989ec67e80c1e (patch)
tree2efde72294545c6b0129133d43d1f7335182fa61 /sysdeps
parent4c011268960c6f24650672597deed756f21ad363 (diff)
downloadglibc-6901def689b5c77465d34f07822989ec67e80c1e.tar
glibc-6901def689b5c77465d34f07822989ec67e80c1e.tar.gz
glibc-6901def689b5c77465d34f07822989ec67e80c1e.tar.bz2
glibc-6901def689b5c77465d34f07822989ec67e80c1e.zip
Avoid an extra branch to PLT for -z now
When --enable-bind-now is used to configure glibc build, we can avoid an extra branch to the PLT entry by using indirect branch via the GOT slot instead, which is similar to the first instructuon in the PLT entry. Changes in the shared library sizes in text sections: Shared library Before (bytes) After (bytes) libm.so 1060813 1060797 libmvec.so 160881 160805 libpthread.so 94992 94984 librt.so 25064 25048 * config.h.in (BIND_NOW): New. * configure.ac (BIND_NOW): New. Defined for --enable-bind-now. * configure: Regenerated. * sysdeps/x86_64/sysdep.h (JUMPTARGET)[BIND_NOW]: Defined to indirect branch via the GOT slot.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/x86_64/sysdep.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h
index fbe3560588..75ac747be8 100644
--- a/sysdeps/x86_64/sysdep.h
+++ b/sysdeps/x86_64/sysdep.h
@@ -90,9 +90,13 @@ lose: \
#undef JUMPTARGET
#ifdef PIC
-#define JUMPTARGET(name) name##@PLT
+# ifdef BIND_NOW
+# define JUMPTARGET(name) *name##@GOTPCREL(%rip)
+# else
+# define JUMPTARGET(name) name##@PLT
+# endif
#else
-#define JUMPTARGET(name) name
+# define JUMPTARGET(name) name
#endif
/* Local label name for asm code. */