summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-10-11 16:56:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-10-11 16:56:33 +0000
commit1a0e5a19336128d2bca4daef506345f92a6ae587 (patch)
tree8a0c74b030d6e3acc5f8996ea9da0099d658f7e1 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
parentbf626195df1df24c46ba258278f7ce91844dd212 (diff)
downloadbcm5719-llvm-1a0e5a19336128d2bca4daef506345f92a6ae587.tar.gz
bcm5719-llvm-1a0e5a19336128d2bca4daef506345f92a6ae587.zip
Convert an ErrorOr to Expected.
getRelocationAddend should never be called on non SHT_RELA sections, but changing that requires changing RelocVisitor.h. llvm-svn: 315473
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index d4f22ad05b5..b32b842e657 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -611,7 +611,7 @@ Error RuntimeDyldELF::findOPDEntrySection(const ELFObjectFileBase &Obj,
if (auto AddendOrErr = i->getAddend())
Addend = *AddendOrErr;
else
- return errorCodeToError(AddendOrErr.getError());
+ return AddendOrErr.takeError();
++i;
if (i == e)
@@ -1079,8 +1079,11 @@ RuntimeDyldELF::processRelocationRef(
ObjSectionToIDMap &ObjSectionToID, StubMap &Stubs) {
const auto &Obj = cast<ELFObjectFileBase>(O);
uint64_t RelType = RelI->getType();
- ErrorOr<int64_t> AddendOrErr = ELFRelocationRef(*RelI).getAddend();
- int64_t Addend = AddendOrErr ? *AddendOrErr : 0;
+ int64_t Addend = 0;
+ if (Expected<int64_t> AddendOrErr = ELFRelocationRef(*RelI).getAddend())
+ Addend = *AddendOrErr;
+ else
+ consumeError(AddendOrErr.takeError());
elf_symbol_iterator Symbol = RelI->getSymbol();
// Obtain the symbol name which is referenced in the relocation
OpenPOWER on IntegriCloud