Simon Dardis | c97cfb6 | 2016-12-13 11:39:18 +0000 | [diff] [blame] | 1 | //===-- RuntimeDyldELFMips.h ---- ELF/Mips specific code. -------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDELFMIPS_H |
| 11 | #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDELFMIPS_H |
| 12 | |
| 13 | #include "../RuntimeDyldELF.h" |
| 14 | #include <string> |
| 15 | |
| 16 | #define DEBUG_TYPE "dyld" |
| 17 | |
| 18 | namespace llvm { |
| 19 | |
| 20 | class RuntimeDyldELFMips : public RuntimeDyldELF { |
| 21 | public: |
| 22 | |
| 23 | typedef uint64_t TargetPtrT; |
| 24 | |
| 25 | RuntimeDyldELFMips(RuntimeDyld::MemoryManager &MM, |
| 26 | JITSymbolResolver &Resolver) |
| 27 | : RuntimeDyldELF(MM, Resolver) {} |
| 28 | |
| 29 | void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override; |
| 30 | |
| 31 | protected: |
| 32 | void resolveMIPSO32Relocation(const SectionEntry &Section, uint64_t Offset, |
| 33 | uint32_t Value, uint32_t Type, int32_t Addend); |
| 34 | void resolveMIPSN32Relocation(const SectionEntry &Section, uint64_t Offset, |
| 35 | uint64_t Value, uint32_t Type, int64_t Addend, |
| 36 | uint64_t SymOffset, SID SectionID); |
| 37 | void resolveMIPSN64Relocation(const SectionEntry &Section, uint64_t Offset, |
| 38 | uint64_t Value, uint32_t Type, int64_t Addend, |
| 39 | uint64_t SymOffset, SID SectionID); |
| 40 | |
| 41 | private: |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 42 | /// A object file specific relocation resolver |
Simon Dardis | c97cfb6 | 2016-12-13 11:39:18 +0000 | [diff] [blame] | 43 | /// \param RE The relocation to be resolved |
| 44 | /// \param Value Target symbol address to apply the relocation action |
| 45 | uint64_t evaluateRelocation(const RelocationEntry &RE, uint64_t Value, |
| 46 | uint64_t Addend); |
| 47 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 48 | /// A object file specific relocation resolver |
Simon Dardis | c97cfb6 | 2016-12-13 11:39:18 +0000 | [diff] [blame] | 49 | /// \param RE The relocation to be resolved |
| 50 | /// \param Value Target symbol address to apply the relocation action |
| 51 | void applyRelocation(const RelocationEntry &RE, uint64_t Value); |
| 52 | |
| 53 | int64_t evaluateMIPS32Relocation(const SectionEntry &Section, uint64_t Offset, |
| 54 | uint64_t Value, uint32_t Type); |
| 55 | int64_t evaluateMIPS64Relocation(const SectionEntry &Section, |
| 56 | uint64_t Offset, uint64_t Value, |
| 57 | uint32_t Type, int64_t Addend, |
| 58 | uint64_t SymOffset, SID SectionID); |
| 59 | |
| 60 | void applyMIPSRelocation(uint8_t *TargetPtr, int64_t CalculatedValue, |
| 61 | uint32_t Type); |
| 62 | |
| 63 | }; |
| 64 | } |
| 65 | |
| 66 | #undef DEBUG_TYPE |
| 67 | |
| 68 | #endif |