1 //===-- RuntimeDyldELF.h - Run-time dynamic linker for MC-JIT ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // ELF support for MC-JIT runtime dynamic linker.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_RUNTIME_DYLD_ELF_H
15 #define LLVM_RUNTIME_DYLD_ELF_H
17 #include "RuntimeDyldImpl.h"
24 // Helper for extensive error checking in debug builds.
25 error_code Check(error_code Err) {
27 report_fatal_error(Err.message());
31 } // end anonymous namespace
33 class RuntimeDyldELF : public RuntimeDyldImpl {
34 void resolveRelocation(const SectionEntry &Section,
39 uint64_t SymOffset=0);
41 void resolveX86_64Relocation(const SectionEntry &Section,
48 void resolveX86Relocation(const SectionEntry &Section,
54 void resolveAArch64Relocation(const SectionEntry &Section,
60 void resolveARMRelocation(const SectionEntry &Section,
66 void resolveMIPSRelocation(const SectionEntry &Section,
72 void resolvePPC64Relocation(const SectionEntry &Section,
78 void resolveSystemZRelocation(const SectionEntry &Section,
84 uint64_t findPPC64TOC() const;
85 void findOPDEntrySection(ObjectImage &Obj,
86 ObjSectionToIDMap &LocalSections,
87 RelocationValueRef &Rel);
89 uint64_t findGOTEntry(uint64_t LoadAddr, uint64_t Offset);
90 size_t getGOTEntrySize();
92 virtual void updateGOTEntries(StringRef Name, uint64_t Addr);
94 SmallVector<RelocationValueRef, 2> GOTEntries;
95 unsigned GOTSectionID;
98 RuntimeDyldELF(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm),
102 virtual void resolveRelocation(const RelocationEntry &RE, uint64_t Value);
103 virtual void processRelocationRef(unsigned SectionID,
106 ObjSectionToIDMap &ObjSectionToID,
107 const SymbolTableMap &Symbols,
109 virtual bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
110 virtual ObjectImage *createObjectImage(ObjectBuffer *InputBuffer);
111 virtual StringRef getEHFrameSection();
112 virtual void finalizeLoad();
113 virtual ~RuntimeDyldELF();
116 } // end namespace llvm