https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87472

--- Comment #3 from Mark Wielaard <mark at gcc dot gnu.org> ---
(In reply to Mark Wielaard from comment #2)
> (In reply to Richard Biener from comment #1)
> > Confirmed with GCC 8 and just -g3 -gsplit-dwarf.  readelf isn't very verbose
> > of which macro section it complains about though...
> > 
> > Mark?
> 
> With -gsplit-dwarf the .debug_macro section (actually the .debug_macro.dwo
> section) goes into the .dwo file. readelf is complaining about the second
> and third such section. But there really should only be one debug_macro
> section. Need to figure out why.

It is by design, see output_macinfo ():

  /* If any DW_MACRO_import were used, on those DW_MACRO_import entries         
     terminate the current chain and switch to a new comdat .debug_macinfo      
     section and emit the define/undef entries within it.  */                   

Which makes sense for normal .o files because the linker will resolve the
references and comdat sections. But not for .dwo files.

It isn't clear to me how DW_MACRO_import would work for split-dwarf. It looks
like there is no clear mechanism for it that would work. Which seems to mean
that for split-dwarf we should not use it. Which would be somewhat painful
since then we cannot easily deduplicate macro definitions anymore. It would
have to be done by some post-processor (dwp or dwz?) that finds duplicates and
(re)creates the .debug_macro section.

Reply via email to