bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/21565] New: Z80: Incorrect linkage of call instructions


From: tgalbers2000 at gmail dot com
Subject: [Bug ld/21565] New: Z80: Incorrect linkage of call instructions
Date: Sun, 11 Jun 2017 19:14:30 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=21565

            Bug ID: 21565
           Summary: Z80: Incorrect linkage of call instructions
           Product: binutils
           Version: 2.28
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: tgalbers2000 at gmail dot com
  Target Milestone: ---

Created attachment 10092
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10092&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]