about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.vnet.ibm.com>2016-09-06 14:44:15 +0200
committerStefan Liebler <stli@linux.vnet.ibm.com>2016-09-06 14:44:15 +0200
commita0d47f487fe250c63cc21e9608b85bc02dc2a006 (patch)
treec733063f3ab96b40cac1fe55cf54dda3b672eebb
parent4bf5f2224baa1590f92f7a26930928fe9f7e4b57 (diff)
downloadglibc-a0d47f487fe250c63cc21e9608b85bc02dc2a006.tar.gz
glibc-a0d47f487fe250c63cc21e9608b85bc02dc2a006.tar.xz
glibc-a0d47f487fe250c63cc21e9608b85bc02dc2a006.zip
S390: Support PLT and GOT references in check-localplt.
on s390x the test elf/check-localplt is failing after recent commits:
"elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]"
"elf: Avoid using memalign for TLS allocations [BZ #17730]"
"elf: dl-minimal malloc needs to respect fundamental alignment"
due to "Missing required PLT reference: ld.so: __libc_memalign".

After the commits __libc_memalign is only called in elf/dl-minimal.c in
malloc() function in ld.so and gcc -O2/-O3 leads to R_390_GLOB_DAT
instead of R_390_JMP_SLOT. __libc_memalign is called via
function-pointer loaded from GOT instead of calling via a plt-stub. In
this case there is the R_390_GLOB_DAT relocation in section .rela.dyn
instead of R_390_JMP_SLOT in .rela.plt.
This patch marks ld.so: __libc_memalign with R_390_GLOB_DAT in
localplt.data to allow both relocations.
If build with -fno-optimize-sibling-calls or on s390(31bit) a
R_390_JMP_SLOT is generated.

ChangeLog:

	* sysdeps/unix/sysv/linux/s390/localplt.data: Mark
	ld.so: __libc_memalign with "+ RELA R_390_GLOB_DAT".
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/unix/sysv/linux/s390/localplt.data9
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 73c9073ee2..d74100f2bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-06  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
+	* sysdeps/unix/sysv/linux/s390/localplt.data: Mark ld.so:
+	__libc_memalign with "+ RELA R_390_GLOB_DAT".
+
 2016-09-06  Florian Weimer  <fweimer@redhat.com>
 
 	Convert malloc to __libc_lock.  Automated part, using this Perl
diff --git a/sysdeps/unix/sysv/linux/s390/localplt.data b/sysdeps/unix/sysv/linux/s390/localplt.data
index b25abf8006..122641312c 100644
--- a/sysdeps/unix/sysv/linux/s390/localplt.data
+++ b/sysdeps/unix/sysv/linux/s390/localplt.data
@@ -8,7 +8,14 @@ libm.so: matherr
 # 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
+# It is also allowed to call __libc_memalign via function-pointer loaded from
+# GOT instead of calling via a plt-stub. In this case there is a R_390_GLOB_DAT
+# relocation in section .rela.dyn instead of R_390_JMP_SLOT in .rela.plt.
+# After commit "elf: Do not use memalign for TCB/TLS blocks allocation
+# [BZ #17730]" __libc_memalign is only called in elf/dl-minimal.c: malloc() in
+# ld.so and gcc -O2/-O3 leads to R_390_GLOB_DAT. If build with
+# -fno-optimize-sibling-calls an R_390_JMP_SLOT is generated.
+ld.so: __libc_memalign + RELA R_390_GLOB_DAT
 ld.so: malloc
 ld.so: calloc
 ld.so: realloc