LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
llvm::RTDyldMemoryManager Class Referenceabstract

#include <RTDyldMemoryManager.h>

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

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 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=0)=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.

llvm::RTDyldMemoryManager::~RTDyldMemoryManager ( )
virtual

Definition at line 33 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 132 of file RTDyldMemoryManager.cpp.

References llvm::__deregister_frame().

virtual bool llvm::RTDyldMemoryManager::finalizeMemory ( std::string *  ErrMsg = 0)
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 272 of file RTDyldMemoryManager.cpp.

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

Referenced by llvm::JIT::getPointerToNamedFunction(), and 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 214 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().

virtual void llvm::RTDyldMemoryManager::notifyObjectLoaded ( ExecutionEngine EE,
const ObjectImage  
)
inlinevirtual

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 91 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 121 of file RTDyldMemoryManager.cpp.

References llvm::__register_frame().


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