Add z8k ld testsuite and fix range check in coff-z8k.c

bfd/
	* coff-z8k.c (extra_case): Fix range check for R_JR relocation.

ld/
	* ld/testsuite/ld-z8k/0filler.s: New file.
	* ld/testsuite/ld-z8k/branch-target.s: New file.
	* ld/testsuite/ld-z8k/branch-target2.s: New file.
	* ld/testsuite/ld-z8k/calr-back-8001.d: New file.
	* ld/testsuite/ld-z8k/calr-back-8002.d: New file.
	* ld/testsuite/ld-z8k/calr-back-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/calr-back-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/calr-forw-8001.d: New file.
	* ld/testsuite/ld-z8k/calr-forw-8002.d: New file.
	* ld/testsuite/ld-z8k/calr-forw-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/calr-forw-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/calr-opcode.s: New file.
	* ld/testsuite/ld-z8k/dbjnz-forw-8001.d: New file.
	* ld/testsuite/ld-z8k/dbjnz-forw-8002.d: New file.
	* ld/testsuite/ld-z8k/dbjnz-forw-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/dbjnz-forw-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/dbjnz-opcode.s: New file.
	* ld/testsuite/ld-z8k/djnz-back-8001.d: New file.
	* ld/testsuite/ld-z8k/djnz-back-8002.d: New file.
	* ld/testsuite/ld-z8k/djnz-back-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/djnz-back-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/djnz-forw-8001.d: New file.
	* ld/testsuite/ld-z8k/djnz-forw-8002.d: New file.
	* ld/testsuite/ld-z8k/djnz-forw-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/djnz-forw-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/djnz-opcode.s: New file.
	* ld/testsuite/ld-z8k/filler.s: New file.
	* ld/testsuite/ld-z8k/jr-back-8001.d: New file.
	* ld/testsuite/ld-z8k/jr-back-8002.d: New file.
	* ld/testsuite/ld-z8k/jr-back-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/jr-back-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/jr-forw-8001.d: New file.
	* ld/testsuite/ld-z8k/jr-forw-8002.d: New file.
	* ld/testsuite/ld-z8k/jr-forw-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/jr-forw-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/jr-opcode.s: New file.
	* ld/testsuite/ld-z8k/ldr-back-8001.d: New file.
	* ld/testsuite/ld-z8k/ldr-back-8002.d: New file.
	* ld/testsuite/ld-z8k/ldr-back-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/ldr-back-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/ldr-forw-8001.d: New file.
	* ld/testsuite/ld-z8k/ldr-forw-8002.d: New file.
	* ld/testsuite/ld-z8k/ldr-forw-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/ldr-forw-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/ldr-opcode.s: New file.
	* ld/testsuite/ld-z8k/ldrb-forw-8001.d: New file.
	* ld/testsuite/ld-z8k/ldrb-forw-8002.d: New file.
	* ld/testsuite/ld-z8k/ldrb-forw-fail-8001.d: New file.
	* ld/testsuite/ld-z8k/ldrb-forw-fail-8002.d: New file.
	* ld/testsuite/ld-z8k/ldrb-opcode.s: New file.
	* ld/testsuite/ld-z8k/ldrb-opcode2.s: New file.
	* ld/testsuite/ld-z8k/other-file.s: New file.
	* ld/testsuite/ld-z8k/reloc.dd: New file.
	* ld/testsuite/ld-z8k/reloc.ld: New file.
	* ld/testsuite/ld-z8k/relocseg.dd: New file.
	* ld/testsuite/ld-z8k/relocseg.ld: New file.
	* ld/testsuite/ld-z8k/relocseg1.dd: New file.
	* ld/testsuite/ld-z8k/test-ld.sh: New file.
	* ld/testsuite/ld-z8k/this-file.s: New file.
	* ld/testsuite/ld-z8k/z8k.exp: New file.
This commit is contained in:
Christian Groessler 2016-06-04 22:15:52 +02:00
parent de3da64574
commit 2ac27cd3c1
63 changed files with 9986 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2016-06-04 Christian Groessler <chris@groessler.org>
* coff-z8k.c (extra_case): Fix range check for R_JR relocation.
2016-06-02 Nick Clifton <nickc@redhat.com>
PR target/20088

View File

