This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] PowerPC notoc call stub tests


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=60d53d7f032ad7af09760afbaf01b2ec413f198a

commit 60d53d7f032ad7af09760afbaf01b2ec413f198a
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jun 28 10:15:57 2019 +0930

    PowerPC notoc call stub tests
    
    	* testsuite/ld-powerpc/callstub-1.d,
    	* testsuite/ld-powerpc/callstub-1.s: New test.
    	* testsuite/ld-powerpc/callstub-2.d,
    	* testsuite/ld-powerpc/callstub-2.s: New test.
    	* testsuite/ld-powerpc/powerpc.exp: Run them.

Diff:
---
 ld/ChangeLog                         |  8 ++++++++
 ld/testsuite/ld-powerpc/callstub-1.d | 29 +++++++++++++++++++++++++++++
 ld/testsuite/ld-powerpc/callstub-1.s |  9 +++++++++
 ld/testsuite/ld-powerpc/callstub-2.d | 35 +++++++++++++++++++++++++++++++++++
 ld/testsuite/ld-powerpc/callstub-2.s |  8 ++++++++
 ld/testsuite/ld-powerpc/powerpc.exp  |  2 ++
 6 files changed, 91 insertions(+)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index cb9ae84..f7d7af6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2019-06-28  Alan Modra  <amodra@gmail.com>
+
+	* testsuite/ld-powerpc/callstub-1.d,
+	* testsuite/ld-powerpc/callstub-1.s: New test.
+	* testsuite/ld-powerpc/callstub-2.d,
+	* testsuite/ld-powerpc/callstub-2.s: New test.
+	* testsuite/ld-powerpc/powerpc.exp: Run them.
+
 2019-06-25  Jan Beulich  <jbeulich@suse.com>
 
 	* plugin.c (get_lto_kind, get_lto_resolution,
diff --git a/ld/testsuite/ld-powerpc/callstub-1.d b/ld/testsuite/ld-powerpc/callstub-1.d
new file mode 100644
index 0000000..a9926e5
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/callstub-1.d
@@ -0,0 +1,29 @@
+#as: -a64 -mfuture
+#ld: -shared --plt-align=0 --hash-style=gnu
+#objdump: -dr -Mfuture
+
+.*
+
+Disassembly of section \.text:
+
+.*\.plt_call\.f1>:
+.*:	(f8 41 00 18|18 00 41 f8) 	std     r2,24\(r1\)
+.*:	(60 00 00 00|00 00 00 60) 	nop
+.*:	(04 10 00 01|01 00 10 04) 	pld     r12,.*
+.*:	(e5 80 .. ..|.. .. 80 e5) 
+.*:	(7d 89 03 a6|a6 03 89 7d) 	mtctr   r12
+.*:	(4e 80 04 20|20 04 80 4e) 	bctr
+
+.*\.plt_call\.f2>:
+.*:	(04 10 00 01|01 00 10 04) 	pld     r12,.*
+.*:	(e5 80 .. ..|.. .. 80 e5) 
+.*:	(7d 89 03 a6|a6 03 89 7d) 	mtctr   r12
+.*:	(4e 80 04 20|20 04 80 4e) 	bctr
+#...
+.*:	(4b ff ff c1|c1 ff ff 4b) 	bl      .*\.plt_call\.f1>
+.*:	(e8 41 00 18|18 00 41 e8) 	ld      r2,24\(r1\)
+.*:	(4b ff ff bd|bd ff ff 4b) 	bl      .*\.plt_call\.f1\+0x4>
+.*:	(4b ff ff cd|cd ff ff 4b) 	bl      .*\.plt_call\.f2>
+.*:	(04 10 00 01|01 00 10 04) 	pld     r3,.*
+.*:	(e4 60 .. ..|.. .. 60 e4) 
+#pass
diff --git a/ld/testsuite/ld-powerpc/callstub-1.s b/ld/testsuite/ld-powerpc/callstub-1.s
new file mode 100644
index 0000000..a36eb3f
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/callstub-1.s
@@ -0,0 +1,9 @@
+#notoc call stubs, pcrel insns
+ .text
+ .abiversion 2
+_start:
+ bl f1
+ nop
+ bl f1@notoc
+ bl f2@notoc
+ pld 3,ext@got@pcrel
diff --git a/ld/testsuite/ld-powerpc/callstub-2.d b/ld/testsuite/ld-powerpc/callstub-2.d
new file mode 100644
index 0000000..a8db9bd
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/callstub-2.d
@@ -0,0 +1,35 @@
+#as: -a64
+#ld: -shared --plt-align=0 --hash-style=gnu
+#objdump: -dr
+
+.*
+
+Disassembly of section \.text:
+
+.*\.plt_call\.f1>:
+.*:	(f8 41 00 18|18 00 41 f8) 	std     r2,24\(r1\)
+.*:	(7d 88 02 a6|a6 02 88 7d) 	mflr    r12
+.*:	(42 9f 00 05|05 00 9f 42) 	bcl     .*
+.*:	(7d 68 02 a6|a6 02 68 7d) 	mflr    r11
+.*:	(7d 88 03 a6|a6 03 88 7d) 	mtlr    r12
+.*:	(3d 8b 00 01|01 00 8b 3d) 	addis   r12,r11,1
+.*:	(e9 8c .. ..|.. .. 8c e9) 	ld      r12,.*\(r12\)
+.*:	(7d 89 03 a6|a6 03 89 7d) 	mtctr   r12
+.*:	(4e 80 04 20|20 04 80 4e) 	bctr
+
+.*\.plt_call\.f2>:
+.*:	(7d 88 02 a6|a6 02 88 7d) 	mflr    r12
+.*:	(42 9f 00 05|05 00 9f 42) 	bcl     .*
+.*:	(7d 68 02 a6|a6 02 68 7d) 	mflr    r11
+.*:	(7d 88 03 a6|a6 03 88 7d) 	mtlr    r12
+.*:	(3d 8b 00 01|01 00 8b 3d) 	addis   r12,r11,1
+.*:	(e9 8c .. ..|.. .. 8c e9) 	ld      r12,.*\(r12\)
+.*:	(7d 89 03 a6|a6 03 89 7d) 	mtctr   r12
+.*:	(4e 80 04 20|20 04 80 4e) 	bctr
+
+#...
+.*:	(4b ff ff bd|bd ff ff 4b) 	bl      .*\.plt_call\.f1>
+.*:	(e8 41 00 18|18 00 41 e8) 	ld      r2,24\(r1\)
+.*:	(4b ff ff b9|b9 ff ff 4b) 	bl      .*\.plt_call\.f1\+0x4>
+.*:	(4b ff ff d5|d5 ff ff 4b) 	bl      .*\.plt_call\.f2>
+#pass
diff --git a/ld/testsuite/ld-powerpc/callstub-2.s b/ld/testsuite/ld-powerpc/callstub-2.s
new file mode 100644
index 0000000..f25ea02
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/callstub-2.s
@@ -0,0 +1,8 @@
+#notoc call stubs, no pcrel insns
+ .text
+ .abiversion 2
+_start:
+ bl f1
+ nop
+ bl f1@notoc
+ bl f2@notoc
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index af4d13e..e6c3333 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -341,6 +341,8 @@ if [ supports_ppc64 ] then {
     run_dump_test "dotsym3"
     run_dump_test "dotsym4"
     run_dump_test "pr23937"
+    run_dump_test "callstub-1"
+    run_dump_test "callstub-2"
 }
 
 run_dump_test "tlsld32"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]