From 68317985439c7eb789bd3046b633130fec03e52c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 20 Sep 2016 07:37:53 +0000 Subject: [PATCH] debug.h (gcc_debug_hooks): Add filename parameter to early_finish hook. 2016-09-20 Richard Biener * debug.h (gcc_debug_hooks): Add filename parameter to early_finish hook. * debug.c (do_nothing_debug_hooks): Adjust. * dbxout.c (dbx_debug_hooks): Likewise. * sdbout.c (sdb_debug_hooks): Likewise. * dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise. (dwarf2out_finish): Move producer, filename and path annotation ... (dwarf2out_early_finish): ... here. Remove in_lto_p special-casing. * cgraphunit.c (symbol_table::finalize_compilation_unit): Adjust. lto/ * lto.c (lto_main): Call early_finish with "" as filename. From-SVN: r240255 --- gcc/ChangeLog | 13 +++++++++++ gcc/cgraphunit.c | 2 +- gcc/dbxout.c | 2 +- gcc/debug.c | 2 +- gcc/debug.h | 2 +- gcc/dwarf2out.c | 55 +++++++++++++++++++++-------------------------- gcc/lto/ChangeLog | 5 +++++ gcc/lto/lto.c | 2 +- gcc/sdbout.c | 2 +- 9 files changed, 49 insertions(+), 36 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e42b2e77f4e..5b35f9224fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2016-09-20 Richard Biener + + * debug.h (gcc_debug_hooks): Add filename parameter to early_finish + hook. + * debug.c (do_nothing_debug_hooks): Adjust. + * dbxout.c (dbx_debug_hooks): Likewise. + * sdbout.c (sdb_debug_hooks): Likewise. + * dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise. + (dwarf2out_finish): Move producer, filename and + path annotation ... + (dwarf2out_early_finish): ... here. Remove in_lto_p special-casing. + * cgraphunit.c (symbol_table::finalize_compilation_unit): Adjust. + 2016-09-19 Bernd Edlinger PR c++/77434 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 6a1d1267202..eb611c1d74c 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2561,7 +2561,7 @@ symbol_table::finalize_compilation_unit (void) /* Clean up anything that needs cleaning up after initial debug generation. */ - (*debug_hooks->early_finish) (); + (*debug_hooks->early_finish) (main_input_filename); } /* Finally drive the pass manager. */ diff --git a/gcc/dbxout.c b/gcc/dbxout.c index ad256c706a0..5485a6cbc88 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -344,7 +344,7 @@ const struct gcc_debug_hooks dbx_debug_hooks = { dbxout_init, dbxout_finish, - debug_nothing_void, + debug_nothing_charstar, debug_nothing_void, debug_nothing_int_charstar, debug_nothing_int_charstar, diff --git a/gcc/debug.c b/gcc/debug.c index 9c2caaea695..3d658e883b8 100644 --- a/gcc/debug.c +++ b/gcc/debug.c @@ -26,7 +26,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks = { debug_nothing_charstar, debug_nothing_charstar, - debug_nothing_void, /* early_finish */ + debug_nothing_charstar, /* early_finish */ debug_nothing_void, debug_nothing_int_charstar, debug_nothing_int_charstar, diff --git a/gcc/debug.h b/gcc/debug.h index 6711f8bd620..34b63d7c590 100644 --- a/gcc/debug.h +++ b/gcc/debug.h @@ -31,7 +31,7 @@ struct gcc_debug_hooks void (* finish) (const char *main_filename); /* Run cleanups necessary after early debug generation. */ - void (* early_finish) (void); + void (* early_finish) (const char *main_filename); /* Called from cgraph_optimize before starting to assemble functions/variables/toplevel asms. */ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 10f8ba93a15..61c515207f6 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2480,7 +2480,7 @@ build_cfa_aligned_loc (dw_cfa_location *cfa, static void dwarf2out_init (const char *); static void dwarf2out_finish (const char *); -static void dwarf2out_early_finish (void); +static void dwarf2out_early_finish (const char *); static void dwarf2out_assembly_start (void); static void dwarf2out_define (unsigned int, const char *); static void dwarf2out_undef (unsigned int, const char *); @@ -2556,7 +2556,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks = { dwarf2out_init, debug_nothing_charstar, - debug_nothing_void, + debug_nothing_charstar, debug_nothing_void, debug_nothing_int_charstar, debug_nothing_int_charstar, @@ -27804,7 +27804,7 @@ flush_limbo_die_list (void) and generate the DWARF-2 debugging info. */ static void -dwarf2out_finish (const char *filename) +dwarf2out_finish (const char *) { comdat_type_node *ctnode; dw_die_ref main_comp_unit_die; @@ -27816,34 +27816,8 @@ dwarf2out_finish (const char *filename) DIEs generated after early finish. */ gcc_assert (deferred_asm_name == NULL); - /* PCH might result in DW_AT_producer string being restored from the - header compilation, so always fill it with empty string initially - and overwrite only here. */ - dw_attr_node *producer = get_AT (comp_unit_die (), DW_AT_producer); - producer_string = gen_producer_string (); - producer->dw_attr_val.v.val_str->refcount--; - producer->dw_attr_val.v.val_str = find_AT_string (producer_string); - gen_remaining_tmpl_value_param_die_attribute (); - /* Add the name for the main input file now. We delayed this from - dwarf2out_init to avoid complications with PCH. - For LTO produced units use a fixed artificial name to avoid - leaking tempfile names into the dwarf. */ - if (!in_lto_p) - add_name_attribute (comp_unit_die (), remap_debug_filename (filename)); - else - add_name_attribute (comp_unit_die (), ""); - if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir) - add_comp_dir_attribute (comp_unit_die ()); - else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL) - { - bool p = false; - file_table->traverse (&p); - if (p) - add_comp_dir_attribute (comp_unit_die ()); - } - #if ENABLE_ASSERT_CHECKING { dw_die_ref die = comp_unit_die (), c; @@ -28151,10 +28125,31 @@ dwarf2out_finish (const char *filename) has run. */ static void -dwarf2out_early_finish (void) +dwarf2out_early_finish (const char *filename) { set_early_dwarf s; + /* PCH might result in DW_AT_producer string being restored from the + header compilation, so always fill it with empty string initially + and overwrite only here. */ + dw_attr_node *producer = get_AT (comp_unit_die (), DW_AT_producer); + producer_string = gen_producer_string (); + producer->dw_attr_val.v.val_str->refcount--; + producer->dw_attr_val.v.val_str = find_AT_string (producer_string); + + /* Add the name for the main input file now. We delayed this from + dwarf2out_init to avoid complications with PCH. */ + add_name_attribute (comp_unit_die (), remap_debug_filename (filename)); + if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir) + add_comp_dir_attribute (comp_unit_die ()); + else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL) + { + bool p = false; + file_table->traverse (&p); + if (p) + add_comp_dir_attribute (comp_unit_die ()); + } + /* With LTO early dwarf was really finished at compile-time, so make sure to adjust the phase after annotating the LTRANS CU DIE. */ if (in_lto_p) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index c5bd7a07a6e..67fc164aad9 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2016-09-20 Richard Biener + + * lto.c (lto_main): Call early_finish with "" as + filename. + 2016-09-19 Richard Biener * lto.c (lto_main): Invoke early_finish debug hook. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index c94ed622307..ecd30b99574 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -3316,7 +3316,7 @@ lto_main (void) lto_promote_statics_nonwpa (); /* Annotate the CU DIE and mark the early debug phase as finished. */ - debug_hooks->early_finish (); + debug_hooks->early_finish (""); /* Let the middle end know that we have read and merged all of the input files. */ diff --git a/gcc/sdbout.c b/gcc/sdbout.c index dc52716391e..7eea772bed7 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -277,7 +277,7 @@ const struct gcc_debug_hooks sdb_debug_hooks = { sdbout_init, /* init */ sdbout_finish, /* finish */ - debug_nothing_void, /* early_finish */ + debug_nothing_charstar, /* early_finish */ debug_nothing_void, /* assembly_start */ debug_nothing_int_charstar, /* define */ debug_nothing_int_charstar, /* undef */ -- 2.30.2