S12Z Add tests for relocs.
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 3 Sep 2018 11:22:36 +0000 (13:22 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 16 Sep 2018 15:50:09 +0000 (17:50 +0200)
ld/testsuite/ld-s12z/
    * reloc-ext18-1.d: New file.
    * reloc-ext18-1.d: New file.
    * reloc-ext18-2.d: New file.
    * reloc-ext18.d: New file.
    * reloc-ext18.s: New file.
    * reloc-ext24.d: New file.
    * reloc-ext24.s: New file.
    * reloc-ext32.d: New file.
    * reloc-ext32.s: New file.
    * reloc-opr.d: New file.
    * reloc-opr.d: New file.
    * reloc-opr.s: New file.
    * reloc-pc-rel-7-15.d: New file.
    * reloc-pc-rel-7-15.s: New file.

12 files changed:
ld/testsuite/ld-s12z/reloc-ext18-1.d [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-ext18-2.d [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-ext18.d [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-ext18.s [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-ext24.d [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-ext24.s [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-ext32.d [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-ext32.s [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-opr.d [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-opr.s [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-pc-rel-7-15.d [new file with mode: 0644]
ld/testsuite/ld-s12z/reloc-pc-rel-7-15.s [new file with mode: 0644]

diff --git a/ld/testsuite/ld-s12z/reloc-ext18-1.d b/ld/testsuite/ld-s12z/reloc-ext18-1.d
new file mode 100644 (file)
index 0000000..8bf3154
--- /dev/null
@@ -0,0 +1,11 @@
+#source: reloc-ext18.s
+#ld: --no-relax --defsym x=0x1abcd
+#objdump: -d -r
+
+tmpdir/dump:     file format elf32-s12z
+
+
+Disassembly of section .text:
+
+00fe0000 <here>:
+  fe0000:      a0 f9 ab cd     ld d2, x
diff --git a/ld/testsuite/ld-s12z/reloc-ext18-2.d b/ld/testsuite/ld-s12z/reloc-ext18-2.d
new file mode 100644 (file)
index 0000000..5995782
--- /dev/null
@@ -0,0 +1,11 @@
+#source: reloc-ext18.s
+#ld: --no-relax --defsym x=0x2abcd
+#objdump: -d -r
+
+tmpdir/dump:     file format elf32-s12z
+
+
+Disassembly of section .text:
+
+00fe0000 <here>:
+  fe0000:      a0 fc ab cd     ld d2, x
diff --git a/ld/testsuite/ld-s12z/reloc-ext18.d b/ld/testsuite/ld-s12z/reloc-ext18.d
new file mode 100644 (file)
index 0000000..c558621
--- /dev/null
@@ -0,0 +1,11 @@
+#source: reloc-ext18.s
+#ld: --no-relax --defsym x=0xabcd
+#objdump: -d -r
+
+tmpdir/dump:     file format elf32-s12z
+
+
+Disassembly of section .text:
+
+00fe0000 <here>:
+  fe0000:      a0 f8 ab cd     ld d2, x
diff --git a/ld/testsuite/ld-s12z/reloc-ext18.s b/ld/testsuite/ld-s12z/reloc-ext18.s
new file mode 100644 (file)
index 0000000..172bc8c
--- /dev/null
@@ -0,0 +1,11 @@
+
+here:
+       ;; ld d2, 0
+       .byte 0xa0
+       .byte 0xf8
+       .byte 0x00
+       .byte 0x00
+
+
+.reloc here+1,R_S12Z_EXT18, x
+
diff --git a/ld/testsuite/ld-s12z/reloc-ext24.d b/ld/testsuite/ld-s12z/reloc-ext24.d
new file mode 100644 (file)
index 0000000..2eb7e8e
--- /dev/null
@@ -0,0 +1,15 @@
+#source: reloc-ext24.s
+#ld: --no-relax --defsym foobar=0xabcdef
+#objdump: -d -r
+
+tmpdir/dump:     file format elf32-s12z
+
+
+Disassembly of section .text:
+
+00fe0000 <here>:
+  fe0000:      ba ab cd ef     jmp foobar
+  fe0004:      01              nop
+
+00fe0005 <_etext>:
+       ...
diff --git a/ld/testsuite/ld-s12z/reloc-ext24.s b/ld/testsuite/ld-s12z/reloc-ext24.s
new file mode 100644 (file)
index 0000000..539b5ac
--- /dev/null
@@ -0,0 +1,12 @@
+       
+here:
+       ;; jmp foobar
+       .byte 0xba
+       .byte 0x00
+       .byte 0x00
+       .byte 0x00
+       nop
+
+
+.reloc here+1,R_S12Z_EXT24, foobar
+
diff --git a/ld/testsuite/ld-s12z/reloc-ext32.d b/ld/testsuite/ld-s12z/reloc-ext32.d
new file mode 100644 (file)
index 0000000..ec74b88
--- /dev/null
@@ -0,0 +1,8 @@
+#source: reloc-ext32.s
+#ld: --no-relax --defsym foobar=0x12345678
+#objdump: -r -s  --section=.text
+
+tmpdir/dump:     file format elf32-s12z
+
+Contents of section .text:
+ fe0000 01123456 7801                        ..4Vx.          
diff --git a/ld/testsuite/ld-s12z/reloc-ext32.s b/ld/testsuite/ld-s12z/reloc-ext32.s
new file mode 100644 (file)
index 0000000..ce16e44
--- /dev/null
@@ -0,0 +1,12 @@
+       
+here:
+       nop
+       .byte 0x00
+       .byte 0x00
+       .byte 0x00
+       .byte 0x00
+       nop
+
+
+.reloc here+1,R_S12Z_EXT32, foobar
+
diff --git a/ld/testsuite/ld-s12z/reloc-opr.d b/ld/testsuite/ld-s12z/reloc-opr.d
new file mode 100644 (file)
index 0000000..35736c5
--- /dev/null
@@ -0,0 +1,15 @@
+#source: reloc-opr.s
+#ld: --no-relax --defsym bar=0xabcdef
+#objdump: -d -r
+
+tmpdir/dump:     file format elf32-s12z
+
+
+Disassembly of section .text:
+
+00fe0000 <_etext-0x5>:
+  fe0000:      83 fa ab cd     sub d5, bar
+  fe0004:      ef 
+
+00fe0005 <_etext>:
+       ...
diff --git a/ld/testsuite/ld-s12z/reloc-opr.s b/ld/testsuite/ld-s12z/reloc-opr.s
new file mode 100644 (file)
index 0000000..bfb153d
--- /dev/null
@@ -0,0 +1,8 @@
+
+;;;  This byte sequence corresponds to sub d5, xxx
+       .byte 0x83
+       .byte 0xfa
+       .byte 0x00
+       .byte 0x00
+       .byte 0x00
+       .reloc .-3,R_S12Z_OPR,bar
diff --git a/ld/testsuite/ld-s12z/reloc-pc-rel-7-15.d b/ld/testsuite/ld-s12z/reloc-pc-rel-7-15.d
new file mode 100644 (file)
index 0000000..f408728
--- /dev/null
@@ -0,0 +1,12 @@
+#source: reloc-pc-rel-7-15.s
+#ld: --no-relax --defsym here=0xfe0000 --defsym foo=here-9
+#objdump: -d -r
+
+tmpdir/dump:     file format elf32-s12z
+
+
+Disassembly of section .text:
+
+00fe0000 <here>:
+  fe0000:      2f ff f6        ble \*\-10
+  fe0003:      01              nop$
\ No newline at end of file
diff --git a/ld/testsuite/ld-s12z/reloc-pc-rel-7-15.s b/ld/testsuite/ld-s12z/reloc-pc-rel-7-15.s
new file mode 100644 (file)
index 0000000..9c7c622
--- /dev/null
@@ -0,0 +1,11 @@
+
+here:
+       ;; BLE
+       .byte 0x2f
+       .byte 0x80
+       .byte 0x00
+       nop
+
+
+.reloc here+1,R_S12Z_PCREL_7_15, foo
+