--gdb-index currently crashes when reading a translation unit with
DWARF v5 .debug_loclists . Call stack:
SyntheticSections.cpp GdbIndexSection::create SyntheticSections.cpp readAddressAreas DWARFUnit.cpp DWARFUnit::tryExtractDIEsIfNeeded DWARFListTable.cpp DWARFListTableHeader::extract ... DWARFDataExtractor.cpp DWARFDataExtractor::getRelocatedValue lld/ELF/DWARF.cpp LLDDwarfObj<ELFT>::find (sec.sec is nullptr) ...
This patch adds support for .debug_loclists to make DWARFUnit::tryExtractDIEsIfNeeded happy.
Building --gdb-index does not need .debug_loclists