blob: f53b9e6bd75a51bf2eecb0432028f2aef2387b58 [file] [log] [blame]
Simon Dardisc97cfb62016-12-13 11:39:18 +00001//===-- 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
18namespace llvm {
19
20class RuntimeDyldELFMips : public RuntimeDyldELF {
21public:
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
31protected:
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
41private:
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000042 /// A object file specific relocation resolver
Simon Dardisc97cfb62016-12-13 11:39:18 +000043 /// \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 Prantl5f8f34e42018-05-01 15:54:18 +000048 /// A object file specific relocation resolver
Simon Dardisc97cfb62016-12-13 11:39:18 +000049 /// \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