On 01/13/2014 07:12 AM, Senthil Kumar Selvaraj wrote:
I have been hacking a bit on dwarf2out.c to make gcc generate DWARF information that gets discarded along with the appropriate function section code when compiled with -ffunction-sections and then linked with --gc-sections. Currently, debug information for discarded functions is not removed, and this could cause the debugger to get confused.
I did a bunch of work on doing this for COMDAT functions, but never finished it. You can find my WIP in the jason/comdat-debug branch in git. Want to integrate that with your work?
Before going on, I thought I'd ask if my approach is right (and doable). Did I read the standard right?
The first problem I notice with your output is that your separate CUs need to start with DW_TAG_compile_unit or DW_TAG_partial_unit. DW_TAG_imported_unit should not contain other DIEs, it just refers to another unit DIE.
Jason