bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/30781] New: Ranges section dump is broken if both ranges a


From: sevaa at sprynet dot com
Subject: [Bug binutils/30781] New: Ranges section dump is broken if both ranges and rnglists sections are present
Date: Fri, 18 Aug 2023 19:41:54 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30781

            Bug ID: 30781
           Summary: Ranges section dump is broken if both ranges and
                    rnglists sections are present
           Product: binutils
           Version: 2.42 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: sevaa at sprynet dot com
  Target Milestone: ---

Created attachment 15071
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15071&action=edit
dwarf_test_versions_mix.elf

Run the following with the attached binary:

readelf --debug-dump=Ranges dwarf_test_versions_mix.elf

For the .debug_ranges section, it outputs the following:


    Offset   Begin    End
    00000000 0000000000001040 0000000000001060
    00000000 <End of list>
    0000000c <End of list>
readelf: Warning: Corrupt offset (0x2d) in range entry 2

That's wrong, there is only one rangelist in that section, at 0. The error
stems from the way readelf enumerates rangelists - it scrolls through all DIEs
in the binary and picks the value of DW_AT_ranges. In case of a split v4/v5
binary, like this one, the logic of enumeration should be version aware; when
looking at a DIE, it should check whether the DIE in a DWARFv5 CU or in a
DWARFv4- one; the rangelist offsets in the former point at .debug_rnglists
section, not at the .debug_ranges one.

Specifically for this binary, the bogus rangelist offsets 0xc and 0x2d come
DIEs in the CUs for crti.S and crtn.S, which are both DWARFv5.

Chances are, dumping debug_rnglists is affected by the same issue, and a
parallel issue plagues the loclist sections dump; the loclists sections for
DWARF v4- and for DWARFv5 may also coexist in the same binary.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]