Bug 2073443 - addr2line shows DWARF errors for binaries built with clang 14
Summary: addr2line shows DWARF errors for binaries built with clang 14
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: binutils
Version: DTS 11.1 RHEL 7
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: alpha
: 9.1
Assignee: Nick Clifton
QA Contact: Miloš Prchlík
URL:
Whiteboard:
Depends On:
Blocks: 2074022 2074396 2076478 2087104
TreeView+ depends on / blocked
 
Reported: 2022-04-08 13:51 UTC by simon.giesecke
Modified: 2023-07-18 14:10 UTC (History)
7 users (show)

Fixed In Version: devtoolset-12-binutils-2.36.1-2.el7
Doc Type: No Doc Update
Doc Text:
If this bug requires documentation, please select an appropriate Doc Type value.
Clone Of:
: 2074022 2074396 2076478 (view as bug list)
Environment:
Last Closed: 2022-11-22 15:06:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker DTS-353 0 None Waiting on Customer [bz 1986304, 1986308] [Certification] Cluster among datacenters with quorum, supportability schema and best practices[ 2022-05-23 18:05:03 UTC
Red Hat Product Errata RHEA-2022:8584 0 None None None 2022-11-22 15:07:05 UTC

Description simon.giesecke 2022-04-08 13:51:49 UTC
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

Comment 1 Nick Clifton 2022-04-08 14:12:25 UTC
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.

Comment 6 Nick Clifton 2022-04-13 08:45:12 UTC
Fixed in devtoolset-12-binutils-2.36.1-2.el7

Comment 7 simon.giesecke 2022-04-13 13:43:31 UTC
> Fixed in devtoolset-12-binutils-2.36.1-2.el7

This Jira is about devtoolset-11, is this also going to be fixed?

Comment 8 Nick Clifton 2022-04-14 09:57:05 UTC
(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

Comment 9 simon.giesecke 2022-04-14 14:36:22 UTC
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.

Comment 10 Nick Clifton 2022-04-19 10:21:18 UTC
(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.

Comment 11 Miloš Prchlík 2022-05-19 13:43:39 UTC
I need to bump ITM to a later window to get more time for testing.

Comment 14 Miloš Prchlík 2022-06-03 12:05:33 UTC
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    
$

Comment 16 errata-xmlrpc 2022-11-22 15:06:57 UTC
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


Note You need to log in before you can comment on or make changes to this bug.