LLVM API Documentation

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
llvm::RuntimeDyldImpl Class Reference

#include <RuntimeDyldImpl.h>

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

List of all members.

Public Member Functions

 RuntimeDyldImpl (RTDyldMemoryManager *mm)
virtual ~RuntimeDyldImpl ()
void setProcessAllSections (bool ProcessAllSections)
void setRuntimeDyldChecker (RuntimeDyldCheckerImpl *Checker)
ObjectImageloadObject (ObjectImage *InputObject)
uint8_t * 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 bool isCompatibleFile (const ObjectFile *Obj) const =0
virtual void registerEHFrames ()
virtual void deregisterEHFrames ()
virtual void finalizeLoad (ObjectImage &ObjImg, 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.
unsigned emitSection (ObjectImage &Obj, const SectionRef &Section, bool IsCode)
 Emits section data from the object file to the MemoryManager.
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.
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 relocation_iterator processRelocationRef (unsigned SectionID, relocation_iterator RelI, ObjectImage &Obj, ObjSectionToIDMap &ObjSectionToID, const SymbolTableMap &Symbols, 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 resolveExternalSymbols ()
 Resolve relocations to external symbols.
virtual void updateGOTEntries (StringRef Name, uint64_t Addr)
 Update GOT entries for external symbols.
void computeTotalAllocSize (ObjectImage &Obj, uint64_t &CodeSize, uint64_t &DataSizeRO, uint64_t &DataSizeRW)
unsigned computeSectionStubBufSize (ObjectImage &Obj, const SectionRef &Section)

Protected Attributes

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

Friends

class RuntimeDyldCheckerImpl

Detailed Description

Definition at line 161 of file RuntimeDyldImpl.h.


Member Typedef Documentation

Definition at line 197 of file RuntimeDyldImpl.h.

Definition at line 199 of file RuntimeDyldImpl.h.

Definition at line 188 of file RuntimeDyldImpl.h.

Definition at line 206 of file RuntimeDyldImpl.h.

Definition at line 180 of file RuntimeDyldImpl.h.

typedef unsigned llvm::RuntimeDyldImpl::SID [protected]

Definition at line 183 of file RuntimeDyldImpl.h.

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

Definition at line 218 of file RuntimeDyldImpl.h.

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

Definition at line 192 of file RuntimeDyldImpl.h.

Definition at line 193 of file RuntimeDyldImpl.h.


Constructor & Destructor Documentation

Definition at line 355 of file RuntimeDyldImpl.h.

Definition at line 31 of file RuntimeDyld.cpp.


Member Function Documentation

Definition at line 401 of file RuntimeDyldImpl.h.

void llvm::RuntimeDyldImpl::computeTotalAllocSize ( ObjectImage Obj,
uint64_t &  CodeSize,
uint64_t &  DataSizeRO,
uint64_t &  DataSizeRW 
) [protected]
uint8_t * llvm::RuntimeDyldImpl::createStubFunction ( uint8_t *  Addr,
unsigned  AbiVariant = 0 
) [protected]

Emits long jump instruction to Addr.

Returns:
Pointer to the memory area for emitting target address.

Definition at line 526 of file RuntimeDyld.cpp.

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

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

References Align(), llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::format(), llvm::LibFunc::memset, Name, 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) [inline, protected]
virtual void llvm::RuntimeDyldImpl::finalizeLoad ( ObjectImage ObjImg,
ObjSectionToIDMap SectionMap 
) [inline, virtual]
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 489 of file RuntimeDyld.cpp.

References llvm::ARMBuildAttrs::Section.

Definition at line 404 of file RuntimeDyldImpl.h.

virtual unsigned llvm::RuntimeDyldImpl::getMaxStubSize ( ) [protected, pure virtual]
uint8_t* llvm::RuntimeDyldImpl::getSectionAddress ( unsigned  SectionID) [inline, protected]

Definition at line 256 of file RuntimeDyldImpl.h.

uint64_t llvm::RuntimeDyldImpl::getSectionLoadAddress ( unsigned  SectionID) [inline, protected]

Definition at line 252 of file RuntimeDyldImpl.h.

virtual unsigned llvm::RuntimeDyldImpl::getStubAlignment ( ) [protected, pure virtual]

Definition at line 371 of file RuntimeDyldImpl.h.

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

Definition at line 381 of file RuntimeDyldImpl.h.

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

Definition at line 398 of file RuntimeDyldImpl.h.

virtual bool llvm::RuntimeDyldImpl::isCompatibleFile ( const ObjectFile Obj) const [pure virtual]
virtual bool llvm::RuntimeDyldImpl::isCompatibleFormat ( const ObjectBuffer Buffer) const [pure virtual]
void llvm::RuntimeDyldImpl::mapSectionAddress ( const void *  LocalAddress,
uint64_t  TargetAddress 
)

Definition at line 65 of file RuntimeDyld.cpp.

References llvm_unreachable.

virtual relocation_iterator llvm::RuntimeDyldImpl::processRelocationRef ( unsigned  SectionID,
relocation_iterator  RelI,
ObjectImage Obj,
ObjSectionToIDMap ObjSectionToID,
const SymbolTableMap Symbols,
StubMap Stubs 
) [protected, pure virtual]

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

Returns:
Iterator to the next relocation that needs to be parsed.

Implemented in llvm::RuntimeDyldMachOAArch64, llvm::RuntimeDyldELF, llvm::RuntimeDyldMachOARM, llvm::RuntimeDyldMachOI386, and llvm::RuntimeDyldMachOX86_64.

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

Definition at line 615 of file RuntimeDyld.cpp.

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

Definition at line 40 of file RuntimeDyld.cpp.

virtual void llvm::RuntimeDyldImpl::resolveRelocation ( const RelocationEntry RE,
uint64_t  Value 
) [protected, pure virtual]

A object file specific relocation resolver.

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

Implemented in llvm::RuntimeDyldMachOAArch64, llvm::RuntimeDyldELF, llvm::RuntimeDyldMachOARM, llvm::RuntimeDyldMachOI386, and llvm::RuntimeDyldMachOX86_64.

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

Resolves relocations from Relocs list with address from Value.

Definition at line 630 of file RuntimeDyld.cpp.

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

Definition at line 45 of file RuntimeDyld.cpp.

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

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

Definition at line 361 of file RuntimeDyldImpl.h.

Definition at line 365 of file RuntimeDyldImpl.h.

virtual void llvm::RuntimeDyldImpl::updateGOTEntries ( StringRef  Name,
uint64_t  Addr 
) [inline, protected, virtual]

Update GOT entries for external symbols.

Definition at line 343 of file RuntimeDyldImpl.h.

void llvm::RuntimeDyldImpl::writeInt16BE ( uint8_t *  Addr,
uint16_t  Value 
) [inline, protected]

Definition at line 260 of file RuntimeDyldImpl.h.

References llvm::sys::swapByteOrder().

void llvm::RuntimeDyldImpl::writeInt32BE ( uint8_t *  Addr,
uint32_t  Value 
) [inline, protected]

Definition at line 267 of file RuntimeDyldImpl.h.

References llvm::sys::swapByteOrder().

void llvm::RuntimeDyldImpl::writeInt64BE ( uint8_t *  Addr,
uint64_t  Value 
) [inline, protected]

Definition at line 276 of file RuntimeDyldImpl.h.

References llvm::sys::swapByteOrder().


Friends And Related Function Documentation

friend class RuntimeDyldCheckerImpl [friend]

Definition at line 162 of file RuntimeDyldImpl.h.


Member Data Documentation

Definition at line 220 of file RuntimeDyldImpl.h.

Referenced by llvm::RuntimeDyldMachOI386::processRelocationRef().

Definition at line 176 of file RuntimeDyldImpl.h.

std::string llvm::RuntimeDyldImpl::ErrorStr [protected]

Definition at line 243 of file RuntimeDyldImpl.h.

Definition at line 215 of file RuntimeDyldImpl.h.

Definition at line 194 of file RuntimeDyldImpl.h.

Definition at line 242 of file RuntimeDyldImpl.h.

Definition at line 221 of file RuntimeDyldImpl.h.

Definition at line 237 of file RuntimeDyldImpl.h.

Definition at line 173 of file RuntimeDyldImpl.h.

Definition at line 225 of file RuntimeDyldImpl.h.

Definition at line 210 of file RuntimeDyldImpl.h.


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