diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2014-12-21 09:12:04 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2014-12-21 09:27:11 -0800 |
commit | 050f7298e1ecc39887c329037575ccd972071255 (patch) | |
tree | 3e4caaa9640efd7e9a7020943f932c426b29ba29 /sysdeps | |
parent | 6df5547e9349f0e22cd4356c8ef517e97530ddd0 (diff) | |
download | glibc-050f7298e1ecc39887c329037575ccd972071255.tar.gz |
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 'sysdeps')
-rw-r--r-- | sysdeps/generic/localplt.data | 7 | ||||
-rw-r--r-- | sysdeps/i386/dl-tls.h | 2 | ||||
-rw-r--r-- | sysdeps/i386/dl-tlsdesc.S | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/localplt.data | 9 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-tlsdesc.S | 2 |
5 files changed, 10 insertions, 15 deletions
diff --git a/sysdeps/generic/localplt.data b/sysdeps/generic/localplt.data index d7d673454f..1a40cf9841 100644 --- a/sysdeps/generic/localplt.data +++ b/sysdeps/generic/localplt.data @@ -7,10 +7,9 @@ libc.so: malloc libc.so: memalign libc.so: realloc libm.so: matherr -# The dynamic loader needs __tls_get_addr for TLS, and uses __libc_memalign -# internally to allocate aligned TLS storage. The other malloc family of -# functions are expected to allow user symbol interposition. -ld.so: __tls_get_addr +# The dynamic loader uses __libc_memalign internally to allocate aligned +# TLS storage. The other malloc family of functions are expected to allow +# user symbol interposition. ld.so: __libc_memalign ld.so: malloc ld.so: calloc diff --git a/sysdeps/i386/dl-tls.h b/sysdeps/i386/dl-tls.h index 48809a5da1..99b86f902a 100644 --- a/sysdeps/i386/dl-tls.h +++ b/sysdeps/i386/dl-tls.h @@ -50,6 +50,8 @@ __tls_get_addr (tls_index *ti) version of this file. */ # define __tls_get_addr __attribute__ ((__regparm__ (1))) ___tls_get_addr strong_alias (___tls_get_addr, ___tls_get_addr_internal) +rtld_hidden_proto (___tls_get_addr) +rtld_hidden_def (___tls_get_addr) #else /* Users should get the better interface. */ diff --git a/sysdeps/i386/dl-tlsdesc.S b/sysdeps/i386/dl-tlsdesc.S index e6753e9e19..570b180dd0 100644 --- a/sysdeps/i386/dl-tlsdesc.S +++ b/sysdeps/i386/dl-tlsdesc.S @@ -126,10 +126,7 @@ _dl_tlsdesc_dynamic: .p2align 4,,7 .Lslow: cfi_adjust_cfa_offset (28) - movl %ebx, 16(%esp) - LOAD_PIC_REG (bx) - call ___tls_get_addr@PLT - movl 16(%esp), %ebx + call HIDDEN_JUMPTARGET (___tls_get_addr) jmp .Lret cfi_endproc .size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic diff --git a/sysdeps/unix/sysv/linux/i386/localplt.data b/sysdeps/unix/sysv/linux/i386/localplt.data index 009797bc06..b25abf8006 100644 --- a/sysdeps/unix/sysv/linux/i386/localplt.data +++ b/sysdeps/unix/sysv/linux/i386/localplt.data @@ -5,12 +5,9 @@ libc.so: malloc libc.so: memalign libc.so: realloc libm.so: matherr -# The dynamic loader needs ___tls_get_addr for TLS, and uses __libc_memalign -# internally to allocate aligned TLS storage. The other malloc family of -# functions are expected to allow user symbol interposition. -# Note that it is triple underscore for ___tls_get_addr e.g. the alternate -# ABI. -ld.so: ___tls_get_addr +# The dynamic loader uses __libc_memalign internally to allocate aligned +# TLS storage. The other malloc family of functions are expected to allow +# user symbol interposition. ld.so: __libc_memalign ld.so: malloc ld.so: calloc diff --git a/sysdeps/x86_64/dl-tlsdesc.S b/sysdeps/x86_64/dl-tlsdesc.S index 92e18a54c2..03f5ca494f 100644 --- a/sysdeps/x86_64/dl-tlsdesc.S +++ b/sysdeps/x86_64/dl-tlsdesc.S @@ -128,7 +128,7 @@ _dl_tlsdesc_dynamic: movq %r10, 40(%rsp) movq %r11, 48(%rsp) /* %rdi already points to the tlsinfo data structure. */ - call __tls_get_addr@PLT + call HIDDEN_JUMPTARGET (__tls_get_addr) movq 8(%rsp), %rdx movq 16(%rsp), %rcx movq 24(%rsp), %r8 |