fe5ae90fc86b090dcda3e1bbe7b49ee32035142e
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / Targets / RuntimeDyldCOFFX86_64.h
1 //===-- RuntimeDyldCOFFX86_64.h --- COFF/X86_64 specific code ---*- 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 // COFF x86_x64 support for MC-JIT runtime dynamic linker.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFF86_64_H
15 #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFF86_64_H
16
17 #include "llvm/Object/COFF.h"
18 #include "llvm/Support/COFF.h"
19 #include "../RuntimeDyldCOFF.h"
20
21 using namespace llvm;
22
23 namespace llvm {
24
25 class RuntimeDyldCOFFX86_64 : public RuntimeDyldCOFF {
26
27 private:
28   // When a module is loaded we save the SectionID of the unwind
29   // sections in a table until we receive a request to register all
30   // unregisteredEH frame sections with the memory manager.
31   SmallVector<SID, 2> UnregisteredEHFrameSections;
32   SmallVector<SID, 2> RegisteredEHFrameSections;
33
34 public:
35   RuntimeDyldCOFFX86_64(RTDyldMemoryManager *MM) : RuntimeDyldCOFF(MM) {}
36
37   unsigned getMaxStubSize() override {
38     return 6; // 2-byte jmp instruction + 32-bit relative address
39   }
40
41   void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override;
42
43   relocation_iterator processRelocationRef(unsigned SectionID,
44                                            relocation_iterator RelI,
45                                            const ObjectFile &Obj,
46                                            ObjSectionToIDMap &ObjSectionToID,
47                                            StubMap &Stubs) override;
48
49   unsigned getStubAlignment() override { return 1; }
50   void registerEHFrames() override;
51   void deregisterEHFrames() override;
52   void finalizeLoad(const ObjectFile &Obj,
53                     ObjSectionToIDMap &SectionMap) override;
54 };
55
56 } // end namespace llvm
57
58 #undef DEBUG_TYPE
59
60 #endif