From 80c5ad359f30c86d48a04c080785606a2701ab71 Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Thu, 18 Aug 2016 14:39:22 +0000 Subject: [PATCH] DWARF: do not emit DW_TAG_variable to materialize DWARF procedures Hello, For -gdwarf-3 and newer, the DWARF back-end sometimes generates DWARF procedures to factorize complex location descriptions. DWARF procedures can be materialized as DW_TAG_dwarf_procedure DIEs, but actually any DIE that can hold a DW_AT_location attribute is also accepted. Unlike what I thought at some point, the DW_TAG_dwarf_procedure tag was introduced in the DWARFv3 standard, not the DWARFv4 one, so the back-end can always emit DW_TAG_dwarf_procedure DIEs, as this simplifies code and prevents the types pruning pass from missing a DWARF procedure. Boostrapped and regtested on x86_64-linux: no regression. Ok to commit? Thank you in advance! gcc/ * dwarf2out.c (copy_dwarf_procedure): Remove obsolete comment. (new_dwarf_proc_die): Emit DW_TAG_dwarf_procedure DIEs even for -gdwarf-3. (function_to_dwarf_procedure): Update comment. From-SVN: r239575 --- gcc/ChangeLog | 7 +++++++ gcc/dwarf2out.c | 16 ++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb870117a3c..505e66eae01 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-08-18 Pierre-Marie de Rodat + + * dwarf2out.c (copy_dwarf_procedure): Remove obsolete comment. + (new_dwarf_proc_die): Emit DW_TAG_dwarf_procedure DIEs even for + -gdwarf-3. + (function_to_dwarf_procedure): Update comment. + 2016-08-18 David Malcolm * input.c (diagnostics_file_cache_forcibly_evict_file): New diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 0fdab9a3198..98f08b7f65b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -7747,9 +7747,6 @@ copy_dwarf_procedure (dw_die_ref die, comdat_type_node *type_node, hash_map &copied_dwarf_procs) { - /* We do this for COMDAT section, which is DWARFv4 specific, so - DWARF procedure are always DW_TAG_dwarf_procedure DIEs (unlike - DW_TAG_variable in DWARFv3). */ gcc_assert (die->die_tag == DW_TAG_dwarf_procedure); /* DWARF procedures are not supposed to have children... */ @@ -15332,22 +15329,15 @@ static dw_die_ref new_dwarf_proc_die (dw_loc_descr_ref location, tree fndecl, dw_die_ref parent_die) { - const bool dwarf_proc_supported = dwarf_version >= 4; dw_die_ref dwarf_proc_die; if ((dwarf_version < 3 && dwarf_strict) || location == NULL) return NULL; - dwarf_proc_die = new_die (dwarf_proc_supported - ? DW_TAG_dwarf_procedure - : DW_TAG_variable, - parent_die, - fndecl); + dwarf_proc_die = new_die (DW_TAG_dwarf_procedure, parent_die, fndecl); if (fndecl) equate_decl_number_to_die (fndecl, dwarf_proc_die); - if (!dwarf_proc_supported) - add_AT_flag (dwarf_proc_die, DW_AT_artificial, 1); add_AT_loc (dwarf_proc_die, DW_AT_location, location); return dwarf_proc_die; } @@ -15673,9 +15663,7 @@ function_to_dwarf_procedure (tree fndecl) if (dwarf_proc_die != NULL) return dwarf_proc_die; - /* DWARF procedures are available starting with the DWARFv3 standard, but - it's the DWARFv4 standard that introduces the DW_TAG_dwarf_procedure - DIE. */ + /* DWARF procedures are available starting with the DWARFv3 standard. */ if (dwarf_version < 3 && dwarf_strict) return NULL; -- 2.30.2