summaryrefslogtreecommitdiff
path: root/include/llvm/Object/RelocVisitor.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Object/RelocVisitor.h')
-rw-r--r--include/llvm/Object/RelocVisitor.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/include/llvm/Object/RelocVisitor.h b/include/llvm/Object/RelocVisitor.h
index f80ee0a8a7a20..950e2ed0e3389 100644
--- a/include/llvm/Object/RelocVisitor.h
+++ b/include/llvm/Object/RelocVisitor.h
@@ -240,16 +240,14 @@ private:
}
int64_t getELFAddend(RelocationRef R) {
- const auto *Obj = cast<ELFObjectFileBase>(R.getObjectFile());
- DataRefImpl DRI = R.getRawDataRefImpl();
- ErrorOr<int64_t> AddendOrErr = Obj->getRelocationAddend(DRI);
+ ErrorOr<int64_t> AddendOrErr = ELFRelocationRef(R).getAddend();
if (std::error_code EC = AddendOrErr.getError())
report_fatal_error(EC.message());
return *AddendOrErr;
}
uint8_t getLengthMachO64(RelocationRef R) {
- const MachOObjectFile *Obj = cast<MachOObjectFile>(R.getObjectFile());
+ const MachOObjectFile *Obj = cast<MachOObjectFile>(R.getObject());
return Obj->getRelocationLength(R.getRawDataRefImpl());
}
@@ -267,8 +265,7 @@ private:
}
RelocToApply visitELF_386_PC32(RelocationRef R, uint64_t Value) {
- uint64_t Address;
- R.getOffset(Address);
+ uint64_t Address = R.getOffset();
return RelocToApply(Value - Address, 4);
}
@@ -282,8 +279,7 @@ private:
}
RelocToApply visitELF_X86_64_PC32(RelocationRef R, uint64_t Value) {
int64_t Addend = getELFAddend(R);
- uint64_t Address;
- R.getOffset(Address);
+ uint64_t Address = R.getOffset();
return RelocToApply(Value + Addend - Address, 4);
}
RelocToApply visitELF_X86_64_32(RelocationRef R, uint64_t Value) {
@@ -412,6 +408,6 @@ private:
}
};
-} // namespace object
-} // namespace llvm
+}
+}
#endif