LLVM API Documentation

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

#include <RuntimeDyldImpl.h>

Inheritance diagram for llvm::RuntimeDyldImpl:
Inheritance graph
[legend]
Collaboration diagram for llvm::RuntimeDyldImpl:
Collaboration graph
[legend]

Public Member Functions

 RuntimeDyldImpl (RTDyldMemoryManager *mm)
 
virtual ~RuntimeDyldImpl ()
 
ObjectImageloadObject (ObjectBuffer *InputBuffer)
 
void * getSymbolAddress (StringRef Name)
 
uint64_t getSymbolLoadAddress (StringRef Name)
 
void resolveRelocations ()
 
void reassignSectionAddress (unsigned SectionID, uint64_t Addr)
 
void mapSectionAddress (const void *LocalAddress, uint64_t TargetAddress)
 
bool hasError ()
 
void clearError ()
 
StringRef getErrorString ()
 
virtual bool isCompatibleFormat (const ObjectBuffer *Buffer) const =0
 
virtual void registerEHFrames ()
 
virtual void deregisterEHFrames ()
 
virtual void finalizeLoad (ObjSectionToIDMap &SectionMap)
 

Protected Types

typedef SmallVector
< SectionEntry, 64 > 
SectionList
 
typedef unsigned SID
 
typedef std::map< SectionRef,
unsigned
ObjSectionToIDMap
 
typedef std::pair< unsigned,
uintptr_t > 
SymbolLoc
 
typedef StringMap< SymbolLocSymbolTableMap
 
typedef std::pair< unsigned,
unsigned
CommonSymbolInfo
 
typedef std::map< SymbolRef,
CommonSymbolInfo
CommonSymbolMap
 
typedef SmallVector
< RelocationEntry, 64 > 
RelocationList
 
typedef std::map
< RelocationValueRef,
uintptr_t > 
StubMap
 

Protected Member Functions

virtual unsigned getMaxStubSize ()=0
 
virtual unsigned getStubAlignment ()=0
 
bool Error (const Twine &Msg)
 
uint64_t getSectionLoadAddress (unsigned SectionID)
 
uint8_t * getSectionAddress (unsigned SectionID)
 
void writeInt16BE (uint8_t *Addr, uint16_t Value)
 
void writeInt32BE (uint8_t *Addr, uint32_t Value)
 
void writeInt64BE (uint8_t *Addr, uint64_t Value)
 
void emitCommonSymbols (ObjectImage &Obj, const CommonSymbolMap &CommonSymbols, uint64_t TotalSize, SymbolTableMap &SymbolTable)
 Given the common symbols discovered in the object file, emit a new section for them and update the symbol mappings in the object and symbol table. More...
 
unsigned emitSection (ObjectImage &Obj, const SectionRef &Section, bool IsCode)
 Emits section data from the object file to the MemoryManager. More...
 
unsigned findOrEmitSection (ObjectImage &Obj, const SectionRef &Section, bool IsCode, ObjSectionToIDMap &LocalSections)
 Find Section in LocalSections. If the secton is not found - emit it and store in LocalSections. More...
 
void addRelocationForSection (const RelocationEntry &RE, unsigned SectionID)
 
void addRelocationForSymbol (const RelocationEntry &RE, StringRef SymbolName)
 
uint8_t * createStubFunction (uint8_t *Addr)
 Emits long jump instruction to Addr. More...
 
void resolveRelocationList (const RelocationList &Relocs, uint64_t Value)
 Resolves relocations from Relocs list with address from Value. More...
 
virtual void resolveRelocation (const RelocationEntry &RE, uint64_t Value)=0
 A object file specific relocation resolver. More...
 
virtual void processRelocationRef (unsigned SectionID, RelocationRef RelI, ObjectImage &Obj, ObjSectionToIDMap &ObjSectionToID, const SymbolTableMap &Symbols, StubMap &Stubs)=0
 Parses the object file relocation and stores it to Relocations or SymbolRelocations (this depends on the object file type). More...
 
void resolveExternalSymbols ()
 Resolve relocations to external symbols. More...
 
virtual void updateGOTEntries (StringRef Name, uint64_t Addr)
 Update GOT entries for external symbols. More...
 
virtual ObjectImagecreateObjectImage (ObjectBuffer *InputBuffer)
 

Protected Attributes

RTDyldMemoryManagerMemMgr
 
SectionList Sections
 
SymbolTableMap GlobalSymbolTable
 
DenseMap< unsigned,
RelocationList
Relocations
 
StringMap< RelocationListExternalSymbolRelocations
 
Triple::ArchType Arch
 
bool IsTargetLittleEndian
 
sys::Mutex lock
 
bool HasError
 
std::string ErrorStr
 

Detailed Description

Definition at line 141 of file RuntimeDyldImpl.h.

Member Typedef Documentation

Definition at line 165 of file RuntimeDyldImpl.h.

Definition at line 167 of file RuntimeDyldImpl.h.

Definition at line 156 of file RuntimeDyldImpl.h.

Definition at line 174 of file RuntimeDyldImpl.h.

