On Tue, 27 Sep 2016, Jason Merrill wrote: > OK.
May I ping https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01835.html then on which this depends? Thanks, Richard. > On Tue, Sep 27, 2016 at 9:47 AM, Richard Biener <rguent...@suse.de> wrote: > > > > This is moving break_out_includes (aka -feliminate-dwarf2-dups handling) > > to early finish. It requires some massaging with the way we pick > > up its results which previously "conveniently" ended up in the > > limbo list but after moving to early will be scrapped off by > > late finish doing a limbo list flush (where we just drop all CU DIEs > > thinking it can only be comp_unit_die () itself). Thus this patch > > adds a cu_die_list list for it (much similar to the comdat one we already > > have). > > > > Eventually -feliminate-dwarf2-dups might die anyway(?), its testing > > coverage is very low and it's declared broken for C++. > > > > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. > > > > Ok for trunk? > > > > Thanks, > > Richard. > > > > 2016-09-27 Richard Biener <rguent...@suse.de> > > > > * dwarf2out.c (cu_die_list): New global. > > (dwarf2out_finish): Walk cu_die_list instead of limbo DIEs. Add > > main_comp_unit_die to cu_die_list if we created it. > > Move break_out_includes ... > > (dwarf2out_early_finish): ... here. Push created CU DIEs onto > > the cu_die_list. > > > > diff -u gcc/dwarf2out.c gcc/dwarf2out.c > > --- gcc/dwarf2out.c (working copy) > > +++ gcc/dwarf2out.c (working copy) > > @@ -2866,6 +2866,9 @@ > > /* A list of type DIEs that have been separated into comdat sections. */ > > static GTY(()) comdat_type_node *comdat_type_list; > > > > +/* A list of CU DIEs that have been separated. */ > > +static GTY(()) limbo_die_node *cu_die_list; > > + > > /* A list of DIEs with a NULL parent waiting to be relocated. */ > > static GTY(()) limbo_die_node *limbo_die_list; > > > > @@ -27855,11 +27858,6 @@ > > resolve_addr (comp_unit_die ()); > > move_marked_base_types (); > > > > - /* Generate separate CUs for each of the include files we've seen. > > - They will go into limbo_die_list. */ > > - if (flag_eliminate_dwarf2_dups) > > - break_out_includes (comp_unit_die ()); > > - > > /* Initialize sections and labels used for actual assembler output. */ > > init_sections_and_labels (); > > > > @@ -27867,7 +27865,7 @@ > > have children. */ > > add_sibling_attributes (comp_unit_die ()); > > limbo_die_node *node; > > - for (node = limbo_die_list; node; node = node->next) > > + for (node = cu_die_list; node; node = node->next) > > add_sibling_attributes (node->die); > > for (ctnode = comdat_type_list; ctnode != NULL; ctnode = ctnode->next) > > add_sibling_attributes (ctnode->root_die); > > @@ -27876,7 +27874,15 @@ > > skeleton compile_unit DIE that remains in the .o, while > > most attributes go in the DWO compile_unit_die. */ > > if (dwarf_split_debug_info) > > - main_comp_unit_die = gen_compile_unit_die (NULL); > > + { > > + limbo_die_node *cu; > > + main_comp_unit_die = gen_compile_unit_die (NULL); > > + cu = limbo_die_list; > > + gcc_assert (cu->die == main_comp_unit_die); > > + limbo_die_list = limbo_die_list->next; > > + cu->next = cu_die_list; > > + cu_die_list = cu; > > + } > > else > > main_comp_unit_die = comp_unit_die (); > > > > @@ -27988,7 +27994,7 @@ > > > > /* Output all of the compilation units. We put the main one last so that > > the offsets are available to output_pubnames. */ > > - for (node = limbo_die_list; node; node = node->next) > > + for (node = cu_die_list; node; node = node->next) > > output_comp_unit (node->die, 0); > > > > hash_table<comdat_type_hasher> comdat_type_table (100); > > @@ -28217,6 +28223,21 @@ > > prune_unused_types (); > > } > > > > + /* Generate separate CUs for each of the include files we've seen. > > + They will go into limbo_die_list and from there to cu_die_list. */ > > + if (flag_eliminate_dwarf2_dups) > > + { > > + gcc_assert (limbo_die_list == NULL); > > + break_out_includes (comp_unit_die ()); > > + limbo_die_node *cu; > > + while ((cu = limbo_die_list)) > > + { > > + limbo_die_list = cu->next; > > + cu->next = cu_die_list; > > + cu_die_list = cu; > > + } > > + } > > + > > /* The early debug phase is now finished. */ > > early_dwarf_finished = true; > > } > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)