LLVM: llvm::RuntimeDyldImpl Class Reference (original) (raw)

#include "[ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h](RuntimeDyldImpl%5F8h%5Fsource.html)"

Public Member Functions
RuntimeDyldImpl (RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
virtual ~RuntimeDyldImpl ()
void setProcessAllSections (bool ProcessAllSections)
virtual std::unique_ptr< RuntimeDyld::LoadedObjectInfo > loadObject (const object::ObjectFile &Obj)=0
uint64_t getSectionLoadAddress (unsigned SectionID) const
uint8_t * getSectionAddress (unsigned SectionID) const
StringRef getSectionContent (unsigned SectionID) const
uint8_t * getSymbolLocalAddress (StringRef Name) const
unsigned getSymbolSectionID (StringRef Name) const
JITEvaluatedSymbol getSymbol (StringRef Name) const
std::map< StringRef, JITEvaluatedSymbol > getSymbolTable () const
void resolveRelocations ()
void resolveLocalRelocations ()
void reassignSectionAddress (unsigned SectionID, uint64_t Addr)
void mapSectionAddress (const void *LocalAddress, uint64_t TargetAddress)
bool hasError ()
void clearError ()
StringRef getErrorString ()
virtual bool isCompatibleFile (const ObjectFile &Obj) const =0
void setNotifyStubEmitted (NotifyStubEmittedFunction NotifyStubEmitted)
virtual void registerEHFrames ()
void deregisterEHFrames ()
virtual Error finalizeLoad (const ObjectFile &ObjImg, ObjSectionToIDMap &SectionMap)
Protected Types
typedef std::deque< SectionEntry > SectionList
typedef unsigned SID
typedef std::map< SectionRef, unsigned > ObjSectionToIDMap
typedef std::vector< SymbolRef > CommonSymbolList
typedef SmallVector< RelocationEntry, 64 > RelocationList
typedef std::map< RelocationValueRef, uintptr_t > StubMap
using NotifyStubEmittedFunction
Protected Member Functions
virtual unsigned getMaxStubSize () const =0
virtual Align getStubAlignment ()=0
void writeInt16BE (uint8_t *Addr, uint16_t Value)
void writeInt32BE (uint8_t *Addr, uint32_t Value)
void writeInt64BE (uint8_t *Addr, uint64_t Value)
virtual void setMipsABI (const ObjectFile &Obj)
uint64_t readBytesUnaligned (uint8_t *Src, unsigned Size) const
Endian-aware read Read the least significant Size bytes from Src.
void writeBytesUnaligned (uint64_t Value, uint8_t *Dst, unsigned Size) const
Endian-aware write.
virtual Expected< JITSymbolFlags > getJITSymbolFlags (const SymbolRef &Sym)
Generate JITSymbolFlags from a libObject symbol.
virtual uint64_t modifyAddressBasedOnFlags (uint64_t Addr, JITSymbolFlags Flags) const
Modify the given target address based on the given symbol flags.
Error emitCommonSymbols (const ObjectFile &Obj, CommonSymbolList &CommonSymbols, uint64_t CommonSize, uint32_t CommonAlign)
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.
Expected< unsigned > emitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode)
Emits section data from the object file to the MemoryManager.
Expected< unsigned > findOrEmitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode, ObjSectionToIDMap &LocalSections)
Find Section in LocalSections.
void addRelocationForSection (const RelocationEntry &RE, unsigned SectionID)
void addRelocationForSymbol (const RelocationEntry &RE, StringRef SymbolName)
uint8_t * createStubFunction (uint8_t *Addr, unsigned AbiVariant=0)
Emits long jump instruction to Addr.
void resolveRelocationList (const RelocationList &Relocs, uint64_t Value)
Resolves relocations from Relocs list with address from Value.
virtual void resolveRelocation (const RelocationEntry &RE, uint64_t Value)=0
A object file specific relocation resolver.
virtual Expected< relocation_iterator > processRelocationRef (unsigned SectionID, relocation_iterator RelI, const ObjectFile &Obj, ObjSectionToIDMap &ObjSectionToID, StubMap &Stubs)=0
Parses one or more object file relocations (some object files use relocation pairs) and stores it to Relocations or SymbolRelocations (this depends on the object file type).
void applyExternalSymbolRelocations (const StringMap< JITEvaluatedSymbol > ExternalSymbolMap)
Error resolveExternalSymbols ()
Resolve relocations to external symbols.
Error computeTotalAllocSize (const ObjectFile &Obj, uint64_t &CodeSize, Align &CodeAlign, uint64_t &RODataSize, Align &RODataAlign, uint64_t &RWDataSize, Align &RWDataAlign)
unsigned computeGOTSize (const ObjectFile &Obj)
unsigned computeSectionStubBufSize (const ObjectFile &Obj, const SectionRef &Section)
Expected< ObjSectionToIDMap > loadObjectImpl (const object::ObjectFile &Obj)
virtual size_t getGOTEntrySize ()
virtual void processNewSymbol (const SymbolRef &ObjSymbol, SymbolTableEntry &Entry)
virtual bool relocationNeedsGot (const RelocationRef &R) const
virtual bool relocationNeedsStub (const RelocationRef &R) const
virtual bool relocationNeedsDLLImportStub (const RelocationRef &R) const
virtual unsigned sizeAfterAddingDLLImportStub (unsigned Size) const
Protected Attributes
RuntimeDyld::MemoryManager & MemMgr
JITSymbolResolver & Resolver
SectionList Sections
RTDyldSymbolTable GlobalSymbolTable
std::unordered_map< unsigned, RelocationList > Relocations
StringMap< RelocationList > ExternalSymbolRelocations
Triple::ArchType Arch
bool IsTargetLittleEndian
bool IsMipsO32ABI
bool IsMipsN32ABI
bool IsMipsN64ABI
bool ProcessAllSections
sys::Mutex lock
NotifyStubEmittedFunction NotifyStubEmitted
bool HasError
std::string ErrorStr

