[lld] [lld][ELF] Add --debug-names to create merged .debug_names. (PR #86508)

Greg Clayton via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 15:33:56 PDT 2024


clayborg wrote:

Does this merge all .debug_names sections from all .o files into a single .debug_names section? If so this will cause problems with foreign type unit support when we use .debug_names with split DWARF. When we create a .dwp file, one of the type units from one of the .dwo files will end up in the .dwp file and then we have all of the accelerator tables from all copies of the same type unit in the final output file. Since type units are not always emitted the same, some accelerator table entries will have bad DIE offsets. Right now the only way for us to tell if a .debug_names entry matches the type unit it to look in the individual .debug_names table and see if it only has one compile unit. The type unit has a DW_AT_dwo_name attribute in it and if it matches the .dwo name for the one and only CU on the .debug_names table, we can trust it, else we ignore the entry. So if this patch makes a single .debug_names table, we lose this information and our .debug_names might have things pointing at the wrong name or contain DIE offsets that are in between two actual DIE entries in the foreign type units.

To see this in action, see this patch that is up for review right now: https://github.com/llvm/llvm-project/pull/87740



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


More information about the llvm-commits mailing list