aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-16 22:57:51 +0930
committerAlan Modra <amodra@gmail.com>2020-08-16 23:00:34 +0930
commit0dbd452ad2f712df52a71a2e3037c48925afc612 (patch)
tree1e996936aba053136f5a4ef2b793ca02ca292db7
parent246b9ea1983d59c8b0070746a904a6b3f8d62187 (diff)
downloadgdb-0dbd452ad2f712df52a71a2e3037c48925afc612.zip
gdb-0dbd452ad2f712df52a71a2e3037c48925afc612.tar.gz
gdb-0dbd452ad2f712df52a71a2e3037c48925afc612.tar.bz2
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.
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/testsuite/ld-powerpc/inline-1.d19
-rw-r--r--ld/testsuite/ld-powerpc/inline-2.d20
-rw-r--r--ld/testsuite/ld-powerpc/inline-3.d20
-rw-r--r--ld/testsuite/ld-powerpc/inline-4.d20
-rw-r--r--ld/testsuite/ld-powerpc/inline.s12
-rw-r--r--ld/testsuite/ld-powerpc/inlinepcrel-1.d17
-rw-r--r--ld/testsuite/ld-powerpc/inlinepcrel-2.d18
-rw-r--r--ld/testsuite/ld-powerpc/inlinepcrel-3.d18
-rw-r--r--ld/testsuite/ld-powerpc/inlinepcrel.s9
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp7
11 files changed, 173 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3131c68..973c000 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2020-08-16 Alan Modra <amodra@gmail.com>
+
+ * 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 <hongjiu.lu@intel.com>
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 0000000..988b390
--- /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\)
+#...
+.* <my_func@plt>:
+.*: (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 0000000..d57174a
--- /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\)
+#...
+.* <my_func@plt>:
+.*: (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 0000000..cb85911
--- /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 .* <my_func>
+.*: (60 00 00 00|00 00 00 60) nop
+
+.* <my_func>:
+.*: (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 0000000..5e51c03
--- /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\)
+#...
+.* <my_func@plt>:
+.*: (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 0000000..462e702
--- /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 0000000..7dcb3ad
--- /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
+#...
+.* <my_func@plt>:
+.*: (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 0000000..5e901dc
--- /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
+#...
+.* <my_func@plt>:
+.*: (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 0000000..31fc15e
--- /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 .* <my_func>
+
+.* <my_func>:
+.*: (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 0000000..37aee8a
--- /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 9b1ee13..a4c060a 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"