Menu

#255 ld - add support for ELF symbol table and string table

None
closed-accepted
None
5
2016-05-13
2015-12-29
No

Hello SDCC team,

Here is a patch that gets the basics of the symbol table and string table working.

Its not 100% yet, but objdump can read and understand it, so its not all bad.

Please review/apply/reject.

The patch:

  • Adds missing types for stm8.
  • Finalizes dwarf otuput for stm8.
  • Adds support for outputting ELF symbol table and string table.

Thanks,

/pedro

1 Attachments

Discussion

  • Peter Dons Tychsen

    Here is the latest version of the patch.

    Improvements:

    • Prevent crash caused by missing STM8 handler.
    • Add all symbols to table, not just first module.
    • Set dwarf address size to 4, not 2.

    Any feedback would be great.

    Thanks,

    /pedro

     
  • Peter Dons Tychsen

    Ping. If someone could at least commit the part for stm8_genAssemblerEnd().

    The reason is that as soon as this is complete, i would like to send a request to ST to add official support for SDCC in their debugger. It actually works.... :-)

    Thanks,

    /pedro

     
    • Philipp Klaus Krause

      Ok, I'll look into it as soon as I find a bit of time. Probably monday or tuesday.

      Philipp

       
    • Philipp Klaus Krause

      The stm8/main.c part, and thus stm8_genAssemblerEnd() has been applied in revision #9483.

      Philipp

       
  • Philipp Klaus Krause

    Which version of the DWARF standard are you aiming for. AFAIK the current one is 4, but SDCC previously used 2, which is the worst version, since it does not have a formal specification.

    Philipp

     
  • Peter Dons Tychsen

    The stm8/main.c part, and thus stm8_genAssemblerEnd() has been applied in revision #9483.
    Good show. Thanks for the help (along with all the other help :-)).

    Which version of the DWARF standard are you aiming for. AFAIK the current one is 4, but SDCC previously used 2, which is the worst version, since it does not have a formal specification.

    Many embedded debuggers and tools i have come across simply do not or support later versions than version 2, even tough it is simply a draft. So my idea was really just to bug-fix the version 2 version so its works for tools like STs "visual develop". Other compilers that support compiling for it also just emit version 2 info. I think the reason is that for many embedded purposes the later version do not provide much extra functionality that is relevant for debugging small targets in C.

    That said, the support for version 2 seems quite complete in e.g. GNU objdump. The fact that the document was never ratified does not seem to impact that.

    So going forward i think if someone needs dwarf4 support it should be a seperate implementation that does not trash the current dwarf2 implementation as there are planty tools which only accept version 2 files possibly due to the reasons above. It would also be a shame to ruin the current dwarf2 as it frankly seems to work quite well and is fairly cleverly implemented. The way it embeds itself in the REL files is quite effective and resourceful. The only thing really missing is the handling og the .debug_lines info, which makes e.g. source debugging not work currently.

    Thanks,

    /pedro

     
  • Philipp Klaus Krause

    • status: open --> closed-accepted
    • assigned_to: Philipp Klaus Krause
    • Group: -->
     
  • Philipp Klaus Krause

    The rest got applied in revision #9559.

    Philipp

     

Log in to post a comment.