aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2014-12-21 09:12:04 -0800
committerH.J. Lu <hjl.tools@gmail.com>2014-12-21 09:27:11 -0800
commit050f7298e1ecc39887c329037575ccd972071255 (patch)
tree3e4caaa9640efd7e9a7020943f932c426b29ba29 /elf
parent6df5547e9349f0e22cd4356c8ef517e97530ddd0 (diff)
downloadglibc-050f7298e1ecc39887c329037575ccd972071255.zip
glibc-050f7298e1ecc39887c329037575ccd972071255.tar.gz
glibc-050f7298e1ecc39887c329037575ccd972071255.tar.bz2
Add hidden __tls_get_addr/___tls_get_addr alias
__tls_get_addr/___tls_get_addr is always defined in ld.so. There is no need to call them via PLT inside ld.so. This patch adds the hidden __tls_get_addr/___tls_get_addr aliases and calls them directly from _dl_tlsdesc_dynamic. There is no need to set up the EBX register in i386 _dl_tlsdesc_dynamic when calling the hidden ___tls_get_addr. * elf/dl-tls.c (__tls_get_addr): Provide the hidden definition if not defined. * sysdeps/i386/dl-tls.h (___tls_get_addr): Provide the hidden definition. * sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the hidden ___tls_get_addr. * sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the hidden __tls_get_addr. * sysdeps/generic/localplt.data (__tls_get_addr): Removed. * sysdeps/unix/sysv/linux/i386/localplt.data (___tls_get_addr): Likewise.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-tls.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 76b8b36..0abb024 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -809,6 +809,16 @@ update_get_addr (GET_ADDR_ARGS)
return (void *) p + GET_ADDR_OFFSET;
}
+/* For all machines that have a non-macro version of __tls_get_addr, we
+ want to use rtld_hidden_proto/rtld_hidden_def in order to call the
+ internal alias for __tls_get_addr from ld.so. This avoids a PLT entry
+ in ld.so for __tls_get_addr. */
+
+#ifndef __tls_get_addr
+extern void * __tls_get_addr (GET_ADDR_ARGS);
+rtld_hidden_proto (__tls_get_addr)
+rtld_hidden_def (__tls_get_addr)
+#endif
/* The generic dynamic and local dynamic model cannot be used in
statically linked applications. */