#2048 Simple HC08 program cannot be output to ELF

hc08 port (43)

I really wanted to use the ELF format in my project, but I could not get a simple test working.

int main()
return 0;

sdcc test.c -mhc08 --out-fmt-elf
test.asm:99: Error: <o> .org in REL area or directive / mnemonic error
test.asm:105: Error: <o> .org in REL area or directive / mnemonic error
removing test.rel


  • Lee Morrison

    Lee Morrison - 2012-06-19

    A bit of experimenting reveals that the sdas08 assembler does not like statement like:

    S(null)$main$4 ==.

    which only show up when the -out-fmt-elf option is present.
    You may try to add the "--debug" option before the -out-fmt-elf as a work-around.

    The above assembly lines are generated by hc08_emitDebuggerSymbol .
    Turning on --debug removes the "(null)" from the assembly code generated.

    Aside from that, both the assembly code and
    the assembler options (-plosgffw) match.

  • Blake W. Ford

    Blake W. Ford - 2012-06-20

    --debug does work. However the code bloat is a serious complication.

  • Maarten Brock

    Maarten Brock - 2012-06-20


    Can you elaborate on that?
    What do you consider code bloat?
    And why do you prefer the ELF format if it is not for debugging info?


  • Blake W. Ford

    Blake W. Ford - 2012-06-20

    I'd like something binary as my final output format, and there are many existing tools to parse ELF files. I suppose I am not completely tied to the format, but my domain knowledge / desktop programming consistency is the real driver.

  • Erik Petrich

    Erik Petrich - 2012-09-06
    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
  • Erik Petrich

    Erik Petrich - 2012-09-06

    Fixed in revision #8087.
    Although --debug fixed the problem with the assembly generated, there were also some bugs in the linker that corrupted the debug sections and the interrupt vector section in the ELF file.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks