MIPS16/GAS/testsuite: Add cross-section R_MIPS16_PC16_S1 relocation tests
authorMaciej W. Rozycki <macro@mips.com>
Tue, 20 Feb 2018 20:51:37 +0000 (20:51 +0000)
committerMaciej W. Rozycki <macro@mips.com>
Tue, 20 Feb 2018 20:51:37 +0000 (20:51 +0000)
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.

gas/ChangeLog
gas/testsuite/gas/mips/mips.exp
gas/testsuite/gas/mips/mips16-branch-reloc-4.d [new file with mode: 0644]
gas/testsuite/gas/mips/mips16-branch-reloc-4.s [new file with mode: 0644]
gas/testsuite/gas/mips/mips16-branch-reloc-5.d [new file with mode: 0644]
gas/testsuite/gas/mips/mips16-branch-reloc-5.s [new file with mode: 0644]

index 3ce69953544e6e486342ddd6008225d7bcc6e2ad..07e357486110e134fa1d01a937821ce97525be65 100644 (file)
@@ -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
index d1191388b3c9f00238fff3a7108bb2cc3054a204..026c276304844d8e31326d4d2fead26d3fe29575 100644 (file)
@@ -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 (file)
index 0000000..a2705f0
--- /dev/null
@@ -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 (file)
index 0000000..ed47a2a
--- /dev/null
@@ -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 (file)
index 0000000..6cd7ebb
--- /dev/null
@@ -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 (file)
index 0000000..1cf62c4
--- /dev/null
@@ -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