1 //===-- RuntimeDyldMachO.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 // MachO support for MC-JIT runtime dynamic linker.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_RUNTIME_DYLD_MACHO_H
15 #define LLVM_RUNTIME_DYLD_MACHO_H
17 #include "RuntimeDyldImpl.h"
18 #include "llvm/ADT/IndexedMap.h"
19 #include "llvm/Object/MachO.h"
20 #include "llvm/Support/Format.h"
23 using namespace llvm::object;
27 class RuntimeDyldMachO : public RuntimeDyldImpl {
28 bool resolveI386Relocation(uint8_t *LocalAddress,
29 uint64_t FinalAddress,
35 bool resolveX86_64Relocation(uint8_t *LocalAddress,
36 uint64_t FinalAddress,
42 bool resolveARMRelocation(uint8_t *LocalAddress,
43 uint64_t FinalAddress,
50 void resolveRelocation(const SectionEntry &Section,
58 struct EHFrameRelatedSections {
59 EHFrameRelatedSections() : EHFrameSID(RTDYLD_INVALID_SECTION_ID),
60 TextSID(RTDYLD_INVALID_SECTION_ID),
61 ExceptTabSID(RTDYLD_INVALID_SECTION_ID) {}
62 EHFrameRelatedSections(SID EH, SID T, SID Ex)
63 : EHFrameSID(EH), TextSID(T), ExceptTabSID(Ex) {}
69 // When a module is loaded we save the SectionID of the EH frame section
70 // in a table until we receive a request to register all unregistered
71 // EH frame sections with the memory manager.
72 SmallVector<EHFrameRelatedSections, 2> UnregisteredEHFrameSections;
74 RuntimeDyldMachO(RTDyldMemoryManager *mm) : RuntimeDyldImpl(mm) {}
76 virtual void resolveRelocation(const RelocationEntry &RE, uint64_t Value);
77 virtual void processRelocationRef(unsigned SectionID,
80 ObjSectionToIDMap &ObjSectionToID,
81 const SymbolTableMap &Symbols,
83 virtual bool isCompatibleFormat(const ObjectBuffer *Buffer) const;
84 virtual void registerEHFrames();
85 virtual void finalizeLoad(ObjSectionToIDMap &SectionMap);
88 } // end namespace llvm