|
LLVM
3.7.0
|
#include <RuntimeDyldImpl.h>
Public Member Functions | |
| RuntimeDyldImpl (RuntimeDyld::MemoryManager &MemMgr, RuntimeDyld::SymbolResolver &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 |
| RuntimeDyld::SymbolInfo | 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 void | 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 |
| bool | Error (const Twine &Msg) |
| 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... | |
| void | 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... | |
| unsigned | emitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode) |
| Emits section data from the object file to the MemoryManager. More... | |
| 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 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... | |
| void | computeTotalAllocSize (const ObjectFile &Obj, uint64_t &CodeSize, uint64_t &DataSizeRO, uint64_t &DataSizeRW) |
| unsigned | computeSectionStubBufSize (const ObjectFile &Obj, const SectionRef &Section) |
| std::pair< unsigned, unsigned > | loadObjectImpl (const object::ObjectFile &Obj) |
Friends | |
| class | RuntimeDyld::LoadedObjectInfo |
| class | RuntimeDyldCheckerImpl |
Definition at line 187 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 216 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 210 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 223 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 202 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 205 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 235 of file RuntimeDyldImpl.h.
|
inline |
Definition at line 384 of file RuntimeDyldImpl.h.
|
virtual |
Definition at line 31 of file RuntimeDyld.cpp.
|
protected |
Definition at line 633 of file RuntimeDyld.cpp.
Referenced by llvm::RuntimeDyldMachOI386::processRelocationRef(), llvm::RuntimeDyldMachOX86_64::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldMachOAArch64::processRelocationRef().
|
protected |
Definition at line 638 of file RuntimeDyld.cpp.
References llvm::RelocationEntry::Addend, and llvm::StringMapEntry< ValueTy >::second.
Referenced by llvm::RuntimeDyldMachOI386::processRelocationRef(), llvm::RuntimeDyldMachOX86_64::processRelocationRef(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldMachOAArch64::processRelocationRef().
|
inline |
Definition at line 435 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 393 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 310 of file RuntimeDyld.cpp.
References llvm::Check(), llvm::computeAllocationSizeForSections(), 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::object::SymbolicFile::symbol_begin(), and llvm::object::SymbolicFile::symbol_end().
|
protected |
Emits long jump instruction to Addr.
Definition at line 655 of file RuntimeDyld.cpp.
References llvm::Triple::aarch64, llvm::Triple::aarch64_be, llvm::Triple::arm, llvm::Triple::armeb, 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::RuntimeDyldCOFFX86_64, and llvm::RuntimeDyldELF.
Definition at line 40 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 458 of file RuntimeDyld.cpp.
References Align(), llvm::Check(), llvm::dbgs(), DEBUG, llvm::Exported, llvm::format(), llvm::ErrorOr< T >::getError(), llvm::None, llvm::OffsetToAlignment(), llvm::report_fatal_error(), llvm::object::BasicSymbolRef::SF_Exported, llvm::object::BasicSymbolRef::SF_Weak, and llvm::Weak.
|
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 529 of file RuntimeDyld.cpp.
References llvm::Check(), llvm::StringRef::data(), llvm::dbgs(), DEBUG, 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().
Definition at line 265 of file RuntimeDyldImpl.h.
References llvm::Twine::str().
Referenced by llvm::RuntimeDyldMachOX86_64::resolveRelocation(), llvm::RuntimeDyldMachOI386::resolveRelocation(), and llvm::RuntimeDyldMachOARM::resolveRelocation().
|
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 446 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 617 of file RuntimeDyld.cpp.
References llvm::ARMBuildAttrs::Section.
Referenced by llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), and llvm::RuntimeDyldELF::processRelocationRef().
|
inline |
Definition at line 438 of file RuntimeDyldImpl.h.
|
protectedpure virtual |
|
inlineprotected |
Definition at line 275 of file RuntimeDyldImpl.h.
|
inlineprotected |
Definition at line 271 of file RuntimeDyldImpl.h.
|
protectedpure virtual |
|
inline |
Definition at line 413 of file RuntimeDyldImpl.h.
References llvm::StringMapEntry< ValueTy >::second.
|
inline |
Definition at line 403 of file RuntimeDyldImpl.h.
References llvm::StringMapEntry< ValueTy >::second.
|
inline |
Definition at line 432 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 126 of file RuntimeDyld.cpp.
References llvm::Check(), llvm::dbgs(), DEBUG, llvm::Exported, llvm::format(), llvm::object::ObjectFile::getArch(), llvm::ErrorOr< T >::getError(), llvm::object::Binary::getFileName(), llvm::getOffset(), I, llvm::object::Binary::isLittleEndian(), llvm::None, llvm::object::ObjectFile::section_begin(), llvm::object::ObjectFile::section_end(), llvm::object::BasicSymbolRef::SF_Common, llvm::object::BasicSymbolRef::SF_Exported, llvm::object::BasicSymbolRef::SF_Weak, SI, llvm::object::SymbolRef::ST_Data, llvm::object::SymbolRef::ST_Function, llvm::object::SymbolRef::ST_Unknown, llvm::object::SymbolicFile::symbol_begin(), llvm::object::SymbolicFile::symbol_end(), and llvm::Weak.
Referenced by llvm::RuntimeDyldELF::loadObject().
| void llvm::RuntimeDyldImpl::mapSectionAddress | ( | const void * | LocalAddress, |
| uint64_t | TargetAddress | ||
| ) |
Definition at line 104 of file RuntimeDyld.cpp.
References llvm::dwarf::syntax::Address, 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::RuntimeDyldMachOARM, llvm::RuntimeDyldMachOI386, and llvm::RuntimeDyldMachOX86_64.
|
protected |
Endian-aware read Read the least significant Size bytes from Src.
Definition at line 428 of file RuntimeDyld.cpp.
Referenced by llvm::RuntimeDyldMachOARM::decodeAddend(), llvm::RuntimeDyldELF::processRelocationRef(), and llvm::RuntimeDyldMachOARM::resolveRelocation().
| void llvm::RuntimeDyldImpl::reassignSectionAddress | ( | unsigned | SectionID, |
| uint64_t | Addr | ||
| ) |
Definition at line 733 of file RuntimeDyld.cpp.
References llvm::dbgs(), DEBUG, and llvm::format().
|
virtual |
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 38 of file RuntimeDyld.cpp.
|
protected |
Resolve relocations to external symbols.
Definition at line 763 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::RuntimeDyldMachOAArch64, llvm::RuntimeDyldELF, llvm::RuntimeDyldMachOARM, llvm::RuntimeDyldMachOI386, llvm::RuntimeDyldMachOX86_64, and llvm::RuntimeDyldCOFFX86_64.
|
protected |
Resolves relocations from Relocs list with address from Value.
Definition at line 752 of file RuntimeDyld.cpp.
References llvm::RelocationEntry::SectionID, and llvm::SmallVectorTemplateCommon< T, typename >::size().
| void llvm::RuntimeDyldImpl::resolveRelocations | ( | ) |
Definition at line 82 of file RuntimeDyld.cpp.
References llvm::dbgs(), DEBUG, llvm::dumpSectionMemory(), and llvm::format().
|
inlineprotectedvirtual |
Definition at line 308 of file RuntimeDyldImpl.h.
|
inline |
Definition at line 392 of file RuntimeDyldImpl.h.
|
inline |
Definition at line 396 of file RuntimeDyldImpl.h.
|
protected |
Endian-aware write.
Write the least significant Size bytes from Value to Dst.
Definition at line 442 of file RuntimeDyld.cpp.
Referenced by llvm::RuntimeDyldMachOX86_64::resolveRelocation(), llvm::RuntimeDyldMachOI386::resolveRelocation(), and llvm::RuntimeDyldMachOARM::resolveRelocation().
|
inlineprotected |
Definition at line 279 of file RuntimeDyldImpl.h.
References llvm::sys::swapByteOrder().
|
inlineprotected |
Definition at line 286 of file RuntimeDyldImpl.h.
References llvm::sys::swapByteOrder().
|
inlineprotected |
Definition at line 295 of file RuntimeDyldImpl.h.
References llvm::sys::swapByteOrder().
|
friend |
Definition at line 188 of file RuntimeDyldImpl.h.
|
friend |
Definition at line 189 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 237 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::processRelocationRef().
|
protected |
Definition at line 198 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::finalizeLoad().
|
protected |
Definition at line 262 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 232 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 213 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::processRelocationRef().
|
protected |
Definition at line 261 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 240 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::finalizeLoad(), and llvm::RuntimeDyldELF::processRelocationRef().
|
protected |
Definition at line 239 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::processRelocationRef().
|
protected |
Definition at line 238 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 256 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 192 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldELF::deregisterEHFrames(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldELF::registerEHFrames(), and llvm::RuntimeDyldCOFFX86_64::registerEHFrames().
|
protected |
Definition at line 244 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 227 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 195 of file RuntimeDyldImpl.h.
|
protected |
Definition at line 203 of file RuntimeDyldImpl.h.
Referenced by llvm::RuntimeDyldMachOAArch64::decodeAddend(), llvm::RuntimeDyldMachOARM::decodeAddend(), llvm::RuntimeDyldELF::deregisterEHFrames(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::RuntimeDyldCOFFX86_64::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::RuntimeDyldELF::registerEHFrames(), llvm::RuntimeDyldCOFFX86_64::registerEHFrames(), llvm::RuntimeDyldCOFFX86_64::resolveRelocation(), llvm::RuntimeDyldMachOX86_64::resolveRelocation(), llvm::RuntimeDyldMachOI386::resolveRelocation(), llvm::RuntimeDyldMachOARM::resolveRelocation(), llvm::RuntimeDyldELF::resolveRelocation(), and llvm::RuntimeDyldMachOAArch64::resolveRelocation().
1.8.6