This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Emit DWARF5 DW_AT_export_symbols for namespaces
- From: Jason Merrill <jason at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>, Marek Polacek <polacek at redhat dot com>
- Date: Fri, 28 Jul 2017 15:44:21 -0400
- Subject: Re: [PATCH] Emit DWARF5 DW_AT_export_symbols for namespaces
- Authentication-results: sourceware.org; auth=none
- References: <20170721203312.GL2123@tucnak>
On Fri, Jul 21, 2017 at 4:33 PM, Jakub Jelinek <jakub@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