[llvm] [DWARFVerifier] Fix debug_str_offsets DWARF version detection (PR #81210)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 08:49:28 PST 2024


felipepiovezan wrote:

> The legacy DWARFv4 Split DWARF mode str offsets format can only appear in .dwo files (it was/is never emitted into .o files - many of the Split DWARF features that were generalized to be applicable to .o files (& to non-split DWARF entirely) were not done in the prototype/legacy version, only in the DWARFv5 standard version)
> 
> And a DWP file can't contain mixed 4/5 Split DWARF anyway - so I think we could leave the "use the first CU version" in place, but only do it for .debug_str_offsets.dwo - and always use the header-ful parsing of .debug_str_offsets (nondwo) - it'll be future proof and can mix/match versions because it'll always have the length+version encoding.
> 
> Does that make sense/work?

I think this makes sense, thank you, let me give this a try and update the patch!
`DWARFVerifier::handleDebugStrOffsets` calls `DWARFVerifier::verifyDebugStrOffsets` twice, once for the `dwo` version and once for the non-dwo version; that might be the place we can make this distinction. 

https://github.com/llvm/llvm-project/pull/81210


More information about the llvm-commits mailing list