Created attachment 12787 [details] Problematic .elf file I have multiple embedded C++ projects that - as part of the compilation process - produce also assembly listing with command similar to this one: $ arm-none-eabi-objdump -S --demangle distortosTest.elf > distortosTest.lss This worked flawlessly up to (and including) previous release of binutils. In 2.35 something changed. The assembly listing is still generated and it seems to be correct (I did not check it very thoroughly), the command ends with no fatal errors (it returns "0" to the shell), however I see multiple errors like these: arm-none-eabi-objdump: DWARF error: could not find variable specification at offset 2f9 arm-none-eabi-objdump: DWARF error: could not find variable specification at offset 305 arm-none-eabi-objdump: DWARF error: could not find variable specification at offset 311 ... If I take the .elf file produced by the "new" toolchain (it also includes GCC 10.2) and do the command above but with objdump from the "old" toolchain (binutils 2.34), then there is no error. In a reversed scenario (.elf produced by "old" toolchain, passed to "new" objdump) I see 10x more errors like the ones above. I attach the problematic .elf file for ARM Cortex-M4 which produces such errors. After further inspection it turns out that none of "my" .o object files or .a archives produce such error. When examining toolchain libraries, such errors are produced by only ONE library there - libstdc++.a. arm-none-eabi-objdump -S --demangle libstdc++.a > libstdc++.lss arm-none-eabi-objdump: DWARF error: could not find variable specification at offset 76c arm-none-eabi-objdump: DWARF error: could not find variable specification at offset 1733 arm-none-eabi-objdump: DWARF error: could not find variable specification at offset 1740 ... (a lot...) No other toolchain libraries or toolchain object files produce such error, only libstdc++.a. At this moment I cannot confirm whether or not this is arm-none-eabi specific or not, as Arch Linux still has binutils 2.34 in the repos.
Created attachment 12788 [details] Problematic libstdc++.a file I also attach the .a archive which generates such errors (to be specific: arm-none-eabi/lib/thumb/v7e-m/nofp/libstdc++.a, however every libstdc++.a variant from the toolchain produces these errors).
the message looks similar to https://sourceware.org/bugzilla/show_bug.cgi?id=26518
I think that this is a bug in the DWARF parser in the BFD library. Testing a local patch now...
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6f04d55f681149a69102a73937d0987719c3f16 commit e6f04d55f681149a69102a73937d0987719c3f16 Author: Nick Clifton <nickc@redhat.com> Date: Sat Aug 29 08:03:15 2020 +0100 Include members in the variable table used when resolving DW_AT_specification tags. PR 26520 * dwarf2.c (scan_unit_for_symbols): Add member entries to the variable table.
Hi Freddie, I have applied a patch which should fix this problem. Please can you give it a go and let me know if it works for you ? Cheers Nick
I had the same problem and I can confirm that this change fixes my problem. Thanks!
The patch has resolved the problem.
The issue is fixed for me too - thanks!
Please consider backporting this fix to the 2.35 branch. Thank you!
The binutils-2_35-branch branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=269d40a2ef3b020b5beb3f3de5b8e909c43ab53b commit 269d40a2ef3b020b5beb3f3de5b8e909c43ab53b Author: Nick Clifton <nickc@redhat.com> Date: Thu Sep 24 13:42:04 2020 +0100 Import patch from mainline to fix decoding DWARF information in the BFD library. PR 26520 * dwarf2.c (scan_unit_for_symbols): Add member entries to the variable table.
(In reply to Frank Mehnert from comment #9) > Please consider backporting this fix to the 2.35 branch. Done.
Greatly appreciated. Thanks!
*** Bug 26914 has been marked as a duplicate of this bug. ***