forked from OSchip/llvm-project
parent
33f250931c
commit
d285d3fbb7
|
@ -583,7 +583,7 @@ ELFDefinedAtom<ELFT> *ELFFile<ELFT>::createDefinedAtomAndAssignRelocations(
|
|||
template <class ELFT>
|
||||
void ELFFile<ELFT>::createRelocationReferences(const Elf_Sym *symbol,
|
||||
ArrayRef<uint8_t> content,
|
||||
range<Elf_Rela_Iter> rels) {
|
||||
range<const Elf_Rela *> rels) {
|
||||
bool isMips64EL = _objFile->isMips64EL();
|
||||
const auto symValue = getSymbolValue(symbol);
|
||||
for (const auto &rel : rels) {
|
||||
|
@ -601,7 +601,7 @@ template <class ELFT>
|
|||
void ELFFile<ELFT>::createRelocationReferences(const Elf_Sym *symbol,
|
||||
ArrayRef<uint8_t> symContent,
|
||||
ArrayRef<uint8_t> secContent,
|
||||
range<Elf_Rel_Iter> rels) {
|
||||
range<const Elf_Rel *> rels) {
|
||||
bool isMips64EL = _objFile->isMips64EL();
|
||||
const auto symValue = getSymbolValue(symbol);
|
||||
for (const auto &rel : rels) {
|
||||
|
|
|
@ -26,8 +26,6 @@ template <class ELFT> class ELFFile : public SimpleFile {
|
|||
typedef llvm::object::Elf_Shdr_Impl<ELFT> Elf_Shdr;
|
||||
typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
|
||||
typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
|
||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rela_Iter Elf_Rela_Iter;
|
||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rel_Iter Elf_Rel_Iter;
|
||||
typedef typename llvm::object::ELFFile<ELFT>::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<uint8_t> content,
|
||||
range<Elf_Rela_Iter> rels);
|
||||
range<const Elf_Rela *> rels);
|
||||
|
||||
/// \brief Iterate over Elf_Rel relocations list and create references.
|
||||
virtual void createRelocationReferences(const Elf_Sym *symbol,
|
||||
ArrayRef<uint8_t> symContent,
|
||||
ArrayRef<uint8_t> secContent,
|
||||
range<Elf_Rel_Iter> rels);
|
||||
range<const Elf_Rel *> 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<const Elf_Shdr *, range<Elf_Rela_Iter>>
|
||||
_relocationAddendReferences;
|
||||
std::unordered_map<const Elf_Shdr *, range<const Elf_Rela *>>
|
||||
_relocationAddendReferences;
|
||||
MergedSectionMapT _mergedSectionMap;
|
||||
std::unordered_map<const Elf_Shdr *, range<Elf_Rel_Iter>> _relocationReferences;
|
||||
std::unordered_map<const Elf_Shdr *, range<const Elf_Rel *>>
|
||||
_relocationReferences;
|
||||
std::vector<ELFReference<ELFT> *> _references;
|
||||
llvm::DenseMap<const Elf_Sym *, Atom *> _symbolToAtomMapping;
|
||||
llvm::DenseMap<const ELFReference<ELFT> *, const Elf_Sym *>
|
||||
|
|
|
@ -222,9 +222,9 @@ template <class ELFT> std::error_code MipsELFFile<ELFT>::readAuxData() {
|
|||
}
|
||||
|
||||
template <class ELFT>
|
||||
void MipsELFFile<ELFT>::createRelocationReferences(const Elf_Sym *symbol,
|
||||
ArrayRef<uint8_t> content,
|
||||
range<Elf_Rela_Iter> rels) {
|
||||
void MipsELFFile<ELFT>::createRelocationReferences(
|
||||
const Elf_Sym *symbol, ArrayRef<uint8_t> content,
|
||||
range<const Elf_Rela *> 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<ELFT>::createRelocationReferences(const Elf_Sym *symbol,
|
|||
}
|
||||
|
||||
template <class ELFT>
|
||||
void MipsELFFile<ELFT>::createRelocationReferences(const Elf_Sym *symbol,
|
||||
ArrayRef<uint8_t> symContent,
|
||||
ArrayRef<uint8_t> secContent,
|
||||
range<Elf_Rel_Iter> rels) {
|
||||
void MipsELFFile<ELFT>::createRelocationReferences(
|
||||
const Elf_Sym *symbol, ArrayRef<uint8_t> symContent,
|
||||
ArrayRef<uint8_t> secContent, range<const Elf_Rel *> 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<ELFT>::getPairRelocation(const Elf_Rel &rel) const {
|
|||
}
|
||||
|
||||
template <class ELFT>
|
||||
typename MipsELFFile<ELFT>::Elf_Rel_Iter
|
||||
const typename MipsELFFile<ELFT>::Elf_Rel *
|
||||
MipsELFFile<ELFT>::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<ELFT>()) ==
|
||||
|
|
|
@ -71,9 +71,8 @@ protected:
|
|||
private:
|
||||
typedef llvm::object::Elf_Sym_Impl<ELFT> Elf_Sym;
|
||||
typedef llvm::object::Elf_Shdr_Impl<ELFT> Elf_Shdr;
|
||||
typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
|
||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rel_Iter Elf_Rel_Iter;
|
||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rela_Iter Elf_Rela_Iter;
|
||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rel Elf_Rel;
|
||||
typedef typename llvm::object::ELFFile<ELFT>::Elf_Rela Elf_Rela;
|
||||
|
||||
enum { TP_OFFSET = 0x7000, DTP_OFFSET = 0x8000 };
|
||||
|
||||
|
@ -90,11 +89,11 @@ private:
|
|||
|
||||
void createRelocationReferences(const Elf_Sym *symbol,
|
||||
ArrayRef<uint8_t> content,
|
||||
range<Elf_Rela_Iter> rels) override;
|
||||
range<const Elf_Rela *> rels) override;
|
||||
void createRelocationReferences(const Elf_Sym *symbol,
|
||||
ArrayRef<uint8_t> symContent,
|
||||
ArrayRef<uint8_t> secContent,
|
||||
range<Elf_Rel_Iter> rels) override;
|
||||
range<const Elf_Rel *> 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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue