aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-s390
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2018-09-17 11:01:24 +0200
committerAndreas Krebbel <krebbel@linux.ibm.com>2018-09-17 11:01:24 +0200
commite6213e09ed0ef6ee40d00981c38baac6964aa95b (patch)
treeca32212da5f51751ecf178dd17e5b271ed87224d /ld/testsuite/ld-s390
parentcb5248409d7a5a10748c2aa70824ecddf2f913d5 (diff)
downloadgdb-e6213e09ed0ef6ee40d00981c38baac6964aa95b.zip
gdb-e6213e09ed0ef6ee40d00981c38baac6964aa95b.tar.gz
gdb-e6213e09ed0ef6ee40d00981c38baac6964aa95b.tar.bz2
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.
Diffstat (limited to 'ld/testsuite/ld-s390')
-rw-r--r--ld/testsuite/ld-s390/gotreloc-1.s12
-rw-r--r--ld/testsuite/ld-s390/gotreloc-1.ver2
-rw-r--r--ld/testsuite/ld-s390/gotreloc_31-1.dd14
-rw-r--r--ld/testsuite/ld-s390/gotreloc_64-norelro-1.dd14
-rw-r--r--ld/testsuite/ld-s390/gotreloc_64-relro-1.dd14
5 files changed, 32 insertions, 24 deletions
diff --git a/ld/testsuite/ld-s390/gotreloc-1.s b/ld/testsuite/ld-s390/gotreloc-1.s
index b60d6c1..0e1f6f7 100644
--- a/ld/testsuite/ld-s390/gotreloc-1.s
+++ b/ld/testsuite/ld-s390/gotreloc-1.s
@@ -1,4 +1,4 @@
- .text
+.text
.globl foo
foo:
lgrl %r1,bar@GOTENT
@@ -6,6 +6,14 @@ foo:
lrl %r1,bar@GOTENT
l %r1,bar@GOT(%r12)
ly %r1,bar@GOT(%r12)
+ lgrl %r1,_GLOBAL_OFFSET_TABLE_@GOTENT
+ lgrl %r1,misaligned_sym@GOTENT
+.data
.globl bar
-bar: .long 0x123
+bar: .quad 0x123
+
+.globl misaligned_sym
+ .byte 1
+misaligned_sym:
+ .quad 42
diff --git a/ld/testsuite/ld-s390/gotreloc-1.ver b/ld/testsuite/ld-s390/gotreloc-1.ver
index 1cb06d6..0eb6096 100644
--- a/ld/testsuite/ld-s390/gotreloc-1.ver
+++ b/ld/testsuite/ld-s390/gotreloc-1.ver
@@ -1 +1 @@
-{ local: bar; };
+{ local: bar; misaligned_sym; };
diff --git a/ld/testsuite/ld-s390/gotreloc_31-1.dd b/ld/testsuite/ld-s390/gotreloc_31-1.dd
index 5e3f824..b1cf37c 100644
--- a/ld/testsuite/ld-s390/gotreloc_31-1.dd
+++ b/ld/testsuite/ld-s390/gotreloc_31-1.dd
@@ -4,10 +4,10 @@ tmpdir/gotreloc_31-1: file format elf32-s390
Disassembly of section .text:
.* <foo>:
-.*: c4 18 00 00 08 4e [ ]*lgrl %r1,118c <_GLOBAL_OFFSET_TABLE_\+0xc>
-.*: e3 10 c0 0c 00 04 [ ]*lg %r1,12\(%r12\)
-.*: c0 10 00 00 00 08 [ ]*larl %r1,10c <bar>
-.*: 58 10 c0 0c [ ]*l %r1,12\(%r12\)
-.*: c0 10 00 00 00 03 [ ]*larl %r1,10c <bar>
-.* <bar>:
-.*: 00 00 01 23 .long 0x00000123
+.*: c4 18 00 00 08 56 [ ]*lgrl %r1,11b4 <_GLOBAL_OFFSET_TABLE_\+0x14>
+.*: e3 10 c0 14 00 04 [ ]*lg %r1,20\(%r12\)
+.*: c0 10 00 00 08 52 [ ]*larl %r1,11b8 <bar>
+.*: 58 10 c0 14 [ ]*l %r1,20\(%r12\)
+.*: c0 10 00 00 08 4d [ ]*larl %r1,11b8 <bar>
+.*: c4 18 00 00 08 46 [ ]*lgrl %r1,11b0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+.*: c4 18 00 00 08 41 [ ]*lgrl %r1,11ac <_GLOBAL_OFFSET_TABLE_\+0xc>
diff --git a/ld/testsuite/ld-s390/gotreloc_64-norelro-1.dd b/ld/testsuite/ld-s390/gotreloc_64-norelro-1.dd
index 8c8c619..8debd97 100644
--- a/ld/testsuite/ld-s390/gotreloc_64-norelro-1.dd
+++ b/ld/testsuite/ld-s390/gotreloc_64-norelro-1.dd
@@ -3,10 +3,10 @@ tmpdir/gotreloc_64-1: file format elf64-s390
Disassembly of section .text:
.* <foo>:
-.*: c0 10 00 00 00 0e [ ]*larl %r1,.* <bar>
-.*: c0 10 00 00 00 0b [ ]*larl %r1,.* <bar>
-.*: c4 1d 00 00 08 86 [ ]*lrl %r1,.* <_GLOBAL_OFFSET_TABLE_\+0x18>
-.*: 58 10 c0 18 [ ]*l %r1,24\(%r12\)
-.*: e3 10 c0 18 00 58 [ ]*ly %r1,24\(%r12\)
-.* <bar>:
-.*: 00 00 01 23 .long 0x00000123
+.*: c0 10 00 00 08 9c [ ]*larl %r1,12e8 <bar>
+.*: c0 10 00 00 08 99 [ ]*larl %r1,12e8 <bar>
+.*: c4 1d 00 00 08 92 [ ]*lrl %r1,12e0 <_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 08 86 [ ]*lgrl %r1,12d8 <_GLOBAL_OFFSET_TABLE_\+0x20>
+.*: c4 18 00 00 08 7f [ ]*lgrl %r1,12d0 <_GLOBAL_OFFSET_TABLE_\+0x18>
diff --git a/ld/testsuite/ld-s390/gotreloc_64-relro-1.dd b/ld/testsuite/ld-s390/gotreloc_64-relro-1.dd
index 36f5001..64151d1 100644
--- a/ld/testsuite/ld-s390/gotreloc_64-relro-1.dd
+++ b/ld/testsuite/ld-s390/gotreloc_64-relro-1.dd
@@ -3,10 +3,10 @@ tmpdir/gotreloc_64-1: file format elf64-s390
Disassembly of section .text:
.* <foo>:
-.*: c0 10 00 00 00 0e [ ]*larl %r1,.* <bar>
-.*: c0 10 00 00 00 0b [ ]*larl %r1,.* <bar>
-.*: c4 1d 00 00 0f 1a [ ]*lrl %r1,.* <_GLOBAL_OFFSET_TABLE_\+0x18>
-.*: 58 10 c0 18 [ ]*l %r1,24\(%r12\)
-.*: e3 10 c0 18 00 58 [ ]*ly %r1,24\(%r12\)
-.* <bar>:
-.*: 00 00 01 23 .long 0x00000123
+.*: 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>