summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-30 00:33:59 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-30 00:33:59 +0000
commit71784d611d211c07efc5686ee795dfd7907ff7b5 (patch)
tree16302475dc33ca705c9c5bde5b29dba0268bf12d /llvm/lib/ExecutionEngine
parentbd23647379440b0c0edd2d6e694934c71f7002f9 (diff)
downloadbcm5719-llvm-71784d611d211c07efc5686ee795dfd7907ff7b5.tar.gz
bcm5719-llvm-71784d611d211c07efc5686ee795dfd7907ff7b5.zip
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. llvm-svn: 241028
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index b303e300470..6311c6ec5e4 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -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
OpenPOWER on IntegriCloud