Description of problem: addr2line shows DWARF errors ("DWARF error: could not find variable specification at offset ...") Version-Release number of selected component (if applicable): devtoolset-11-binutils-2.36.1-1.el7.1 How reproducible: Running on proprietary binaries built with clang 14. If necessary, I guess I can reproduce this with some public sources. Actual results: scl enable devtoolset-11 -- addr2line -e <path_to_binary> <some_address_of_a_function_in_binary> addr2line: DWARF error: could not find variable specification at offset 40 addr2line: DWARF error: could not find variable specification at offset 2a00f addr2line: DWARF error: could not find variable specification at offset 2a082 addr2line: DWARF error: could not find variable specification at offset 2a1c7 addr2line: DWARF error: could not find variable specification at offset 2a25d addr2line: DWARF error: could not find variable specification at offset 2a2f3 addr2line: DWARF error: could not find variable specification at offset 2a366 addr2line: DWARF error: could not find variable specification at offset 2a3fd /path/to/Foo.hpp:264 Expected results: scl enable devtoolset-11 -- addr2line -e <path_to_binary> <some_address_of_a_function_in_binary> /path/to/Foo.hpp:264 Additional info: I bisected https://github.com/bminor/binutils-gdb and found that the following commit from 2.37 fixes the issue (though I don't know if this patch alone fixes the issue or if it can be applied cleanly to 2.36.1): ca8f6bc629cb27792ce449e7253c74a3f6f75fda is the first fixed commit commit ca8f6bc629cb27792ce449e7253c74a3f6f75fda Author: Nick Clifton <nickc> Date: Tue Mar 2 16:08:23 2021 +0000 Fix the BFD library's parsing of DIEs where specification attributes can refer to variables that are defined later on. PR 27484 * dwarf2.c (scan_unit_for_symbols): Scan twice, once to accumulate function and variable tags and a second time to resolve their attributes. bfd/ChangeLog | 7 ++++ bfd/dwarf2.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 114 insertions(+), 26 deletions(-) bisect run success
That patch will fix the problem, but it does introduce a new issue - it appreciably slows down tools like addr2line. Fortunately there is a later patch which removes this delay in all but certain corner cases, so I will apply that one too.
Fixed in devtoolset-12-binutils-2.36.1-2.el7
> Fixed in devtoolset-12-binutils-2.36.1-2.el7 This Jira is about devtoolset-11, is this also going to be fixed?
(In reply to simon.giesecke from comment #7) Hi Simon, > This Jira is about devtoolset-11, is this also going to be fixed? Fixing devtoolset-11 would mean a z-stream update. I assume that you are able to use gdb as an alternative to addr2line for the purposes of connecting addresses to source code lines, so is a backport to DTS-11 really important to you ? We can do it, I just want to be sure that it is something that you really need. Cheers Nick
In principle gdb provides the functionality as well, but the relevant processes here use addr2line. Since devtoolset-12-binutils is a whole different package than devtoolset-11-binutils (it's not just packaging a different upstream version) and provides addr2line at different paths resp. requires adapting scl enable calls, switching to that would add a whole extra dimension of complexity. So a backport to DTS-11 would help a lot.
(In reply to simon.giesecke from comment #9) > Since devtoolset-12-binutils is a whole different package than > devtoolset-11-binutils (it's not just packaging a different upstream > version) and provides addr2line at different paths resp. requires adapting > scl enable calls, switching to that would add a whole extra dimension of > complexity. So a backport to DTS-11 would help a lot. Fair enough. I have created a separate BZ for a backport of the patch to DTS-11: https://bugzilla.redhat.com/show_bug.cgi?id=2076478 I need to work out how to set the z-stream marker on it, but once that is done I should be able to apply the patch and build a new rpm.
I need to bump ITM to a later window to get more time for testing.
Verified with devtoolset-12-binutils-2.36.1-2.el7: $ rpm -q devtoolset-12-binutils devtoolset-12-binutils-2.36.1-2.el7.x86_64 $ scl enable devtoolset-12 -- objdump -S object-file.o object-file.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 <_Z30YearDatatypeValidatorserializev>: 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: 5d pop %rbp 5: c3 ret $
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (new packages: devtoolset-12-binutils), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2022:8584