mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Cleanup getRelocationAddend.
Realistically, this will be returning ErrorOr for some time as refactoring the user code to check once per section will take some time. Given that, use it for checking if a relocation has addend or not. While at it, add ELFRelocationRef to simplify the users. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241028 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -767,8 +767,8 @@ void RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj,
|
||||
if (RelSectionName != ".opd")
|
||||
continue;
|
||||
|
||||
for (relocation_iterator i = si->relocation_begin(),
|
||||
e = si->relocation_end();
|
||||
for (elf_relocation_iterator i = si->relocation_begin(),
|
||||
e = si->relocation_end();
|
||||
i != e;) {
|
||||
// The R_PPC64_ADDR64 relocation indicates the first field
|
||||
// of a .opd entry
|
||||
@@ -781,8 +781,7 @@ void RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj,
|
||||
|
||||
uint64_t TargetSymbolOffset = i->getOffset();
|
||||
symbol_iterator TargetSymbol = i->getSymbol();
|
||||
ErrorOr<int64_t> AddendOrErr =
|
||||
Obj.getRelocationAddend(i->getRawDataRefImpl());
|
||||
ErrorOr<int64_t> AddendOrErr = i->getAddend();
|
||||
Check(AddendOrErr.getError());
|
||||
int64_t Addend = *AddendOrErr;
|
||||
|
||||
@@ -1062,9 +1061,8 @@ relocation_iterator RuntimeDyldELF::processRelocationRef(
|
||||
const auto &Obj = cast<ELFObjectFileBase>(O);
|
||||
uint64_t RelType;
|
||||
Check(RelI->getType(RelType));
|
||||
int64_t Addend = 0;
|
||||
if (Obj.hasRelocationAddend(RelI->getRawDataRefImpl()))
|
||||
Addend = *Obj.getRelocationAddend(RelI->getRawDataRefImpl());
|
||||
ErrorOr<int64_t> AddendOrErr = ELFRelocationRef(*RelI).getAddend();
|
||||
int64_t Addend = AddendOrErr ? *AddendOrErr : 0;
|
||||
elf_symbol_iterator Symbol = RelI->getSymbol();
|
||||
|
||||
// Obtain the symbol name which is referenced in the relocation
|
||||
|
Reference in New Issue
Block a user