diff options
author | Sergey Belyashov <sergey.belyashov@gmail.com> | 2020-01-02 14:10:40 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-01-02 14:14:59 +0000 |
commit | 6655dba246bd164d953fe220a0e3d4eed85bb268 (patch) | |
tree | 423258b5dadb447dc649e71c6ce48aaeed8ba385 /ld/testsuite/ld-z80 | |
parent | 0db131fb835e4c4f6a024e86743467e7e01c965e (diff) | |
download | binutils-6655dba246bd164d953fe220a0e3d4eed85bb268.zip binutils-6655dba246bd164d953fe220a0e3d4eed85bb268.tar.gz binutils-6655dba246bd164d953fe220a0e3d4eed85bb268.tar.bz2 |
Add support for the GBZ80, Z180, and eZ80 variants of the Z80 architecure. Add an ELF based target for these as well.
PR 25224
bfd * Makefile.am: Add z80-elf target support.
* configure.ac: Likewise.
* targets.c: Likewise.
* config.bfd: Add z80-elf target support and new arches: ez80 and z180.
* elf32-z80.c: New file.
* archures.c: Add new z80 architectures: eZ80 and Z180.
* coffcode.h: Likewise.
* cpu-z80.c: Likewise.
* bfd-in2.h: Likewise plus additional Z80 relocations.
* coff-z80.c: Add new relocations for Z80 target and local label check.
gas * config/tc-z80.c: Add new architectures: Z180 and eZ80. Add support
for assembler code generated by SDCC. Add new relocation types. Add
z80-elf target support.
* config/tc-z80.h: Add z80-elf target support. Enable dollar local
labels. Local labels starts from ".L".
* testsuite/gas/all/fwdexp.d: Fix failure due to symbol conflict.
* testsuite/gas/all/fwdexp.s: Likewise.
* testsuite/gas/z80/suffix.d: Fix failure on ELF target.
* testsuite/gas/z80/z80.exp: Add new tests
* testsuite/gas/z80/dollar.d: New file.
* testsuite/gas/z80/dollar.s: New file.
* testsuite/gas/z80/ez80_adl_all.d: New file.
* testsuite/gas/z80/ez80_adl_all.s: New file.
* testsuite/gas/z80/ez80_adl_suf.d: New file.
* testsuite/gas/z80/ez80_isuf.s: New file.
* testsuite/gas/z80/ez80_z80_all.d: New file.
* testsuite/gas/z80/ez80_z80_all.s: New file.
* testsuite/gas/z80/ez80_z80_suf.d: New file.
* testsuite/gas/z80/r800_extra.d: New file.
* testsuite/gas/z80/r800_extra.s: New file.
* testsuite/gas/z80/r800_ii8.d: New file.
* testsuite/gas/z80/r800_z80_doc.d: New file.
* testsuite/gas/z80/z180.d: New file.
* testsuite/gas/z80/z180.s: New file.
* testsuite/gas/z80/z180_z80_doc.d: New file.
* testsuite/gas/z80/z80_doc.d: New file.
* testsuite/gas/z80/z80_doc.s: New file.
* testsuite/gas/z80/z80_ii8.d: New file.
* testsuite/gas/z80/z80_ii8.s: New file.
* testsuite/gas/z80/z80_in_f_c.d: New file.
* testsuite/gas/z80/z80_in_f_c.s: New file.
* testsuite/gas/z80/z80_op_ii_ld.d: New file.
* testsuite/gas/z80/z80_op_ii_ld.s: New file.
* testsuite/gas/z80/z80_out_c_0.d: New file.
* testsuite/gas/z80/z80_out_c_0.s: New file.
* testsuite/gas/z80/z80_reloc.d: New file.
* testsuite/gas/z80/z80_reloc.s: New file.
* testsuite/gas/z80/z80_sli.d: New file.
* testsuite/gas/z80/z80_sli.s: New file.
ld * Makefile.am: Add new target z80-elf
* configure.tgt: Likewise.
* emultempl/z80.em: Add support for eZ80 and Z180 architectures.
* emulparams/elf32z80.sh: New file.
* emultempl/z80elf.em: Likewise.
* testsuite/ld-z80/arch_ez80_adl.d: Likewise.
* testsuite/ld-z80/arch_ez80_z80.d: Likewise.
* testsuite/ld-z80/arch_r800.d: Likewise.
* testsuite/ld-z80/arch_z180.d: Likewise.
* testsuite/ld-z80/arch_z80.d: Likewise.
* testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise.
* testsuite/ld-z80/comb_arch_z180.d: Likewise.
* testsuite/ld-z80/labels.s: Likewise.
* testsuite/ld-z80/relocs.s: Likewise.
* testsuite/ld-z80/relocs_b_ez80.d: Likewise.
* testsuite/ld-z80/relocs_b_z80.d: Likewise.
* testsuite/ld-z80/relocs_f_z80.d: Likewise.
* testsuite/ld-z80/z80.exp: Likewise.
opcodes * z80-dis.c: Add support for eZ80 and Z80 instructions.
Diffstat (limited to 'ld/testsuite/ld-z80')
-rw-r--r-- | ld/testsuite/ld-z80/arch_default.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/arch_ez80_adl.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/arch_ez80_z80.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/arch_r800.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/arch_z180.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/arch_z80.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/comb_arch_ez80_z80.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/comb_arch_z180_z80.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/comb_arch_z80_ez80.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/comb_arch_z80_z180.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/dummy1.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/dummy2.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/jr.s | 58 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/jr_b.d | 51 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/jr_f.d | 70 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/labels.s | 43 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/relocs.s | 81 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/relocs_b_ez80.d | 60 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/relocs_b_z80.d | 60 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/relocs_f_ez80.d | 78 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/relocs_f_z80.d | 79 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/z80.exp | 33 |
22 files changed, 734 insertions, 0 deletions
diff --git a/ld/testsuite/ld-z80/arch_default.d b/ld/testsuite/ld-z80/arch_default.d new file mode 100644 index 0000000..8c8527b --- /dev/null +++ b/ld/testsuite/ld-z80/arch_default.d @@ -0,0 +1,11 @@ +#name: default arch test +#source: dummy1.s +#source: dummy2.s +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: z80, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/arch_ez80_adl.d b/ld/testsuite/ld-z80/arch_ez80_adl.d new file mode 100644 index 0000000..aa9bd443 --- /dev/null +++ b/ld/testsuite/ld-z80/arch_ez80_adl.d @@ -0,0 +1,11 @@ +#name: eZ80 ADL mode arch test +#source: dummy1.s -ez80-adl +#source: dummy2.s -ez80-adl +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: ez80-adl, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/arch_ez80_z80.d b/ld/testsuite/ld-z80/arch_ez80_z80.d new file mode 100644 index 0000000..72c03e8 --- /dev/null +++ b/ld/testsuite/ld-z80/arch_ez80_z80.d @@ -0,0 +1,11 @@ +#name: eZ80 Z80 mode arch test +#source: dummy1.s -ez80 +#source: dummy2.s -ez80 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: ez80-z80, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/arch_r800.d b/ld/testsuite/ld-z80/arch_r800.d new file mode 100644 index 0000000..c079be1 --- /dev/null +++ b/ld/testsuite/ld-z80/arch_r800.d @@ -0,0 +1,11 @@ +#name: R800 arch test +#source: dummy1.s -r800 +#source: dummy2.s -r800 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: r800, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/arch_z180.d b/ld/testsuite/ld-z80/arch_z180.d new file mode 100644 index 0000000..d63ce23 --- /dev/null +++ b/ld/testsuite/ld-z80/arch_z180.d @@ -0,0 +1,11 @@ +#name: Z180 arch test +#source: dummy1.s -z180 +#source: dummy2.s -z180 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: z180, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/arch_z80.d b/ld/testsuite/ld-z80/arch_z80.d new file mode 100644 index 0000000..a92b13b --- /dev/null +++ b/ld/testsuite/ld-z80/arch_z80.d @@ -0,0 +1,11 @@ +#name: Z80 arch test +#source: dummy1.s -z80 +#source: dummy2.s -z80 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: z80, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/comb_arch_ez80_z80.d b/ld/testsuite/ld-z80/comb_arch_ez80_z80.d new file mode 100644 index 0000000..318a055 --- /dev/null +++ b/ld/testsuite/ld-z80/comb_arch_ez80_z80.d @@ -0,0 +1,11 @@ +#name: eZ80/Z80 arch combination test +#source: dummy1.s -ez80 +#source: dummy2.s -z80 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: ez80-z80, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/comb_arch_z180_z80.d b/ld/testsuite/ld-z80/comb_arch_z180_z80.d new file mode 100644 index 0000000..f7a420c --- /dev/null +++ b/ld/testsuite/ld-z80/comb_arch_z180_z80.d @@ -0,0 +1,11 @@ +#name: Z180/Z80 arch combination test +#source: dummy1.s -z180 +#source: dummy2.s -z80 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: z180, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/comb_arch_z80_ez80.d b/ld/testsuite/ld-z80/comb_arch_z80_ez80.d new file mode 100644 index 0000000..18f9f0b --- /dev/null +++ b/ld/testsuite/ld-z80/comb_arch_z80_ez80.d @@ -0,0 +1,11 @@ +#name: Z80/eZ80 arch combination test +#source: dummy1.s -z80 +#source: dummy2.s -ez80 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: ez80-z80, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/comb_arch_z80_z180.d b/ld/testsuite/ld-z80/comb_arch_z80_z180.d new file mode 100644 index 0000000..1f3e092 --- /dev/null +++ b/ld/testsuite/ld-z80/comb_arch_z80_z180.d @@ -0,0 +1,11 @@ +#name: Z80/Z180 arch combination test +#source: dummy1.s -z80 +#source: dummy2.s -z180 +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff)|(elf32)\-z80 +architecture: z180, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/dummy1.s b/ld/testsuite/ld-z80/dummy1.s new file mode 100644 index 0000000..5e27477 --- /dev/null +++ b/ld/testsuite/ld-z80/dummy1.s @@ -0,0 +1,6 @@ + .text +_start: + ld a,a + .data + .db 0 + .end diff --git a/ld/testsuite/ld-z80/dummy2.s b/ld/testsuite/ld-z80/dummy2.s new file mode 100644 index 0000000..43ca80c --- /dev/null +++ b/ld/testsuite/ld-z80/dummy2.s @@ -0,0 +1,5 @@ + .text + ld a,a + .data + .db 0 + .end diff --git a/ld/testsuite/ld-z80/jr.s b/ld/testsuite/ld-z80/jr.s new file mode 100644 index 0000000..aaf978a --- /dev/null +++ b/ld/testsuite/ld-z80/jr.s @@ -0,0 +1,58 @@ + .text +; .org 0 + + .globl label1 + .globl label2 + .globl label3 + .globl label4 + .globl label5 + .globl label6 + + djnz label1 + + jr label2 + jr nz,label3 + jr z,label4 + jr nc,label5 + jr c,label6 + + djnz . + jr . + jr nz,. + jr z,. + jr nc,. + jr c,. + +.Ll1: + djnz .Ll1 +.Ll2: + jr .Ll2 +.Ll3: + jr nz,.Ll3 +.Ll4: + jr z,.Ll4 +.Ll5: + jr nc,.Ll5 +.Ll6: + jr c,.Ll6 + + djnz .Lf1 + jr .Lf2 + jr nz,.Lf3 + jr z,.Lf4 + jr nc,.Lf5 + jr c,.Lf6 + +.Lf1: + ret +.Lf2: + ret +.Lf3: + ret +.Lf4: + ret +.Lf5: + ret +.Lf6: + ret + .end diff --git a/ld/testsuite/ld-z80/jr_b.d b/ld/testsuite/ld-z80/jr_b.d new file mode 100644 index 0000000..9349d4f --- /dev/null +++ b/ld/testsuite/ld-z80/jr_b.d @@ -0,0 +1,51 @@ +#name: Z80 backward PC relative relocations +#source: labels.s -z80 +#source: jr.s -z80 +#ld: -e 0 -Ttext 0 -Tdata 0x100 -s +#objdump: -d + +.*:[ ]+file format (coff)|(elf32)\-z80 + + +.* \.text: + +00000000 <.*>: +[ ]+0:[ ]+78[ ]+ld a,b +[ ]+1:[ ]+79[ ]+ld a,c +[ ]+2:[ ]+7a[ ]+ld a,d +[ ]+3:[ ]+7b[ ]+ld a,e +[ ]+4:[ ]+7c[ ]+ld a,h +[ ]+5:[ ]+7d[ ]+ld a,l +[ ]+6:[ ]+7e[ ]+ld a,\(hl\) +[ ]+7:[ ]+7f[ ]+ld a,a +[ ]+8:[ ]+2f[ ]+cpl +[ ]+9:[ ]+10 f5[ ]+djnz 0x0000 +[ ]+b:[ ]+18 f4[ ]+jr 0x0001 +[ ]+d:[ ]+20 f3[ ]+jr nz,0x0002 +[ ]+f:[ ]+28 f2[ ]+jr z,0x0003 +[ ]+11:[ ]+30 f1[ ]+jr nc,0x0004 +[ ]+13:[ ]+38 f0[ ]+jr c,0x0005 +[ ]+15:[ ]+10 fe[ ]+djnz 0x0015 +[ ]+17:[ ]+18 fe[ ]+jr 0x0017 +[ ]+19:[ ]+20 fe[ ]+jr nz,0x0019 +[ ]+1b:[ ]+28 fe[ ]+jr z,0x001b +[ ]+1d:[ ]+30 fe[ ]+jr nc,0x001d +[ ]+1f:[ ]+38 fe[ ]+jr c,0x001f +[ ]+21:[ ]+10 fe[ ]+djnz 0x0021 +[ ]+23:[ ]+18 fe[ ]+jr 0x0023 +[ ]+25:[ ]+20 fe[ ]+jr nz,0x0025 +[ ]+27:[ ]+28 fe[ ]+jr z,0x0027 +[ ]+29:[ ]+30 fe[ ]+jr nc,0x0029 +[ ]+2b:[ ]+38 fe[ ]+jr c,0x002b +[ ]+2d:[ ]+10 0a[ ]+djnz 0x0039 +[ ]+2f:[ ]+18 09[ ]+jr 0x003a +[ ]+31:[ ]+20 08[ ]+jr nz,0x003b +[ ]+33:[ ]+28 07[ ]+jr z,0x003c +[ ]+35:[ ]+30 06[ ]+jr nc,0x003d +[ ]+37:[ ]+38 05[ ]+jr c,0x003e +[ ]+39:[ ]+c9[ ]+ret +[ ]+3a:[ ]+c9[ ]+ret +[ ]+3b:[ ]+c9[ ]+ret +[ ]+3c:[ ]+c9[ ]+ret +[ ]+3d:[ ]+c9[ ]+ret +[ ]+3e:[ ]+c9[ ]+ret diff --git a/ld/testsuite/ld-z80/jr_f.d b/ld/testsuite/ld-z80/jr_f.d new file mode 100644 index 0000000..5a107c3 --- /dev/null +++ b/ld/testsuite/ld-z80/jr_f.d @@ -0,0 +1,70 @@ +#name: Z80 forward PC relative relocations +#source: jr.s -z80 +#source: labels.s -z80 +#ld: -e 0 -Ttext 0 -Tdata 0x100 +#objdump: -d + + +.*:[ ]+file format (coff)|(elf32)\-z80 + + +.* \.text: + +00000000 <.*>: +[ ]+0:[ ]+10 34[ ]+djnz 0x0036 +[ ]+2:[ ]+18 33[ ]+jr 0x0037 +[ ]+4:[ ]+20 32[ ]+jr nz,0x0038 +[ ]+6:[ ]+28 31[ ]+jr z,0x0039 +[ ]+8:[ ]+30 30[ ]+jr nc,0x003a +[ ]+a:[ ]+38 2f[ ]+jr c,0x003b +[ ]+c:[ ]+10 fe[ ]+djnz 0x000c +[ ]+e:[ ]+18 fe[ ]+jr 0x000e +[ ]+10:[ ]+20 fe[ ]+jr nz,0x0010 +[ ]+12:[ ]+28 fe[ ]+jr z,0x0012 +[ ]+14:[ ]+30 fe[ ]+jr nc,0x0014 +[ ]+16:[ ]+38 fe[ ]+jr c,0x0016 +[ ]+18:[ ]+10 fe[ ]+djnz 0x0018 +[ ]+1a:[ ]+18 fe[ ]+jr 0x001a +[ ]+1c:[ ]+20 fe[ ]+jr nz,0x001c +[ ]+1e:[ ]+28 fe[ ]+jr z,0x001e +[ ]+20:[ ]+30 fe[ ]+jr nc,0x0020 +[ ]+22:[ ]+38 fe[ ]+jr c,0x0022 +[ ]+24:[ ]+10 0a[ ]+djnz 0x0030 +[ ]+26:[ ]+18 09[ ]+jr 0x0031 +[ ]+28:[ ]+20 08[ ]+jr nz,0x0032 +[ ]+2a:[ ]+28 07[ ]+jr z,0x0033 +[ ]+2c:[ ]+30 06[ ]+jr nc,0x0034 +[ ]+2e:[ ]+38 05[ ]+jr c,0x0035 +[ ]+30:[ ]+c9[ ]+ret +[ ]+31:[ ]+c9[ ]+ret +[ ]+32:[ ]+c9[ ]+ret +[ ]+33:[ ]+c9[ ]+ret +[ ]+34:[ ]+c9[ ]+ret +[ ]+35:[ ]+c9[ ]+ret + +00000036 <label1>: +[ ]+36:[ ]+78[ ]+ld a,b + +00000037 <label2>: +[ ]+37:[ ]+79[ ]+ld a,c + +00000038 <label3>: +[ ]+38:[ ]+7a[ ]+ld a,d + +00000039 <label4>: +[ ]+39:[ ]+7b[ ]+ld a,e + +0000003a <label5>: +[ ]+3a:[ ]+7c[ ]+ld a,h + +0000003b <label6>: +[ ]+3b:[ ]+7d[ ]+ld a,l + +0000003c <label7>: +[ ]+3c:[ ]+7e[ ]+ld a,\(hl\) + +0000003d <label8>: +[ ]+3d:[ ]+7f[ ]+ld a,a + +0000003e <label9>: +[ ]+3e:[ ]+2f[ ]+cpl diff --git a/ld/testsuite/ld-z80/labels.s b/ld/testsuite/ld-z80/labels.s new file mode 100644 index 0000000..a957fef --- /dev/null +++ b/ld/testsuite/ld-z80/labels.s @@ -0,0 +1,43 @@ + .text + .globl label1 + .globl label2 + .globl label3 + .globl label4 + .globl label5 + .globl label6 + .globl label7 + .globl label8 + .globl label9 + .globl value8 + .globl value16 + .globl value24 + .globl value32 + .globl field_0 + .globl field_1 +_start: +label1: + ld a,b +label2: + ld a,c +label3: + ld a,d +label4: + ld a,e +label5: + ld a,h +label6: + ld a,l +label7: + ld a,(hl) +label8: + ld a,a +label9: + cpl + +value8 .equ 0x12 +value16 .equ 0x1234 +value24 .equ 0x123456 +value32 .equ 0x12345678 + +field_0 .equ 3 +field_1 .equ field_0 + 1 diff --git a/ld/testsuite/ld-z80/relocs.s b/ld/testsuite/ld-z80/relocs.s new file mode 100644 index 0000000..131a702 --- /dev/null +++ b/ld/testsuite/ld-z80/relocs.s @@ -0,0 +1,81 @@ + .text +; .org 0 + + .globl label1 + .globl label2 + .globl label3 + .globl label4 + .globl label5 + .globl label6 + .globl label7 + .globl label8 + .globl label9 + + .globl value8 + .globl value16 + .globl value24 + .globl value32 + + .globl field_0 + .globl field_1 + + call label1 + call nz,label2 + call z,label3 + call nc,label4 + call c,label5 + call po,label6 + call pe,label7 + call p,label8 + call m,label9 + + jp label1 + jp nz,label2 + jp z,label3 + jp nc,label4 + jp c,label5 + jp po,label6 + jp pe,label7 + jp p,label8 + jp m,label9 + + ld l,(ix+5) + ld a,(ix+field_0) + ld c,(ix+field_1-10) + ld b,(ix+field_1-11) + +field_0_1 .equ field_0+90 + + ld (iy-5),l + ld (iy+field_0),a + ld (iy+field_1+10),c + ld (iy+field_1+11),b + ld h,(iy+field_0_1) + + .ifdef ADLMODE + ld.is de,value32 >> 16 + ld.is hl,value32 & 0xffff + ld.is de,(value32 + 0x12345678) >> 16 + ld.is hl,(value32 + 0x12345678) & 0xffff + .else + ld de,value32 >> 16 + ld hl,value32 & 0xffff + ld de,(value32 + 0x12345678) >> 16 + ld hl,(value32 + 0x12345678) & 0xffff + .endif + + ld d,value32 >> 24 + ld e,value32 >> 16 + ld h,value32 >> 8 + ld l,value32 >> 0 + + ld d,(value32 + 0x12345678) >> 24 + ld e,(value32 + 0x12345678) >> 16 + ld h,(value32 + 0x12345678) >> 8 + ld l,(value32 + 0x12345678) >> 0 + + .data + .db value8 + .dw value16 + .d24 value24 + .d32 value32 diff --git a/ld/testsuite/ld-z80/relocs_b_ez80.d b/ld/testsuite/ld-z80/relocs_b_ez80.d new file mode 100644 index 0000000..a421ce8 --- /dev/null +++ b/ld/testsuite/ld-z80/relocs_b_ez80.d @@ -0,0 +1,60 @@ +#name: eZ80 backward relocation in ADL mode +#source: labels.s -ez80-adl +#source: relocs.s -ez80-adl --defsym ADLMODE=1 +#ld: -e 0 -Ttext 0x100 -Tdata 0x200 -s +#objdump: -d + +.*:[ ]+file format (coff)|(elf32)\-z80 + + +.* \.text: + +00000100 <.*>: + 100:[ ]+78[ ]+ld a,b + 101:[ ]+79[ ]+ld a,c + 102:[ ]+7a[ ]+ld a,d + 103:[ ]+7b[ ]+ld a,e + 104:[ ]+7c[ ]+ld a,h + 105:[ ]+7d[ ]+ld a,l + 106:[ ]+7e[ ]+ld a,\(hl\) + 107:[ ]+7f[ ]+ld a,a + 108:[ ]+2f[ ]+cpl + 109:[ ]+cd 00 01 00[ ]+call 0x0100 + 10d:[ ]+c4 01 01 00[ ]+call nz,0x0101 + 111:[ ]+cc 02 01 00[ ]+call z,0x0102 + 115:[ ]+d4 03 01 00[ ]+call nc,0x0103 + 119:[ ]+dc 04 01 00[ ]+call c,0x0104 + 11d:[ ]+e4 05 01 00[ ]+call po,0x0105 + 121:[ ]+ec 06 01 00[ ]+call pe,0x0106 + 125:[ ]+f4 07 01 00[ ]+call p,0x0107 + 129:[ ]+fc 08 01 00[ ]+call m,0x0108 + 12d:[ ]+c3 00 01 00[ ]+jp 0x0100 + 131:[ ]+c2 01 01 00[ ]+jp nz,0x0101 + 135:[ ]+ca 02 01 00[ ]+jp z,0x0102 + 139:[ ]+d2 03 01 00[ ]+jp nc,0x0103 + 13d:[ ]+da 04 01 00[ ]+jp c,0x0104 + 141:[ ]+e2 05 01 00[ ]+jp po,0x0105 + 145:[ ]+ea 06 01 00[ ]+jp pe,0x0106 + 149:[ ]+f2 07 01 00[ ]+jp p,0x0107 + 14d:[ ]+fa 08 01 00[ ]+jp m,0x0108 + 151:[ ]+dd 6e 05[ ]+ld l,\(ix\+5\) + 154:[ ]+dd 7e 03[ ]+ld a,\(ix\+3\) + 157:[ ]+dd 4e fa[ ]+ld c,\(ix\-6\) + 15a:[ ]+dd 46 f9[ ]+ld b,\(ix\-7\) + 15d:[ ]+fd 75 fb[ ]+ld \(iy\-5\),l + 160:[ ]+fd 77 03[ ]+ld \(iy\+3\),a + 163:[ ]+fd 71 0e[ ]+ld \(iy\+14\),c + 166:[ ]+fd 70 0f[ ]+ld \(iy\+15\),b + 169:[ ]+fd 66 5d[ ]+ld h,\(iy\+93\) + 16c:[ ]+49 11 34 12[ ]+ld\.lis de,0x1234 + 170:[ ]+49 21 78 56[ ]+ld\.lis hl,0x5678 + 174:[ ]+49 11 68 24[ ]+ld\.lis de,0x2468 + 178:[ ]+49 21 f0 ac[ ]+ld\.lis hl,0xacf0 + 17c:[ ]+16 12[ ]+ld d,0x12 + 17e:[ ]+1e 34[ ]+ld e,0x34 + 180:[ ]+26 56[ ]+ld h,0x56 + 182:[ ]+2e 78[ ]+ld l,0x78 + 184:[ ]+16 24[ ]+ld d,0x24 + 186:[ ]+1e 68[ ]+ld e,0x68 + 188:[ ]+26 ac[ ]+ld h,0xac + 18a:[ ]+2e f0[ ]+ld l,0xf0 diff --git a/ld/testsuite/ld-z80/relocs_b_z80.d b/ld/testsuite/ld-z80/relocs_b_z80.d new file mode 100644 index 0000000..1417650 --- /dev/null +++ b/ld/testsuite/ld-z80/relocs_b_z80.d @@ -0,0 +1,60 @@ +#name: Z80 backward relocation +#source: labels.s -z80 +#source: relocs.s -z80 +#ld: -e 0 -Ttext 0x100 -Tdata 0x200 -s +#objdump: -d + +.*:[ ]+file format (coff)|(elf32)\-z80 + + +.* \.text: + +00000100 <.*>: + 100:[ ]+78[ ]+ld a,b + 101:[ ]+79[ ]+ld a,c + 102:[ ]+7a[ ]+ld a,d + 103:[ ]+7b[ ]+ld a,e + 104:[ ]+7c[ ]+ld a,h + 105:[ ]+7d[ ]+ld a,l + 106:[ ]+7e[ ]+ld a,\(hl\) + 107:[ ]+7f[ ]+ld a,a + 108:[ ]+2f[ ]+cpl + 109:[ ]+cd 00 01[ ]+call 0x0100 + 10c:[ ]+c4 01 01[ ]+call nz,0x0101 + 10f:[ ]+cc 02 01[ ]+call z,0x0102 + 112:[ ]+d4 03 01[ ]+call nc,0x0103 + 115:[ ]+dc 04 01[ ]+call c,0x0104 + 118:[ ]+e4 05 01[ ]+call po,0x0105 + 11b:[ ]+ec 06 01[ ]+call pe,0x0106 + 11e:[ ]+f4 07 01[ ]+call p,0x0107 + 121:[ ]+fc 08 01[ ]+call m,0x0108 + 124:[ ]+c3 00 01[ ]+jp 0x0100 + 127:[ ]+c2 01 01[ ]+jp nz,0x0101 + 12a:[ ]+ca 02 01[ ]+jp z,0x0102 + 12d:[ ]+d2 03 01[ ]+jp nc,0x0103 + 130:[ ]+da 04 01[ ]+jp c,0x0104 + 133:[ ]+e2 05 01[ ]+jp po,0x0105 + 136:[ ]+ea 06 01[ ]+jp pe,0x0106 + 139:[ ]+f2 07 01[ ]+jp p,0x0107 + 13c:[ ]+fa 08 01[ ]+jp m,0x0108 + 13f:[ ]+dd 6e 05[ ]+ld l,\(ix\+5\) + 142:[ ]+dd 7e 03[ ]+ld a,\(ix\+3\) + 145:[ ]+dd 4e fa[ ]+ld c,\(ix\-6\) + 148:[ ]+dd 46 f9[ ]+ld b,\(ix\-7\) + 14b:[ ]+fd 75 fb[ ]+ld \(iy\-5\),l + 14e:[ ]+fd 77 03[ ]+ld \(iy\+3\),a + 151:[ ]+fd 71 0e[ ]+ld \(iy\+14\),c + 154:[ ]+fd 70 0f[ ]+ld \(iy\+15\),b + 157:[ ]+fd 66 5d[ ]+ld h,\(iy\+93\) + 15a:[ ]+11 34 12[ ]+ld de,0x1234 + 15d:[ ]+21 78 56[ ]+ld hl,0x5678 + 160:[ ]+11 68 24[ ]+ld de,0x2468 + 163:[ ]+21 f0 ac[ ]+ld hl,0xacf0 + 166:[ ]+16 12[ ]+ld d,0x12 + 168:[ ]+1e 34[ ]+ld e,0x34 + 16a:[ ]+26 56[ ]+ld h,0x56 + 16c:[ ]+2e 78[ ]+ld l,0x78 + 16e:[ ]+16 24[ ]+ld d,0x24 + 170:[ ]+1e 68[ ]+ld e,0x68 + 172:[ ]+26 ac[ ]+ld h,0xac + 174:[ ]+2e f0[ ]+ld l,0xf0 diff --git a/ld/testsuite/ld-z80/relocs_f_ez80.d b/ld/testsuite/ld-z80/relocs_f_ez80.d new file mode 100644 index 0000000..323156b --- /dev/null +++ b/ld/testsuite/ld-z80/relocs_f_ez80.d @@ -0,0 +1,78 @@ +#name: eZ80 forward relocation in ADL mode +#source: relocs.s -ez80-adl --defsym ADLMODE=1 +#source: labels.s -ez80-adl +#ld: -e 0 -Ttext 0x100 -Tdata 0x200 +#objdump: -d + +.*:[ ]+file format (coff)|(elf32)\-z80 + + +.* \.text: + +00000100 <.*>: + 100:[ ]+cd 83 01 00[ ]+call 0x0183 + 104:[ ]+c4 84 01 00[ ]+call nz,0x0184 + 108:[ ]+cc 85 01 00[ ]+call z,0x0185 + 10c:[ ]+d4 86 01 00[ ]+call nc,0x0186 + 110:[ ]+dc 87 01 00[ ]+call c,0x0187 + 114:[ ]+e4 88 01 00[ ]+call po,0x0188 + 118:[ ]+ec 89 01 00[ ]+call pe,0x0189 + 11c:[ ]+f4 8a 01 00[ ]+call p,0x018a + 120:[ ]+fc 8b 01 00[ ]+call m,0x018b + 124:[ ]+c3 83 01 00[ ]+jp 0x0183 + 128:[ ]+c2 84 01 00[ ]+jp nz,0x0184 + 12c:[ ]+ca 85 01 00[ ]+jp z,0x0185 + 130:[ ]+d2 86 01 00[ ]+jp nc,0x0186 + 134:[ ]+da 87 01 00[ ]+jp c,0x0187 + 138:[ ]+e2 88 01 00[ ]+jp po,0x0188 + 13c:[ ]+ea 89 01 00[ ]+jp pe,0x0189 + 140:[ ]+f2 8a 01 00[ ]+jp p,0x018a + 144:[ ]+fa 8b 01 00[ ]+jp m,0x018b + 148:[ ]+dd 6e 05[ ]+ld l,\(ix\+5\) + 14b:[ ]+dd 7e 03[ ]+ld a,\(ix\+3\) + 14e:[ ]+dd 4e fa[ ]+ld c,\(ix\-6\) + 151:[ ]+dd 46 f9[ ]+ld b,\(ix\-7\) + 154:[ ]+fd 75 fb[ ]+ld \(iy\-5\),l + 157:[ ]+fd 77 03[ ]+ld \(iy\+3\),a + 15a:[ ]+fd 71 0e[ ]+ld \(iy\+14\),c + 15d:[ ]+fd 70 0f[ ]+ld \(iy\+15\),b + 160:[ ]+fd 66 5d[ ]+ld h,\(iy\+93\) + 163:[ ]+49 11 34 12[ ]+ld\.lis de,0x1234 + 167:[ ]+49 21 78 56[ ]+ld\.lis hl,0x5678 + 16b:[ ]+49 11 68 24[ ]+ld\.lis de,0x2468 + 16f:[ ]+49 21 f0 ac[ ]+ld\.lis hl,0xacf0 + 173:[ ]+16 12[ ]+ld d,0x12 + 175:[ ]+1e 34[ ]+ld e,0x34 + 177:[ ]+26 56[ ]+ld h,0x56 + 179:[ ]+2e 78[ ]+ld l,0x78 + 17b:[ ]+16 24[ ]+ld d,0x24 + 17d:[ ]+1e 68[ ]+ld e,0x68 + 17f:[ ]+26 ac[ ]+ld h,0xac + 181:[ ]+2e f0[ ]+ld l,0xf0 + +00000183 <label1>: + 183:[ ]+78[ ]+ld a,b + +00000184 <label2>: + 184:[ ]+79[ ]+ld a,c + +00000185 <label3>: + 185:[ ]+7a[ ]+ld a,d + +00000186 <label4>: + 186:[ ]+7b[ ]+ld a,e + +00000187 <label5>: + 187:[ ]+7c[ ]+ld a,h + +00000188 <label6>: + 188:[ ]+7d[ ]+ld a,l + +00000189 <label7>: + 189:[ ]+7e[ ]+ld a,\(hl\) + +0000018a <label8>: + 18a:[ ]+7f[ ]+ld a,a + +0000018b <label9>: + 18b:[ ]+2f[ ]+cpl diff --git a/ld/testsuite/ld-z80/relocs_f_z80.d b/ld/testsuite/ld-z80/relocs_f_z80.d new file mode 100644 index 0000000..462da8a --- /dev/null +++ b/ld/testsuite/ld-z80/relocs_f_z80.d @@ -0,0 +1,79 @@ +#name: Z80 forward relocation +#source: relocs.s -z80 +#source: labels.s -z80 +#ld: -e 0 -Ttext 0x100 -Tdata 0x200 +#objdump: -d + + +.*:[ ]+file format (coff)|(elf32)\-z80 + + +.* \.text: + +00000100 <.*>: + 100:[ ]+cd 6d 01[ ]+call 0x016d + 103:[ ]+c4 6e 01[ ]+call nz,0x016e + 106:[ ]+cc 6f 01[ ]+call z,0x016f + 109:[ ]+d4 70 01[ ]+call nc,0x0170 + 10c:[ ]+dc 71 01[ ]+call c,0x0171 + 10f:[ ]+e4 72 01[ ]+call po,0x0172 + 112:[ ]+ec 73 01[ ]+call pe,0x0173 + 115:[ ]+f4 74 01[ ]+call p,0x0174 + 118:[ ]+fc 75 01[ ]+call m,0x0175 + 11b:[ ]+c3 6d 01[ ]+jp 0x016d + 11e:[ ]+c2 6e 01[ ]+jp nz,0x016e + 121:[ ]+ca 6f 01[ ]+jp z,0x016f + 124:[ ]+d2 70 01[ ]+jp nc,0x0170 + 127:[ ]+da 71 01[ ]+jp c,0x0171 + 12a:[ ]+e2 72 01[ ]+jp po,0x0172 + 12d:[ ]+ea 73 01[ ]+jp pe,0x0173 + 130:[ ]+f2 74 01[ ]+jp p,0x0174 + 133:[ ]+fa 75 01[ ]+jp m,0x0175 + 136:[ ]+dd 6e 05[ ]+ld l,\(ix\+5\) + 139:[ ]+dd 7e 03[ ]+ld a,\(ix\+3\) + 13c:[ ]+dd 4e fa[ ]+ld c,\(ix\-6\) + 13f:[ ]+dd 46 f9[ ]+ld b,\(ix\-7\) + 142:[ ]+fd 75 fb[ ]+ld \(iy\-5\),l + 145:[ ]+fd 77 03[ ]+ld \(iy\+3\),a + 148:[ ]+fd 71 0e[ ]+ld \(iy\+14\),c + 14b:[ ]+fd 70 0f[ ]+ld \(iy\+15\),b + 14e:[ ]+fd 66 5d[ ]+ld h,\(iy\+93\) + 151:[ ]+11 34 12[ ]+ld de,0x1234 + 154:[ ]+21 78 56[ ]+ld hl,0x5678 + 157:[ ]+11 68 24[ ]+ld de,0x2468 + 15a:[ ]+21 f0 ac[ ]+ld hl,0xacf0 + 15d:[ ]+16 12[ ]+ld d,0x12 + 15f:[ ]+1e 34[ ]+ld e,0x34 + 161:[ ]+26 56[ ]+ld h,0x56 + 163:[ ]+2e 78[ ]+ld l,0x78 + 165:[ ]+16 24[ ]+ld d,0x24 + 167:[ ]+1e 68[ ]+ld e,0x68 + 169:[ ]+26 ac[ ]+ld h,0xac + 16b:[ ]+2e f0[ ]+ld l,0xf0 + +0000016d <label1>: + 16d:[ ]+78[ ]+ld a,b + +0000016e <label2>: + 16e:[ ]+79[ ]+ld a,c + +0000016f <label3>: + 16f:[ ]+7a[ ]+ld a,d + +00000170 <label4>: + 170:[ ]+7b[ ]+ld a,e + +00000171 <label5>: + 171:[ ]+7c[ ]+ld a,h + +00000172 <label6>: + 172:[ ]+7d[ ]+ld a,l + +00000173 <label7>: + 173:[ ]+7e[ ]+ld a,\(hl\) + +00000174 <label8>: + 174:[ ]+7f[ ]+ld a,a + +00000175 <label9>: + 175:[ ]+2f[ ]+cpl diff --git a/ld/testsuite/ld-z80/z80.exp b/ld/testsuite/ld-z80/z80.exp new file mode 100644 index 0000000..d141ab8 --- /dev/null +++ b/ld/testsuite/ld-z80/z80.exp @@ -0,0 +1,33 @@ +# Expect script for ld-z80 tests +# Copyright (C) 2016-2019 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# Test z80 linking; all types of relocs. This tests the assembler +# and tools like objdump as well as the main target, the linker. + +if ![istarget "z80-*-*"] then { + return +} + +set z80_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +foreach z80_test $z80_test_list { + verbose [file rootname $z80_test] + run_dump_test [file rootname $z80_test] +} |