From a63cc5f70ca64f41f5144ac330bc7978e584eed3 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 5 Jul 2013 09:51:00 +0000 Subject: 2013-07-05 Andreas Krebbel bfd/ * elf32-s390.c: Rewrite GOT accesses using larl if possible. * elf64-s390.c: Likewise. ld/testsuite/ * ld-s390/gotreloc-1.s: New file. * ld-s390/gotreloc-1.ver: New file. * ld-s390/gotreloc_31-1.dd: New file. * ld-s390/gotreloc_64-1.dd: New file. * ld-s390/s390.exp: Run the new tests. Run 31 bit tests also on 64 bit. --- ld/testsuite/ld-s390/gotreloc-1.s | 11 +++++++++++ ld/testsuite/ld-s390/gotreloc-1.ver | 1 + ld/testsuite/ld-s390/gotreloc_31-1.dd | 14 ++++++++++++++ ld/testsuite/ld-s390/gotreloc_64-1.dd | 12 ++++++++++++ ld/testsuite/ld-s390/s390.exp | 11 +++++++++++ 5 files changed, 49 insertions(+) create mode 100644 ld/testsuite/ld-s390/gotreloc-1.s create mode 100644 ld/testsuite/ld-s390/gotreloc-1.ver create mode 100644 ld/testsuite/ld-s390/gotreloc_31-1.dd create mode 100644 ld/testsuite/ld-s390/gotreloc_64-1.dd (limited to 'ld/testsuite') diff --git a/ld/testsuite/ld-s390/gotreloc-1.s b/ld/testsuite/ld-s390/gotreloc-1.s new file mode 100644 index 0000000..b60d6c1 --- /dev/null +++ b/ld/testsuite/ld-s390/gotreloc-1.s @@ -0,0 +1,11 @@ + .text + .globl foo +foo: + lgrl %r1,bar@GOTENT + lg %r1,bar@GOT(%r12) + lrl %r1,bar@GOTENT + l %r1,bar@GOT(%r12) + ly %r1,bar@GOT(%r12) + +.globl bar +bar: .long 0x123 diff --git a/ld/testsuite/ld-s390/gotreloc-1.ver b/ld/testsuite/ld-s390/gotreloc-1.ver new file mode 100644 index 0000000..1cb06d6 --- /dev/null +++ b/ld/testsuite/ld-s390/gotreloc-1.ver @@ -0,0 +1 @@ +{ local: bar; }; diff --git a/ld/testsuite/ld-s390/gotreloc_31-1.dd b/ld/testsuite/ld-s390/gotreloc_31-1.dd new file mode 100644 index 0000000..4df4aa5 --- /dev/null +++ b/ld/testsuite/ld-s390/gotreloc_31-1.dd @@ -0,0 +1,14 @@ + +tmpdir/gotreloc_31-1: file format elf32-s390 + +Disassembly of section .text: + +.* : +.*: c4 18 00 00 .long 0xc4180000 +.*: 08 4e e3 10 .long 0x084ee310 +.*: c0 0c 00 04 .long 0xc00c0004 +.*: c0 10 00 00 00 08 [ ]*larl %r1,168 +.*: 58 10 c0 0c [ ]*l %r1,12\(%r12\) +.*: c0 10 00 00 00 03 [ ]*larl %r1,168 +.* : +.*: 00 00 01 23 .long 0x00000123 diff --git a/ld/testsuite/ld-s390/gotreloc_64-1.dd b/ld/testsuite/ld-s390/gotreloc_64-1.dd new file mode 100644 index 0000000..8c8c619 --- /dev/null +++ b/ld/testsuite/ld-s390/gotreloc_64-1.dd @@ -0,0 +1,12 @@ +tmpdir/gotreloc_64-1: file format elf64-s390 + +Disassembly of section .text: + +.* : +.*: c0 10 00 00 00 0e [ ]*larl %r1,.* +.*: c0 10 00 00 00 0b [ ]*larl %r1,.* +.*: 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\) +.* : +.*: 00 00 01 23 .long 0x00000123 diff --git a/ld/testsuite/ld-s390/s390.exp b/ld/testsuite/ld-s390/s390.exp index 34c5b33..1ac11c7 100644 --- a/ld/testsuite/ld-s390/s390.exp +++ b/ld/testsuite/ld-s390/s390.exp @@ -48,6 +48,11 @@ set s390tests { {{readelf -Ssrl tlsbin.rd} {objdump -dzrj.text tlsbin.dd} {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}} "tlsbin"} + {"GOT: symbol address load from got to larl" + "-shared -melf_s390 --version-script=gotreloc-1.ver" "" + "-m31" {gotreloc-1.s} + {{objdump -dzrj.text gotreloc_31-1.dd}} + "gotreloc_31-1"} } set s390xtests { @@ -64,6 +69,11 @@ set s390xtests { {{readelf -WSsrl tlsbin_64.rd} {objdump -dzrj.text tlsbin_64.dd} {objdump -sj.got tlsbin_64.sd} {objdump -sj.tdata tlsbin_64.td}} "tlsbin_64"} + {"GOT: symbol address load from got to larl" + "-shared -melf64_s390 --version-script=gotreloc-1.ver" "" + "-m64" {gotreloc-1.s} + {{objdump -dzrj.text gotreloc_64-1.dd}} + "gotreloc_64-1"} } if [istarget "s390-*-*"] { @@ -71,5 +81,6 @@ if [istarget "s390-*-*"] { } if [istarget "s390x-*-*"] { + run_ld_link_tests $s390tests run_ld_link_tests $s390xtests } -- cgit v1.1