blob: ef56f551fc893d3a47c2b228289b85347e2a1bbf [file] [log] [blame]
Eli Bendersky76463fd2012-01-22 07:05:02 +00001//===-- 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
22using namespace llvm;
23using namespace llvm::object;
24
25
26namespace llvm {
27class RuntimeDyldMachO : public RuntimeDyldImpl {
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000028protected:
Sean Callananb38aae42012-03-26 20:45:52 +000029 bool resolveI386Relocation(uint8_t *LocalAddress,
30 uint64_t FinalAddress,
31 uint64_t Value,
32 bool isPCRel,
33 unsigned Type,
34 unsigned Size,
35 int64_t Addend);
Sean Callanan61dfa772012-03-07 23:05:25 +000036 bool resolveX86_64Relocation(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 bool resolveARMRelocation(uint8_t *LocalAddress,
44 uint64_t FinalAddress,
45 uint64_t Value,
46 bool isPCRel,
47 unsigned Type,
48 unsigned Size,
49 int64_t Addend);
Eli Bendersky76463fd2012-01-22 07:05:02 +000050
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000051 virtual void processRelocationRef(const ObjRelocationInfo &Rel,
Preston Gurd689ff9c2012-04-16 22:12:58 +000052 ObjectImage &Obj,
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000053 ObjSectionToIDMap &ObjSectionToID,
Eli Benderskyd98c9e92012-05-01 06:58:59 +000054 const SymbolTableMap &Symbols,
55 StubMap &Stubs);
Eli Bendersky76463fd2012-01-22 07:05:02 +000056
57public:
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000058 virtual void resolveRelocation(uint8_t *LocalAddress,
59 uint64_t FinalAddress,
60 uint64_t Value,
61 uint32_t Type,
62 int64_t Addend);
Preston Gurd689ff9c2012-04-16 22:12:58 +000063
Eli Bendersky76463fd2012-01-22 07:05:02 +000064 RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {}
65
Andrew Kaylor3f23cef2012-10-02 21:18:39 +000066 bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
Eli Bendersky76463fd2012-01-22 07:05:02 +000067};
68
69} // end namespace llvm
70
71#endif