@ -263,7 +263,7 @@ extra_case (bfd *in_abfd,
if (gap & 1)
abort ();
gap /= 2;
if (gap > 128 || gap < -128)
if (gap > 127 || gap < -128)
(*link_info->callbacks->reloc_overflow)
(link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr),
reloc->howto->name, reloc->addend, input_section->owner,

View File

@ -1,3 +1,66 @@
2016-06-04 Christian Groessler <chris@groessler.org>
* ld/testsuite/ld-z8k/0filler.s: New file.
* ld/testsuite/ld-z8k/branch-target.s: New file.
* ld/testsuite/ld-z8k/branch-target2.s: New file.
* ld/testsuite/ld-z8k/calr-back-8001.d: New file.
* ld/testsuite/ld-z8k/calr-back-8002.d: New file.
* ld/testsuite/ld-z8k/calr-back-fail-8001.d: New file.
* ld/testsuite/ld-z8k/calr-back-fail-8002.d: New file.
* ld/testsuite/ld-z8k/calr-forw-8001.d: New file.
* ld/testsuite/ld-z8k/calr-forw-8002.d: New file.
* ld/testsuite/ld-z8k/calr-forw-fail-8001.d: New file.
* ld/testsuite/ld-z8k/calr-forw-fail-8002.d: New file.
* ld/testsuite/ld-z8k/calr-opcode.s: New file.
* ld/testsuite/ld-z8k/dbjnz-forw-8001.d: New file.
* ld/testsuite/ld-z8k/dbjnz-forw-8002.d: New file.
* ld/testsuite/ld-z8k/dbjnz-forw-fail-8001.d: New file.
* ld/testsuite/ld-z8k/dbjnz-forw-fail-8002.d: New file.
* ld/testsuite/ld-z8k/dbjnz-opcode.s: New file.
* ld/testsuite/ld-z8k/djnz-back-8001.d: New file.
* ld/testsuite/ld-z8k/djnz-back-8002.d: New file.
* ld/testsuite/ld-z8k/djnz-back-fail-8001.d: New file.
* ld/testsuite/ld-z8k/djnz-back-fail-8002.d: New file.
* ld/testsuite/ld-z8k/djnz-forw-8001.d: New file.
* ld/testsuite/ld-z8k/djnz-forw-8002.d: New file.
* ld/testsuite/ld-z8k/djnz-forw-fail-8001.d: New file.
* ld/testsuite/ld-z8k/djnz-forw-fail-8002.d: New file.
* ld/testsuite/ld-z8k/djnz-opcode.s: New file.
* ld/testsuite/ld-z8k/filler.s: New file.
* ld/testsuite/ld-z8k/jr-back-8001.d: New file.
* ld/testsuite/ld-z8k/jr-back-8002.d: New file.
* ld/testsuite/ld-z8k/jr-back-fail-8001.d: New file.
* ld/testsuite/ld-z8k/jr-back-fail-8002.d: New file.
* ld/testsuite/ld-z8k/jr-forw-8001.d: New file.
* ld/testsuite/ld-z8k/jr-forw-8002.d: New file.
* ld/testsuite/ld-z8k/jr-forw-fail-8001.d: New file.
* ld/testsuite/ld-z8k/jr-forw-fail-8002.d: New file.
* ld/testsuite/ld-z8k/jr-opcode.s: New file.
* ld/testsuite/ld-z8k/ldr-back-8001.d: New file.
* ld/testsuite/ld-z8k/ldr-back-8002.d: New file.
* ld/testsuite/ld-z8k/ldr-back-fail-8001.d: New file.
* ld/testsuite/ld-z8k/ldr-back-fail-8002.d: New file.
* ld/testsuite/ld-z8k/ldr-forw-8001.d: New file.
* ld/testsuite/ld-z8k/ldr-forw-8002.d: New file.
* ld/testsuite/ld-z8k/ldr-forw-fail-8001.d: New file.
* ld/testsuite/ld-z8k/ldr-forw-fail-8002.d: New file.
* ld/testsuite/ld-z8k/ldr-opcode.s: New file.
* ld/testsuite/ld-z8k/ldrb-forw-8001.d: New file.
* ld/testsuite/ld-z8k/ldrb-forw-8002.d: New file.
* ld/testsuite/ld-z8k/ldrb-forw-fail-8001.d: New file.
* ld/testsuite/ld-z8k/ldrb-forw-fail-8002.d: New file.
* ld/testsuite/ld-z8k/ldrb-opcode.s: New file.
* ld/testsuite/ld-z8k/ldrb-opcode2.s: New file.
* ld/testsuite/ld-z8k/other-file.s: New file.
* ld/testsuite/ld-z8k/reloc.dd: New file.
* ld/testsuite/ld-z8k/reloc.ld: New file.
* ld/testsuite/ld-z8k/relocseg.dd: New file.
* ld/testsuite/ld-z8k/relocseg.ld: New file.
* ld/testsuite/ld-z8k/relocseg1.dd: New file.
* ld/testsuite/ld-z8k/test-ld.sh: New file.
* ld/testsuite/ld-z8k/this-file.s: New file.
* ld/testsuite/ld-z8k/z8k.exp: New file.
2016-06-03 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/ld-i386/i386.exp: Assemble gotpc1.o and pr19319b.o

View File

@ -0,0 +1,6 @@
.text
.rept BYTES
.byte 0
.endr
.end

View File

@ -0,0 +1,5 @@
.text
.globl target
target: ldk r0,#4
.end

View File

@ -0,0 +1,5 @@
.text
.globl target2
target2:ldk r2,#4
.end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
#name: Z8001 backward calr just out of range
#source: branch-target.s -z8001
#source: filler.s -z8001 --defsym NOPS=2046
#source: calr-opcode.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_callr against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 backward calr just out of range
#source: branch-target.s -z8002
#source: filler.s -z8002 --defsym NOPS=2046
#source: calr-opcode.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_callr against `target'

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
#name: Z8001 forward calr just out of range
#source: calr-opcode.s -z8001
#source: filler.s -z8001 --defsym NOPS=2049
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_callr against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 forward calr just out of range
#source: calr-opcode.s -z8002
#source: filler.s -z8002 --defsym NOPS=2049
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_callr against `target'

View File

@ -0,0 +1,4 @@
.text
calr target
.end

View File

@ -0,0 +1,16 @@
#name: Z8001 forward dbjnz just in range
#source: dbjnz-opcode.s -z8001
#source: branch-target2.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: f000 dbjnz rh0,0x1002
00001002 <target2>:
1002: bd24 ldk r2,#0x4

View File

@ -0,0 +1,16 @@
#name: Z8002 forward dbjnz just in range
#source: dbjnz-opcode.s -z8002
#source: branch-target2.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: f000 dbjnz rh0,0x1002
00001002 <target2>:
1002: bd24 ldk r2,#0x4

View File

@ -0,0 +1,6 @@
#name: Z8001 forward dbjnz just out of range
#source: dbjnz-opcode.s -z8001
#source: filler.s -z8001 --defsym NOPS=1
#source: branch-target2.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_disp7 against `target2'

View File

@ -0,0 +1,6 @@
#name: Z8002 forward dbjnz just out of range
#source: dbjnz-opcode.s -z8002
#source: filler.s -z8002 --defsym NOPS=1
#source: branch-target2.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_disp7 against `target2'

View File

@ -0,0 +1,4 @@
.text
dbjnz rh0,target2
.end

View File

@ -0,0 +1,151 @@
#name: Z8001 backward djnz just in range
#source: branch-target.s -z8001
#source: branch-target2.s -z8001
#source: filler.s -z8001 --defsym NOPS=124
#source: djnz-opcode.s -z8001
#source: dbjnz-opcode.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <target>:
1000: bd04 ldk r0,#0x4
00001002 <target2>:
1002: bd24 ldk r2,#0x4
00001004 <\.text>:
1004: 8d07 nop
1006: 8d07 nop
1008: 8d07 nop
100a: 8d07 nop
100c: 8d07 nop
100e: 8d07 nop
1010: 8d07 nop
1012: 8d07 nop
1014: 8d07 nop
1016: 8d07 nop
1018: 8d07 nop
101a: 8d07 nop
101c: 8d07 nop
101e: 8d07 nop
1020: 8d07 nop
1022: 8d07 nop
1024: 8d07 nop
1026: 8d07 nop
1028: 8d07 nop
102a: 8d07 nop
102c: 8d07 nop
102e: 8d07 nop
1030: 8d07 nop
1032: 8d07 nop
1034: 8d07 nop
1036: 8d07 nop
1038: 8d07 nop
103a: 8d07 nop
103c: 8d07 nop
103e: 8d07 nop
1040: 8d07 nop
1042: 8d07 nop
1044: 8d07 nop
1046: 8d07 nop
1048: 8d07 nop
104a: 8d07 nop
104c: 8d07 nop
104e: 8d07 nop
1050: 8d07 nop
1052: 8d07 nop
1054: 8d07 nop
1056: 8d07 nop
1058: 8d07 nop
105a: 8d07 nop
105c: 8d07 nop
105e: 8d07 nop
1060: 8d07 nop
1062: 8d07 nop
1064: 8d07 nop
1066: 8d07 nop
1068: 8d07 nop
106a: 8d07 nop
106c: 8d07 nop
106e: 8d07 nop
1070: 8d07 nop
1072: 8d07 nop
1074: 8d07 nop
1076: 8d07 nop
1078: 8d07 nop
107a: 8d07 nop
107c: 8d07 nop
107e: 8d07 nop
1080: 8d07 nop
1082: 8d07 nop
1084: 8d07 nop
1086: 8d07 nop
1088: 8d07 nop
108a: 8d07 nop
108c: 8d07 nop
108e: 8d07 nop
1090: 8d07 nop
1092: 8d07 nop
1094: 8d07 nop
1096: 8d07 nop
1098: 8d07 nop
109a: 8d07 nop
109c: 8d07 nop
109e: 8d07 nop
10a0: 8d07 nop
10a2: 8d07 nop
10a4: 8d07 nop
10a6: 8d07 nop
10a8: 8d07 nop
10aa: 8d07 nop
10ac: 8d07 nop
10ae: 8d07 nop
10b0: 8d07 nop
10b2: 8d07 nop
10b4: 8d07 nop
10b6: 8d07 nop
10b8: 8d07 nop
10ba: 8d07 nop
10bc: 8d07 nop
10be: 8d07 nop
10c0: 8d07 nop
10c2: 8d07 nop
10c4: 8d07 nop
10c6: 8d07 nop
10c8: 8d07 nop
10ca: 8d07 nop
10cc: 8d07 nop
10ce: 8d07 nop
10d0: 8d07 nop
10d2: 8d07 nop
10d4: 8d07 nop
10d6: 8d07 nop
10d8: 8d07 nop
10da: 8d07 nop
10dc: 8d07 nop
10de: 8d07 nop
10e0: 8d07 nop
10e2: 8d07 nop
10e4: 8d07 nop
10e6: 8d07 nop
10e8: 8d07 nop
10ea: 8d07 nop
10ec: 8d07 nop
10ee: 8d07 nop
10f0: 8d07 nop
10f2: 8d07 nop
10f4: 8d07 nop
10f6: 8d07 nop
10f8: 8d07 nop
10fa: 8d07 nop
000010fc <\.text>:
10fc: f0ff djnz r0,0x1000
000010fe <\.text>:
10fe: f07f dbjnz rh0,0x1002

View File

@ -0,0 +1,151 @@
#name: Z8002 backward djnz just in range
#source: branch-target.s -z8002
#source: branch-target2.s -z8002
#source: filler.s -z8002 --defsym NOPS=124
#source: djnz-opcode.s -z8002
#source: dbjnz-opcode.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <target>:
1000: bd04 ldk r0,#0x4
00001002 <target2>:
1002: bd24 ldk r2,#0x4
00001004 <\.text>:
1004: 8d07 nop
1006: 8d07 nop
1008: 8d07 nop
100a: 8d07 nop
100c: 8d07 nop
100e: 8d07 nop
1010: 8d07 nop
1012: 8d07 nop
1014: 8d07 nop
1016: 8d07 nop
1018: 8d07 nop
101a: 8d07 nop
101c: 8d07 nop
101e: 8d07 nop
1020: 8d07 nop
1022: 8d07 nop
1024: 8d07 nop
1026: 8d07 nop
1028: 8d07 nop
102a: 8d07 nop
102c: 8d07 nop
102e: 8d07 nop
1030: 8d07 nop
1032: 8d07 nop
1034: 8d07 nop
1036: 8d07 nop
1038: 8d07 nop
103a: 8d07 nop
103c: 8d07 nop
103e: 8d07 nop
1040: 8d07 nop
1042: 8d07 nop
1044: 8d07 nop
1046: 8d07 nop
1048: 8d07 nop
104a: 8d07 nop
104c: 8d07 nop
104e: 8d07 nop
1050: 8d07 nop
1052: 8d07 nop
1054: 8d07 nop
1056: 8d07 nop
1058: 8d07 nop
105a: 8d07 nop
105c: 8d07 nop
105e: 8d07 nop
1060: 8d07 nop
1062: 8d07 nop
1064: 8d07 nop
1066: 8d07 nop
1068: 8d07 nop
106a: 8d07 nop
106c: 8d07 nop
106e: 8d07 nop
1070: 8d07 nop
1072: 8d07 nop
1074: 8d07 nop
1076: 8d07 nop
1078: 8d07 nop
107a: 8d07 nop
107c: 8d07 nop
107e: 8d07 nop
1080: 8d07 nop
1082: 8d07 nop
1084: 8d07 nop
1086: 8d07 nop
1088: 8d07 nop
108a: 8d07 nop
108c: 8d07 nop
108e: 8d07 nop
1090: 8d07 nop
1092: 8d07 nop
1094: 8d07 nop
1096: 8d07 nop
1098: 8d07 nop
109a: 8d07 nop
109c: 8d07 nop
109e: 8d07 nop
10a0: 8d07 nop
10a2: 8d07 nop
10a4: 8d07 nop
10a6: 8d07 nop
10a8: 8d07 nop
10aa: 8d07 nop
10ac: 8d07 nop
10ae: 8d07 nop
10b0: 8d07 nop
10b2: 8d07 nop
10b4: 8d07 nop
10b6: 8d07 nop
10b8: 8d07 nop
10ba: 8d07 nop
10bc: 8d07 nop
10be: 8d07 nop
10c0: 8d07 nop
10c2: 8d07 nop
10c4: 8d07 nop
10c6: 8d07 nop
10c8: 8d07 nop
10ca: 8d07 nop
10cc: 8d07 nop
10ce: 8d07 nop
10d0: 8d07 nop
10d2: 8d07 nop
10d4: 8d07 nop
10d6: 8d07 nop
10d8: 8d07 nop
10da: 8d07 nop
10dc: 8d07 nop
10de: 8d07 nop
10e0: 8d07 nop
10e2: 8d07 nop
10e4: 8d07 nop
10e6: 8d07 nop
10e8: 8d07 nop
10ea: 8d07 nop
10ec: 8d07 nop
10ee: 8d07 nop
10f0: 8d07 nop
10f2: 8d07 nop
10f4: 8d07 nop
10f6: 8d07 nop
10f8: 8d07 nop
10fa: 8d07 nop
000010fc <\.text>:
10fc: f0ff djnz r0,0x1000
000010fe <\.text>:
10fe: f07f dbjnz rh0,0x1002

View File

@ -0,0 +1,8 @@
#name: Z8001 backward djnz just out of range
#source: branch-target.s -z8001
#source: branch-target2.s -z8001
#source: filler.s -z8001 --defsym NOPS=125
#source: djnz-opcode.s -z8001
#source: dbjnz-opcode.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_disp7 against `target'

View File

@ -0,0 +1,8 @@
#name: Z8002 backward djnz just out of range
#source: branch-target.s -z8002
#source: branch-target2.s -z8002
#source: filler.s -z8002 --defsym NOPS=125
#source: djnz-opcode.s -z8002
#source: dbjnz-opcode.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_disp7 against `target'

View File

@ -0,0 +1,16 @@
#name: Z8001 forward djnz just in range
#source: djnz-opcode.s -z8001
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: f080 djnz r0,0x1002
00001002 <target>:
1002: bd04 ldk r0,#0x4

View File

@ -0,0 +1,16 @@
#name: Z8002 forward djnz just in range
#source: djnz-opcode.s -z8002
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: f080 djnz r0,0x1002
00001002 <target>:
1002: bd04 ldk r0,#0x4

View File

@ -0,0 +1,6 @@
#name: Z8001 forward djnz just out of range
#source: djnz-opcode.s -z8001
#source: filler.s -z8001 --defsym NOPS=1
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_disp7 against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 forward djnz just out of range
#source: djnz-opcode.s -z8002
#source: filler.s -z8002 --defsym NOPS=1
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_disp7 against `target'

View File

@ -0,0 +1,4 @@
.text
djnz r0,target
.end

View File

@ -0,0 +1,6 @@
.text
.rept NOPS
nop
.endr
.end

View File

@ -0,0 +1,145 @@
#name: Z8001 backward jr just in range
#source: branch-target.s -z8001
#source: filler.s -z8001 --defsym NOPS=126
#source: jr-opcode.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <target>:
1000: bd04 ldk r0,#0x4
00001002 <\.text>:
1002: 8d07 nop
1004: 8d07 nop
1006: 8d07 nop
1008: 8d07 nop
100a: 8d07 nop
100c: 8d07 nop
100e: 8d07 nop
1010: 8d07 nop
1012: 8d07 nop
1014: 8d07 nop
1016: 8d07 nop
1018: 8d07 nop
101a: 8d07 nop
101c: 8d07 nop
101e: 8d07 nop
1020: 8d07 nop
1022: 8d07 nop
1024: 8d07 nop
1026: 8d07 nop
1028: 8d07 nop
102a: 8d07 nop
102c: 8d07 nop
102e: 8d07 nop
1030: 8d07 nop
1032: 8d07 nop
1034: 8d07 nop
1036: 8d07 nop
1038: 8d07 nop
103a: 8d07 nop
103c: 8d07 nop
103e: 8d07 nop
1040: 8d07 nop
1042: 8d07 nop
1044: 8d07 nop
1046: 8d07 nop
1048: 8d07 nop
104a: 8d07 nop
104c: 8d07 nop
104e: 8d07 nop
1050: 8d07 nop
1052: 8d07 nop
1054: 8d07 nop
1056: 8d07 nop
1058: 8d07 nop
105a: 8d07 nop
105c: 8d07 nop
105e: 8d07 nop
1060: 8d07 nop
1062: 8d07 nop
1064: 8d07 nop
1066: 8d07 nop
1068: 8d07 nop
106a: 8d07 nop
106c: 8d07 nop
106e: 8d07 nop
1070: 8d07 nop
1072: 8d07 nop
1074: 8d07 nop
1076: 8d07 nop
1078: 8d07 nop
107a: 8d07 nop
107c: 8d07 nop
107e: 8d07 nop
1080: 8d07 nop
1082: 8d07 nop
1084: 8d07 nop
1086: 8d07 nop
1088: 8d07 nop
108a: 8d07 nop
108c: 8d07 nop
108e: 8d07 nop
1090: 8d07 nop
1092: 8d07 nop
1094: 8d07 nop
1096: 8d07 nop
1098: 8d07 nop
109a: 8d07 nop
109c: 8d07 nop
109e: 8d07 nop
10a0: 8d07 nop
10a2: 8d07 nop
10a4: 8d07 nop
10a6: 8d07 nop
10a8: 8d07 nop
10aa: 8d07 nop
10ac: 8d07 nop
10ae: 8d07 nop
10b0: 8d07 nop
10b2: 8d07 nop
10b4: 8d07 nop
10b6: 8d07 nop
10b8: 8d07 nop
10ba: 8d07 nop
10bc: 8d07 nop
10be: 8d07 nop
10c0: 8d07 nop
10c2: 8d07 nop
10c4: 8d07 nop
10c6: 8d07 nop
10c8: 8d07 nop
10ca: 8d07 nop
10cc: 8d07 nop
10ce: 8d07 nop
10d0: 8d07 nop
10d2: 8d07 nop
10d4: 8d07 nop
10d6: 8d07 nop
10d8: 8d07 nop
10da: 8d07 nop
10dc: 8d07 nop
10de: 8d07 nop
10e0: 8d07 nop
10e2: 8d07 nop
10e4: 8d07 nop
10e6: 8d07 nop
10e8: 8d07 nop
10ea: 8d07 nop
10ec: 8d07 nop
10ee: 8d07 nop
10f0: 8d07 nop
10f2: 8d07 nop
10f4: 8d07 nop
10f6: 8d07 nop
10f8: 8d07 nop
10fa: 8d07 nop
10fc: 8d07 nop
000010fe <\.text>:
10fe: e880 jr t,0x1000

View File

@ -0,0 +1,145 @@
#name: Z8002 backward jr just in range
#source: branch-target.s -z8002
#source: filler.s -z8002 --defsym NOPS=126
#source: jr-opcode.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <target>:
1000: bd04 ldk r0,#0x4
00001002 <\.text>:
1002: 8d07 nop
1004: 8d07 nop
1006: 8d07 nop
1008: 8d07 nop
100a: 8d07 nop
100c: 8d07 nop
100e: 8d07 nop
1010: 8d07 nop
1012: 8d07 nop
1014: 8d07 nop
1016: 8d07 nop
1018: 8d07 nop
101a: 8d07 nop
101c: 8d07 nop
101e: 8d07 nop
1020: 8d07 nop
1022: 8d07 nop
1024: 8d07 nop
1026: 8d07 nop
1028: 8d07 nop
102a: 8d07 nop
102c: 8d07 nop
102e: 8d07 nop
1030: 8d07 nop
1032: 8d07 nop
1034: 8d07 nop
1036: 8d07 nop
1038: 8d07 nop
103a: 8d07 nop
103c: 8d07 nop
103e: 8d07 nop
1040: 8d07 nop
1042: 8d07 nop
1044: 8d07 nop
1046: 8d07 nop
1048: 8d07 nop
104a: 8d07 nop
104c: 8d07 nop
104e: 8d07 nop
1050: 8d07 nop
1052: 8d07 nop
1054: 8d07 nop
1056: 8d07 nop
1058: 8d07 nop
105a: 8d07 nop
105c: 8d07 nop
105e: 8d07 nop
1060: 8d07 nop
1062: 8d07 nop
1064: 8d07 nop
1066: 8d07 nop
1068: 8d07 nop
106a: 8d07 nop
106c: 8d07 nop
106e: 8d07 nop
1070: 8d07 nop
1072: 8d07 nop
1074: 8d07 nop
1076: 8d07 nop
1078: 8d07 nop
107a: 8d07 nop
107c: 8d07 nop
107e: 8d07 nop
1080: 8d07 nop
1082: 8d07 nop
1084: 8d07 nop
1086: 8d07 nop
1088: 8d07 nop
108a: 8d07 nop
108c: 8d07 nop
108e: 8d07 nop
1090: 8d07 nop
1092: 8d07 nop
1094: 8d07 nop
1096: 8d07 nop
1098: 8d07 nop
109a: 8d07 nop
109c: 8d07 nop
109e: 8d07 nop
10a0: 8d07 nop
10a2: 8d07 nop
10a4: 8d07 nop
10a6: 8d07 nop
10a8: 8d07 nop
10aa: 8d07 nop
10ac: 8d07 nop
10ae: 8d07 nop
10b0: 8d07 nop
10b2: 8d07 nop
10b4: 8d07 nop
10b6: 8d07 nop
10b8: 8d07 nop
10ba: 8d07 nop
10bc: 8d07 nop
10be: 8d07 nop
10c0: 8d07 nop
10c2: 8d07 nop
10c4: 8d07 nop
10c6: 8d07 nop
10c8: 8d07 nop
10ca: 8d07 nop
10cc: 8d07 nop
10ce: 8d07 nop
10d0: 8d07 nop
10d2: 8d07 nop
10d4: 8d07 nop
10d6: 8d07 nop
10d8: 8d07 nop
10da: 8d07 nop
10dc: 8d07 nop
10de: 8d07 nop
10e0: 8d07 nop
10e2: 8d07 nop
10e4: 8d07 nop
10e6: 8d07 nop
10e8: 8d07 nop
10ea: 8d07 nop
10ec: 8d07 nop
10ee: 8d07 nop
10f0: 8d07 nop
10f2: 8d07 nop
10f4: 8d07 nop
10f6: 8d07 nop
10f8: 8d07 nop
10fa: 8d07 nop
10fc: 8d07 nop
000010fe <\.text>:
10fe: e880 jr t,0x1000

View File

@ -0,0 +1,6 @@
#name: Z8001 backward jr just out of range
#source: branch-target.s -z8001
#source: filler.s -z8001 --defsym NOPS=127
#source: jr-opcode.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_jr against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 backward jr just out of range
#source: branch-target.s -z8002
#source: filler.s -z8002 --defsym NOPS=127
#source: jr-opcode.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_jr against `target'

View File

@ -0,0 +1,146 @@
#name: Z8001 forward jr just in range
#source: jr-opcode.s -z8001
#source: filler.s -z8001 --defsym NOPS=127
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: e87f jr t,0x1100
00001002 <\.text>:
1002: 8d07 nop
1004: 8d07 nop
1006: 8d07 nop
1008: 8d07 nop
100a: 8d07 nop
100c: 8d07 nop
100e: 8d07 nop
1010: 8d07 nop
1012: 8d07 nop
1014: 8d07 nop
1016: 8d07 nop
1018: 8d07 nop
101a: 8d07 nop
101c: 8d07 nop
101e: 8d07 nop
1020: 8d07 nop
1022: 8d07 nop
1024: 8d07 nop
1026: 8d07 nop
1028: 8d07 nop
102a: 8d07 nop
102c: 8d07 nop
102e: 8d07 nop
1030: 8d07 nop
1032: 8d07 nop
1034: 8d07 nop
1036: 8d07 nop
1038: 8d07 nop
103a: 8d07 nop
103c: 8d07 nop
103e: 8d07 nop
1040: 8d07 nop
1042: 8d07 nop
1044: 8d07 nop
1046: 8d07 nop
1048: 8d07 nop
104a: 8d07 nop
104c: 8d07 nop
104e: 8d07 nop
1050: 8d07 nop
1052: 8d07 nop
1054: 8d07 nop
1056: 8d07 nop
1058: 8d07 nop
105a: 8d07 nop
105c: 8d07 nop
105e: 8d07 nop
1060: 8d07 nop
1062: 8d07 nop
1064: 8d07 nop
1066: 8d07 nop
1068: 8d07 nop
106a: 8d07 nop
106c: 8d07 nop
106e: 8d07 nop
1070: 8d07 nop
1072: 8d07 nop
1074: 8d07 nop
1076: 8d07 nop
1078: 8d07 nop
107a: 8d07 nop
107c: 8d07 nop
107e: 8d07 nop
1080: 8d07 nop
1082: 8d07 nop
1084: 8d07 nop
1086: 8d07 nop
1088: 8d07 nop
108a: 8d07 nop
108c: 8d07 nop
108e: 8d07 nop
1090: 8d07 nop
1092: 8d07 nop
1094: 8d07 nop
1096: 8d07 nop
1098: 8d07 nop
109a: 8d07 nop
109c: 8d07 nop
109e: 8d07 nop
10a0: 8d07 nop
10a2: 8d07 nop
10a4: 8d07 nop
10a6: 8d07 nop
10a8: 8d07 nop
10aa: 8d07 nop
10ac: 8d07 nop
10ae: 8d07 nop
10b0: 8d07 nop
10b2: 8d07 nop
10b4: 8d07 nop
10b6: 8d07 nop
10b8: 8d07 nop
10ba: 8d07 nop
10bc: 8d07 nop
10be: 8d07 nop
10c0: 8d07 nop
10c2: 8d07 nop
10c4: 8d07 nop
10c6: 8d07 nop
10c8: 8d07 nop
10ca: 8d07 nop
10cc: 8d07 nop
10ce: 8d07 nop
10d0: 8d07 nop
10d2: 8d07 nop
10d4: 8d07 nop
10d6: 8d07 nop
10d8: 8d07 nop
10da: 8d07 nop
10dc: 8d07 nop
10de: 8d07 nop
10e0: 8d07 nop
10e2: 8d07 nop
10e4: 8d07 nop
10e6: 8d07 nop
10e8: 8d07 nop
10ea: 8d07 nop
10ec: 8d07 nop
10ee: 8d07 nop
10f0: 8d07 nop
10f2: 8d07 nop
10f4: 8d07 nop
10f6: 8d07 nop
10f8: 8d07 nop
10fa: 8d07 nop
10fc: 8d07 nop
10fe: 8d07 nop
00001100 <target>:
1100: bd04 ldk r0,#0x4

View File

@ -0,0 +1,146 @@
#name: Z8002 forward jr just in range
#source: jr-opcode.s -z8002
#source: filler.s -z8002 --defsym NOPS=127
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: e87f jr t,0x1100
00001002 <\.text>:
1002: 8d07 nop
1004: 8d07 nop
1006: 8d07 nop
1008: 8d07 nop
100a: 8d07 nop
100c: 8d07 nop
100e: 8d07 nop
1010: 8d07 nop
1012: 8d07 nop
1014: 8d07 nop
1016: 8d07 nop
1018: 8d07 nop
101a: 8d07 nop
101c: 8d07 nop
101e: 8d07 nop
1020: 8d07 nop
1022: 8d07 nop
1024: 8d07 nop
1026: 8d07 nop
1028: 8d07 nop
102a: 8d07 nop
102c: 8d07 nop
102e: 8d07 nop
1030: 8d07 nop
1032: 8d07 nop
1034: 8d07 nop
1036: 8d07 nop
1038: 8d07 nop
103a: 8d07 nop
103c: 8d07 nop
103e: 8d07 nop
1040: 8d07 nop
1042: 8d07 nop
1044: 8d07 nop
1046: 8d07 nop
1048: 8d07 nop
104a: 8d07 nop
104c: 8d07 nop
104e: 8d07 nop
1050: 8d07 nop
1052: 8d07 nop
1054: 8d07 nop
1056: 8d07 nop
1058: 8d07 nop
105a: 8d07 nop
105c: 8d07 nop
105e: 8d07 nop
1060: 8d07 nop
1062: 8d07 nop
1064: 8d07 nop
1066: 8d07 nop
1068: 8d07 nop
106a: 8d07 nop
106c: 8d07 nop
106e: 8d07 nop
1070: 8d07 nop
1072: 8d07 nop
1074: 8d07 nop
1076: 8d07 nop
1078: 8d07 nop
107a: 8d07 nop
107c: 8d07 nop
107e: 8d07 nop
1080: 8d07 nop
1082: 8d07 nop
1084: 8d07 nop
1086: 8d07 nop
1088: 8d07 nop
108a: 8d07 nop
108c: 8d07 nop
108e: 8d07 nop
1090: 8d07 nop
1092: 8d07 nop
1094: 8d07 nop
1096: 8d07 nop
1098: 8d07 nop
109a: 8d07 nop
109c: 8d07 nop
109e: 8d07 nop
10a0: 8d07 nop
10a2: 8d07 nop
10a4: 8d07 nop
10a6: 8d07 nop
10a8: 8d07 nop
10aa: 8d07 nop
10ac: 8d07 nop
10ae: 8d07 nop
10b0: 8d07 nop
10b2: 8d07 nop
10b4: 8d07 nop
10b6: 8d07 nop
10b8: 8d07 nop
10ba: 8d07 nop
10bc: 8d07 nop
10be: 8d07 nop
10c0: 8d07 nop
10c2: 8d07 nop
10c4: 8d07 nop
10c6: 8d07 nop
10c8: 8d07 nop
10ca: 8d07 nop
10cc: 8d07 nop
10ce: 8d07 nop
10d0: 8d07 nop
10d2: 8d07 nop
10d4: 8d07 nop
10d6: 8d07 nop
10d8: 8d07 nop
10da: 8d07 nop
10dc: 8d07 nop
10de: 8d07 nop
10e0: 8d07 nop
10e2: 8d07 nop
10e4: 8d07 nop
10e6: 8d07 nop
10e8: 8d07 nop
10ea: 8d07 nop
10ec: 8d07 nop
10ee: 8d07 nop
10f0: 8d07 nop
10f2: 8d07 nop
10f4: 8d07 nop
10f6: 8d07 nop
10f8: 8d07 nop
10fa: 8d07 nop
10fc: 8d07 nop
10fe: 8d07 nop
00001100 <target>:
1100: bd04 ldk r0,#0x4

View File

@ -0,0 +1,6 @@
#name: Z8001 forward jr just out of range
#source: jr-opcode.s -z8001
#source: filler.s -z8001 --defsym NOPS=128
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_jr against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 forward jr just out of range
#source: jr-opcode.s -z8002
#source: filler.s -z8002 --defsym NOPS=128
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_jr against `target'

View File

@ -0,0 +1,4 @@
.text
jr target
.end

View File

@ -0,0 +1,20 @@
#name: Z8001 backward relative load just in range
#source: branch-target.s -z8001
#source: 0filler.s -z8001 --defsym BYTES=32762
#source: ldr-opcode.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <target>:
1000: bd04 ldk r0,#0x4
00001002 <\.text>:
\.\.\.
00008ffc <\.text>:
8ffc: 3100 8000 ldr r0,0x1000

View File

@ -0,0 +1,20 @@
#name: Z8002 backward relative load just in range
#source: branch-target.s -z8002
#source: 0filler.s -z8002 --defsym BYTES=32762
#source: ldr-opcode.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <target>:
1000: bd04 ldk r0,#0x4
00001002 <\.text>:
\.\.\.
00008ffc <\.text>:
8ffc: 3100 8000 ldr r0,0x1000

View File

@ -0,0 +1,6 @@
#name: Z8001 backward relative load just out of range
#source: branch-target.s -z8001
#source: 0filler.s -z8001 --defsym BYTES=32764
#source: ldr-opcode.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_rel16 against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 backward relative load just out of range
#source: branch-target.s -z8002
#source: 0filler.s -z8002 --defsym BYTES=32764
#source: ldr-opcode.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_rel16 against `target'

View File

@ -0,0 +1,20 @@
#name: Z8001 forward relative load just in range
#source: ldr-opcode.s -z8001
#source: 0filler.s -z8001 --defsym BYTES=32766
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: 3100 7ffe ldr r0,0x9002
00001004 <\.text>:
\.\.\.
00009002 <target>:
9002: bd04 ldk r0,#0x4

View File

@ -0,0 +1,20 @@
#name: Z8002 forward relative load just in range
#source: ldr-opcode.s -z8002
#source: 0filler.s -z8002 --defsym BYTES=32766
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: 3100 7ffe ldr r0,0x9002
00001004 <\.text>:
\.\.\.
00009002 <target>:
9002: bd04 ldk r0,#0x4

View File

@ -0,0 +1,6 @@
#name: Z8001 forward relative load just out of range
#source: ldr-opcode.s -z8001
#source: 0filler.s -z8001 --defsym BYTES=32768
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_rel16 against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 forward relative load just out of range
#source: ldr-opcode.s -z8002
#source: 0filler.s -z8002 --defsym BYTES=32768
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_rel16 against `target'

View File

@ -0,0 +1,4 @@
.text
ldr r0,target
.end

View File

@ -0,0 +1,20 @@
#name: Z8001 forward relative byte load just in range
#source: ldrb-opcode.s -z8001
#source: 0filler.s -z8001 --defsym BYTES=32766
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: 3000 7fff ldrb rh0,0x9003
00001004 <\.text>:
\.\.\.
00009002 <target>:
9002: bd04 ldk r0,#0x4

View File

@ -0,0 +1,20 @@
#name: Z8002 forward relative byte load just in range
#source: ldrb-opcode.s -z8002
#source: 0filler.s -z8002 --defsym BYTES=32766
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#objdump: -dr
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <\.text>:
1000: 3000 7fff ldrb rh0,0x9003
00001004 <\.text>:
\.\.\.
00009002 <target>:
9002: bd04 ldk r0,#0x4

View File

@ -0,0 +1,6 @@
#name: Z8001 forward relative byte load just out of range
#source: ldrb-opcode2.s -z8001
#source: 0filler.s -z8001 --defsym BYTES=32766
#source: branch-target.s -z8001
#ld: -T reloc.ld -mz8001 -e 0
#error: .*: relocation truncated to fit: r_rel16 against `target'

View File

@ -0,0 +1,6 @@
#name: Z8002 forward relative byte load just out of range
#source: ldrb-opcode2.s -z8002
#source: 0filler.s -z8002 --defsym BYTES=32766
#source: branch-target.s -z8002
#ld: -T reloc.ld -mz8002 -e 0
#error: .*: relocation truncated to fit: r_rel16 against `target'

View File

@ -0,0 +1,4 @@
.text
ldrb rh0,target+1
.end

View File

@ -0,0 +1,4 @@
.text
ldrb rh0,target+2
.end

View File

@ -0,0 +1,55 @@
.text
.globl other_start, other_label, other_imm4_val
other_start:
nop
djnz r1,other_start
dbjnz rl0,this_label
jr t,this_start
jr t,other_start
jp t,this_start
jp t,other_start
call other_start
call other_label
call this_start
call this_label
calr other_start
calr other_label
calr this_start
calr this_label
ld r1,other_data
ld r1,this_data
ld r1,#other_data
ld r1,#this_data
other_label:
ldb rl2,#this_data
ldb rl2,#this_data + 0x10
ldb rl2,#other_data
ldb rl2,#other_data + 0x10
! ldr r2,this_data
! ldr r2,other_data
ldk r5,#this_imm4_val
nop
.set other_imm4_val, 3
.data
.globl other_data
.ds.l 1
other_data:
.word 0x5678
.ds.l 1
.end

View File

@ -0,0 +1,61 @@
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <this_start>:
1000: 8d07 nop
1002: e8fe jr t,0x1000
1004: e81e jr t,0x1042
1006: 5e08 1000 jp t,0x1000
100a: 5e08 1042 jp t,0x1042
100e: 5f00 1042 call 0x1042
1012: 5f00 107c call 0x107c
1016: 5f00 1000 call 0x1000
101a: 5f00 1036 call 0x1036
101e: dfef calr 0x1042
1020: dfd3 calr 0x107c
1022: d012 calr 0x1000
1024: dff8 calr 0x1036
1026: 6101 200e ld r1,0x200e
102a: 6101 2004 ld r1,0x2004
102e: 2101 200e ld r1,#0x200e
1032: 2101 2004 ld r1,#0x2004
00001036 <this_label>:
1036: ca04 ldb rl2,#0x4
1038: ca14 ldb rl2,#0x14
103a: ca0e ldb rl2,#0xe
103c: ca1e ldb rl2,#0x1e
103e: a6b3 bitb rl3,#0x3
1040: 8d07 nop
00001042 <other_start>:
1042: 8d07 nop
1044: f182 djnz r1,0x1042
1046: f809 dbjnz rl0,0x1036
1048: e8db jr t,0x1000
104a: e8fb jr t,0x1042
104c: 5e08 1000 jp t,0x1000
1050: 5e08 1042 jp t,0x1042
1054: 5f00 1042 call 0x1042
1058: 5f00 107c call 0x107c
105c: 5f00 1000 call 0x1000
1060: 5f00 1036 call 0x1036
1064: d012 calr 0x1042
1066: dff6 calr 0x107c
1068: d035 calr 0x1000
106a: d01b calr 0x1036
106c: 6101 200e ld r1,0x200e
1070: 6101 2004 ld r1,0x2004
1074: 2101 200e ld r1,#0x200e
1078: 2101 2004 ld r1,#0x2004
0000107c <other_label>:
107c: ca04 ldb rl2,#0x4
107e: ca14 ldb rl2,#0x14
1080: ca0e ldb rl2,#0xe
1082: ca1e ldb rl2,#0x1e
1084: bd5a ldk r5,#0xa
1086: 8d07 nop

View File

@ -0,0 +1,22 @@
/* everything in one segment */
SECTIONS
{
.text 0x00001000 :
{
*(.text)
*(.strings)
*(.rdata)
}
.data 0x00002000 :
{
*(.data)
}
.bss 0x00003000 :
{
*(.bss);
*(COMMON);
}
}

View File

@ -0,0 +1,61 @@
.*: file format coff-z8k
Disassembly of section \.text:
00011000 <this_start>:
11000: 8d07 nop
11002: e8fe jr t,0x11000
11004: e826 jr t,0x11052
11006: 5e08 8100 1000 jp t,0x1001000
1100c: 5e08 8100 1052 jp t,0x1001052
11012: 5f00 8100 1052 call 0x1001052
11018: 5f00 8100 109c call 0x100109c
1101e: 5f00 8100 1000 call 0x1001000
11024: 5f00 8100 1046 call 0x1001046
1102a: dfed calr 0x11052
1102c: dfc9 calr 0x1109c
1102e: d018 calr 0x11000
11030: dff6 calr 0x11046
11032: 6101 8200 200e ld r1,0x200200e
11038: 6101 8200 2004 ld r1,0x2002004
1103e: 2101 200e ld r1,#0x200e
11042: 2101 2004 ld r1,#0x2004
00011046 <this_label>:
11046: ca04 ldb rl2,#0x4
11048: ca14 ldb rl2,#0x14
1104a: ca0e ldb rl2,#0xe
1104c: ca1e ldb rl2,#0x1e
1104e: a6b3 bitb rl3,#0x3
11050: 8d07 nop
00011052 <other_start>:
11052: 8d07 nop
11054: f182 djnz r1,0x11052
11056: f809 dbjnz rl0,0x11046
11058: e8d3 jr t,0x11000
1105a: e8fb jr t,0x11052
1105c: 5e08 8100 1000 jp t,0x1001000
11062: 5e08 8100 1052 jp t,0x1001052
11068: 5f00 8100 1052 call 0x1001052
1106e: 5f00 8100 109c call 0x100109c
11074: 5f00 8100 1000 call 0x1001000
1107a: 5f00 8100 1046 call 0x1001046
11080: d018 calr 0x11052
11082: dff4 calr 0x1109c
11084: d043 calr 0x11000
11086: d021 calr 0x11046
11088: 6101 8200 200e ld r1,0x200200e
1108e: 6101 8200 2004 ld r1,0x2002004
11094: 2101 200e ld r1,#0x200e
11098: 2101 2004 ld r1,#0x2004
0001109c <other_label>:
1109c: ca04 ldb rl2,#0x4
1109e: ca14 ldb rl2,#0x14
110a0: ca0e ldb rl2,#0xe
110a2: ca1e ldb rl2,#0x1e
110a4: bd5a ldk r5,#0xa
110a6: 8d07 nop

View File

@ -0,0 +1,22 @@
/* one segment for each of .text, .data, and .bss */
SECTIONS
{
.text 0x00011000 :
{
*(.text)
*(.strings)
*(.rdata)
}
.data 0x00022000 :
{
*(.data)
}
.bss 0x00033000 :
{
*(.bss);
*(COMMON);
}
}

View File

@ -0,0 +1,61 @@
.*: file format coff-z8k
Disassembly of section \.text:
00001000 <this_start>:
1000: 8d07 nop
1002: e8fe jr t,0x1000
1004: e826 jr t,0x1052
1006: 5e08 8000 1000 jp t,0x1000
100c: 5e08 8000 1052 jp t,0x1052
1012: 5f00 8000 1052 call 0x1052
1018: 5f00 8000 109c call 0x109c
101e: 5f00 8000 1000 call 0x1000
1024: 5f00 8000 1046 call 0x1046
102a: dfed calr 0x1052
102c: dfc9 calr 0x109c
102e: d018 calr 0x1000
1030: dff6 calr 0x1046
1032: 6101 8000 200e ld r1,0x200e
1038: 6101 8000 2004 ld r1,0x2004
103e: 2101 200e ld r1,#0x200e
1042: 2101 2004 ld r1,#0x2004
00001046 <this_label>:
1046: ca04 ldb rl2,#0x4
1048: ca14 ldb rl2,#0x14
104a: ca0e ldb rl2,#0xe
104c: ca1e ldb rl2,#0x1e
104e: a6b3 bitb rl3,#0x3
1050: 8d07 nop
00001052 <other_start>:
1052: 8d07 nop
1054: f182 djnz r1,0x1052
1056: f809 dbjnz rl0,0x1046
1058: e8d3 jr t,0x1000
105a: e8fb jr t,0x1052
105c: 5e08 8000 1000 jp t,0x1000
1062: 5e08 8000 1052 jp t,0x1052
1068: 5f00 8000 1052 call 0x1052
106e: 5f00 8000 109c call 0x109c
1074: 5f00 8000 1000 call 0x1000
107a: 5f00 8000 1046 call 0x1046
1080: d018 calr 0x1052
1082: dff4 calr 0x109c
1084: d043 calr 0x1000
1086: d021 calr 0x1046
1088: 6101 8000 200e ld r1,0x200e
108e: 6101 8000 2004 ld r1,0x2004
1094: 2101 200e ld r1,#0x200e
1098: 2101 2004 ld r1,#0x2004
0000109c <other_label>:
109c: ca04 ldb rl2,#0x4
109e: ca14 ldb rl2,#0x14
10a0: ca0e ldb rl2,#0xe
10a2: ca1e ldb rl2,#0x1e
10a4: bd5a ldk r5,#0xa
10a6: 8d07 nop

19
ld/testsuite/ld-z8k/test-ld.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# use files from ~/tmp/binutils-gdb/ld/testsuite/ld-z8k
SRCDIR=~/tmp/binutils-gdb/ld/testsuite/ld-z8k
set -e
z8k-coff-as -I $SRCDIR -o this-file.o $SRCDIR/this-file.s
z8k-coff-as -I $SRCDIR -o other-file.o $SRCDIR/other-file.s
z8k-coff-ld -o reloc.coff -L$SRCDIR -T reloc.ld this-file.o other-file.o
z8k-coff-objdump -dr reloc.coff
z8k-coff-as -z8001 -I $SRCDIR -o this-fileseg.o $SRCDIR/this-file.s
z8k-coff-as -z8001 -I $SRCDIR -o other-fileseg.o $SRCDIR/other-file.s
z8k-coff-ld -o relocseg.coff -mz8001 -L$SRCDIR -T reloc.ld this-fileseg.o other-fileseg.o
z8k-coff-objdump -dr relocseg.coff
z8k-coff-ld -o relocseg2.coff -mz8001 -L$SRCDIR -T relocseg.ld this-fileseg.o other-fileseg.o
z8k-coff-objdump -dr relocseg2.coff

View File

@ -0,0 +1,50 @@
.text
.globl this_start, this_label, this_imm4_val
this_start:
nop
jr t,this_start
jr t,other_start
jp t,this_start
jp t,other_start
call other_start
call other_label
call this_start
call this_label
calr other_start
calr other_label
calr this_start
calr this_label
ld r1,other_data
ld r1,this_data
ld r1,#other_data
ld r1,#this_data
this_label:
ldb rl2,#this_data
ldb rl2,#this_data + 0x10
ldb rl2,#other_data
ldb rl2,#other_data + 0x10
! ldr r2,this_data
! ldr r2,other_data
bitb rl3,#other_imm4_val
nop
.set this_imm4_val, 10
.data
.ds.l 1
.globl this_data
this_data:
.word 0x1234
.ds.l 1
.end

View File

@ -0,0 +1,63 @@
# Expect script for ld-z8k tests
# Copyright (C) 2016 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 z8k linking; (not yet) all types of relocs. This tests the
# assembler and tools like objdump as well as the main target, the
# linker.
if ![istarget "z8k-*-*"] then {
return
}
set z8ktests {
{"z8k specific relocations (non-segmented)"
"-T reloc.ld"
""
"-z8002"
{this-file.s other-file.s}
{{objdump -dr reloc.dd}}
"reloc.prog"
}
{"z8k specific relocations (segmented, all in one segment)"
"-T reloc.ld"
"-mz8001"
"-z8001"
{this-file.s other-file.s}
{{objdump -dr relocseg1.dd}}
"relocseg1.prog"
}
{"z8k specific relocations (segmented, different segments)"
"-T relocseg.ld"
"-mz8001"
"-z8001"
{this-file.s other-file.s}
{{objdump -dr relocseg.dd}}
"relocseg.prog"
}
}
run_ld_link_tests $z8ktests
set z8k_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach z8k_test $z8k_test_list {
verbose [file rootname $z8k_test]
run_dump_test [file rootname $z8k_test]
}