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] MIPS16/GAS/testsuite: Add cross-section R_MIPS16_PC16_S1 relocation tests


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

commit 1f1e0a5d0eb8474321a1a6431b4171f67a438231
Author: Maciej W. Rozycki <macro@mips.com>
Date:   Tue Feb 20 20:51:37 2018 +0000

    MIPS16/GAS/testsuite: Add cross-section R_MIPS16_PC16_S1 relocation tests
    
    Add a pair of MIPS16 branch tests to verify correct R_MIPS16_PC16_S1
    relocation generation for cross-section references in a single source.
    This complements commit c9775dde3277 ("MIPS16: Add R_MIPS16_PC16_S1
    branch relocation support").
    
    	gas/
    	* testsuite/gas/mips/mips16-branch-reloc-4.d: New test.
    	* testsuite/gas/mips/mips16-branch-reloc-5.d: New test.
    	* testsuite/gas/mips/mips16-branch-reloc-4.s: New test source.
    	* testsuite/gas/mips/mips16-branch-reloc-5.s: New test source.
    	* testsuite/gas/mips/mips.exp: Run the new tests.

Diff:
---
 gas/ChangeLog                                  |  8 +++++++
 gas/testsuite/gas/mips/mips.exp                |  2 ++
 gas/testsuite/gas/mips/mips16-branch-reloc-4.d | 24 +++++++++++++++++++
 gas/testsuite/gas/mips/mips16-branch-reloc-4.s | 32 ++++++++++++++++++++++++++
 gas/testsuite/gas/mips/mips16-branch-reloc-5.d | 24 +++++++++++++++++++
 gas/testsuite/gas/mips/mips16-branch-reloc-5.s | 32 ++++++++++++++++++++++++++
 6 files changed, 122 insertions(+)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3ce6995..07e3574 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2018-02-20  Maciej W. Rozycki  <macro@mips.com>
+
+	* testsuite/gas/mips/mips16-branch-reloc-4.d: New test.
+	* testsuite/gas/mips/mips16-branch-reloc-5.d: New test.
+	* testsuite/gas/mips/mips16-branch-reloc-4.s: New test source.
+	* testsuite/gas/mips/mips16-branch-reloc-5.s: New test source.
+	* testsuite/gas/mips/mips.exp: Run the new tests.
+
 2018-02-20  Max Filippov  <jcmvbkbc@gmail.com>
 
 	* config/tc-xtensa.c (struct litpool_frag): Add new field
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index d119138..026c276 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1750,6 +1750,8 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "mips16-branch-reloc-1"
     run_dump_test "mips16-branch-reloc-2"
     run_dump_test "mips16-branch-reloc-3"
+    run_dump_test "mips16-branch-reloc-4"
+    run_dump_test "mips16-branch-reloc-5"
     run_dump_test "mips16-branch-addend-0"
     run_dump_test "mips16-branch-addend-1"
     run_dump_test "mips16-branch-addend-2"
diff --git a/gas/testsuite/gas/mips/mips16-branch-reloc-4.d b/gas/testsuite/gas/mips/mips16-branch-reloc-4.d
new file mode 100644
index 0000000..a2705f0
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-reloc-4.d
@@ -0,0 +1,24 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS16 branch relocation 4
+#as: -32
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text\.foo:
+	\.\.\.
+[0-9a-f]+ <[^>]*> f7ff 101e 	b	00001000 <foo>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 601e 	bteqz	00001004 <foo\+0x4>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 611e 	btnez	00001008 <foo\+0x8>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 221e 	beqz	v0,0000100c <foo\+0xc>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 2a1e 	bnez	v0,00001010 <foo\+0x10>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> 6500      	nop
+	\.\.\.
+
+Disassembly of section \.text\.bar:
+[0-9a-f]+ <[^>]*> 6500      	nop
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/mips16-branch-reloc-4.s b/gas/testsuite/gas/mips/mips16-branch-reloc-4.s
new file mode 100644
index 0000000..ed47a2a
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-reloc-4.s
@@ -0,0 +1,32 @@
+	.section .text.foo, "ax", @progbits
+
+	.space	0x1000
+
+	.ent	foo
+	.set	mips16
+foo:
+	b	bar
+	bteqz	bar
+	btnez	bar
+	beqz	$2, bar
+	bnez	$2, bar
+	nop
+	.set	nomips16
+	.end	foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+	.align	4, 0
+	.space	16
+
+	.section .text.bar, "ax", @progbits
+
+	.ent	bar
+	.set	mips16
+bar:
+	nop
+	.set	nomips16
+	.end	bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+	.align	4, 0
+	.space	16
diff --git a/gas/testsuite/gas/mips/mips16-branch-reloc-5.d b/gas/testsuite/gas/mips/mips16-branch-reloc-5.d
new file mode 100644
index 0000000..6cd7ebb
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-reloc-5.d
@@ -0,0 +1,24 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS16 branch relocation 5
+#as: -32
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text\.bar:
+	\.\.\.
+[0-9a-f]+ <[^>]*> 6500      	nop
+	\.\.\.
+
+Disassembly of section \.text\.foo:
+[0-9a-f]+ <[^>]*> f7ff 101e 	b	00000000 <foo>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 601e 	bteqz	00000004 <foo\+0x4>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 611e 	btnez	00000008 <foo\+0x8>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 221e 	beqz	v0,0000000c <foo\+0xc>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> f7ff 2a1e 	bnez	v0,00000010 <foo\+0x10>
+[ 	]*[0-9a-f]+: R_MIPS16_PC16_S1	bar
+[0-9a-f]+ <[^>]*> 6500      	nop
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/mips16-branch-reloc-5.s b/gas/testsuite/gas/mips/mips16-branch-reloc-5.s
new file mode 100644
index 0000000..1cf62c4
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-branch-reloc-5.s
@@ -0,0 +1,32 @@
+	.section .text.bar, "ax", @progbits
+
+	.space	0x1000
+
+	.ent	bar
+	.set	mips16
+bar:
+	nop
+	.set	nomips16
+	.end	bar
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+	.align	4, 0
+	.space	16
+
+	.section .text.foo, "ax", @progbits
+
+	.ent	foo
+	.set	mips16
+foo:
+	b	bar
+	bteqz	bar
+	btnez	bar
+	beqz	$2, bar
+	bnez	$2, bar
+	nop
+	.set	nomips16
+	.end	foo
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+	.align	4, 0
+	.space	16


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