This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/plt created. glibc-2.20-403-gb04886d
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 20 Dec 2014 23:49:04 -0000
- Subject: GNU C Library master sources branch hjl/plt created. glibc-2.20-403-gb04886d
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/plt has been created
at b04886d18b736d8c3cced97b55c7898cb4b3c9c5 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b04886d18b736d8c3cced97b55c7898cb4b3c9c5
commit b04886d18b736d8c3cced97b55c7898cb4b3c9c5
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat Dec 20 12:23:54 2014 -0800
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.
diff --git a/ChangeLog b/ChangeLog
index c79f1ab..ee571f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
+ * 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.
+
+2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
+
* sysdeps/i386/dl-machine.h (_dl_start_user): Remove @PLT
from "call _dl_init@PLT".
* sysdeps/x86_64/dl-machine.h (_dl_start_user): Likewise.
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 76b8b36..cff213f 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -809,6 +809,11 @@ update_get_addr (GET_ADDR_ARGS)
return (void *) p + GET_ADDR_OFFSET;
}
+#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. */
diff --git a/sysdeps/generic/localplt.data b/sysdeps/generic/localplt.data
index d7d6734..1a40cf9 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 48809a5..99b86f9 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 e6753e9..570b180 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 009797b..b25abf8 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 92e18a5..03f5ca4 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
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4faf1904fe7b3eb864ec780647f3f21dab2c6baa
commit 4faf1904fe7b3eb864ec780647f3f21dab2c6baa
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sat Dec 20 12:15:28 2014 -0800
Remove @PLT from "call _dl_init@PLT" in _dl_start_user
_dl_start_user in ld.so calls the local function _dl_init. There is no
need to go through PLT.
* sysdeps/i386/dl-machine.h (_dl_start_user): Remove @PLT
from "call _dl_init@PLT".
* sysdeps/x86_64/dl-machine.h (_dl_start_user): Likewise.
from "call _dl_init@PLT".
diff --git a/ChangeLog b/ChangeLog
index 642f84d..c79f1ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ * sysdeps/i386/dl-machine.h (_dl_start_user): Remove @PLT
+ from "call _dl_init@PLT".
+ * sysdeps/x86_64/dl-machine.h (_dl_start_user): Likewise.
+ from "call _dl_init@PLT".
+
2014-12-20 Chris Metcalf <cmetcalf@ezchip.com>
* sysdeps/unix/sysv/linux/tile/localplt.data: New file.
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index c10b1e5..94a6d38 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -221,7 +221,7 @@ _dl_start_user:\n\
# Clear %ebp, so that even constructors have terminated backchain.\n\
xorl %ebp, %ebp\n\
# Call the function to run the initializers.\n\
- call _dl_init@PLT\n\
+ call _dl_init\n\
# Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
leal _dl_fini@GOTOFF(%ebx), %edx\n\
# Restore %esp _start expects.\n\
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 8316f13..5e1bb07 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -156,7 +156,7 @@ _dl_start_user:\n\
# Clear %rbp to mark outermost frame obviously even for constructors.\n\
xorl %ebp, %ebp\n\
# Call the function to run the initializers.\n\
- call _dl_init@PLT\n\
+ call _dl_init\n\
# Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
leaq _dl_fini(%rip), %rdx\n\
# And make sure %rsp points to argc stored on the stack.\n\
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=aca5e9b4700284b8f6f91e0510c678d5fb71d35a
commit aca5e9b4700284b8f6f91e0510c678d5fb71d35a
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Dec 19 06:30:31 2014 -0800
Compile vismain with -fPIC and link with -pie
diff --git a/elf/Makefile b/elf/Makefile
index 9e07073..ea1fdf1 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -130,7 +130,7 @@ endif
tests += $(tests-static)
ifeq (yes,$(build-shared))
tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
- constload1 order vismain noload filter unload \
+ constload1 order noload filter unload \
reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
nodlopen nodlopen2 neededtest neededtest2 \
neededtest3 neededtest4 unload2 lateglobal initfirst global \
@@ -218,6 +218,8 @@ ifeq (yesyes,$(have-fpie)$(build-shared))
modules-names += tst-piemod1
tests += tst-pie1 tst-pie2
tests-pie += tst-pie1 tst-pie2
+tests += vismain
+tests-pie += vismain
endif
modules-execstack-yes = tst-execstack-mod
extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
@@ -656,6 +658,7 @@ $(objpfx)order-cmp.out: $(objpfx)order.out
(echo "0123456789" | cmp $< -) > $@; \
$(evaluate-test)
+CFLAGS-vismain.c = $(pic-ccflag)
$(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
$(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources