[Patch debug] Do not emit debug sections until they are required.

IainS developer@sandoe-acoustics.co.uk
Wed Nov 3 13:55:00 GMT 2010


Hi Richard,

On 2 Nov 2010, at 20:58, Richard Henderson wrote:

> On 11/02/2010 05:23 AM, IainS wrote:
>> -  dw2_asm_output_offset (DWARF_OFFSET_SIZE,  
>> debug_info_section_label,
>> +  if (info_section_emitted)
>> +    dw2_asm_output_offset (DWARF_OFFSET_SIZE,  
>> debug_info_section_label,
>> 			 debug_info_section,
>> 			 "Offset of Compilation Unit Info");
>> +  else
>> +    dw2_asm_output_data (4, 0, "No Debug Info Section");
>
> This is the only hunk that concerns me.  I don't believe that this
> is valid dwarf.  In particular, a non-empty pubnames implies that
> we must have had an info section from which to pull the names.
>
> Did you have a test case that caused you to make this change?
> If not, ok with gcc_assert (info_section_emitted).

not a test-case -- but Java achieves it ...
... and with the gcc_assert (), fails to bootstrap on i686-darwin.

.. because I've removed the unconditional emitting of the section  
switch in dwarf2_init()
now the section is only emitted _if_ there's actually a switch to it....
(so without the assert we would simply fail later with a not-found- 
label in the assembler).

-

If it is unconditionally necessary to emit a (potentially empty)  
section - that can still easily be handled from dwarf2_finish() ...
..  is an empty info section valid?
(I noted, also, the comment about some targets not liking empty debug  
sections).

Iain

also, ISTR that maybe only darwin is using pubnames (so maybe no other  
platform would notice).
(I seem to recall some traffic about this on the list, but not exactly  
the when, why and outcome).



More information about the Gcc-patches mailing list