Index: lld/trunk/ELF/InputFiles.h =================================================================== --- lld/trunk/ELF/InputFiles.h +++ lld/trunk/ELF/InputFiles.h @@ -194,7 +194,6 @@ StringRef SourceFile; private: - InputSectionBase *getSection(uint32_t Index) const; void initializeSections(llvm::DenseSet &ComdatGroups); void initializeSymbols(); Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -599,19 +599,14 @@ this->Symbols.push_back(createSymbol(&Sym)); } -template -InputSectionBase *ObjFile::getSection(uint32_t Index) const { - if (Index == 0) - return nullptr; - if (Index >= this->Sections.size()) - fatal(toString(this) + ": invalid section index: " + Twine(Index)); - return this->Sections[Index]; -} - template Symbol *ObjFile::createSymbol(const Elf_Sym *Sym) { int Binding = Sym->getBinding(); - InputSectionBase *Sec = getSection(this->getSectionIndex(*Sym)); + uint32_t SecIdx = this->getSectionIndex(*Sym); + if (SecIdx >= this->Sections.size()) + fatal(toString(this) + ": invalid section index: " + Twine(SecIdx)); + + InputSectionBase *Sec = this->Sections[SecIdx]; uint8_t StOther = Sym->st_other; uint8_t Type = Sym->getType(); uint64_t Value = Sym->st_value;