https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90441
--- Comment #25 from rguenther at suse dot de <rguenther at suse dot de> --- On Sun, 26 May 2019, hoganmeier at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90441 > > --- Comment #22 from krux <hoganmeier at gmail dot com> --- > I can also reproduce it without any linker script, simplified code: > > int serial3_available() {} > struct HardwareSerial3 { > int available() { serial3_available(); } > }; > HardwareSerial3 Serial3; > > void yield() { serial3_available(); } > int main() > { > yield(); > } > > $ g++-9 -c -fno-exceptions -fno-rtti -flto -g -O2 main.cpp > $ g++-9 -o firmware.elf -g -O2 main.o > $ nm -ClS --radix=d --size-sort firmware.elf > 0000000000004496 0000000000000001 T __libc_csu_fininm: DWARF error: could not > find abbrev number 8 I fear this is the libbfd dwarf reader simply not coping with DW_AT_abstract_origin in other CUs, being confused as to which abbrev section it needs to look into (probably using that of the refering CU instead of the referred to one). We have Compilation Unit @ offset 0xce: Length: 0x7a (32-bit) Version: 4 Abbrev Offset: 0x64 Pointer Size: 8 <0><d9>: Abbrev Number: 1 (DW_TAG_compile_unit) <da> DW_AT_producer : (indirect string, offset: 0x1ac): GNU GIMPLE 9.1. 0 -mtune=generic -march=x86-64 -g -O2 -O2 -fno-openmp -fno-openacc -fno-pie -flt rans with 5 abbrev entries refering to the DIE: Compilation Unit @ offset 0x14c: Length: 0x83 (32-bit) Version: 4 Abbrev Offset: 0xb9 Pointer Size: 8 <0><157>: Abbrev Number: 1 (DW_TAG_compile_unit) <158> DW_AT_producer : (indirect string, offset: 0x26f): GNU C++14 9.1. 0 -mtune=generic -march=x86-64 -g -O2 -fno-exceptions -fno-rtti -flto ... <1><1aa>: Abbrev Number: 8 (DW_TAG_subprogram) <1ab> DW_AT_external : 1 <1ab> DW_AT_name : (indirect string, offset: 0x2cc): main <1af> DW_AT_decl_file : 1 <1b0> DW_AT_decl_line : 8 <1b1> DW_AT_decl_column : 5 <1b2> DW_AT_type : <0x191> so I think this is a BFD bug and to be filed in sourceware bugzilla (probably enough to have an actual binary with this kind of DWARF as testcase). Disclaimer: I didn't actually see whether my guess above is true (but it looks so obvious ;))