binutils-gdb/ld/testsuite/ld-s390/gotreloc_64-relro-1.dd
Andreas Krebbel e6213e09ed S/390: Prevent GOT access rewrite for certain symbols
When dereferencing a GOT slot with lgrl or lg we rewrite this using
larl to get rid of the extra memory access.  However, we cannot do
this for:

- symbols marked for absolute addressing
- symbols at odd addresses (larl can handle only even addresses)

Fixed with the attached patch.

bfd/ChangeLog:

2018-09-17  Andreas Krebbel  <krebbel@linux.ibm.com>

	* elf64-s390.c (elf_s390_relocate_section): Prevent rewriting of
	GOT accesses with larl for ABS or misaligned symbols.

ld/ChangeLog:

2018-09-17  Andreas Krebbel  <krebbel@linux.ibm.com>

	* testsuite/ld-s390/gotreloc-1.s: Add tests for ABS and misaligned
	symbol. Move variables into data section. Make bar 8 bytes wide.
	* testsuite/ld-s390/gotreloc-1.ver: Make misaligned_sym resolve locally.
	* testsuite/ld-s390/gotreloc_31-1.dd: Adjust patterns.
	* testsuite/ld-s390/gotreloc_64-norelro-1.dd: Likewise.
	* testsuite/ld-s390/gotreloc_64-relro-1.dd: Likewise.
2018-09-17 11:01:24 +02:00

13 lines
480 B
Plaintext

tmpdir/gotreloc_64-1: file format elf64-s390
Disassembly of section .text:
.* <foo>:
.*: c0 10 00 00 0f 0c [ ]*larl %r1,2000 <bar>
.*: c0 10 00 00 0f 09 [ ]*larl %r1,2000 <bar>
.*: c4 1d 00 00 0f 02 [ ]*lrl %r1,1ff8 <_GLOBAL_OFFSET_TABLE_\+0x28>
.*: 58 10 c0 28 [ ]*l %r1,40\(%r12\)
.*: e3 10 c0 28 00 58 [ ]*ly %r1,40\(%r12\)
.*: c4 18 00 00 0e f6 [ ]*lgrl %r1,1ff0 <_GLOBAL_OFFSET_TABLE_\+0x20>
.*: c4 18 00 00 0e ef [ ]*lgrl %r1,1fe8 <_GLOBAL_OFFSET_TABLE_\+0x18>