On Fri, Jul 21, 2017 at 4:33 PM, Jakub Jelinek <ja...@redhat.com> wrote: > DWARF5 introduced DW_AT_export_symbols that may be preset on > DW_TAG_namespace or DW_TAG_{structure,union,class}_type to signalize > inline or anonymous namespaces or anonymous structures/unions/classes. > > What we were emitting instead is an implicit DW_TAG_imported_module > in the outer namespace. > > The following patch changes nothing for -gdwarf-4 and below with > -gstrict-dwarf, for -gdwarf-4 and below -gno-strict-dwarf it > just adds DW_AT_export_symbols to inline namespaces (so that interested > consumers can find out it is inline namespace, but consumers not knowing > about DW_AT_export_symbols still have the implicit DW_TAG_imported_module). > In that mode, no changes for anonymous namespaces, because those > are already easily detectable by the consumers (missing DW_AT_name). > For -gdwarf-5 it emits DW_AT_export_symbols on both inline namespaces > and anonymous namespaces and doesn't emit the implicit > DW_TAG_imported_module, which is shorter. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK. > This patch doesn't do anything about anon struct/union/class, I've tried > to handle it, the problem is that ANON_AGGR_TYPE_P flag is set too late, > after the debug hook adds the type DIE. Any thoughts on how to handle that? Hmm, I guess we want to call rest_of_type_compilation again after we set ANON_AGGR_TYPE_P, and adjust the debug back-ends to handle that; I see that gen_struct_or_union_type_die already handles being called again to fill in variable-length fields. Jason