From: Richard Biener Date: Thu, 5 Nov 2020 08:27:28 +0000 (+0100) Subject: debug/97718 - fix abstract origin references after last change X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1436ef2a57e79b6b8ce5b03e32a38dd64f46c97c;p=gcc.git debug/97718 - fix abstract origin references after last change The change to clear the external_die_map slot after creating the concrete instance DIE broke abstract origin processing which tried to make sure to have those point to the early abstract instance and not the concrete instance. The following restores this by eventually following the abstract origin link in the concrete instance. 2020-11-05 Richard Biener PR debug/97718 * dwarf2out.c (add_abstract_origin_attribute): Make sure to point to the abstract instance. --- diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 64ac94a8cbd..81cb7341a7e 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -21293,7 +21293,16 @@ add_abstract_origin_attribute (dw_die_ref die, tree origin) here. */ if (origin_die) - add_AT_die_ref (die, DW_AT_abstract_origin, origin_die); + { + dw_attr_node *a; + /* Like above, if we already created a concrete instance DIE + do not use that for the abstract origin but the early DIE + if present. */ + if (in_lto_p + && (a = get_AT (origin_die, DW_AT_abstract_origin))) + origin_die = AT_ref (a); + add_AT_die_ref (die, DW_AT_abstract_origin, origin_die); + } } /* We do not currently support the pure_virtual attribute. */