LLVM  4.0.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::RuntimeDyldELF Class Reference

#include <RuntimeDyldELF.h>

Inheritance diagram for llvm::RuntimeDyldELF:
[legend]
Collaboration diagram for llvm::RuntimeDyldELF:
[legend]

Public Member Functions

 RuntimeDyldELF (RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
 
 ~RuntimeDyldELF () override
 
std::unique_ptr
< RuntimeDyld::LoadedObjectInfo
loadObject (const object::ObjectFile &O) override
 
void resolveRelocation (const RelocationEntry &RE, uint64_t Value) override
 A object file specific relocation resolver. More...
 
Expected< relocation_iteratorprocessRelocationRef (unsigned SectionID, relocation_iterator RelI, const ObjectFile &Obj, ObjSectionToIDMap &ObjSectionToID, StubMap &Stubs) override
 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). More...
 
bool isCompatibleFile (const object::ObjectFile &Obj) const override
 
void registerEHFrames () override
 
void deregisterEHFrames () override
 
Error finalizeLoad (const ObjectFile &Obj, ObjSectionToIDMap &SectionMap) override
 
- Public Member Functions inherited from llvm::RuntimeDyldImpl
 RuntimeDyldImpl (RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
 
virtual ~RuntimeDyldImpl ()
 
void setProcessAllSections (bool ProcessAllSections)
 
void setRuntimeDyldChecker (RuntimeDyldCheckerImpl *Checker)
 
uint8_t * getSymbolLocalAddress (StringRef Name) const
 
JITEvaluatedSymbol getSymbol (StringRef Name) const
 
void resolveRelocations ()
 
void reassignSectionAddress (unsigned SectionID, uint64_t Addr)
 
void mapSectionAddress (const void *LocalAddress, uint64_t TargetAddress)
 
bool hasError ()
 
void clearError ()
 
StringRef getErrorString ()
 

Static Public Member Functions

static std::unique_ptr
< RuntimeDyldELF
create (Triple::ArchType Arch, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
 

Protected Member Functions

size_t getGOTEntrySize ()
 
- Protected Member Functions inherited from llvm::RuntimeDyldImpl
uint64_t getSectionLoadAddress (unsigned SectionID) const
 
uint8_t * getSectionAddress (unsigned SectionID) const
 
void writeInt16BE (uint8_t *Addr, uint16_t Value)
 
void writeInt32BE (uint8_t *Addr, uint32_t Value)
 
void writeInt64BE (uint8_t *Addr, uint64_t Value)
 
uint64_t readBytesUnaligned (uint8_t *Src, unsigned Size) const
 Endian-aware read Read the least significant Size bytes from Src. More...
 
void writeBytesUnaligned (uint64_t Value, uint8_t *Dst, unsigned Size) const
 Endian-aware write. More...
 
Error emitCommonSymbols (const ObjectFile &Obj, CommonSymbolList &CommonSymbols)
 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...
 
Expected< unsignedemitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode)
 Emits section data from the object file to the MemoryManager. More...
 
Expected< unsignedfindOrEmitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode, ObjSectionToIDMap &LocalSections)
 Find Section in LocalSections. More...
 
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. More...
 
void resolveRelocationList (const RelocationList &Relocs, uint64_t Value)
 Resolves relocations from Relocs list with address from Value. More...
 
void resolveExternalSymbols ()
 Resolve relocations to external symbols. More...
 
Error computeTotalAllocSize (const ObjectFile &Obj, uint64_t &CodeSize, uint32_t &CodeAlign, uint64_t &RODataSize, uint32_t &RODataAlign, uint64_t &RWDataSize, uint32_t &RWDataAlign)
 
unsigned computeSectionStubBufSize (const ObjectFile &Obj, const SectionRef &Section)
 
Expected< ObjSectionToIDMaploadObjectImpl (const object::ObjectFile &Obj)
 

Protected Attributes

DenseMap< SID, SIDSectionToGOTMap
 
- Protected Attributes inherited from llvm::RuntimeDyldImpl
RuntimeDyld::MemoryManagerMemMgr
 
JITSymbolResolverResolver
 
RuntimeDyldCheckerImplChecker
 
SectionList Sections
 
RTDyldSymbolTable GlobalSymbolTable
 
std::unordered_map< unsigned,
RelocationList
Relocations
 
StringMap< RelocationListExternalSymbolRelocations
 
Triple::ArchType Arch
 
bool IsTargetLittleEndian
 
bool IsMipsO32ABI
 
bool IsMipsN32ABI
 
bool IsMipsN64ABI
 
bool ProcessAllSections
 
sys::Mutex lock
 
bool HasError
 
std::string ErrorStr
 

Additional Inherited Members

- Protected Types inherited from llvm::RuntimeDyldImpl
typedef SmallVector
< SectionEntry, 64 > 
SectionList
 
typedef unsigned SID
 
typedef std::map< SectionRef,
unsigned
ObjSectionToIDMap
 
typedef std::vector< SymbolRefCommonSymbolList
 
typedef SmallVector
< RelocationEntry, 64 > 
RelocationList
 
typedef std::map
< RelocationValueRef,
uintptr_t > 
StubMap
 
