LLVM API Documentation
#include <RuntimeDyldImpl.h>
Public Member Functions | |
RuntimeDyldImpl (RTDyldMemoryManager *mm) | |
virtual | ~RuntimeDyldImpl () |
ObjectImage * | loadObject (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< SymbolLoc > | SymbolTableMap |
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 ObjectImage * | createObjectImage (ObjectBuffer *InputBuffer) |
Protected Attributes | |
RTDyldMemoryManager * | MemMgr |
SectionList | Sections |
SymbolTableMap | GlobalSymbolTable |
DenseMap< unsigned, RelocationList > | Relocations |
StringMap< RelocationList > | ExternalSymbolRelocations |
Triple::ArchType | Arch |
bool | IsTargetLittleEndian |
sys::Mutex | lock |
bool | HasError |
std::string | ErrorStr |
Definition at line 141 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 165 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 167 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 156 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 174 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 148 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 151 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 185 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 160 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 161 of file RuntimeDyldImpl.h.
|
inline |
Definition at line 315 of file RuntimeDyldImpl.h.
|
virtual |
Definition at line 30 of file RuntimeDyld.cpp.
|
protected |
Definition at line 373 of file RuntimeDyld.cpp.
|
protected |
Definition at line 378 of file RuntimeDyld.cpp.
References llvm::RelocationEntry::Addend, and llvm::StringMapEntry< ValueTy >::second.
|
inline |
Definition at line 351 of file RuntimeDyldImpl.h.
|
protectedvirtual |
Reimplemented in llvm::RuntimeDyldELF.
Definition at line 81 of file RuntimeDyld.cpp.
|
protected |
Emits long jump instruction to Addr.
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.
|
virtual |
Reimplemented in llvm::RuntimeDyldELF.
Definition at line 42 of file RuntimeDyld.cpp.
|
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().
|
protected |
Emits section data from the object file to the MemoryManager.
IsCode | if it's true then allocateCodeSection() will be used for emits, else allocateDataSection() will be used. |
Definition at line 236 of file RuntimeDyld.cpp.
References llvm::object::ObjectFile::begin_sections(), Check(), llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::object::ObjectFile::end_sections(), llvm::format(), llvm::object::SectionRef::getAlignment(), llvm::object::SectionRef::getContents(), llvm::object::SectionRef::getName(), llvm::ObjectImage::getObjectFile(), llvm::object::SectionRef::getSize(), I, llvm::object::content_iterator< content_type >::increment(), llvm::object::SectionRef::isReadOnlyData(), llvm::object::SectionRef::isRequiredForExecution(), llvm::object::SectionRef::isVirtual(), llvm::object::SectionRef::isZeroInit(), llvm::Intrinsic::memcpy, llvm::Intrinsic::memset, llvm::report_fatal_error(), and llvm::ObjectImage::updateSectionAddress().
Definition at line 209 of file RuntimeDyldImpl.h.
References llvm::Twine::str().
|
inlinevirtual |
Reimplemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.
Definition at line 362 of file RuntimeDyldImpl.h.
|
protected |
Find Section in LocalSections. If the secton is not found - emit it and store in LocalSections.
IsCode | if it's true then allocateCodeSection() will be used for emmits, else allocateDataSection() will be used. |
Definition at line 357 of file RuntimeDyld.cpp.
References llvm::ARMBuildAttrs::Section.
|
inline |
Definition at line 354 of file RuntimeDyldImpl.h.
|
protectedpure virtual |
|
inlineprotected |
Definition at line 219 of file RuntimeDyldImpl.h.
|
inlineprotected |
Definition at line 215 of file RuntimeDyldImpl.h.
|
protectedpure virtual |
|
inline |
Definition at line 321 of file RuntimeDyldImpl.h.
References llvm::StringMapEntry< ValueTy >::second.
|
inline |
Definition at line 331 of file RuntimeDyldImpl.h.
References llvm::StringMapEntry< ValueTy >::second.
|
inline |
Definition at line 348 of file RuntimeDyldImpl.h.
|
pure virtual |
Implemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.
ObjectImage * llvm::RuntimeDyldImpl::loadObject | ( | ObjectBuffer * | InputBuffer | ) |
Definition at line 85 of file RuntimeDyld.cpp.
References Align(), llvm::StringRef::begin(), llvm::ObjectImage::begin_sections(), llvm::ObjectImage::begin_symbols(), Check(), llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::ObjectImage::end_sections(), llvm::ObjectImage::end_symbols(), llvm::format(), llvm::ObjectImage::getArch(), llvm::ObjectBuffer::getBufferStart(), llvm::ObjectImage::getObjectFile(), llvm::object::content_iterator< content_type >::increment(), llvm::object::Binary::isLittleEndian(), llvm::report_fatal_error(), llvm::object::SymbolRef::ST_Data, llvm::object::SymbolRef::ST_Function, llvm::object::SymbolRef::ST_Unknown, and llvm::OwningPtr< T >::take().
void llvm::RuntimeDyldImpl::mapSectionAddress | ( | const void * | LocalAddress, |
uint64_t | TargetAddress | ||
) |
Definition at line 67 of file RuntimeDyld.cpp.
References llvm_unreachable.
|
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.
|
virtual |
Reimplemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.
Definition at line 39 of file RuntimeDyld.cpp.
|
protected |
Resolve relocations to external symbols.
Definition at line 498 of file RuntimeDyld.cpp.
References llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::format(), llvm::report_fatal_error(), llvm::StringMapEntry< ValueTy >::second, and llvm::StringRef::size().
|
protectedpure virtual |
A object file specific relocation resolver.
RE | The relocation to be resolved |
Value | Target symbol address to apply the relocation action |
Implemented in llvm::RuntimeDyldELF, and llvm::RuntimeDyldMachO.
|
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().
|
inlineprotectedvirtual |
Update GOT entries for external symbols.
Definition at line 311 of file RuntimeDyldImpl.h.
|
inlineprotected |
Definition at line 223 of file RuntimeDyldImpl.h.
References llvm::sys::SwapByteOrder().
|
inlineprotected |
Definition at line 230 of file RuntimeDyldImpl.h.
References llvm::sys::SwapByteOrder().
|
inlineprotected |
Definition at line 239 of file RuntimeDyldImpl.h.
References llvm::sys::SwapByteOrder().
|
protected |
Definition at line 187 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 206 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 183 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 162 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 205 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 188 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 200 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 144 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 178 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 149 of file RuntimeDyldImpl.h.