This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Debuggin info for unused sections
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.