S12Z Add tests for relocs.

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.
This commit is contained in:
John Darrington 2018-09-03 13:22:36 +02:00
parent 57d5aa265f
commit 43276309de
12 changed files with 137 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,11 @@
here:
;; ld d2, 0
.byte 0xa0
.byte 0xf8
.byte 0x00
.byte 0x00
.reloc here+1,R_S12Z_EXT18, x

View File

@ -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>:
...

View File

@ -0,0 +1,12 @@
here:
;; jmp foobar
.byte 0xba
.byte 0x00
.byte 0x00
.byte 0x00
nop
.reloc here+1,R_S12Z_EXT24, foobar

View File

@ -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.

View File

@ -0,0 +1,12 @@
here:
nop
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
nop
.reloc here+1,R_S12Z_EXT32, foobar

View File

@ -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>:
...

View File

@ -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

View File

@ -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$

View File

@ -0,0 +1,11 @@
here:
;; BLE
.byte 0x2f
.byte 0x80
.byte 0x00
nop
.reloc here+1,R_S12Z_PCREL_7_15, foo