LLVM 20.0.0git
Public Types | Public Member Functions | List of all members
llvm::RuntimeDyldMachOARM Class Reference

#include "ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h"

Inheritance diagram for llvm::RuntimeDyldMachOARM:
Inheritance graph
[legend]

Public Types

typedef uint32_t TargetPtrT
 

Public Member Functions

 RuntimeDyldMachOARM (RuntimeDyld::MemoryManager &MM, JITSymbolResolver &Resolver)
 
unsigned getMaxStubSize () const override
 
Align getStubAlignment () override
 
Expected< JITSymbolFlagsgetJITSymbolFlags (const SymbolRef &SR) override
 Generate JITSymbolFlags from a libObject symbol.
 
uint64_t modifyAddressBasedOnFlags (uint64_t Addr, JITSymbolFlags Flags) const override
 Modify the given target address based on the given symbol flags.
 
bool isAddrTargetThumb (unsigned SectionID, uint64_t Offset)
 
Expected< int64_t > decodeAddend (const RelocationEntry &RE) const
 
Expected< relocation_iteratorprocessRelocationRef (unsigned SectionID, relocation_iterator RelI, const ObjectFile &BaseObjT, 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).
 
void resolveRelocation (const RelocationEntry &RE, uint64_t Value) override
 A object file specific relocation resolver.
 
Error finalizeSection (const ObjectFile &Obj, unsigned SectionID, const SectionRef &Section)
 
