Debuggin info for unused sections

Tristan Gingold gingold@adacore.com
Wed Jan 4 11:27:00 GMT 2012


On Jan 4, 2012, at 12:19 PM, nick clifton wrote:

> Hi Praveen,
> 
>> While using -gc-sections to remove unused sections, the section is removed but the debug info in not removed.
> 
>> Is this expected?
> 
> Yes.
> 
> > Can we completely remove the debug info for unused section?
> 
> It *could* be done, but it would take some effort.
> 
> The assembler would have to generate .debug_line.<foo> sections containing the line number debug information for each .main.<foo> section, and ensure that there is a relocation referencing .main.<foo> inside .debug_line.<foo>.  Then the linker would have to be taught that it can garbage collect *some* debug sections (ie .debug_line).

Wouldn't be possible to compact debug sections (i.e. discarding bytes corresponding to garbage collected sections) ?  Might be even more work however, but will be cleaner wrt to .dwarf_info.

Tristan.



More information about the Binutils mailing list