Created attachment 10092 [details] Here is the file used for testing For the z80-unknown-coff target ld produces a wrong output for call instructions, I'm sure it happens in ld because the object file generated by as does not have the error. This produces wrong executable code from well written z80 source code. As an example: start: ld A, 0 add A, 5 sub 4 call loop loop: jr loop after assembling it with "z80-unknown-coff-as a.asm -o a.o -z80" and disassembling it with "z80-unknown-coff-objdump a.o -d" the output is the following: a.o: file format coff-z80 Disassembly of section .text: 00000000 <start>: 0: 3e 00 ld a,0x00 2: c6 05 add a,0x05 4: d6 04 sub 0x04 6: cd 09 00 call 0x0009 00000009 <loop>: 9: 18 fe jr 0x0009 which does not have any errors at all, but after linking it I got the following output: 3E 00 C6 05 D6 04 CD 09 01 18 FE instead of: 3E 00 C6 05 D6 04 CD 09 00 18 FE which is the correct output I should get.
It is correct. Default linker script (*.ld file) contains 0x100 offset for .text. So produces binary should be loaded at address 0x100. It is done for CP/M compatibility (it is described by comment in the *.ld script). You may create your own linker script and place code in any location.
Please close the bug as invalid.
closing