diff options
author | Lang Hames <lhames@gmail.com> | 2014-05-09 00:11:18 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2014-05-09 00:11:18 +0000 |
commit | f35553e90a7b139545ec8dcb153d6d6e34a7c3b5 (patch) | |
tree | 3929688d6ef554b997dcebc9bc55dc9d15c62738 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h | |
parent | 2ae250c36a5e4a5305b0d0b6774eaa3270d61736 (diff) | |
download | bcm5719-llvm-f35553e90a7b139545ec8dcb153d6d6e34a7c3b5.tar.gz bcm5719-llvm-f35553e90a7b139545ec8dcb153d6d6e34a7c3b5.zip |
[RuntimeDyld] Unify the RuntimeDyldMachO resolve.*Relocation method signatures
around RelocationEntries, rather than passing the same information via loose
arguments.
No functional change.
llvm-svn: 208375
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h index 85d6501a264..0c799bd7bc4 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.h +++ b/llvm/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) |