summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
index 85d6501a26..0c799bd7bc 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
@@ -25,22 +25,26 @@ using namespace llvm::object;
namespace llvm {
class RuntimeDyldMachO : public RuntimeDyldImpl {
- bool resolveI386Relocation(uint8_t *LocalAddress, uint64_t FinalAddress,
- uint64_t Value, bool isPCRel, unsigned Type,
- unsigned Size, int64_t Addend);
- bool resolveX86_64Relocation(uint8_t *LocalAddress, uint64_t FinalAddress,
- uint64_t Value, bool isPCRel, unsigned Type,
- unsigned Size, int64_t Addend);
- bool resolveARMRelocation(uint8_t *LocalAddress, uint64_t FinalAddress,
- uint64_t Value, bool isPCRel, unsigned Type,
- unsigned Size, int64_t Addend);
- bool resolveARM64Relocation(uint8_t *LocalAddress, uint64_t FinalAddress,
- uint64_t Value, bool IsPCRel, unsigned Type,
- unsigned Size, int64_t Addend);
-
- void resolveRelocation(const SectionEntry &Section, uint64_t Offset,
- uint64_t Value, uint32_t Type, int64_t Addend,
- bool isPCRel, unsigned Size);
+private:
+
+ /// Write the least significant 'Size' bytes in 'Value' out at the address
+ /// pointed to by Addr. Check for overflow.
+ bool applyRelocationValue(uint8_t *Addr, uint64_t Value, unsigned Size) {
+ for (unsigned i = 0; i < Size; ++i) {
+ *Addr++ = (uint8_t)Value;
+ Value >>= 8;
+ }
+
+ if (Value) // Catch overflow
+ return Error("Relocation out of range.");
+
+ return false;
+ }
+
+ bool resolveI386Relocation(const RelocationEntry &RE, uint64_t Value);
+ bool resolveX86_64Relocation(const RelocationEntry &RE, uint64_t Value);
+ bool resolveARMRelocation(const RelocationEntry &RE, uint64_t Value);
+ bool resolveARM64Relocation(const RelocationEntry &RE, uint64_t Value);
unsigned getMaxStubSize() override {
if (Arch == Triple::arm || Arch == Triple::thumb)