Definition at line 233 of file RuntimeDyldImpl.h.

CommonSymbolList

NotifyStubEmittedFunction

Initial value:

std::function< void( StringRef FileName, StringRef SectionName, StringRef SymbolName, unsigned SectionID, uint32_t StubOffset)> NotifyStubEmittedFunction

Definition at line 305 of file RuntimeDyldImpl.h.

ObjSectionToIDMap

RelocationList

SectionList

SID

StubMap

~RuntimeDyldImpl()

RuntimeDyldImpl::~RuntimeDyldImpl ( ) virtualdefault

addRelocationForSection()

addRelocationForSymbol()

Definition at line 954 of file RuntimeDyld.cpp.

References llvm::RelocationEntry::Addend, assert(), ExternalSymbolRelocations, GlobalSymbolTable, and Relocations.

Referenced by llvm::RuntimeDyldCOFF::getDLLImportOffset(), llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection(), llvm::RuntimeDyldCOFFAArch64::processRelocationRef(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::RuntimeDyldMachOAArch64::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldMachOI386::processRelocationRef(), and llvm::RuntimeDyldMachOX86_64::processRelocationRef().

applyExternalSymbolRelocations()

Definition at line 1124 of file RuntimeDyld.cpp.

References assert(), llvm::dbgs(), llvm::StringMap< ValueTy, AllocatorTy >::end(), ExternalSymbolRelocations, llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::format(), getSectionLoadAddress(), GlobalSymbolTable, LLVM_DEBUG, modifyAddressBasedOnFlags(), llvm::report_fatal_error(), Resolver, resolveRelocationList(), and UINT64_MAX.

Referenced by resolveExternalSymbols().

clearError()

void llvm::RuntimeDyldImpl::clearError ( ) inline

computeGOTSize()

computeSectionStubBufSize()

Definition at line 668 of file RuntimeDyld.cpp.

References llvm::commonAlignment(), llvm::DataSize, getMaxStubSize(), getStubAlignment(), MemMgr, relocationNeedsDLLImportStub(), relocationNeedsStub(), llvm::report_fatal_error(), sizeAfterAddingDLLImportStub(), llvm::Expected< T >::takeError(), llvm::toString(), and llvm::Align::value().

Referenced by computeTotalAllocSize(), and emitSection().

computeTotalAllocSize()

Definition at line 535 of file RuntimeDyld.cpp.

References llvm::alignTo(), CodeSize, llvm::computeAllocationSizeForSections(), computeGOTSize(), computeSectionStubBufSize(), llvm::DataSize, getGOTEntrySize(), getStubAlignment(), I, llvm::isReadOnlyData(), llvm::isRequiredForExecution(), llvm::isTLS(), ProcessAllSections, llvm::object::BasicSymbolRef::SF_Common, Size, llvm::Error::success(), llvm::Expected< T >::takeError(), and llvm::Align::value().

Referenced by loadObjectImpl().

createStubFunction()

Emits long jump instruction to Addr.

Returns

Pointer to the memory area for emitting target address.

Definition at line 973 of file RuntimeDyld.cpp.

References llvm::Triple::aarch64, llvm::Triple::aarch64_32, llvm::Triple::aarch64_be, Arch, llvm::Triple::arm, llvm::Triple::armeb, llvm::ELF::EF_MIPS_ARCH, llvm::ELF::EF_MIPS_ARCH_32R6, llvm::ELF::EF_MIPS_ARCH_64R6, IsMipsN32ABI, IsMipsN64ABI, IsMipsO32ABI, llvm::Triple::loongarch64, llvm::Triple::ppc64, llvm::Triple::ppc64le, llvm::Triple::systemz, writeBytesUnaligned(), writeInt16BE(), writeInt32BE(), llvm::Triple::x86, and llvm::Triple::x86_64.

Referenced by llvm::RuntimeDyldCOFFAArch64::generateRelocationStub(), llvm::RuntimeDyldCOFFX86_64::generateRelocationStub(), and llvm::RuntimeDyldELF::processRelocationRef().

deregisterEHFrames()

void llvm::RuntimeDyldImpl::deregisterEHFrames ( )

emitCommonSymbols()

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 748 of file RuntimeDyld.cpp.

References llvm::dbgs(), llvm::format(), getJITSymbolFlags(), GlobalSymbolTable, LLVM_DEBUG, MemMgr, llvm::Offset, llvm::offsetToAlignment(), llvm::report_fatal_error(), Sections, Size, and llvm::Error::success().

Referenced by loadObjectImpl().

emitSection()

Emits section data from the object file to the MemoryManager.

Parameters

IsCode if it's true then allocateCodeSection() will be used for emits, else allocateDataSection() will be used.

Returns

SectionID.

Definition at line 804 of file RuntimeDyld.cpp.

References computeSectionStubBufSize(), data, llvm::DataSize, llvm::dbgs(), llvm::format(), getStubAlignment(), llvm::isReadOnlyData(), llvm::isRequiredForExecution(), llvm::isTLS(), llvm::isZeroInit(), LLVM_DEBUG, MemMgr, ProcessAllSections, llvm::report_fatal_error(), Sections, llvm::Expected< T >::takeError(), and llvm::Align::value().

Referenced by findOrEmitSection().

finalizeAsync()

finalizeLoad()

findOrEmitSection()

getErrorString()

StringRef llvm::RuntimeDyldImpl::getErrorString ( ) inline

getGOTEntrySize()

virtual size_t llvm::RuntimeDyldImpl::getGOTEntrySize ( ) inlineprotectedvirtual

getJITSymbolFlags()

getMaxStubSize()

virtual unsigned llvm::RuntimeDyldImpl::getMaxStubSize ( ) const protectedpure virtual

getSectionAddress()

uint8_t * llvm::RuntimeDyldImpl::getSectionAddress ( unsigned SectionID) const inline

getSectionContent()

StringRef llvm::RuntimeDyldImpl::getSectionContent ( unsigned SectionID) const inline

getSectionLoadAddress()

uint64_t llvm::RuntimeDyldImpl::getSectionLoadAddress ( unsigned SectionID) const inline

getStubAlignment()

virtual Align llvm::RuntimeDyldImpl::getStubAlignment ( ) protectedpure virtual

getSymbol()

getSymbolLocalAddress()

uint8_t * llvm::RuntimeDyldImpl::getSymbolLocalAddress ( StringRef Name) const inline

getSymbolSectionID()

getSymbolTable()

hasError()

bool llvm::RuntimeDyldImpl::hasError ( ) inline

isCompatibleFile()

virtual bool llvm::RuntimeDyldImpl::isCompatibleFile ( const ObjectFile & Obj) const pure virtual

loadObject()

loadObjectImpl()

Definition at line 182 of file RuntimeDyld.cpp.

References AbsoluteSymbolSection, llvm::alignTo(), Arch, CodeSize, computeTotalAllocSize(), llvm::dbgs(), emitCommonSymbols(), finalizeLoad(), findOrEmitSection(), llvm::format(), getJITSymbolFlags(), llvm::getOffset(), GlobalSymbolTable, I, IsTargetLittleEndian, llvm::object::SectionRef::isText(), LLVM_DEBUG, lock, MemMgr, NotifyStubEmitted, ProcessAllSections, processNewSymbol(), processRelocationRef(), Resolver, Sections, setMipsABI(), llvm::object::BasicSymbolRef::SF_Absolute, llvm::object::BasicSymbolRef::SF_Common, llvm::object::BasicSymbolRef::SF_Undefined, llvm::object::BasicSymbolRef::SF_Weak, Size, llvm::object::SymbolRef::ST_Data, llvm::object::SymbolRef::ST_File, llvm::object::SymbolRef::ST_Function, llvm::object::SymbolRef::ST_Other, llvm::object::SymbolRef::ST_Unknown, and llvm::Expected< T >::takeError().

Referenced by llvm::RuntimeDyldCOFF::loadObject(), llvm::RuntimeDyldELF::loadObject(), and llvm::RuntimeDyldMachO::loadObject().

mapSectionAddress()

void llvm::RuntimeDyldImpl::mapSectionAddress ( const void * LocalAddress,
uint64_t TargetAddress )

modifyAddressBasedOnFlags()

processNewSymbol()

processRelocationRef()

readBytesUnaligned()

reassignSectionAddress()

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

registerEHFrames()

void llvm::RuntimeDyldImpl::registerEHFrames ( ) virtual

relocationNeedsDLLImportStub()

virtual bool llvm::RuntimeDyldImpl::relocationNeedsDLLImportStub ( const RelocationRef & R) const inlineprotectedvirtual

relocationNeedsGot()

virtual bool llvm::RuntimeDyldImpl::relocationNeedsGot ( const RelocationRef & R) const inlineprotectedvirtual

relocationNeedsStub()

virtual bool llvm::RuntimeDyldImpl::relocationNeedsStub ( const RelocationRef & R) const inlineprotectedvirtual

resolveExternalSymbols()

Error llvm::RuntimeDyldImpl::resolveExternalSymbols ( ) protected

resolveLocalRelocations()

void llvm::RuntimeDyldImpl::resolveLocalRelocations ( )

resolveRelocation()

resolveRelocationList()

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

resolveRelocations()

void llvm::RuntimeDyldImpl::resolveRelocations ( )

setMipsABI()

virtual void llvm::RuntimeDyldImpl::setMipsABI ( const ObjectFile & Obj) inlineprotectedvirtual

setNotifyStubEmitted()

void llvm::RuntimeDyldImpl::setNotifyStubEmitted ( NotifyStubEmittedFunction NotifyStubEmitted) inline

setProcessAllSections()

void llvm::RuntimeDyldImpl::setProcessAllSections ( bool ProcessAllSections) inline

sizeAfterAddingDLLImportStub()

virtual unsigned llvm::RuntimeDyldImpl::sizeAfterAddingDLLImportStub ( unsigned Size) const inlineprotectedvirtual

writeBytesUnaligned()

writeInt16BE()

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

writeInt32BE()

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

writeInt64BE()

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

RuntimeDyld::LoadedObjectInfo

AbsoluteSymbolSection

const unsigned llvm::RuntimeDyldImpl::AbsoluteSymbolSection = ~0U staticprotected

Arch

ErrorStr

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

ExternalSymbolRelocations

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

GlobalSymbolTable

Definition at line 259 of file RuntimeDyldImpl.h.

Referenced by addRelocationForSymbol(), applyExternalSymbolRelocations(), emitCommonSymbols(), llvm::RuntimeDyldMachO::getRelocationValueRef(), getSymbol(), getSymbolLocalAddress(), getSymbolSectionID(), getSymbolTable(), llvm::RuntimeDyldMachOARM::isAddrTargetThumb(), loadObjectImpl(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), and resolveExternalSymbols().

HasError

bool llvm::RuntimeDyldImpl::HasError protected

IsMipsN32ABI

bool llvm::RuntimeDyldImpl::IsMipsN32ABI protected

IsMipsN64ABI

bool llvm::RuntimeDyldImpl::IsMipsN64ABI protected

IsMipsO32ABI

bool llvm::RuntimeDyldImpl::IsMipsO32ABI protected

IsTargetLittleEndian

bool llvm::RuntimeDyldImpl::IsTargetLittleEndian protected

lock

MemMgr

Definition at line 239 of file RuntimeDyldImpl.h.

Referenced by computeSectionStubBufSize(), llvm::RuntimeDyldCOFF::create(), llvm::RuntimeDyldELF::create(), llvm::RuntimeDyldMachO::create(), deregisterEHFrames(), emitCommonSymbols(), emitSection(), llvm::RuntimeDyldELF::finalizeLoad(), loadObjectImpl(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::registerEHFrames(), llvm::RuntimeDyldELF::registerEHFrames(), llvm::RuntimeDyldMachOCRTPBase< Impl >::registerEHFrames(), llvm::RuntimeDyldCOFF::RuntimeDyldCOFF(), llvm::RuntimeDyldELF::RuntimeDyldELF(), RuntimeDyldImpl(), llvm::RuntimeDyldMachO::RuntimeDyldMachO(), llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOARM >::RuntimeDyldMachOCRTPBase(), and llvm::RuntimeDyldELF::~RuntimeDyldELF().

NotifyStubEmitted

NotifyStubEmittedFunction llvm::RuntimeDyldImpl::NotifyStubEmitted protected

ProcessAllSections

bool llvm::RuntimeDyldImpl::ProcessAllSections protected

Relocations

std::unordered_map<unsigned, RelocationList> llvm::RuntimeDyldImpl::Relocations protected

Resolver

Definition at line 242 of file RuntimeDyldImpl.h.

Referenced by applyExternalSymbolRelocations(), llvm::RuntimeDyldCOFF::create(), llvm::RuntimeDyldELF::create(), llvm::RuntimeDyldMachO::create(), loadObjectImpl(), resolveExternalSymbols(), llvm::RuntimeDyldCOFF::RuntimeDyldCOFF(), llvm::RuntimeDyldELF::RuntimeDyldELF(), RuntimeDyldImpl(), llvm::RuntimeDyldMachO::RuntimeDyldMachO(), and llvm::RuntimeDyldELF::~RuntimeDyldELF().

Sections

SectionList llvm::RuntimeDyldImpl::Sections protected

Definition at line 249 of file RuntimeDyldImpl.h.

Referenced by llvm::RuntimeDyldMachOAArch64::decodeAddend(), llvm::RuntimeDyldMachOARM::decodeAddend(), llvm::RuntimeDyldMachO::dumpRelocationToResolve(), emitCommonSymbols(), emitSection(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldCOFFAArch64::generateRelocationStub(), llvm::RuntimeDyldCOFFX86_64::generateRelocationStub(), llvm::RuntimeDyldCOFF::getDLLImportOffset(), llvm::RuntimeDyldMachO::getSection(), getSectionAddress(), getSectionContent(), getSectionLoadAddress(), llvm::RuntimeDyldMachOARM::isAddrTargetThumb(), loadObjectImpl(), mapSectionAddress(), llvm::RuntimeDyldMachO::memcpyAddend(), llvm::RuntimeDyldMachO::populateIndirectSymbolPointersSection(), llvm::RuntimeDyldCOFFAArch64::processRelocationRef(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::RuntimeDyldMachO::processScatteredVANILLA(), reassignSectionAddress(), llvm::RuntimeDyldCOFFX86_64::registerEHFrames(), llvm::RuntimeDyldELF::registerEHFrames(), llvm::RuntimeDyldMachOCRTPBase< Impl >::registerEHFrames(), llvm::RuntimeDyldCOFFAArch64::resolveRelocation(), llvm::RuntimeDyldCOFFI386::resolveRelocation(), llvm::RuntimeDyldCOFFThumb::resolveRelocation(), llvm::RuntimeDyldCOFFX86_64::resolveRelocation(), llvm::RuntimeDyldELF::resolveRelocation(), llvm::RuntimeDyldELFMips::resolveRelocation(), llvm::RuntimeDyldMachOAArch64::resolveRelocation(), llvm::RuntimeDyldMachOARM::resolveRelocation(), llvm::RuntimeDyldMachOI386::resolveRelocation(), llvm::RuntimeDyldMachOX86_64::resolveRelocation(), resolveRelocationList(), and resolveRelocations().


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