Definition at line 148 of file RuntimeDyldImpl.h.

Definition at line 151 of file RuntimeDyldImpl.h.

typedef std::map<RelocationValueRef, uintptr_t> llvm::RuntimeDyldImpl::StubMap
protected

Definition at line 185 of file RuntimeDyldImpl.h.

typedef std::pair<unsigned, uintptr_t> llvm::RuntimeDyldImpl::SymbolLoc
protected

Definition at line 160 of file RuntimeDyldImpl.h.

Definition at line 161 of file RuntimeDyldImpl.h.

Constructor & Destructor Documentation

llvm::RuntimeDyldImpl::RuntimeDyldImpl ( RTDyldMemoryManager mm)
inline

Definition at line 315 of file RuntimeDyldImpl.h.

RuntimeDyldImpl::~RuntimeDyldImpl ( )
virtual

Definition at line 30 of file RuntimeDyld.cpp.

Member Function Documentation

void llvm::RuntimeDyldImpl::addRelocationForSection ( const RelocationEntry RE,
unsigned  SectionID 
)
protected

Definition at line 373 of file RuntimeDyld.cpp.

void llvm::RuntimeDyldImpl::addRelocationForSymbol ( const RelocationEntry RE,
StringRef  SymbolName 
)
protected
void llvm::RuntimeDyldImpl::clearError ( )
inline

Definition at line 351 of file RuntimeDyldImpl.h.

ObjectImage * llvm::RuntimeDyldImpl::createObjectImage ( ObjectBuffer InputBuffer)
protectedvirtual

Reimplemented in llvm::RuntimeDyldELF.

Definition at line 81 of file RuntimeDyld.cpp.

uint8_t * llvm::RuntimeDyldImpl::createStubFunction ( uint8_t *  Addr)
protected

Emits long jump instruction to Addr.

Returns
Pointer to the memory area for emitting target address.

Definition at line 395 of file RuntimeDyld.cpp.

References llvm::Triple::aarch64, llvm::Triple::arm, llvm::Triple::mips, llvm::Triple::mipsel, llvm::Triple::ppc64, llvm::Triple::ppc64le, llvm::Triple::systemz, and llvm::Triple::x86_64.

void llvm::RuntimeDyldImpl::deregisterEHFrames ( )
virtual

Reimplemented in llvm::RuntimeDyldELF.

Definition at line 42 of file RuntimeDyld.cpp.

void llvm::RuntimeDyldImpl::emitCommonSymbols ( ObjectImage Obj,
const CommonSymbolMap CommonSymbols,
uint64_t  TotalSize,
SymbolTableMap SymbolTable 
)
protected

Given the common symbols discovered in the object file, emit a new section for them and update the symbol mappings in the object and symbol table.

Definition at line 195 of file RuntimeDyld.cpp.

References Align(), llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::format(), llvm::Intrinsic::memset, llvm::OffsetToAlignment(), llvm::report_fatal_error(), and llvm::ObjectImage::updateSymbolAddress().

unsigned llvm::RuntimeDyldImpl::emitSection ( ObjectImage Obj,
const SectionRef Section,
bool  IsCode 
)
protected
bool llvm::RuntimeDyldImpl::Error ( const Twine Msg)
inlineprotected

Definition at line 209 of file RuntimeDyldImpl.h.

References llvm::Twine::str().

virtual void llvm::RuntimeDyldImpl::finalizeLoad ( ObjSectionToIDMap SectionMap)
inlinevirtual

Reimplemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.

Definition at line 362 of file RuntimeDyldImpl.h.

unsigned llvm::RuntimeDyldImpl::findOrEmitSection ( ObjectImage Obj,
const SectionRef Section,
bool  IsCode,
ObjSectionToIDMap LocalSections 
)
protected

Find Section in LocalSections. If the secton is not found - emit it and store in LocalSections.

Parameters
IsCodeif it's true then allocateCodeSection() will be used for emmits, else allocateDataSection() will be used.
Returns
SectionID.

Definition at line 357 of file RuntimeDyld.cpp.

References llvm::ARMBuildAttrs::Section.

StringRef llvm::RuntimeDyldImpl::getErrorString ( )
inline

Definition at line 354 of file RuntimeDyldImpl.h.

virtual unsigned llvm::RuntimeDyldImpl::getMaxStubSize ( )
protectedpure virtual
uint8_t* llvm::RuntimeDyldImpl::getSectionAddress ( unsigned  SectionID)
inlineprotected

Definition at line 219 of file RuntimeDyldImpl.h.

uint64_t llvm::RuntimeDyldImpl::getSectionLoadAddress ( unsigned  SectionID)
inlineprotected

Definition at line 215 of file RuntimeDyldImpl.h.

virtual unsigned llvm::RuntimeDyldImpl::getStubAlignment ( )
protectedpure virtual
void* llvm::RuntimeDyldImpl::getSymbolAddress ( StringRef  Name)
inline

Definition at line 321 of file RuntimeDyldImpl.h.

References llvm::StringMapEntry< ValueTy >::second.

