aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-08-09 22:53:00 +0930
committerAlan Modra <amodra@gmail.com>2019-05-24 10:28:07 +0930
commit04bdff6a76b863e61ee46375dd7cdc9adfb75540 (patch)
tree2eca194aaa66a6a9b01295e073bfbb0b4a55a9e7 /ld/testsuite
parent4a421c53cf609d68fe956c2e7270d34c0ab8500f (diff)
downloadgdb-04bdff6a76b863e61ee46375dd7cdc9adfb75540.zip
gdb-04bdff6a76b863e61ee46375dd7cdc9adfb75540.tar.gz
gdb-04bdff6a76b863e61ee46375dd7cdc9adfb75540.tar.bz2
PowerPC notoc linkage stubs
Use pcrel addressing instructions in linkage stubs. bfd/ * elf64-ppc.c: Comment on powerxx _notoc stub variants. (LI_R11_0, LIS_R11, ORI_R11_R11_0, SLDI_R11_R11_34): Define. (PADDI_R12_PC, PLD_R12_PC, D34, HA34): Define. (struct ppc_link_hash_table): Add powerxx_stubs. (ppc64_elf_check_relocs): Set powerxx_stubs. (build_powerxx_offset, size_powerxx_offset), (num_relocs_for_powerxx_offset), (emit_relocs_for_powerxx_offset): New functions. (plt_stub_size): Size powerxx stubs. (ppc_build_one_stub): Emit powerxx stubs. (ppc_size_one_stub): Size powerxx stubs. Omit .eh_frame for powerxx stubs. ld/ * testsuite/ld-powerpc/notoc2.d, * testsuite/ld-powerpc/notoc2.s: New test. * testsuite/ld-powerpc/powerpc.exp: Run it.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-powerpc/notoc2.d29
-rw-r--r--ld/testsuite/ld-powerpc/notoc2.s13
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp2
3 files changed, 44 insertions, 0 deletions
diff --git a/ld/testsuite/ld-powerpc/notoc2.d b/ld/testsuite/ld-powerpc/notoc2.d
new file mode 100644
index 0000000..172835f
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/notoc2.d
@@ -0,0 +1,29 @@
+#source: notoc2.s
+#as: -a64 -mfuture
+#ld: -shared -z norelro
+#objdump: -d -Mfuture
+#target: powerpc64*-*-*
+
+.*
+
+Disassembly of section \.text:
+
+.* <.*\.plt_call\.puts>:
+.*: (04 10 00 01|01 00 10 04) pld r12,66200
+.*: (e5 80 02 98|98 02 80 e5)
+.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
+.*: (4e 80 04 20|20 04 80 4e) bctr
+#...
+.*: (04 13 ff ff|ff ff 13 04) pld r12,-1
+.*: (e5 80 ff ff|ff ff 80 e5)
+.*: (04 10 00 00|00 00 10 04) pld r12,0
+.*: (e5 80 00 00|00 00 80 e5)
+.*: (06 13 ff ff|ff ff 13 06) pla r12,-1
+.*: (39 80 ff ff|ff ff 80 39)
+.*: (06 10 00 00|00 00 10 06) pla r12,0
+.*: (39 80 00 00|00 00 80 39)
+.*: (06 10 00 00|00 00 10 06) pla r3,92
+.*: (38 60 00 5c|5c 00 60 38)
+.*: (4b ff ff 99|99 ff ff 4b) bl .* <.*\.plt_call\.puts>
+.*: (60 00 00 00|00 00 00 60) nop
+#pass
diff --git a/ld/testsuite/ld-powerpc/notoc2.s b/ld/testsuite/ld-powerpc/notoc2.s
new file mode 100644
index 0000000..3a4274c
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/notoc2.s
@@ -0,0 +1,13 @@
+ .text
+ .weak puts
+ pld 12,-1(0),1
+ pld 12,0(0),1
+ paddi 12,0,-1,1
+ paddi 12,0,0,1
+0:
+ paddi 3,0,hello-.,1
+ bl puts@notoc
+ nop
+ b 0b
+ .section .rodata
+hello: .asciz "Hello!"
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 658f319..af4d13e 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -260,6 +260,8 @@ set ppc64elftests {
{"notoc ext" "" "" "-a64" {ext.s} {} ""}
{"notoc" "-melf64ppc --no-plt-localentry -T ext.lnk" "" "-a64" {notoc.s}
{{objdump -d notoc.d} {readelf {-wf -W} notoc.wf}} "notoc"}
+ {"notoc2" "-melf64ppc -shared" "" "-a64 -mfuture" {notoc2.s}
+ {{objdump {-d -Mfuture} notoc2.d}} "notoc2"}
{"pcrelopt" "-melf64ppc --hash-style=gnu" "tmpdir/symtocbase.so"
"-a64 -mfuture" {pcrelopt.s}
{{objdump {-d -Mfuture} pcrelopt.d}