+2016-09-27 Richard Biener <rguenther@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.
+
2016-09-28 Richard Biener <rguenther@suse.de>
* dwarf2out.c (struct die_struct): Add removed flag.
/* 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;
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 ();
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);
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 ();
/* 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);
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;
}