LLVM
8.0.1
|
#include "ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h"
Static Public Member Functions | |
static std::unique_ptr< RuntimeDyldELF > | create (Triple::ArchType Arch, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver) |
Static Public Member Functions inherited from llvm::RuntimeDyldImpl | |
static void | finalizeAsync (std::unique_ptr< RuntimeDyldImpl > This, std::function< void(Error)> OnEmitted, std::unique_ptr< MemoryBuffer > UnderlyingBuffer) |
Protected Member Functions | |
size_t | getGOTEntrySize () override |
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... | |
virtual Expected< JITSymbolFlags > | getJITSymbolFlags (const SymbolRef &Sym) |
Generate JITSymbolFlags from a libObject symbol. More... | |
virtual uint64_t | modifyAddressBasedOnFlags (uint64_t Addr, JITSymbolFlags Flags) const |
Modify the given target address based on the given symbol flags. More... | |
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. More... | |
Expected< unsigned > | emitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode) |
Emits section data from the object file to the MemoryManager. More... | |
Expected< unsigned > | findOrEmitSection (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 | applyExternalSymbolRelocations (const StringMap< JITEvaluatedSymbol > ExternalSymbolMap) |
Error | 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 | computeGOTSize (const ObjectFile &Obj) |
unsigned | computeSectionStubBufSize (const ObjectFile &Obj, const SectionRef &Section) |
Expected< ObjSectionToIDMap > | loadObjectImpl (const object::ObjectFile &Obj) |
Protected Attributes | |
DenseMap< SID, SID > | SectionToGOTMap |
Protected Attributes inherited from llvm::RuntimeDyldImpl | |
RuntimeDyld::MemoryManager & | MemMgr |
JITSymbolResolver & | Resolver |
RuntimeDyldCheckerImpl * | Checker |
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 |
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< SymbolRef > | CommonSymbolList |
typedef SmallVector< RelocationEntry, 64 > | RelocationList |
typedef std::map< RelocationValueRef, uintptr_t > | StubMap |
Static Protected Attributes inherited from llvm::RuntimeDyldImpl | |
static const unsigned | AbsoluteSymbolSection = ~0U |
Definition at line 27 of file RuntimeDyldELF.h.
llvm::RuntimeDyldELF::RuntimeDyldELF | ( | RuntimeDyld::MemoryManager & | MemMgr, |
JITSymbolResolver & | Resolver | ||
) |
Definition at line 220 of file RuntimeDyldELF.cpp.
|
override |
Definition at line 223 of file RuntimeDyldELF.cpp.
|
static |
Definition at line 237 of file RuntimeDyldELF.cpp.
References llvm::RuntimeDyldImpl::MemMgr, llvm::Triple::mips, llvm::Triple::mips64, llvm::Triple::mips64el, llvm::Triple::mipsel, and llvm::RuntimeDyldImpl::Resolver.
Referenced by llvm::createRuntimeDyldELF().
|
overridevirtual |
Reimplemented from llvm::RuntimeDyldImpl.
Definition at line 1842 of file RuntimeDyldELF.cpp.
References llvm::RuntimeDyld::MemoryManager::allocateDataSection(), assert(), llvm::RuntimeDyldImpl::Checker, llvm::StringMap< ValueTy, AllocatorTy >::clear(), llvm::object::Binary::getFileName(), getGOTEntrySize(), llvm::object::SectionRef::getName(), llvm::RuntimeDyldImpl::IsMipsN32ABI, llvm::RuntimeDyldImpl::IsMipsN64ABI, llvm::RuntimeDyldImpl::IsMipsO32ABI, llvm::RuntimeDyldImpl::MemMgr, llvm::Intrinsic::memset, Name, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::ARMBuildAttrs::Section, llvm::object::ObjectFile::section_begin(), llvm::object::ObjectFile::section_end(), llvm::RuntimeDyldImpl::Sections, SectionToGOTMap, SI, and llvm::Error::success().
|
overrideprotectedvirtual |
Reimplemented from llvm::RuntimeDyldImpl.
Definition at line 1760 of file RuntimeDyldELF.cpp.
References llvm::Triple::aarch64, llvm::Triple::aarch64_be, llvm::RuntimeDyldImpl::addRelocationForSection(), llvm::RuntimeDyldImpl::addRelocationForSymbol(), llvm::RuntimeDyldImpl::Arch, llvm::Triple::arm, E, llvm::RuntimeDyldImpl::IsMipsN32ABI, llvm::RuntimeDyldImpl::IsMipsN64ABI, llvm::RuntimeDyldImpl::IsMipsO32ABI, llvm_unreachable, llvm::Triple::mips, llvm::Triple::mips64, llvm::Triple::mips64el, llvm::Triple::mipsel, llvm::RelocationValueRef::Offset, llvm::Triple::ppc64, llvm::Triple::ppc64le, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::RelocationValueRef::SectionID, llvm::RuntimeDyldImpl::Sections, llvm::SmallVectorBase::size(), llvm::RelocationValueRef::SymbolName, llvm::Triple::systemz, llvm::Triple::thumb, llvm::Triple::x86, and llvm::Triple::x86_64.
Referenced by finalizeLoad(), and llvm::RuntimeDyldELFMips::resolveRelocation().
|
overridevirtual |
Implements llvm::RuntimeDyldImpl.
Definition at line 1900 of file RuntimeDyldELF.cpp.
References llvm::Triple::aarch64, llvm::Triple::aarch64_be, llvm::RuntimeDyldImpl::Arch, llvm::object::RelocationRef::getType(), llvm::object::Binary::isELF(), and llvm::Triple::x86_64.
|
overridevirtual |
Implements llvm::RuntimeDyldImpl.
Definition at line 252 of file RuntimeDyldELF.cpp.
References llvm::Triple::aarch64_be, llvm::RelocationValueRef::Addend, llvm::RuntimeDyldImpl::Arch, assert(), llvm::dbgs(), E, llvm::ELF::EF_MIPS_ABI2, llvm::ELF::EF_MIPS_ABI_O32, llvm::StringRef::equals(), llvm::errorCodeToError(), llvm::RuntimeDyldImpl::ErrorStr, llvm::RuntimeDyldImpl::findOrEmitSection(), llvm::format(), llvm::SectionEntry::getAddress(), llvm::SectionEntry::getAddressWithOffset(), llvm::Triple::getArchTypePrefix(), getBits(), llvm::object::ObjectFile::getFileFormatName(), llvm::SectionEntry::getLoadAddressWithOffset(), llvm::SectionEntry::getName(), llvm::object::SymbolRef::getSection(), llvm::object::SymbolRef::getType(), llvm::RuntimeDyldImpl::HasError, llvm::isInt< 32 >(), llvm::isInt< 8 >(), llvm::RuntimeDyldImpl::IsMipsN32ABI, llvm::RuntimeDyldImpl::IsMipsN64ABI, llvm::RuntimeDyldImpl::IsMipsO32ABI, LLVM_DEBUG, llvm_unreachable, llvm::RuntimeDyldImpl::loadObjectImpl(), llvm::logAllUnhandledErrors(), or32AArch64Imm(), or32le(), llvm::ARMBuildAttrs::Section, llvm::object::ObjectFile::section_begin(), llvm::object::ObjectFile::section_end(), llvm::RelocationValueRef::SectionID, AMDGPU::ElfNote::SectionName, llvm::RuntimeDyldImpl::Sections, llvm::object::ObjectFile::sections(), llvm::Error::success(), llvm::RelocationValueRef::SymbolName, llvm::Triple::UnknownArch, write(), and write32AArch64Addr().
|
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).
Implements llvm::RuntimeDyldImpl.
Definition at line 1099 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::consumeError(), llvm::RuntimeDyldImpl::createStubFunction(), llvm::StringRef::data(), llvm::dbgs(), llvm::ELF::EF_PPC64_ABI, 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::ELFObjectFileBase::getPlatformFlags(), llvm::SectionEntry::getStubOffset(), llvm::RuntimeDyldImpl::GlobalSymbolTable, I, llvm::RuntimeDyldImpl::IsMipsN32ABI, llvm::RuntimeDyldImpl::IsMipsN64ABI, llvm::RuntimeDyldImpl::IsMipsO32ABI, LLVM_DEBUG, llvm_unreachable, llvm::logAllUnhandledErrors(), llvm::RISCVFenceField::O, llvm::RelocationValueRef::Offset, llvm::Triple::ppc64, llvm::Triple::ppc64le, llvm::RuntimeDyldImpl::readBytesUnaligned(), llvm::RelocationEntry::RelType, llvm::report_fatal_error(), llvm::object::ObjectFile::section_end(), llvm::RelocationEntry::SectionID, llvm::RelocationValueRef::SectionID, llvm::RuntimeDyldImpl::Sections, llvm::ARMBuildAttrs::Symbol, llvm::object::SymbolicFile::symbol_end(), llvm::RelocationValueRef::SymbolName, llvm::RelocationEntry::SymOffset, and llvm::Expected< T >::takeError().
|
overridevirtual |
Reimplemented from llvm::RuntimeDyldImpl.
Definition at line 225 of file RuntimeDyldELF.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::RuntimeDyldImpl::MemMgr, llvm::RuntimeDyld::MemoryManager::registerEHFrames(), llvm::RuntimeDyldImpl::Sections, and llvm::SmallVectorBase::size().
|
overridevirtual |
A object file specific relocation resolver.
RE | The relocation to be resolved |
Value | Target symbol address to apply the relocation action |
Implements llvm::RuntimeDyldImpl.
Reimplemented in llvm::RuntimeDyldELFMips.
Definition at line 917 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::Address, llvm::SectionEntry::advanceStubOffset(), llvm::RuntimeDyldImpl::Arch, llvm::Triple::arm, llvm::Triple::armeb, llvm::Triple::bpfeb, llvm::Triple::bpfel, llvm::RuntimeDyldImpl::createStubFunction(), llvm::dbgs(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::SectionEntry::getAddress(), llvm::SectionEntry::getAddressWithOffset(), llvm::SectionEntry::getStubOffset(), llvm::RuntimeDyldImpl::GlobalSymbolTable, LLVM_DEBUG, llvm_unreachable, llvm::RelocationEntry::Offset, llvm::RelocationValueRef::Offset, llvm::Triple::ppc, llvm::Triple::ppc64, llvm::Triple::ppc64le, llvm::RelocationEntry::RelType, llvm::RelocationEntry::SectionID, llvm::RelocationValueRef::SectionID, llvm::RuntimeDyldImpl::Sections, llvm::RelocationValueRef::SymbolName, llvm::RelocationEntry::SymOffset, llvm::Triple::systemz, llvm::Triple::thumb, llvm::Triple::thumbeb, llvm::Triple::x86, and llvm::Triple::x86_64.
Definition at line 143 of file RuntimeDyldELF.h.
Referenced by finalizeLoad(), and llvm::RuntimeDyldELFMips::resolveRelocation().