mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Remove Elf_Rela_Iter and Elf_Rel_Iter.
Use just the pointers and check for invalid relocation sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242700 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -689,29 +689,25 @@ template<class ELFT>
|
||||
void ELFDumper<ELFT>::printDynamicRelocations() {
|
||||
W.startLine() << "Dynamic Relocations {\n";
|
||||
W.indent();
|
||||
for (typename ELFO::Elf_Rela_Iter RelI = Obj->dyn_rela_begin(),
|
||||
RelE = Obj->dyn_rela_end();
|
||||
RelI != RelE; ++RelI) {
|
||||
for (const typename ELFO::Elf_Rela &Rel : Obj->dyn_relas()) {
|
||||
SmallString<32> RelocName;
|
||||
Obj->getRelocationTypeName(RelI->getType(Obj->isMips64EL()), RelocName);
|
||||
Obj->getRelocationTypeName(Rel.getType(Obj->isMips64EL()), RelocName);
|
||||
StringRef SymbolName;
|
||||
uint32_t SymIndex = RelI->getSymbol(Obj->isMips64EL());
|
||||
uint32_t SymIndex = Rel.getSymbol(Obj->isMips64EL());
|
||||
const typename ELFO::Elf_Sym *Sym = Obj->dynamic_symbol_begin() + SymIndex;
|
||||
SymbolName = errorOrDefault(Obj->getSymbolName(Sym, true));
|
||||
if (opts::ExpandRelocs) {
|
||||
DictScope Group(W, "Relocation");
|
||||
W.printHex("Offset", RelI->r_offset);
|
||||
W.printNumber("Type", RelocName, (int)RelI->getType(Obj->isMips64EL()));
|
||||
W.printHex("Offset", Rel.r_offset);
|
||||
W.printNumber("Type", RelocName, (int)Rel.getType(Obj->isMips64EL()));
|
||||
W.printString("Symbol", SymbolName.size() > 0 ? SymbolName : "-");
|
||||
W.printHex("Addend", RelI->r_addend);
|
||||
W.printHex("Addend", Rel.r_addend);
|
||||
}
|
||||
else {
|
||||
raw_ostream& OS = W.startLine();
|
||||
OS << W.hex(RelI->r_offset)
|
||||
<< " " << RelocName
|
||||
<< " " << (SymbolName.size() > 0 ? SymbolName : "-")
|
||||
<< " " << W.hex(RelI->r_addend)
|
||||
<< "\n";
|
||||
OS << W.hex(Rel.r_offset) << " " << RelocName << " "
|
||||
<< (SymbolName.size() > 0 ? SymbolName : "-") << " "
|
||||
<< W.hex(Rel.r_addend) << "\n";
|
||||
}
|
||||
}
|
||||
W.unindent();
|
||||
@ -722,22 +718,17 @@ template <class ELFT>
|
||||
void ELFDumper<ELFT>::printRelocations(const Elf_Shdr *Sec) {
|
||||
switch (Sec->sh_type) {
|
||||
case ELF::SHT_REL:
|
||||
for (typename ELFO::Elf_Rel_Iter RI = Obj->rel_begin(Sec),
|
||||
RE = Obj->rel_end(Sec);
|
||||
RI != RE; ++RI) {
|
||||
for (const typename ELFO::Elf_Rel &R : Obj->rels(Sec)) {
|
||||
typename ELFO::Elf_Rela Rela;
|
||||
Rela.r_offset = RI->r_offset;
|
||||
Rela.r_info = RI->r_info;
|
||||
Rela.r_offset = R.r_offset;
|
||||
Rela.r_info = R.r_info;
|
||||
Rela.r_addend = 0;
|
||||
printRelocation(Sec, Rela);
|
||||
}
|
||||
break;
|
||||
case ELF::SHT_RELA:
|
||||
for (typename ELFO::Elf_Rela_Iter RI = Obj->rela_begin(Sec),
|
||||
RE = Obj->rela_end(Sec);
|
||||
RI != RE; ++RI) {
|
||||
printRelocation(Sec, *RI);
|
||||
}
|
||||
for (const typename ELFO::Elf_Rela &R : Obj->relas(Sec))
|
||||
printRelocation(Sec, R);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1371,8 +1362,8 @@ template <class ELFT> void MipsGOTParser<ELFT>::parsePLT() {
|
||||
|
||||
switch (PLTRelShdr->sh_type) {
|
||||
case ELF::SHT_REL:
|
||||
for (typename ObjectFile::Elf_Rel_Iter RI = Obj->rel_begin(PLTRelShdr),
|
||||
RE = Obj->rel_end(PLTRelShdr);
|
||||
for (const typename ObjectFile::Elf_Rel *RI = Obj->rel_begin(PLTRelShdr),
|
||||
*RE = Obj->rel_end(PLTRelShdr);
|
||||
RI != RE && It != PLTEnd; ++RI, ++It) {
|
||||
const Elf_Sym *Sym =
|
||||
Obj->getRelocationSymbol(&*PLTRelShdr, &*RI).second;
|
||||
@ -1380,8 +1371,9 @@ template <class ELFT> void MipsGOTParser<ELFT>::parsePLT() {
|
||||
}
|
||||
break;
|
||||
case ELF::SHT_RELA:
|
||||
for (typename ObjectFile::Elf_Rela_Iter RI = Obj->rela_begin(PLTRelShdr),
|
||||
RE = Obj->rela_end(PLTRelShdr);
|
||||
for (const typename ObjectFile::Elf_Rela
|
||||
*RI = Obj->rela_begin(PLTRelShdr),
|
||||
*RE = Obj->rela_end(PLTRelShdr);
|
||||
RI != RE && It != PLTEnd; ++RI, ++It) {
|
||||
const Elf_Sym *Sym =
|
||||
Obj->getRelocationSymbol(&*PLTRelShdr, &*RI).second;
|
||||
|
Reference in New Issue
Block a user