36b39dd16484fbb70a7e5c59ed87669b960eb8cb
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / RuntimeDyldMachO.h
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 "llvm/ADT/IndexedMap.h"
18 #include "llvm/Object/MachOObject.h"
19 #include "llvm/Support/Format.h"
20 #include "RuntimeDyldImpl.h"
21
22 using namespace llvm;
23 using namespace llvm::object;
24
25
26 namespace llvm {
27 class RuntimeDyldMachO : public RuntimeDyldImpl {
28 protected:
29   bool resolveX86_64Relocation(uint8_t *LocalAddress,
30                                uint64_t FinalAddress,
31                                uint64_t Value,
32                                bool isPCRel,
33                                unsigned Type,
34                                unsigned Size,
35                                int64_t Addend);
36   bool resolveARMRelocation(uint8_t *LocalAddress,
37                             uint64_t FinalAddress,
38                             uint64_t Value,
39                             bool isPCRel,
40                             unsigned Type,
41                             unsigned Size,
42                             int64_t Addend);
43
44   virtual void processRelocationRef(const ObjRelocationInfo &Rel,
45                                     const ObjectFile &Obj,
46                                     ObjSectionToIDMap &ObjSectionToID,
47                                     LocalSymbolMap &Symbols, StubMap &Stubs);
48
49 public:
50   virtual void resolveRelocation(uint8_t *LocalAddress,
51                                  uint64_t FinalAddress,
52                                  uint64_t Value,
53                                  uint32_t Type,
54                                  int64_t Addend);
55                                  
56   RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {}
57
58   bool isCompatibleFormat(const MemoryBuffer *InputBuffer) const;
59 };
60
61 } // end namespace llvm
62
63 #endif