14#ifndef LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H
15#define LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H
21#define DEBUG_TYPE "orc"
63 bool IsReadOnly)
override;
66 uintptr_t RODataSize,
Align RODataAlign,
67 uintptr_t RWDataSize,
Align RWDataAlign)
override;
89 std::unique_ptr<uint8_t[]> Contents;
96 struct SectionAllocGroup {
97 SectionAllocGroup() =
default;
98 SectionAllocGroup(
const SectionAllocGroup &) =
delete;
99 SectionAllocGroup &operator=(
const SectionAllocGroup &) =
delete;
100 SectionAllocGroup(SectionAllocGroup &&) =
default;
101 SectionAllocGroup &operator=(SectionAllocGroup &&) =
default;
103 ExecutorAddrRange RemoteCode;
104 ExecutorAddrRange RemoteROData;
105 ExecutorAddrRange RemoteRWData;
106 std::vector<ExecutorAddrRange> UnfinalizedEHFrames;
107 std::vector<SectionAlloc> CodeAllocs, RODataAllocs, RWDataAllocs;
111 void mapAllocsToRemoteAddrs(RuntimeDyld &Dyld,
112 std::vector<SectionAlloc> &SecAllocs,
113 ExecutorAddr NextAddr);
115 ExecutorProcessControl &EPC;
119 std::vector<SectionAllocGroup> Unmapped;
120 std::vector<SectionAllocGroup> Unfinalized;
121 std::vector<ExecutorAddr> FinalizedAllocs;
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
This class is the base class for all object file types.
uint8_t * allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly) override
Allocate a memory block of (at least) the given size suitable for data.
bool finalizeMemory(std::string *ErrMsg=nullptr) override
This method is called when object loading is complete and section page permissions can be applied.
bool needsToReserveAllocationSpace() override
Override to return true to enable the reserveAllocationSpace callback.
static Expected< std::unique_ptr< EPCGenericRTDyldMemoryManager > > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)
Create an EPCGenericRTDyldMemoryManager using the given EPC, looking up the default symbol names in t...
EPCGenericRTDyldMemoryManager(ExecutorProcessControl &EPC, SymbolAddrs SAs)
Create an EPCGenericRTDyldMemoryManager using the given EPC and symbol addrs.
void reserveAllocationSpace(uintptr_t CodeSize, Align CodeAlign, uintptr_t RODataSize, Align RODataAlign, uintptr_t RWDataSize, Align RWDataAlign) override
Inform the memory manager about the total amount of memory required to allocate all sections to be lo...
void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override
Register the EH frames with the runtime so that c++ exceptions work.
void notifyObjectLoaded(RuntimeDyld &Dyld, const object::ObjectFile &Obj) override
This method is called after an object has been loaded into memory but before relocations are applied ...
void deregisterEHFrames() override
EPCGenericRTDyldMemoryManager & operator=(EPCGenericRTDyldMemoryManager &&)=delete
uint8_t * allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName) override
Allocate a memory block of (at least) the given size suitable for executable code.
EPCGenericRTDyldMemoryManager(const EPCGenericRTDyldMemoryManager &)=delete
EPCGenericRTDyldMemoryManager & operator=(const EPCGenericRTDyldMemoryManager &)=delete
EPCGenericRTDyldMemoryManager(EPCGenericRTDyldMemoryManager &&)=delete
Represents an address in the executor process.
ExecutorProcessControl supports interaction with a JIT target process.
This is an optimization pass for GlobalISel generic memory operations.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Symbol addresses for memory access.
ExecutorAddr DeregisterEHFrame
ExecutorAddr RegisterEHFrame