Index: lld/COFF/InputFiles.cpp =================================================================== --- lld/COFF/InputFiles.cpp +++ lld/COFF/InputFiles.cpp @@ -207,12 +207,6 @@ COFFSymbolRef Sym, const coff_aux_section_definition *Def) { SectionChunk *Parent = SparseChunks[Def->getNumber(Sym.isBigObj())]; - // If the parent is pending, it probably means that its section definition - // appears after us in the symbol table. Leave the associated section as - // pending; we will handle it during the second pass in initializeSymbols(). - if (Parent == PendingComdat) - return; - // Check whether the parent is prevailing. If it is, so are we, and we read // the section; otherwise mark it as discarded. int32_t SectionNumber = Sym.getSectionNumber(); @@ -366,20 +360,15 @@ return Leader; } - // Read associative section definitions and prepare to handle the comdat - // leader symbol by setting the section's ComdatDefs pointer if we encounter a - // non-associative comdat. + // Prepare to handle the comdat leader symbol by setting the section's + // ComdatDefs pointer if we encounter a non-associative comdat. if (SparseChunks[SectionNumber] == PendingComdat) { - if (auto *Def = Sym.getSectionDefinition()) { - if (Def->Selection == IMAGE_COMDAT_SELECT_ASSOCIATIVE) - readAssociativeDefinition(Sym, Def); - else + if (auto *Def = Sym.getSectionDefinition()) + if (Def->Selection != IMAGE_COMDAT_SELECT_ASSOCIATIVE) ComdatDefs[SectionNumber] = Def; - } + return None; } - if (SparseChunks[SectionNumber] == PendingComdat) - return None; return createRegular(Sym); }