about summary refs log tree commit diff
path: root/sysdeps/s390/linkmap.h
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.vnet.ibm.com>2016-07-06 15:22:35 +0200
committerStefan Liebler <stli@linux.vnet.ibm.com>2016-07-06 15:22:35 +0200
commitdd8f8da99d7a0d93f517a07e150d8abd47386d7c (patch)
tree6ef2b2ed5ea18773028cbc06939f5dad6aab070d /sysdeps/s390/linkmap.h
parentb95a6ebb931a8df8604ef3b52eea8f324bc08e92 (diff)
downloadglibc-dd8f8da99d7a0d93f517a07e150d8abd47386d7c.tar.gz
glibc-dd8f8da99d7a0d93f517a07e150d8abd47386d7c.tar.xz
glibc-dd8f8da99d7a0d93f517a07e150d8abd47386d7c.zip
S390: Use DT_JUMPREL in prelink undo code.
On s390, the current prelink undo code in elf_machine_lazy_rel()
has the requirement, that the plt stubs use the first got slots
after the 3 reserved ones.

In case of undoing prelink, the plt got slots are reset to the correct
addresses whithin the corresponding plt-stub. Therefore the address
is calculated by the address of the first plt-stub-address which
was written by prelink (see l->l_mach.plt) to got[1] and index of
current relocation multiplied with 32 (=size of one plt slot).
The index was calculated with &current-got-slot - &got[3].

This patch removes the requirement, that the plt-got-slots are
starting at got[3]. The index is now calculated with
&current-reloc - &reloc[0]. The first struct Elf64_Rela is stored
at DT_JMPREL.

This patch is needed to prepare for partial relro support.

Ulrich Weigand suggested this approach to use DT_JMPREL - Thanks.

ChangeLog:

	* sysdeps/s390/linkmap.h (struct link_map_machine):
	Remove member gotplt and add member jmprel.
	* sysdeps/s390/s390-32/dl-machine.h
	(elf_machine_runtime_setup): Setup member jmprel with DT_JMPREL
	instead of gotplt with &got[3].
	(elf_machine_lazy_rel): Calculate address with reloc and jmprel.
	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
Diffstat (limited to 'sysdeps/s390/linkmap.h')
-rw-r--r--sysdeps/s390/linkmap.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/s390/linkmap.h b/sysdeps/s390/linkmap.h
index fc1fba363a..283615b99a 100644
--- a/sysdeps/s390/linkmap.h
+++ b/sysdeps/s390/linkmap.h
@@ -2,12 +2,12 @@
 struct link_map_machine
   {
     Elf64_Addr plt; /* Address of .plt + 0x2e */
-    Elf64_Addr gotplt; /* Address of .got + 0x18 */
+    const Elf64_Rela *jmprel; /* Address of first JMP_SLOT reloc */
   };
 #else
 struct link_map_machine
   {
     Elf32_Addr plt; /* Address of .plt + 0x2c */
-    Elf32_Addr gotplt; /* Address of .got + 0x0c */
+    const Elf32_Rela *jmprel; /* Address of first JMP_SLOT reloc */
   };
 #endif