- Public Member Functions inherited from llvm::RuntimeDyldMachOCRTPBase< RuntimeDyldMachOARM >
 RuntimeDyldMachOCRTPBase (RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
 
Error finalizeLoad (const ObjectFile &Obj, ObjSectionToIDMap &SectionMap) override
 
void registerEHFrames () override
 
- Public Member Functions inherited from llvm::RuntimeDyldMachO
std::unique_ptr< RuntimeDyld::LoadedObjectInfoloadObject (const object::ObjectFile &O) override
 
SectionEntrygetSection (unsigned SectionID)
 
bool isCompatibleFile (const object::ObjectFile &Obj) const override
 
- Public Member Functions inherited from llvm::RuntimeDyldImpl
 RuntimeDyldImpl (RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
 
virtual ~RuntimeDyldImpl ()
 
void setProcessAllSections (bool ProcessAllSections)
 
virtual std::unique_ptr< RuntimeDyld::LoadedObjectInfoloadObject (const object::ObjectFile &Obj)=0
 
uint64_t getSectionLoadAddress (unsigned SectionID) const
 
uint8_tgetSectionAddress (unsigned SectionID) const
 
StringRef getSectionContent (unsigned SectionID) const
 
uint8_tgetSymbolLocalAddress (StringRef Name) const
 
unsigned getSymbolSectionID (StringRef Name) const
 
JITEvaluatedSymbol getSymbol (StringRef Name) const
 
std::map< StringRef, JITEvaluatedSymbolgetSymbolTable () const
 
void resolveRelocations ()
 
void resolveLocalRelocations ()
 
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
 
void setNotifyStubEmitted (NotifyStubEmittedFunction NotifyStubEmitted)
 
virtual void registerEHFrames ()
 
void deregisterEHFrames ()
 
virtual Error finalizeLoad (const ObjectFile &ObjImg, ObjSectionToIDMap &SectionMap)
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::RuntimeDyldMachO
static std::unique_ptr< RuntimeDyldMachOcreate (Triple::ArchType Arch, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
 Create a RuntimeDyldMachO instance for the given target architecture.
 
- Static Public Member Functions inherited from llvm::RuntimeDyldImpl
static void finalizeAsync (std::unique_ptr< RuntimeDyldImpl > This, unique_function< void(object::OwningBinary< object::ObjectFile >, std::unique_ptr< RuntimeDyld::LoadedObjectInfo >, Error)> OnEmitted, object::OwningBinary< object::ObjectFile > O, std::unique_ptr< RuntimeDyld::LoadedObjectInfo > Info)
 
- Protected Types inherited from llvm::RuntimeDyldImpl
typedef std::deque< SectionEntrySectionList
 
typedef unsigned SID
 
typedef std::map< SectionRef, unsignedObjSectionToIDMap
 
typedef std::vector< SymbolRefCommonSymbolList
 
typedef SmallVector< RelocationEntry, 64 > RelocationList
 
typedef std::map< RelocationValueRef, uintptr_t > StubMap
 
using NotifyStubEmittedFunction = RuntimeDyld::NotifyStubEmittedFunction
 
- Protected Member Functions inherited from llvm::RuntimeDyldMachO
 RuntimeDyldMachO (RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
 
int64_t memcpyAddend (const RelocationEntry &RE) const
 This convenience method uses memcpy to extract a contiguous addend (the addend size and offset are taken from the corresponding fields of the RE).
 
RelocationEntry getRelocationEntry (unsigned SectionID, const ObjectFile &BaseTObj, const relocation_iterator &RI) const
 Given a relocation_iterator for a non-scattered relocation, construct a RelocationEntry and fill in the common fields.
 
Expected< relocation_iteratorprocessScatteredVANILLA (unsigned SectionID, relocation_iterator RelI, const ObjectFile &BaseObjT, RuntimeDyldMachO::ObjSectionToIDMap &ObjSectionToID, bool TargetIsLocalThumbFunc=false)
 Process a scattered vanilla relocation.
 
Expected< RelocationValueRefgetRelocationValueRef (const ObjectFile &BaseTObj, const relocation_iterator &RI, const RelocationEntry &RE, ObjSectionToIDMap &ObjSectionToID)
 Construct a RelocationValueRef representing the relocation target.
 
void makeValueAddendPCRel (RelocationValueRef &Value, const relocation_iterator &RI, unsigned OffsetToNextPC)
 Make the RelocationValueRef addend PC-relative.
 
void dumpRelocationToResolve (const RelocationEntry &RE, uint64_t Value) const
 Dump information about the relocation entry (RE) and resolved value.
 
Error populateIndirectSymbolPointersSection (const MachOObjectFile &Obj, const SectionRef &PTSection, unsigned PTSectionID)
 
- Protected Member Functions inherited from llvm::RuntimeDyldImpl
virtual unsigned getMaxStubSize () const =0
 
virtual Align getStubAlignment ()=0
 
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.
 
void writeBytesUnaligned (uint64_t Value, uint8_t *Dst, unsigned Size) const
 Endian-aware write.
 
virtual Expected< JITSymbolFlagsgetJITSymbolFlags (const SymbolRef &Sym)
 Generate JITSymbolFlags from a libObject symbol.
 
virtual uint64_t modifyAddressBasedOnFlags (uint64_t Addr, JITSymbolFlags Flags) const
 Modify the given target address based on the given symbol flags.
 
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.
 
Expected< unsignedemitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode)
 Emits section data from the object file to the MemoryManager.
 
Expected< unsignedfindOrEmitSection (const ObjectFile &Obj, const SectionRef &Section, bool IsCode, ObjSectionToIDMap &LocalSections)
 Find Section in LocalSections.
 
void addRelocationForSection (const RelocationEntry &RE, unsigned SectionID)
 
void addRelocationForSymbol (const RelocationEntry &RE, StringRef SymbolName)
 
uint8_tcreateStubFunction (uint8_t *Addr, unsigned AbiVariant=0)
 Emits long jump instruction to Addr.
 
void resolveRelocationList (const RelocationList &Relocs, uint64_t Value)
 Resolves relocations from Relocs list with address from Value.
 
virtual void resolveRelocation (const RelocationEntry &RE, uint64_t Value)=0
 A object file specific relocation resolver.
 
virtual Expected< relocation_iteratorprocessRelocationRef (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).
 
void applyExternalSymbolRelocations (const StringMap< JITEvaluatedSymbol > ExternalSymbolMap)
 
Error resolveExternalSymbols ()
 Resolve relocations to external symbols.
 
Error computeTotalAllocSize (const ObjectFile &Obj, uint64_t &CodeSize, Align &CodeAlign, uint64_t &RODataSize, Align &RODataAlign, uint64_t &RWDataSize, Align &RWDataAlign)
 
unsigned computeGOTSize (const ObjectFile &Obj)
 
unsigned computeSectionStubBufSize (const ObjectFile &Obj, const SectionRef &Section)
 
Expected< ObjSectionToIDMaploadObjectImpl (const object::ObjectFile &Obj)
 
virtual size_t getGOTEntrySize ()
 
virtual void processNewSymbol (const SymbolRef &ObjSymbol, SymbolTableEntry &Entry)
 
virtual bool relocationNeedsGot (const RelocationRef &R) const
 
virtual bool relocationNeedsStub (const RelocationRef &R) const
 
virtual bool relocationNeedsDLLImportStub (const RelocationRef &R) const
 
virtual unsigned sizeAfterAddingDLLImportStub (unsigned Size) const
 
- Static Protected Member Functions inherited from llvm::RuntimeDyldMachO
static section_iterator getSectionByAddress (const MachOObjectFile &Obj, uint64_t Addr)
 
- Protected Attributes inherited from llvm::RuntimeDyldMachO
SmallVector< EHFrameRelatedSections, 2 > UnregisteredEHFrameSections
 
- Protected Attributes inherited from llvm::RuntimeDyldImpl
RuntimeDyld::MemoryManagerMemMgr
 
JITSymbolResolverResolver
 
SectionList Sections
 
RTDyldSymbolTable GlobalSymbolTable
 
std::unordered_map< unsigned, RelocationListRelocations
 
StringMap< RelocationListExternalSymbolRelocations
 
Triple::ArchType Arch
 
bool IsTargetLittleEndian
 
bool IsMipsO32ABI
 
bool IsMipsN32ABI
 
bool IsMipsN64ABI
 
bool ProcessAllSections
 
sys::Mutex lock
 
NotifyStubEmittedFunction NotifyStubEmitted
 
bool HasError
 
std::string ErrorStr
 
- Static Protected Attributes inherited from llvm::RuntimeDyldImpl
static const unsigned AbsoluteSymbolSection = ~0U
 

Detailed Description

Definition at line 18 of file RuntimeDyldMachOARM.h.

Member Typedef Documentation

◆ TargetPtrT

Definition at line 25 of file RuntimeDyldMachOARM.h.

Constructor & Destructor Documentation

◆ RuntimeDyldMachOARM()

llvm::RuntimeDyldMachOARM::RuntimeDyldMachOARM ( RuntimeDyld::MemoryManager MM,
JITSymbolResolver Resolver 
)
inline

Definition at line 27 of file RuntimeDyldMachOARM.h.

Member Function Documentation

◆ decodeAddend()

Expected< int64_t > llvm::RuntimeDyldMachOARM::decodeAddend ( const RelocationEntry RE) const
inline

◆ finalizeSection()

Error llvm::RuntimeDyldMachOARM::finalizeSection ( const ObjectFile Obj,
unsigned  SectionID,
const SectionRef Section 
)
inline

◆ getJITSymbolFlags()

Expected< JITSymbolFlags > llvm::RuntimeDyldMachOARM::getJITSymbolFlags ( const SymbolRef Sym)
inlineoverridevirtual

Generate JITSymbolFlags from a libObject symbol.

Reimplemented from llvm::RuntimeDyldImpl.

Definition at line 35 of file RuntimeDyldMachOARM.h.

References llvm::ARMJITSymbolFlags::fromObjectSymbol(), and llvm::RuntimeDyldImpl::getJITSymbolFlags().

◆ getMaxStubSize()

unsigned llvm::RuntimeDyldMachOARM::getMaxStubSize ( ) const
inlineoverridevirtual

Implements llvm::RuntimeDyldImpl.

Definition at line 31 of file RuntimeDyldMachOARM.h.

◆ getStubAlignment()

Align llvm::RuntimeDyldMachOARM::getStubAlignment ( )
inlineoverridevirtual

Implements llvm::RuntimeDyldImpl.

Definition at line 33 of file RuntimeDyldMachOARM.h.

◆ isAddrTargetThumb()

bool llvm::RuntimeDyldMachOARM::isAddrTargetThumb ( unsigned  SectionID,
uint64_t  Offset 
)
inline

◆ modifyAddressBasedOnFlags()

uint64_t llvm::RuntimeDyldMachOARM::modifyAddressBasedOnFlags ( uint64_t  Addr,
JITSymbolFlags  Flags 
) const
inlineoverridevirtual

Modify the given target address based on the given symbol flags.

This can be used by subclasses to tweak addresses based on symbol flags, For example: the MachO/ARM target uses it to set the low bit if the target is a thumb symbol.

Reimplemented from llvm::RuntimeDyldImpl.

Definition at line 43 of file RuntimeDyldMachOARM.h.

References Addr, and llvm::ARMJITSymbolFlags::Thumb.

◆ processRelocationRef()

Expected< relocation_iterator > llvm::RuntimeDyldMachOARM::processRelocationRef ( unsigned  SectionID,
relocation_iterator  RelI,
const ObjectFile Obj,
ObjSectionToIDMap ObjSectionToID,
StubMap Stubs 
)
inlineoverridevirtual

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 100 of file RuntimeDyldMachOARM.h.

References llvm::RelocationEntry::Addend, llvm::RuntimeDyldImpl::addRelocationForSection(), llvm::RuntimeDyldImpl::addRelocationForSymbol(), llvm::MachO::ARM_RELOC_BR24, llvm::MachO::ARM_RELOC_HALF, llvm::MachO::ARM_RELOC_HALF_SECTDIFF, llvm::MachO::ARM_RELOC_LOCAL_SECTDIFF, llvm::MachO::ARM_RELOC_PAIR, llvm::MachO::ARM_RELOC_PB_LA_PTR, llvm::MachO::ARM_RELOC_SECTDIFF, llvm::MachO::ARM_THUMB_32BIT_BRANCH, llvm::MachO::ARM_THUMB_RELOC_BR22, decodeAddend(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::MachO::GENERIC_RELOC_VANILLA, llvm::object::MachOObjectFile::getAnyRelocationType(), llvm::object::MachOObjectFile::getPlainRelocationExternal(), llvm::object::MachOObjectFile::getRelocation(), llvm::RuntimeDyldMachO::getRelocationEntry(), llvm::RuntimeDyldMachO::getRelocationValueRef(), llvm::RuntimeDyldImpl::GlobalSymbolTable, isAddrTargetThumb(), llvm::RelocationEntry::IsPCRel, llvm::object::MachOObjectFile::isRelocationScattered(), llvm::RelocationEntry::IsTargetThumbFunc, llvm::RuntimeDyldMachO::makeValueAddendPCRel(), llvm::RuntimeDyldMachO::processScatteredVANILLA(), llvm::RelocationEntry::RelType, llvm::ARMJITSymbolFlags::Thumb, and UNIMPLEMENTED_RELOC.

◆ resolveRelocation()

void llvm::RuntimeDyldMachOARM::resolveRelocation ( const RelocationEntry RE,
uint64_t  Value 
)
inlineoverridevirtual

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