diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.cpp b/lld/lib/ReaderWriter/ELF/ELFFile.cpp index a825b3d3977f..cac34bad0fac 100644 --- a/lld/lib/ReaderWriter/ELF/ELFFile.cpp +++ b/lld/lib/ReaderWriter/ELF/ELFFile.cpp @@ -583,7 +583,7 @@ ELFDefinedAtom *ELFFile::createDefinedAtomAndAssignRelocations( template void ELFFile::createRelocationReferences(const Elf_Sym *symbol, ArrayRef content, - range rels) { + range rels) { bool isMips64EL = _objFile->isMips64EL(); const auto symValue = getSymbolValue(symbol); for (const auto &rel : rels) { @@ -601,7 +601,7 @@ template void ELFFile::createRelocationReferences(const Elf_Sym *symbol, ArrayRef symContent, ArrayRef secContent, - range rels) { + range rels) { bool isMips64EL = _objFile->isMips64EL(); const auto symValue = getSymbolValue(symbol); for (const auto &rel : rels) { diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.h b/lld/lib/ReaderWriter/ELF/ELFFile.h index f222bb76707a..3543ca066a89 100644 --- a/lld/lib/ReaderWriter/ELF/ELFFile.h +++ b/lld/lib/ReaderWriter/ELF/ELFFile.h @@ -26,8 +26,6 @@ template class ELFFile : public SimpleFile { typedef llvm::object::Elf_Shdr_Impl Elf_Shdr; typedef llvm::object::Elf_Rel_Impl Elf_Rel; typedef llvm::object::Elf_Rel_Impl Elf_Rela; - typedef typename llvm::object::ELFFile::Elf_Rela_Iter Elf_Rela_Iter; - typedef typename llvm::object::ELFFile::Elf_Rel_Iter Elf_Rel_Iter; typedef typename llvm::object::ELFFile::Elf_Word Elf_Word; // A Map is used to hold the atoms that have been divided up @@ -137,13 +135,13 @@ protected: /// \brief Iterate over Elf_Rela relocations list and create references. virtual void createRelocationReferences(const Elf_Sym *symbol, ArrayRef content, - range rels); + range rels); /// \brief Iterate over Elf_Rel relocations list and create references. virtual void createRelocationReferences(const Elf_Sym *symbol, ArrayRef symContent, ArrayRef secContent, - range rels); + range rels); /// \brief After all the Atoms and References are created, update each /// Reference's target with the Atom pointer it refers to. @@ -327,10 +325,11 @@ protected: /// list of relocations references. In ELF, if a section named, ".text" has /// relocations will also have a section named ".rel.text" or ".rela.text" /// which will hold the entries. - std::unordered_map> - _relocationAddendReferences; + std::unordered_map> + _relocationAddendReferences; MergedSectionMapT _mergedSectionMap; - std::unordered_map> _relocationReferences; + std::unordered_map> + _relocationReferences; std::vector *> _references; llvm::DenseMap _symbolToAtomMapping; llvm::DenseMap *, const Elf_Sym *> diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp index 398d302d29b0..85c649627181 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.cpp @@ -222,9 +222,9 @@ template std::error_code MipsELFFile::readAuxData() { } template -void MipsELFFile::createRelocationReferences(const Elf_Sym *symbol, - ArrayRef content, - range rels) { +void MipsELFFile::createRelocationReferences( + const Elf_Sym *symbol, ArrayRef content, + range rels) { const auto value = this->getSymbolValue(symbol); for (const auto &rel : rels) { if (rel.r_offset < value || value + content.size() <= rel.r_offset) @@ -236,12 +236,12 @@ void MipsELFFile::createRelocationReferences(const Elf_Sym *symbol, } template -void MipsELFFile::createRelocationReferences(const Elf_Sym *symbol, - ArrayRef symContent, - ArrayRef secContent, - range rels) { +void MipsELFFile::createRelocationReferences( + const Elf_Sym *symbol, ArrayRef symContent, + ArrayRef secContent, range rels) { const auto value = this->getSymbolValue(symbol); - for (Elf_Rel_Iter rit = rels.begin(), eit = rels.end(); rit != eit; ++rit) { + for (const Elf_Rel *rit = rels.begin(), *eit = rels.end(); rit != eit; + ++rit) { if (rit->r_offset < value || value + symContent.size() <= rit->r_offset) continue; @@ -303,10 +303,10 @@ uint32_t MipsELFFile::getPairRelocation(const Elf_Rel &rel) const { } template -typename MipsELFFile::Elf_Rel_Iter +const typename MipsELFFile::Elf_Rel * MipsELFFile::findMatchingRelocation(uint32_t pairRelType, - Elf_Rel_Iter rit, - Elf_Rel_Iter eit) const { + const Elf_Rel *rit, + const Elf_Rel *eit) const { return std::find_if(rit, eit, [&](const Elf_Rel &rel) { return getPrimaryType(rel) == pairRelType && rel.getSymbol(isMips64EL()) == diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h index 4e1b5a08e890..1865a47a15fb 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -71,9 +71,8 @@ protected: private: typedef llvm::object::Elf_Sym_Impl Elf_Sym; typedef llvm::object::Elf_Shdr_Impl Elf_Shdr; - typedef llvm::object::Elf_Rel_Impl Elf_Rel; - typedef typename llvm::object::ELFFile::Elf_Rel_Iter Elf_Rel_Iter; - typedef typename llvm::object::ELFFile::Elf_Rela_Iter Elf_Rela_Iter; + typedef typename llvm::object::ELFFile::Elf_Rel Elf_Rel; + typedef typename llvm::object::ELFFile::Elf_Rela Elf_Rela; enum { TP_OFFSET = 0x7000, DTP_OFFSET = 0x8000 }; @@ -90,11 +89,11 @@ private: void createRelocationReferences(const Elf_Sym *symbol, ArrayRef content, - range rels) override; + range rels) override; void createRelocationReferences(const Elf_Sym *symbol, ArrayRef symContent, ArrayRef secContent, - range rels) override; + range rels) override; const Elf_Shdr *findSectionByType(uint64_t type) const; const Elf_Shdr *findSectionByFlags(uint64_t flags) const; @@ -114,8 +113,9 @@ private: uint32_t getPairRelocation(const Elf_Rel &rel) const; - Elf_Rel_Iter findMatchingRelocation(uint32_t pairRelType, Elf_Rel_Iter rit, - Elf_Rel_Iter eit) const; + const Elf_Rel *findMatchingRelocation(uint32_t pairRelType, + const Elf_Rel *rit, + const Elf_Rel *eit) const; bool isLocalBinding(const Elf_Rel &rel) const; };