14#ifndef LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H
15#define LLVM_EXECUTIONENGINE_ORC_EPCGENERICRTDYLDMEMORYMANAGER_H
20#define DEBUG_TYPE "orc"
61 bool IsReadOnly)
override;
64 uintptr_t RODataSize,
Align RODataAlign,
65 uintptr_t RWDataSize,
Align RWDataAlign)
override;
83 Contents(
std::make_unique<uint8_t[]>(Size +
Align - 1)) {}
87 std::unique_ptr<uint8_t[]> Contents;
94 struct SectionAllocGroup {
95 SectionAllocGroup() =
default;
96 SectionAllocGroup(
const SectionAllocGroup &) =
delete;
97 SectionAllocGroup &operator=(
const SectionAllocGroup &) =
delete;
98 SectionAllocGroup(SectionAllocGroup &&) =
default;
99 SectionAllocGroup &operator=(SectionAllocGroup &&) =
default;
101 ExecutorAddrRange RemoteCode;
102 ExecutorAddrRange RemoteROData;
103 ExecutorAddrRange RemoteRWData;
104 std::vector<ExecutorAddrRange> UnfinalizedEHFrames;
105 std::vector<SectionAlloc> CodeAllocs, RODataAllocs, RWDataAllocs;
110 std::vector<SectionAlloc> &SecAllocs,
111 ExecutorAddr NextAddr);
113 ExecutorProcessControl &EPC;
117 std::vector<SectionAllocGroup> Unmapped;
118 std::vector<SectionAllocGroup> Unfinalized;
119 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.
Remote-mapped RuntimeDyld-compatible memory manager.
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.
~EPCGenericRTDyldMemoryManager()
static Expected< std::unique_ptr< EPCGenericRTDyldMemoryManager > > CreateWithDefaultBootstrapSymbols(ExecutorProcessControl &EPC)
Create an EPCGenericRTDyldMemoryManager using the given EPC, looking up the default symbol names in t...
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