RuntimeDyldMachO.h revision 245431
1234285Sdim//===-- RuntimeDyldMachO.h - Run-time dynamic linker for MC-JIT ---*- C++ -*-=//
2234285Sdim//
3234285Sdim//                     The LLVM Compiler Infrastructure
4234285Sdim//
5234285Sdim// This file is distributed under the University of Illinois Open Source
6234285Sdim// License. See LICENSE.TXT for details.
7234285Sdim//
8234285Sdim//===----------------------------------------------------------------------===//
9234285Sdim//
10234285Sdim// MachO support for MC-JIT runtime dynamic linker.
11234285Sdim//
12234285Sdim//===----------------------------------------------------------------------===//
13234285Sdim
14234285Sdim#ifndef LLVM_RUNTIME_DYLD_MACHO_H
15234285Sdim#define LLVM_RUNTIME_DYLD_MACHO_H
16234285Sdim
17234285Sdim#include "llvm/ADT/IndexedMap.h"
18234285Sdim#include "llvm/Object/MachOObject.h"
19234285Sdim#include "llvm/Support/Format.h"
20234285Sdim#include "RuntimeDyldImpl.h"
21234285Sdim
22234285Sdimusing namespace llvm;
23234285Sdimusing namespace llvm::object;
24234285Sdim
25234285Sdim
26234285Sdimnamespace llvm {
27234285Sdimclass RuntimeDyldMachO : public RuntimeDyldImpl {
28234285Sdimprotected:
29234285Sdim  bool resolveI386Relocation(uint8_t *LocalAddress,
30234285Sdim                             uint64_t FinalAddress,
31234285Sdim                             uint64_t Value,
32234285Sdim                             bool isPCRel,
33234285Sdim                             unsigned Type,
34234285Sdim                             unsigned Size,
35234285Sdim                             int64_t Addend);
36234285Sdim  bool resolveX86_64Relocation(uint8_t *LocalAddress,
37234285Sdim                               uint64_t FinalAddress,
38234285Sdim                               uint64_t Value,
39234285Sdim                               bool isPCRel,
40234285Sdim                               unsigned Type,
41234285Sdim                               unsigned Size,
42234285Sdim                               int64_t Addend);
43234285Sdim  bool resolveARMRelocation(uint8_t *LocalAddress,
44234285Sdim                            uint64_t FinalAddress,
45234285Sdim                            uint64_t Value,
46234285Sdim                            bool isPCRel,
47234285Sdim                            unsigned Type,
48234285Sdim                            unsigned Size,
49234285Sdim                            int64_t Addend);
50234285Sdim
51234285Sdim  virtual void processRelocationRef(const ObjRelocationInfo &Rel,
52235633Sdim                                    ObjectImage &Obj,
53234285Sdim                                    ObjSectionToIDMap &ObjSectionToID,
54245431Sdim                                    const SymbolTableMap &Symbols,
55245431Sdim                                    StubMap &Stubs);
56234285Sdim
57234285Sdimpublic:
58245431Sdim  virtual void resolveRelocation(const SectionEntry &Section,
59245431Sdim                                 uint64_t Offset,
60234285Sdim                                 uint64_t Value,
61234285Sdim                                 uint32_t Type,
62234285Sdim                                 int64_t Addend);
63235633Sdim
64234285Sdim  RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {}
65234285Sdim
66245431Sdim  bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
67234285Sdim};
68234285Sdim
69234285Sdim} // end namespace llvm
70234285Sdim
71234285Sdim#endif
72