The following avoids adding DW_AT_inline attributes twice on which dsymutil complains. The duplicate attribute is caused by stray code I left in (I guess I hoped nothing ends up DECL_ABSTRACT_P ...). Thus the following patch removes it -- DW_AT_inline is solely set by dwarf2out_abstract_function now.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. The gdb testsuite shows no regression. Will commit once testing finished. Note the assert is deliberately restricted to DW_AT_inline for now given enabling it unconditionally fires left and right ... :/ (sth to fix, but only as followups) Richard. 2017-08-29 Richard Biener <rguent...@suse.de> * dwarf2out.c (add_dwarf_attr): When checking is enabled verify we do not add a DW_AT_inline attribute twice. (gen_subprogram_die): Remove code setting DW_AT_inline on DECL_ABSTRACT_P nodes. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 251401) +++ gcc/dwarf2out.c (working copy) @@ -4122,6 +4122,16 @@ add_dwarf_attr (dw_die_ref die, dw_attr_ if (die == NULL) return; + if (flag_checking) + { + /* Check we do not add duplicate attrs. Can't use get_AT here + because that recurses to the specification/abstract origin DIE. */ + dw_attr_node *a; + unsigned ix; + FOR_EACH_VEC_SAFE_ELT (die->die_attr, ix, a) + gcc_assert (a->dw_attr != attr->dw_attr || a->dw_attr != DW_AT_inline); + } + vec_safe_reserve (die->die_attr, 1); vec_safe_push (die->die_attr, *attr); } @@ -22082,28 +22092,6 @@ gen_subprogram_die (tree decl, dw_die_re add_AT_flag (subr_die, DW_AT_rvalue_reference, 1); } } - /* Tag abstract instances with DW_AT_inline. */ - else if (DECL_ABSTRACT_P (decl)) - { - if (DECL_DECLARED_INLINE_P (decl)) - { - if (cgraph_function_possibly_inlined_p (decl)) - add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined); - else - add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined); - } - else - { - if (cgraph_function_possibly_inlined_p (decl)) - add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined); - else - add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_not_inlined); - } - - if (DECL_DECLARED_INLINE_P (decl) - && lookup_attribute ("artificial", DECL_ATTRIBUTES (decl))) - add_AT_flag (subr_die, DW_AT_artificial, 1); - } /* For non DECL_EXTERNALs, if range information is available, fill the DIE with it. */ else if (!DECL_EXTERNAL (decl) && !early_dwarf)