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 <rguenther@suse.de>
PR debug/97718
* dwarf2out.c (add_abstract_origin_attribute): Make sure to
point to the abstract instance.
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. */