uint64_t llvm::RuntimeDyldImpl::getSymbolLoadAddress ( StringRef  Name)
inline

Definition at line 331 of file RuntimeDyldImpl.h.

References llvm::StringMapEntry< ValueTy >::second.

bool llvm::RuntimeDyldImpl::hasError ( )
inline

Definition at line 348 of file RuntimeDyldImpl.h.

virtual bool llvm::RuntimeDyldImpl::isCompatibleFormat ( const ObjectBuffer Buffer) const
pure virtual
ObjectImage * llvm::RuntimeDyldImpl::loadObject ( ObjectBuffer InputBuffer)
void llvm::RuntimeDyldImpl::mapSectionAddress ( const void *  LocalAddress,
uint64_t  TargetAddress 
)

Definition at line 67 of file RuntimeDyld.cpp.

References llvm_unreachable.

virtual void llvm::RuntimeDyldImpl::processRelocationRef ( unsigned  SectionID,
RelocationRef  RelI,
ObjectImage Obj,
ObjSectionToIDMap ObjSectionToID,
const SymbolTableMap Symbols,
StubMap Stubs 
)
protectedpure virtual

Parses the object file relocation and stores it to Relocations or SymbolRelocations (this depends on the object file type).

Implemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.

void llvm::RuntimeDyldImpl::reassignSectionAddress ( unsigned  SectionID,
uint64_t  Addr 
)

Definition at line 472 of file RuntimeDyld.cpp.

void llvm::RuntimeDyldImpl::registerEHFrames ( )
virtual

Reimplemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.

Definition at line 39 of file RuntimeDyld.cpp.

void llvm::RuntimeDyldImpl::resolveExternalSymbols ( )
protected
virtual void llvm::RuntimeDyldImpl::resolveRelocation ( const RelocationEntry RE,
uint64_t  Value 
)
protectedpure virtual

A object file specific relocation resolver.

Parameters
REThe relocation to be resolved
ValueTarget symbol address to apply the relocation action

Implemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.

void llvm::RuntimeDyldImpl::resolveRelocationList ( const RelocationList Relocs,
uint64_t  Value 
)
protected

Resolves relocations from Relocs list with address from Value.

Definition at line 487 of file RuntimeDyld.cpp.

References llvm::RelocationEntry::SectionID, and llvm::SmallVectorTemplateCommon< T, typename >::size().

void llvm::RuntimeDyldImpl::resolveRelocations ( )

Definition at line 46 of file RuntimeDyld.cpp.

References llvm::dbgs(), DEBUG, and llvm::format().

virtual void llvm::RuntimeDyldImpl::updateGOTEntries ( StringRef  Name,
uint64_t  Addr 
)
inlineprotectedvirtual

Update GOT entries for external symbols.

Definition at line 311 of file RuntimeDyldImpl.h.

void llvm::RuntimeDyldImpl::writeInt16BE ( uint8_t *  Addr,
uint16_t  Value 
)
inlineprotected

Definition at line 223 of file RuntimeDyldImpl.h.

References llvm::sys::SwapByteOrder().

void llvm::RuntimeDyldImpl::writeInt32BE ( uint8_t *  Addr,
uint32_t  Value 
)
inlineprotected

Definition at line 230 of file RuntimeDyldImpl.h.

References llvm::sys::SwapByteOrder().

void llvm::RuntimeDyldImpl::writeInt64BE ( uint8_t *  Addr,
uint64_t  Value 
)
inlineprotected

Definition at line 239 of file RuntimeDyldImpl.h.

References llvm::sys::SwapByteOrder().

Member Data Documentation

Triple::ArchType llvm::RuntimeDyldImpl::Arch
protected

Definition at line 187 of file RuntimeDyldImpl.h.

std::string llvm::RuntimeDyldImpl::ErrorStr
protected

Definition at line 206 of file RuntimeDyldImpl.h.

StringMap<RelocationList> llvm::RuntimeDyldImpl::ExternalSymbolRelocations
protected

Definition at line 183 of file RuntimeDyldImpl.h.

SymbolTableMap llvm::RuntimeDyldImpl::GlobalSymbolTable
protected

Definition at line 162 of file RuntimeDyldImpl.h.

bool llvm::RuntimeDyldImpl::HasError
protected

Definition at line 205 of file RuntimeDyldImpl.h.

bool llvm::RuntimeDyldImpl::IsTargetLittleEndian
protected

Definition at line 188 of file RuntimeDyldImpl.h.

sys::Mutex llvm::RuntimeDyldImpl::lock
protected

Definition at line 200 of file RuntimeDyldImpl.h.

RTDyldMemoryManager* llvm::RuntimeDyldImpl::MemMgr
protected

Definition at line 144 of file RuntimeDyldImpl.h.

DenseMap<unsigned, RelocationList> llvm::RuntimeDyldImpl::Relocations
protected

Definition at line 178 of file RuntimeDyldImpl.h.

SectionList llvm::RuntimeDyldImpl::Sections
protected

Definition at line 149 of file RuntimeDyldImpl.h.


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