- Static Protected Attributes inherited from llvm::RuntimeDyldImpl
static const unsigned AbsoluteSymbolSection = ~0U
 

Detailed Description

Definition at line 27 of file RuntimeDyldELF.h.

Constructor & Destructor Documentation

llvm::RuntimeDyldELF::RuntimeDyldELF ( RuntimeDyld::MemoryManager MemMgr,
JITSymbolResolver Resolver 
)

Definition at line 212 of file RuntimeDyldELF.cpp.

llvm::RuntimeDyldELF::~RuntimeDyldELF ( )
override

Definition at line 215 of file RuntimeDyldELF.cpp.

Member Function Documentation

std::unique_ptr< RuntimeDyldELF > llvm::RuntimeDyldELF::create ( Triple::ArchType  Arch,
RuntimeDyld::MemoryManager MemMgr,
JITSymbolResolver Resolver 
)
static
void llvm::RuntimeDyldELF::deregisterEHFrames ( )
overridevirtual
Error llvm::RuntimeDyldELF::finalizeLoad ( const ObjectFile Obj,
ObjSectionToIDMap SectionMap 
)
overridevirtual
size_t llvm::RuntimeDyldELF::getGOTEntrySize ( )
protected
bool llvm::RuntimeDyldELF::isCompatibleFile ( const object::ObjectFile Obj) const
overridevirtual

Implements llvm::RuntimeDyldImpl.

Definition at line 1662 of file RuntimeDyldELF.cpp.

References llvm::object::Binary::isELF().

std::unique_ptr< RuntimeDyld::LoadedObjectInfo > llvm::RuntimeDyldELF::loadObject ( const object::ObjectFile O)
overridevirtual
Expected< relocation_iterator > llvm::RuntimeDyldELF::processRelocationRef ( unsigned  SectionID,
relocation_iterator  RelI,
const ObjectFile Obj,
ObjSectionToIDMap ObjSectionToID,
StubMap Stubs 
)
overridevirtual

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.

Implements llvm::RuntimeDyldImpl.

Definition at line 945 of file RuntimeDyldELF.cpp.

References llvm::Triple::aarch64, llvm::Triple::aarch64_be, llvm::RelocationEntry::Addend, llvm::RelocationValueRef::Addend, llvm::RuntimeDyldImpl::addRelocationForSection(), llvm::RuntimeDyldImpl::addRelocationForSymbol(), llvm::SectionEntry::advanceStubOffset(), llvm::RuntimeDyldImpl::Arch, llvm::Triple::arm, llvm::RuntimeDyldImpl::createStubFunction(), llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::RuntimeDyldImpl::findOrEmitSection(), llvm::raw_ostream::flush(), llvm::object::ELFRelocationRef::getAddend(), llvm::SectionEntry::getAddress(), llvm::SectionEntry::getAddressWithOffset(), llvm::object::SymbolRef::getName(), llvm::object::ObjectFile::getPlatformFlags(), llvm::object::SymbolRef::getSection(), llvm::SectionEntry::getStubOffset(), llvm::object::SymbolRef::getType(), llvm::RuntimeDyldImpl::GlobalSymbolTable, I, llvm::RuntimeDyldImpl::IsMipsN32ABI, llvm::RuntimeDyldImpl::IsMipsN64ABI, llvm::RuntimeDyldImpl::IsMipsO32ABI, llvm_unreachable, llvm::logAllUnhandledErrors(), llvm::RelocationValueRef::Offset, llvm::RuntimeDyldImpl::readBytesUnaligned(), llvm::RelocationEntry::RelType, llvm::report_fatal_error(), llvm::StringMapEntry< ValueTy >::second, llvm::object::ObjectFile::section_end(), llvm::RelocationEntry::SectionID, llvm::RelocationValueRef::SectionID, llvm::RuntimeDyldImpl::Sections, llvm::object::SymbolRef::ST_Data, llvm::object::SymbolRef::ST_Debug, llvm::object::SymbolRef::ST_Function, llvm::object::SymbolRef::ST_Unknown, llvm::ARMBuildAttrs::Symbol, llvm::object::SymbolicFile::symbol_end(), llvm::RelocationValueRef::SymbolName, llvm::RelocationEntry::SymOffset, and llvm::Expected< T >::takeError().

void llvm::RuntimeDyldELF::registerEHFrames ( )
overridevirtual
void llvm::RuntimeDyldELF::resolveRelocation ( const RelocationEntry RE,
uint64_t  Value 
)
overridevirtual

A object file specific relocation resolver.

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

Implements llvm::RuntimeDyldImpl.

Reimplemented in llvm::RuntimeDyldELFMips.

Definition at line 822 of file RuntimeDyldELF.cpp.

References llvm::RelocationEntry::Addend, llvm::RelocationEntry::Offset, llvm::RelocationEntry::RelType, llvm::RelocationEntry::SectionID, llvm::RuntimeDyldImpl::Sections, and llvm::RelocationEntry::SymOffset.

Member Data Documentation

DenseMap<SID, SID> llvm::RuntimeDyldELF::SectionToGOTMap
protected

Definition at line 133 of file RuntimeDyldELF.h.

Referenced by finalizeLoad().


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