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.