From ecccbf02cbc678ca8b295757137a6a5b954c5f3c Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 28 Sep 2016 14:31:04 +0000 Subject: [PATCH] 2016-09-27 Richard Biener * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240579 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/dwarf2out.c | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c03ac5358ef..3c708605b6c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-09-27 Richard Biener + + * 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 * dwarf2out.c (struct die_struct): Add removed flag. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b6d6aceb917..972da16492f 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2866,6 +2866,9 @@ static GTY(()) dw_die_ref single_comp_unit_die; /* 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 @@ dwarf2out_finish (const char *) 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 @@ dwarf2out_finish (const char *) 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 @@ dwarf2out_finish (const char *) 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 @@ dwarf2out_finish (const char *) /* 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_table (100); @@ -28217,6 +28223,21 @@ dwarf2out_early_finish (const char *filename) 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; } -- 2.11.4.GIT