From: Alan Modra Date: Sun, 16 Aug 2020 13:27:51 +0000 (+0930) Subject: PowerPC64 inline PLT call tests X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0dbd452ad2f712df52a71a2e3037c48925afc612;p=binutils-gdb.git PowerPC64 inline PLT call tests * testsuite/ld-powerpc/inline.s, * testsuite/ld-powerpc/inline-1.d, * testsuite/ld-powerpc/inline-2.d, * testsuite/ld-powerpc/inline-3.d, * testsuite/ld-powerpc/inline-4.d, * testsuite/ld-powerpc/inlinepcrel.s, * testsuite/ld-powerpc/inlinepcrel-1.d, * testsuite/ld-powerpc/inlinepcrel-2.d, * testsuite/ld-powerpc/inlinepcrel-3.d: New tests. * testsuite/ld-powerpc/powerpc.exp: Run them. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 3131c687d09..973c00077b9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,16 @@ +2020-08-16 Alan Modra + + * testsuite/ld-powerpc/inline.s, + * testsuite/ld-powerpc/inline-1.d, + * testsuite/ld-powerpc/inline-2.d, + * testsuite/ld-powerpc/inline-3.d, + * testsuite/ld-powerpc/inline-4.d, + * testsuite/ld-powerpc/inlinepcrel.s, + * testsuite/ld-powerpc/inlinepcrel-1.d, + * testsuite/ld-powerpc/inlinepcrel-2.d, + * testsuite/ld-powerpc/inlinepcrel-3.d: New tests. + * testsuite/ld-powerpc/powerpc.exp: Run them. + 2020-08-16 H.J. Lu PR binutils/26389 diff --git a/ld/testsuite/ld-powerpc/inline-1.d b/ld/testsuite/ld-powerpc/inline-1.d new file mode 100644 index 00000000000..988b39043c2 --- /dev/null +++ b/ld/testsuite/ld-powerpc/inline-1.d @@ -0,0 +1,19 @@ +#source: inline.s +#as: -a64 +#ld: -melf64ppc -shared --hash-style=gnu +#objdump: -dr + +.* + +Disassembly of section \.text: + +.*: +.*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\) +.*: (60 00 00 00|00 00 00 60) nop +.*: (e9 82 80 18|18 80 82 e9) ld r12,-32744\(r2\) +.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 +.*: (4e 80 04 21|21 04 80 4e) bctrl +.*: (e8 41 00 18|18 00 41 e8) ld r2,24\(r1\) +#... +.* : +.*: (4b .. .. ..|.. .. .. 4b) b .* <__glink_PLTresolve> diff --git a/ld/testsuite/ld-powerpc/inline-2.d b/ld/testsuite/ld-powerpc/inline-2.d new file mode 100644 index 00000000000..d57174add7a --- /dev/null +++ b/ld/testsuite/ld-powerpc/inline-2.d @@ -0,0 +1,20 @@ +#source: inline.s +#as: -a64 +#ld: -melf64ppc --hash-style=gnu +#ld_after_inputfiles: tmpdir/funv2.so +#objdump: -dr + +.* + +Disassembly of section \.text: + +.*: +.*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\) +.*: (60 00 00 00|00 00 00 60) nop +.*: (e9 82 80 18|18 80 82 e9) ld r12,-32744\(r2\) +.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 +.*: (4e 80 04 21|21 04 80 4e) bctrl +.*: (e8 41 00 18|18 00 41 e8) ld r2,24\(r1\) +#... +.* : +.*: (4b .. .. ..|.. .. .. 4b) b .* <__glink_PLTresolve> diff --git a/ld/testsuite/ld-powerpc/inline-3.d b/ld/testsuite/ld-powerpc/inline-3.d new file mode 100644 index 00000000000..cb859116e63 --- /dev/null +++ b/ld/testsuite/ld-powerpc/inline-3.d @@ -0,0 +1,20 @@ +#source: inline.s +#source: funv2.s +#as: -a64 +#ld: -melf64ppc --hash-style=gnu +#objdump: -dr + +.* + +Disassembly of section \.text: + +.*: +.*: (60 00 00 00|00 00 00 60) nop +.*: (60 00 00 00|00 00 00 60) nop +.*: (60 00 00 00|00 00 00 60) nop +.*: (60 00 00 00|00 00 00 60) nop +.*: (48 .. .. ..|.. .. .. 48) bl .* +.*: (60 00 00 00|00 00 00 60) nop + +.* : +.*: (4e 80 00 20|20 00 80 4e) blr diff --git a/ld/testsuite/ld-powerpc/inline-4.d b/ld/testsuite/ld-powerpc/inline-4.d new file mode 100644 index 00000000000..5e51c0335ed --- /dev/null +++ b/ld/testsuite/ld-powerpc/inline-4.d @@ -0,0 +1,20 @@ +#source: inline.s +#as: -a64 +#ld: -melf64ppc --no-toc-opt --hash-style=gnu +#ld_after_inputfiles: tmpdir/funv2.so +#objdump: -dr + +.* + +Disassembly of section \.text: + +.*: +.*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\) +.*: (3d 82 00 00|00 00 82 3d) addis r12,r2,0 +.*: (e9 8c 80 18|18 80 8c e9) ld r12,-32744\(r12\) +.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 +.*: (4e 80 04 21|21 04 80 4e) bctrl +.*: (e8 41 00 18|18 00 41 e8) ld r2,24\(r1\) +#... +.* : +.*: (4b .. .. ..|.. .. .. 4b) b .* <__glink_PLTresolve> diff --git a/ld/testsuite/ld-powerpc/inline.s b/ld/testsuite/ld-powerpc/inline.s new file mode 100644 index 00000000000..462e702010b --- /dev/null +++ b/ld/testsuite/ld-powerpc/inline.s @@ -0,0 +1,12 @@ + .text + .globl _start +_start: + std 2,24(1) + .reloc .-4,R_PPC64_PLTSEQ,my_func + addis 12,2,my_func@plt@ha # .reloc .,R_PPC64_PLT16_HA,my_func + ld 12,my_func@plt@l(12) # .reloc .,R_PPC64_PLT16_LO_DS,my_func + mtctr 12 + .reloc .-4,R_PPC64_PLTSEQ,my_func + bctrl + .reloc .-4,R_PPC64_PLTCALL,my_func + ld 2,24(1) diff --git a/ld/testsuite/ld-powerpc/inlinepcrel-1.d b/ld/testsuite/ld-powerpc/inlinepcrel-1.d new file mode 100644 index 00000000000..7dcb3ad7aa9 --- /dev/null +++ b/ld/testsuite/ld-powerpc/inlinepcrel-1.d @@ -0,0 +1,17 @@ +#source: inlinepcrel.s +#as: -a64 -mpower10 +#ld: -melf64ppc -shared --hash-style=gnu +#objdump: -dr -Mpower10 + +.* + +Disassembly of section \.text: + +.*: +.*: (04 10 00 01|01 00 10 04) pld r12,65944 +.*: (e5 80 01 98|98 01 80 e5) +.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 +.*: (4e 80 04 21|21 04 80 4e) bctrl +#... +.* : +.*: (4b .. .. ..|.. .. .. 4b) b .* <__glink_PLTresolve> diff --git a/ld/testsuite/ld-powerpc/inlinepcrel-2.d b/ld/testsuite/ld-powerpc/inlinepcrel-2.d new file mode 100644 index 00000000000..5e901dcb257 --- /dev/null +++ b/ld/testsuite/ld-powerpc/inlinepcrel-2.d @@ -0,0 +1,18 @@ +#source: inlinepcrel.s +#as: -a64 -mpower10 +#ld: -melf64ppc --hash-style=gnu +#ld_after_inputfiles: tmpdir/funv2.so +#objdump: -dr -Mpower10 + +.* + +Disassembly of section \.text: + +.*: +.*: (04 10 00 01|01 00 10 04) pld r12,66072 +.*: (e5 80 02 18|18 02 80 e5) +.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12 +.*: (4e 80 04 21|21 04 80 4e) bctrl +#... +.* : +.*: (4b .. .. ..|.. .. .. 4b) b .* <__glink_PLTresolve> diff --git a/ld/testsuite/ld-powerpc/inlinepcrel-3.d b/ld/testsuite/ld-powerpc/inlinepcrel-3.d new file mode 100644 index 00000000000..31fc15e397d --- /dev/null +++ b/ld/testsuite/ld-powerpc/inlinepcrel-3.d @@ -0,0 +1,18 @@ +#source: inlinepcrel.s +#source: funv2.s +#as: -a64 -mpower10 +#ld: -melf64ppc --hash-style=gnu +#objdump: -dr -Mpower10 + +.* + +Disassembly of section \.text: + +.*: +.*: (07 00 00 00|00 00 00 07) pnop +.*: (00 00 00 00|00 00 00 00) +.*: (60 00 00 00|00 00 00 60) nop +.*: (48 .. .. ..|.. .. .. 48) bl .* + +.* : +.*: (4e 80 00 20|20 00 80 4e) blr diff --git a/ld/testsuite/ld-powerpc/inlinepcrel.s b/ld/testsuite/ld-powerpc/inlinepcrel.s new file mode 100644 index 00000000000..37aee8a1ecd --- /dev/null +++ b/ld/testsuite/ld-powerpc/inlinepcrel.s @@ -0,0 +1,9 @@ + .text + .globl _start +_start: + pld 12,0(0),1 + .reloc .-8,R_PPC64_PLT_PCREL34_NOTOC,my_func + mtctr 12 + .reloc .-4,R_PPC64_PLTSEQ_NOTOC,my_func + bctrl + .reloc .-4,R_PPC64_PLTCALL_NOTOC,my_func diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index 9b1ee130190..a4c060a8770 100644 --- a/ld/testsuite/ld-powerpc/powerpc.exp +++ b/ld/testsuite/ld-powerpc/powerpc.exp @@ -408,6 +408,13 @@ if [ supports_ppc64 ] then { run_dump_test "callstub-2" run_dump_test "callstub-3" run_dump_test "callstub-4" + run_dump_test "inline-1" + run_dump_test "inline-2" + run_dump_test "inline-3" + run_dump_test "inline-4" + run_dump_test "inlinepcrel-1" + run_dump_test "inlinepcrel-2" + run_dump_test "inlinepcrel-3" run_dump_test "tlsgd" run_dump_test "tlsld" run_dump_test "tlsie"