|
LLVM
4.0.0
|
#include <RuntimeDyldImpl.h>
Public Member Functions | |
| RuntimeDyldImpl (RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver) | |
| virtual | ~RuntimeDyldImpl () |
| void | setProcessAllSections (bool ProcessAllSections) |
| void | setRuntimeDyldChecker (RuntimeDyldCheckerImpl *Checker) |
| virtual std::unique_ptr < RuntimeDyld::LoadedObjectInfo > | loadObject (const object::ObjectFile &Obj)=0 |
| 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 () |
| virtual bool | isCompatibleFile (const ObjectFile &Obj) const =0 |
| virtual void | registerEHFrames () |
| virtual void | deregisterEHFrames () |
| virtual Error | finalizeLoad (const ObjectFile &ObjImg, ObjSectionToIDMap &SectionMap) |
Protected Types | |
| 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 |
Protected Member Functions | |
| virtual unsigned | getMaxStubSize ()=0 |
| virtual unsigned | getStubAlignment ()=0 |
| 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) |
| 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. 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< 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... | |
| virtual void | resolveRelocation (const RelocationEntry &RE, uint64_t Value)=0 |
| A object file specific relocation resolver. More... | |
| 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). 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< ObjSectionToIDMap > | loadObjectImpl (const object::ObjectFile &Obj) |
| virtual bool | relocationNeedsStub (const RelocationRef &R) const |
Protected Attributes | |
| 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 |
Static Protected Attributes | |
| static const unsigned | AbsoluteSymbolSection = ~0U |
Friends | |
| class | RuntimeDyld::LoadedObjectInfo |
| class | RuntimeDyldCheckerImpl |
Definition at line 238 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 269 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 263 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 276 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 255 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 258 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 288 of file RuntimeDyldImpl.h.
|
inline |
Definition at line 442 of file RuntimeDyldImpl.h.
|
virtual |
Definition at line 67 of file RuntimeDyld.cpp.
|
protected |
Definition at line 791 of file RuntimeDyld.cpp.
Referenced by llvm::RuntimeDyldMachOI386::processRelocationRef(), llvm::RuntimeDyldMachOX86_64::processRelocationRef(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldMachOAArch64::processRelocationRef().
|
protected |
Definition at line 796 of file RuntimeDyld.cpp.
References llvm::RelocationEntry::Addend, and llvm::StringMapEntry< ValueTy >::second.
Referenced by llvm::RuntimeDyldMachOI386::processRelocationRef(), llvm::RuntimeDyldMachOX86_64::processRelocationRef(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldMachOAArch64::processRelocationRef().
|
inline |
Definition at line 498 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 522 of file RuntimeDyld.cpp.
References llvm::object::SectionRef::getAlignment(), llvm::object::SectionRef::getSize(), llvm::object::ObjectFile::section_begin(), llvm::object::ObjectFile::section_end(), and SI.
|
protected |
Definition at line 428 of file RuntimeDyld.cpp.
References llvm::alignTo(), llvm::computeAllocationSizeForSections(), E, llvm::errorCodeToError(), fuzzer::Flags, llvm::object::SectionRef::getAlignment(), llvm::object::SectionRef::getName(), llvm::object::SectionRef::getSize(), I, llvm::isReadOnlyData(), llvm::isRequiredForExecution(), llvm::object::SectionRef::isText(), llvm::ARMBuildAttrs::Section, llvm::object::ObjectFile::section_begin(), llvm::object::ObjectFile::section_end(), llvm::COFF::SectionSize, llvm::object::BasicSymbolRef::SF_Common, SI, llvm::Error::success(), llvm::object::SymbolicFile::symbol_begin(), and llvm::object::SymbolicFile::symbol_end().
|
protected |
Emits long jump instruction to Addr.
Definition at line 813 of file RuntimeDyld.cpp.
References llvm::Triple::aarch64, llvm::Triple::aarch64_be, llvm::Triple::arm, llvm::Triple::armeb, llvm::ELF::EF_MIPS_ARCH, llvm::ELF::EF_MIPS_ARCH_32R6, llvm::Triple::ppc64, llvm::Triple::ppc64le, llvm::Triple::systemz, llvm::Triple::x86, and llvm::Triple::x86_64.
Referenced by llvm::RuntimeDyldELF::processRelocationRef().
|
virtual |
Reimplemented in llvm::RuntimeDyldCOFFThumb, llvm::RuntimeDyldCOFFI386, llvm::RuntimeDyldCOFFX86_64, and llvm::RuntimeDyldELF.
Definition at line 76 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 586 of file RuntimeDyld.cpp.
References llvm::alignTo(), llvm::dbgs(), DEBUG, llvm::format(), llvm::JITSymbolFlags::fromObjectSymbol(), llvm::object::Binary::getFileName(), Offset, llvm::OffsetToAlignment(), llvm::report_fatal_error(), and llvm::Error::success().
|
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 671 of file RuntimeDyld.cpp.
References llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::errorCodeToError(), llvm::format(), llvm::object::SectionRef::getAlignment(), llvm::object::SectionRef::getContents(), llvm::object::Binary::getFileName(), llvm::object::SectionRef::getName(), llvm::object::SectionRef::getSize(), llvm::isReadOnlyData(), llvm::isRequiredForExecution(), llvm::object::SectionRef::isVirtual(), llvm::isZeroInit(), and llvm::report_fatal_error().
|
inlinevirtual |
Reimplemented in llvm::RuntimeDyldCOFFX86_64, llvm::RuntimeDyldELF, llvm::RuntimeDyldMachOCRTPBase< Impl >, llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOI386 >, llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOAArch64 >, llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOARM >, and llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOX86_64 >.
Definition at line 509 of file RuntimeDyldImpl.h.
References llvm::Error::success().
|
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 772 of file RuntimeDyld.cpp.
References i, if(), and llvm::ARMBuildAttrs::Section.
Referenced by llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), and llvm::RuntimeDyldELF::processRelocationRef().
|
inline |
Definition at line 501 of file RuntimeDyldImpl.h.
|
protectedpure virtual |
|
inlineprotected |
Definition at line 322 of file RuntimeDyldImpl.h.
|
inlineprotected |
Definition at line 318 of file RuntimeDyldImpl.h.
|
protectedpure virtual |
|
inline |
Definition at line 474 of file RuntimeDyldImpl.h.
References llvm::StringMapEntry< ValueTy >::second.
|
inline |
Definition at line 461 of file RuntimeDyldImpl.h.
References llvm::StringMapEntry< ValueTy >::second.
|
inline |
Definition at line 495 of file RuntimeDyldImpl.h.
|
pure virtual |
Implemented in llvm::RuntimeDyldELF, llvm::RuntimeDyldMachO, and llvm::RuntimeDyldCOFF.
|
pure virtual |
Implemented in llvm::RuntimeDyldELF, llvm::RuntimeDyldMachO, and llvm::RuntimeDyldCOFF.
|
protected |
Definition at line 174 of file RuntimeDyld.cpp.
References llvm::dbgs(), DEBUG, E, fuzzer::Flags, llvm::format(), llvm::JITSymbolFlags::fromObjectSymbol(), llvm::object::ObjectFile::getArch(), llvm::object::Binary::getFileName(), llvm::getOffset(), I, llvm::object::Binary::isLittleEndian(), llvm::JITSymbolFlags::isWeak(), llvm::object::ObjectFile::section_begin(), llvm::object::ObjectFile::section_end(), llvm::object::BasicSymbolRef::SF_Absolute, llvm::object::BasicSymbolRef::SF_Common, llvm::object::BasicSymbolRef::SF_Undefined, SI, 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, llvm::object::SymbolicFile::symbol_begin(), and llvm::object::SymbolicFile::symbol_end().
Referenced by llvm::RuntimeDyldELF::loadObject().
| void llvm::RuntimeDyldImpl::mapSectionAddress | ( | const void * | LocalAddress, |
| uint64_t | TargetAddress | ||
| ) |
Definition at line 152 of file RuntimeDyld.cpp.
References i, and llvm_unreachable.
|
protectedpure 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).
Implemented in llvm::RuntimeDyldMachOAArch64, llvm::RuntimeDyldELF, llvm::RuntimeDyldCOFFX86_64, llvm::RuntimeDyldCOFFThumb, llvm::RuntimeDyldMachOARM, llvm::RuntimeDyldCOFFI386, llvm::RuntimeDyldMachOI386, and llvm::RuntimeDyldMachOX86_64.
|
protected |
Endian-aware read Read the least significant Size bytes from Src.
Definition at line 556 of file RuntimeDyld.cpp.
Referenced by llvm::RuntimeDyldMachOARM::decodeAddend(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldMachOARM::resolveRelocation().
| void llvm::RuntimeDyldImpl::reassignSectionAddress | ( | unsigned | SectionID, |
| uint64_t | Addr | ||
| ) |
Definition at line 894 of file RuntimeDyld.cpp.
References llvm::dbgs(), DEBUG, llvm::format(), and getName().
|
virtual |
Reimplemented in llvm::RuntimeDyldCOFFThumb, llvm::RuntimeDyldCOFFI386, llvm::RuntimeDyldCOFFX86_64, llvm::RuntimeDyldELF, llvm::RuntimeDyldMachOCRTPBase< Impl >, llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOI386 >, llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOAArch64 >, llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOARM >, and llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOX86_64 >.
Definition at line 74 of file RuntimeDyld.cpp.
|
inlineprotectedvirtual |
Definition at line 437 of file RuntimeDyldImpl.h.
|
protected |
Resolve relocations to external symbols.
Definition at line 924 of file RuntimeDyld.cpp.
References llvm::StringRef::data(), llvm::dbgs(), DEBUG, llvm::format(), i, 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::RuntimeDyldMachOAArch64, llvm::RuntimeDyldCOFFThumb, llvm::RuntimeDyldELF, llvm::RuntimeDyldCOFFI386, llvm::RuntimeDyldMachOARM, llvm::RuntimeDyldMachOI386, llvm::RuntimeDyldMachOX86_64, llvm::RuntimeDyldCOFFX86_64, and llvm::RuntimeDyldELFMips.
|
protected |
Resolves relocations from Relocs list with address from Value.
Definition at line 913 of file RuntimeDyld.cpp.
References i, llvm::RelocationEntry::SectionID, and llvm::SmallVectorTemplateCommon< T, typename >::size().
| void llvm::RuntimeDyldImpl::resolveRelocations | ( | ) |
Definition at line 119 of file RuntimeDyld.cpp.
References llvm::dbgs(), DEBUG, llvm::dumpSectionMemory(), llvm::format(), and i.
|
inlineprotectedvirtual |
Definition at line 355 of file RuntimeDyldImpl.h.
|
inline |
Definition at line 450 of file RuntimeDyldImpl.h.
|
inline |
Definition at line 454 of file RuntimeDyldImpl.h.
|
protected |
Endian-aware write.
Write the least significant Size bytes from Value to Dst.
Definition at line 570 of file RuntimeDyld.cpp.
Referenced by llvm::RuntimeDyldCOFFX86_64::resolveRelocation(), llvm::RuntimeDyldMachOX86_64::resolveRelocation(), llvm::RuntimeDyldMachOI386::resolveRelocation(), llvm::RuntimeDyldMachOARM::resolveRelocation(), llvm::RuntimeDyldCOFFI386::resolveRelocation(), llvm::RuntimeDyldCOFFThumb::resolveRelocation(), and llvm::RuntimeDyldMachOAArch64::resolveRelocation().
|
inlineprotected |
Definition at line 326 of file RuntimeDyldImpl.h.
References llvm::sys::swapByteOrder().
|
inlineprotected |
Definition at line 333 of file RuntimeDyldImpl.h.
References llvm::sys::swapByteOrder().
|
inlineprotected |
Definition at line 342 of file RuntimeDyldImpl.h.
References llvm::sys::swapByteOrder().
|
friend |
Definition at line 239 of file RuntimeDyldImpl.h.
|
friend |
Definition at line 240 of file RuntimeDyldImpl.h.
Definition at line 242 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 290 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::getGOTEntrySize(), and llvm::RuntimeDyldELF::processRelocationRef().
|
protected |
Definition at line 251 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::finalizeLoad().
|
protected |
Definition at line 316 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::loadObject().
|
protected |
Definition at line 285 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 266 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::processRelocationRef().
|
protected |
Definition at line 315 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::loadObject().
|
protected |
Definition at line 293 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldELF::getGOTEntrySize(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldELFMips::resolveRelocation().
|
protected |
Definition at line 294 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldELF::getGOTEntrySize(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldELFMips::resolveRelocation().
|
protected |
Definition at line 292 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldELF::getGOTEntrySize(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldELFMips::resolveRelocation().
|
protected |
Definition at line 291 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 310 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 245 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::deregisterEHFrames(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldELF::registerEHFrames(), and llvm::RuntimeDyldCOFFX86_64::registerEHFrames().
|
protected |
Definition at line 298 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 280 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 248 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 256 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldMachOAArch64::decodeAddend(), llvm::RuntimeDyldMachOARM::decodeAddend(), llvm::RuntimeDyldELF::deregisterEHFrames(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldCOFFI386::processRelocationRef(), llvm::RuntimeDyldCOFFThumb::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::RuntimeDyldELF::registerEHFrames(), llvm::RuntimeDyldCOFFX86_64::registerEHFrames(), llvm::RuntimeDyldELFMips::resolveRelocation(), llvm::RuntimeDyldCOFFX86_64::resolveRelocation(), llvm::RuntimeDyldMachOX86_64::resolveRelocation(), llvm::RuntimeDyldMachOI386::resolveRelocation(), llvm::RuntimeDyldMachOARM::resolveRelocation(), llvm::RuntimeDyldCOFFI386::resolveRelocation(), llvm::RuntimeDyldELF::resolveRelocation(), llvm::RuntimeDyldCOFFThumb::resolveRelocation(), and llvm::RuntimeDyldMachOAArch64::resolveRelocation().
1.8.6