14#ifndef LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H
15#define LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H
22#define DEBUG_TYPE "orc"
62 bool IsReadOnly)
override;
88 std::unique_ptr<uint8_t[]> Contents;
95 struct SectionAllocGroup {
96 SectionAllocGroup() =
default;
97 SectionAllocGroup(
const SectionAllocGroup &) =
delete;
98 SectionAllocGroup &operator=(
const SectionAllocGroup &) =
delete;
99 SectionAllocGroup(SectionAllocGroup &&) =
default;
100 SectionAllocGroup &operator=(SectionAllocGroup &&) =
default;
102 ExecutorAddrRange RemoteCode;
103 ExecutorAddrRange RemoteROData;
104 ExecutorAddrRange RemoteRWData;
105 std::vector<ExecutorAddrRange> UnfinalizedEHFrames;
106 std::vector<SectionAlloc> CodeAllocs, RODataAllocs, RWDataAllocs;
110 void mapAllocsToRemoteAddrs(RuntimeDyld &Dyld,
111 std::vector<SectionAlloc> &SecAllocs,
112 ExecutorAddr NextAddr);
114 ExecutorProcessControl &EPC;
118 std::vector<SectionAllocGroup> Unmapped;
119 std::vector<SectionAllocGroup> Unfinalized;
120 std::vector<ExecutorAddr> FinalizedAllocs;
Tagged union holding either a T or a Error.
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.
Bindings to the executor-side memory manager, plus the EH-frame registration alloc-action wrappers.
SimpleMemoryMapBindings MemMgr
ExecutorAddr DeregisterEHFrame
ExecutorAddr RegisterEHFrame
The resolved controller-side handle to an executor-side memory manager: the address of the manager in...