blob: e413f780f54ad125b64ed8c2a0e6a6d3776925dd [file] [log] [blame]
Eli Bendersky76463fd2012-01-22 07:05:02 +00001//===-- RuntimeDyldELF.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// ELF support for MC-JIT runtime dynamic linker.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_RUNTIME_DYLD_ELF_H
15#define LLVM_RUNTIME_DYLD_ELF_H
16
17#include "RuntimeDyldImpl.h"
18
19using namespace llvm;
20
21
22namespace llvm {
23class RuntimeDyldELF : public RuntimeDyldImpl {
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000024protected:
Preston Gurd689ff9c2012-04-16 22:12:58 +000025 ObjectImage *LoadedObject;
26
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000027 void resolveX86_64Relocation(uint8_t *LocalAddress,
28 uint64_t FinalAddress,
29 uint64_t Value,
30 uint32_t Type,
31 int64_t Addend);
Eli Bendersky76463fd2012-01-22 07:05:02 +000032
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000033 void resolveX86Relocation(uint8_t *LocalAddress,
34 uint32_t FinalAddress,
35 uint32_t Value,
36 uint32_t Type,
37 int32_t Addend);
Eli Bendersky76463fd2012-01-22 07:05:02 +000038
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000039 void resolveARMRelocation(uint8_t *LocalAddress,
40 uint32_t FinalAddress,
41 uint32_t Value,
42 uint32_t Type,
43 int32_t Addend);
Eli Bendersky76463fd2012-01-22 07:05:02 +000044
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000045 virtual void resolveRelocation(uint8_t *LocalAddress,
46 uint64_t FinalAddress,
47 uint64_t Value,
48 uint32_t Type,
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
Preston Gurd689ff9c2012-04-16 22:12:58 +000057 virtual ObjectImage *createObjectImage(const MemoryBuffer *InputBuffer);
58 virtual void handleObjectLoaded(ObjectImage *Obj);
59
Eli Bendersky76463fd2012-01-22 07:05:02 +000060public:
Preston Gurd689ff9c2012-04-16 22:12:58 +000061 RuntimeDyldELF(RTDyldMemoryManager *mm)
62 : RuntimeDyldImpl(mm), LoadedObject(0) {}
63
64 virtual ~RuntimeDyldELF();
Eli Bendersky76463fd2012-01-22 07:05:02 +000065
Eli Bendersky76463fd2012-01-22 07:05:02 +000066 bool isCompatibleFormat(const MemoryBuffer *InputBuffer) const;
67};
68
69} // end namespace llvm
70
Danil Malyshev0e4fa5f2012-03-30 16:45:19 +000071#endif