https://sourceware.org/bugzilla/show_bug.cgi?id=28012
Bug ID: 28012 Summary: readelf --debug-dump=Ranges doesn't handle concatenated .debug_rnglists sections Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: simark at simark dot ca Target Milestone: --- See attached libstdc++.so.6.0.29, taken from: https://mirror.f4st.host/archlinux/core/os/x86_64/gcc-libs-11.1.0-1-x86_64.pkg.tar.zst (the link may be broken when the package gets upgraded, but it doesn't really matter, the attached file should be enough) It's compiled with gcc, contains DWARF5, and contains a .debug_rnglists section. The .debug_rnglists section is made by concatenating the .debug_rnglists contributions from all .o files, so it's made of multiple range list tables, one after the other (each range list table is described in section 7.28 of DWARF5). It looks like readelf tries to read the whole section as one table or something, because after having displayed the entries of the first table, it shows a bunch of: $ ~/build/binutils-gdb/binutils/readelf --debug-dump=Ranges libstdc++.so.6.0.29 |& less ... 000004d8 00000000000a3580 00000000000a359b 000004e2 00000000000a35a0 00000000000a35b3 000004ec <End of list> readelf: Warning: Corrupt offset (0x000004f9) in range entry 72 readelf: Warning: Corrupt offset (0x000004f9) in range entry 73 readelf: Warning: Corrupt offset (0x00000509) in range entry 74 ... I tried to debug display_debug_ranges, in binutils/dwarf.c, but I don't really understand what's happening. The code uses num_debug_info_entries, I'm not sure where that is coming from. But I don't see why it would be needed to deal with debug info entries here, I think it should be possible to parse and dump .debug_rnglists by just walking the section by itself until the end. -- You are receiving this mail because: You are on the CC list for the bug.