From: Richard Biener Date: Thu, 11 Jun 2015 12:44:56 +0000 (+0000) Subject: re PR debug/66503 (missing DW_AT_abstract_origin for cross-unit call sites) X-Git-Tag: releases/gcc-4.9.3~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=614a4f43b64d34613d4721b0119f4a090df4ff75;p=thirdparty%2Fgcc.git re PR debug/66503 (missing DW_AT_abstract_origin for cross-unit call sites) 2015-06-11 Richard Biener PR middle-end/66503 * dwarf2out.c (resolve_addr): Guard backport of PR66549 with in_lto_p. From-SVN: r224372 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17dda0a26763..aac374463d80 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-11 Richard Biener + + PR middle-end/66503 + * dwarf2out.c (resolve_addr): Guard backport of PR66549 + with in_lto_p. + 2015-06-10 Michael Meissner Backport from mainline: diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6543d81e93cd..6b4e83ad5660 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -23426,22 +23426,29 @@ resolve_addr (dw_die_ref die) { tree tdecl = SYMBOL_REF_DECL (a->dw_attr_val.v.val_addr); dw_die_ref tdie = lookup_decl_die (tdecl); - dw_die_ref cdie; if (tdie == NULL && DECL_EXTERNAL (tdecl) - && DECL_ABSTRACT_ORIGIN (tdecl) == NULL_TREE - && (cdie = lookup_context_die (DECL_CONTEXT (tdecl)))) + && DECL_ABSTRACT_ORIGIN (tdecl) == NULL_TREE) { - /* Creating a full DIE for tdecl is overly expensive and - at this point even wrong when in the LTO phase - as it can end up generating new type DIEs we didn't - output and thus optimize_external_refs will crash. */ - tdie = new_die (DW_TAG_subprogram, cdie, NULL_TREE); - add_AT_flag (tdie, DW_AT_external, 1); - add_AT_flag (tdie, DW_AT_declaration, 1); - add_linkage_attr (tdie, tdecl); - add_name_and_src_coords_attributes (tdie, tdecl); - equate_decl_number_to_die (tdecl, tdie); + dw_die_ref cdie; + if (!in_lto_p) + { + force_decl_die (tdecl); + tdie = lookup_decl_die (tdecl); + } + else if ((cdie = lookup_context_die (DECL_CONTEXT (tdecl)))) + { + /* Creating a full DIE for tdecl is overly expensive and + at this point even wrong when in the LTO phase + as it can end up generating new type DIEs we didn't + output and thus optimize_external_refs will crash. */ + tdie = new_die (DW_TAG_subprogram, cdie, NULL_TREE); + add_AT_flag (tdie, DW_AT_external, 1); + add_AT_flag (tdie, DW_AT_declaration, 1); + add_linkage_attr (tdie, tdecl); + add_name_and_src_coords_attributes (tdie, tdecl); + equate_decl_number_to_die (tdecl, tdie); + } } if (tdie) {