-gdwarf-5 -fdebug-types-section may produce multiple .debug_info sections. All
except one are type units (.debug_types before DWARF v5). When constructing
.gdb_index, we should ignore these type units. We use a simple heuristic: the
compile unit does not have the SHF_GROUP flag. (This needs to be revisited if
people place compile unit .debug_info in COMDAT groups.)
This issue revealsmanifests as a data race: because an object file may have multiple .debug_info
sections, we may concurrently construct LLDDwarfObj for the same file..debug_info sections, If InputSectionBase::data()we may concurrently construct LLDDwarfObj for the same
is compressed,file. when calling `::uncompress` in one threadIf InputSectionBase::data() is compressed, this will trigger a race if another threadwhen calling `::uncompress` in
is also accessing the content.one thread, this will trigger a race if another thread is also accessing the
content.
The new test gdb-index-dwarf5-type-unit.s actually has two compile units. This
cannot be produced with regular approaches (it can be produced with -r
--unique). This is used to demonstrate that the .gdb_index construction code
only considers the last non-SHF_GROUP .debug_info