8000 ld65 outputs wrong HIGH relocation for undefined references · Issue #2066 · cc65/cc65 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
ld65 outputs wrong HIGH relocation for undefined references #2066
Open
@ghost

Description

From http://www.6502.org/users/andre/o65/fileformat.html:
If the segment is "undefined", the typebyte is immediately followed by the two (mode size=0) or four (mode size=1) byte value index in the undefined references list. If it is a high byte relocation, the low byte is saved behind the index value. The index value determines the undefined reference, which must be looked up by the loader.

So, given the code:

lda #>sys_exit

The relocation info should be ?? 40 00 00 00, but it's currently ?? 40 00 00

Current ld65/o65.c, lines 752 to 759 read:

    } else if (ED.ExtRef) {
        /* Imported symbol */
        RelocType |= O65SEG_UNDEF;
        O65RelocPutByte (D->CurReloc, RelocType);
        /* Put the number of the imported symbol into the table */
        O65RelocPutWord (D->CurReloc, ExtSymNum (ED.ExtRef));

    } else {

but I guess after outputting the index of the imported symbol, it needs the code from lines 742 to 750:

       /* Output additional data if needed */
        switch (RelocType & O65RELOC_MASK) {
            case O65RELOC_HIGH:
                O65RelocPutByte (D->CurReloc, ED.Val & 0xFF);
                break;
            case O65RELOC_SEG:
                O65RelocPutWord (D->CurReloc, ED.Val & 0xFFFF);
                break;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0