RuntimeDyldMachO.h revision 252723
1//===-- RuntimeDyldMachO.h - Run-time dynamic linker for MC-JIT ---*- 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// MachO support for MC-JIT runtime dynamic linker.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_RUNTIME_DYLD_MACHO_H
15#define LLVM_RUNTIME_DYLD_MACHO_H
16
17#include "RuntimeDyldImpl.h"
18#include "llvm/ADT/IndexedMap.h"
19#include "llvm/Object/MachO.h"
20#include "llvm/Support/Format.h"
21
22using namespace llvm;
23using namespace llvm::object;
24
25
26namespace llvm {
27class RuntimeDyldMachO : public RuntimeDyldImpl {
28  bool resolveI386Relocation(uint8_t *LocalAddress,
29                             uint64_t FinalAddress,
30                             uint64_t Value,
31                             bool isPCRel,
32                             unsigned Type,
33                             unsigned Size,
34                             int64_t Addend);
35  bool resolveX86_64Relocation(uint8_t *LocalAddress,
36                               uint64_t FinalAddress,
37                               uint64_t Value,
38                               bool isPCRel,
39                               unsigned Type,
40                               unsigned Size,
41                               int64_t Addend);
42  bool resolveARMRelocation(uint8_t *LocalAddress,
43                            uint64_t FinalAddress,
44                            uint64_t Value,
45                            bool isPCRel,
46                            unsigned Type,
47                            unsigned Size,
48                            int64_t Addend);
49
50  void resolveRelocation(const SectionEntry &Section,
51                         uint64_t Offset,
52                         uint64_t Value,
53                         uint32_t Type,
54                         int64_t Addend,
55                         bool isPCRel,
56                         unsigned Size);
57public:
58  RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {}
59
60  virtual void resolveRelocation(const RelocationEntry &RE, uint64_t Value);
61  virtual void processRelocationRef(unsigned SectionID,
62                                    RelocationRef RelI,
63                                    ObjectImage &Obj,
64                                    ObjSectionToIDMap &ObjSectionToID,
65                                    const SymbolTableMap &Symbols,
66                                    StubMap &Stubs);
67  virtual bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
68  virtual StringRef getEHFrameSection();
69};
70
71} // end namespace llvm
72
73#endif
74