summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-05-09 00:11:18 +0000
committerLang Hames <lhames@gmail.com>2014-05-09 00:11:18 +0000
commit7e2946b4e881f4e0774b25d3b45bb8e71d159ea7 (patch)
tree8ac11ffc6d2ae94c559101011837004778a519a7 /lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h
parente4a3254c02abd659f8808aed750c69f808907298 (diff)
downloadllvm-7e2946b4e881f4e0774b25d3b45bb8e71d159ea7.tar.gz
llvm-7e2946b4e881f4e0774b25d3b45bb8e71d159ea7.tar.bz2
llvm-7e2946b4e881f4e0774b25d3b45bb8e71d159ea7.tar.xz
[RuntimeDyld] Unify the RuntimeDyldMachO resolve.*Relocation method signatures
around RelocationEntries, rather than passing the same information via loose arguments. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208375 91177308-0d34-0410-b5e6-96231b3b80d8
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)