LLVM API Documentation

Public Member Functions
llvm::RTDyldMemoryManager Class Reference

#include <RTDyldMemoryManager.h>

Inheritance diagram for llvm::RTDyldMemoryManager:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 RTDyldMemoryManager ()
virtual ~RTDyldMemoryManager ()
virtual uint8_t * allocateCodeSection (uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName)=0
virtual uint8_t * allocateDataSection (uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly)=0
virtual void reserveAllocationSpace (uintptr_t CodeSize, uintptr_t DataSizeRO, uintptr_t DataSizeRW)
virtual bool needsToReserveAllocationSpace ()
 Override to return true to enable the reserveAllocationSpace callback.
virtual void registerEHFrames (uint8_t *Addr, uint64_t LoadAddr, size_t Size)
virtual void deregisterEHFrames (uint8_t *Addr, uint64_t LoadAddr, size_t Size)
virtual uint64_t getSymbolAddress (const std::string &Name)
virtual void * getPointerToNamedFunction (const std::string &Name, bool AbortOnFailure=true)
virtual void notifyObjectLoaded (ExecutionEngine *EE, const ObjectImage *)
virtual bool finalizeMemory (std::string *ErrMsg=nullptr)=0

Detailed Description

Definition at line 33 of file RTDyldMemoryManager.h.


Constructor & Destructor Documentation

llvm::RTDyldMemoryManager::RTDyldMemoryManager ( ) [inline]

Definition at line 37 of file RTDyldMemoryManager.h.

Definition at line 32 of file RTDyldMemoryManager.cpp.


Member Function Documentation

virtual uint8_t* llvm::RTDyldMemoryManager::allocateCodeSection ( uintptr_t  Size,
unsigned  Alignment,
unsigned  SectionID,
StringRef  SectionName 
) [pure virtual]

Allocate a memory block of (at least) the given size suitable for executable code. The SectionID is a unique identifier assigned by the JIT engine, and optionally recorded by the memory manager to access a loaded section.

Implemented in llvm::SectionMemoryManager, and llvm::LinkingMemoryManager.

virtual uint8_t* llvm::RTDyldMemoryManager::allocateDataSection ( uintptr_t  Size,
unsigned  Alignment,
unsigned  SectionID,
StringRef  SectionName,
bool  IsReadOnly 
) [pure virtual]

Allocate a memory block of (at least) the given size suitable for data. The SectionID is a unique identifier assigned by the JIT engine, and optionally recorded by the memory manager to access a loaded section.

Implemented in llvm::SectionMemoryManager, and llvm::LinkingMemoryManager.

void llvm::RTDyldMemoryManager::deregisterEHFrames ( uint8_t *  Addr,
uint64_t  LoadAddr,
size_t  Size 
) [virtual]

Reimplemented in llvm::LinkingMemoryManager.

Definition at line 131 of file RTDyldMemoryManager.cpp.

References llvm::__deregister_frame().

virtual bool llvm::RTDyldMemoryManager::finalizeMemory ( std::string *  ErrMsg = nullptr) [pure virtual]

This method is called when object loading is complete and section page permissions can be applied. It is up to the memory manager implementation to decide whether or not to act on this method. The memory manager will typically allocate all sections as read-write and then apply specific permissions when this method is called. Code sections cannot be executed until this function has been called. In addition, any cache coherency operations needed to reliably use the memory are also performed.

Returns true if an error occurred, false otherwise.

Implemented in llvm::SectionMemoryManager, and llvm::LinkingMemoryManager.

void * llvm::RTDyldMemoryManager::getPointerToNamedFunction ( const std::string &  Name,
bool  AbortOnFailure = true 
) [virtual]

This method returns the address of the specified function. As such it is only useful for resolving library symbols, not code generated symbols.

If AbortOnFailure is false and no function with the given name is found, this function returns a null pointer. Otherwise, it prints a message to stderr and aborts.

This function is deprecated for memory managers to be used with MCJIT or RuntimeDyld. Use getSymbolAddress instead.

Definition at line 271 of file RTDyldMemoryManager.cpp.

References getSymbolAddress(), and llvm::report_fatal_error().

Referenced by llvm::MCJIT::getPointerToNamedFunction().

uint64_t llvm::RTDyldMemoryManager::getSymbolAddress ( const std::string &  Name) [virtual]

This method returns the address of the specified function or variable. It is used to resolve symbols during module linking.

Reimplemented in llvm::LinkingMemoryManager.

Definition at line 213 of file RTDyldMemoryManager.cpp.

References llvm::LibFunc::fstat, llvm::LibFunc::fstat64, llvm::jit_noop(), llvm::LibFunc::lstat, llvm::LibFunc::lstat64, llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(), llvm::LibFunc::stat, and llvm::LibFunc::stat64.

Referenced by getPointerToNamedFunction().

Override to return true to enable the reserveAllocationSpace callback.

Reimplemented in llvm::LinkingMemoryManager.

Definition at line 67 of file RTDyldMemoryManager.h.

virtual void llvm::RTDyldMemoryManager::notifyObjectLoaded ( ExecutionEngine EE,
const ObjectImage  
) [inline, virtual]

This method is called after an object has been loaded into memory but before relocations are applied to the loaded sections. The object load may have been initiated by MCJIT to resolve an external symbol for another object that is being finalized. In that case, the object about which the memory manager is being notified will be finalized immediately after the memory manager returns from this call.

Memory managers which are preparing code for execution in an external address space can use this call to remap the section addresses for the newly loaded object.

Reimplemented in llvm::LinkingMemoryManager.

Definition at line 105 of file RTDyldMemoryManager.h.

void llvm::RTDyldMemoryManager::registerEHFrames ( uint8_t *  Addr,
uint64_t  LoadAddr,
size_t  Size 
) [virtual]

Register the EH frames with the runtime so that c++ exceptions work.

Addr parameter provides the local address of the EH frame section data, while LoadAddr provides the address of the data in the target address space. If the section has not been remapped (which will usually be the case for local execution) these two values will be the same.

Reimplemented in llvm::LinkingMemoryManager.

Definition at line 120 of file RTDyldMemoryManager.cpp.

References llvm::__register_frame().

virtual void llvm::RTDyldMemoryManager::reserveAllocationSpace ( uintptr_t  CodeSize,
uintptr_t  DataSizeRO,
uintptr_t  DataSizeRW 
) [inline, virtual]

Inform the memory manager about the total amount of memory required to allocate all sections to be loaded: CodeSize - the total size of all code sections DataSizeRO - the total size of all read-only data sections DataSizeRW - the total size of all read-write data sections

Note that by default the callback is disabled. To enable it redefine the method needsToReserveAllocationSpace to return true.

Reimplemented in llvm::LinkingMemoryManager.

Definition at line 63 of file RTDyldMemoryManager.h.


The documentation for this class was generated from the following files: