LLVM  10.0.0
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | List of all members
llvm::jitlink::MachOLinkGraphBuilder Class Referenceabstract

#include "ExecutionEngine/JITLink/MachOLinkGraphBuilder.h"

Classes

class  NormalizedSection
 
struct  NormalizedSymbol
 

Public Member Functions

virtual ~MachOLinkGraphBuilder ()
 
Expected< std::unique_ptr< LinkGraph > > buildGraph ()
 

Protected Types

using SectionParserFunction = std::function< Error(NormalizedSection &S)>
 

Protected Member Functions

 MachOLinkGraphBuilder (const object::MachOObjectFile &Obj)
 
LinkGraph & getGraph () const
 
const object::MachOObjectFile & getObject () const
 
void addCustomSectionParser (StringRef SectionName, SectionParserFunction Parse)
 
virtual Error addRelocations ()=0
 
template<typename... ArgTs>
NormalizedSymbol & createNormalizedSymbol (ArgTs &&... Args)
 Create a symbol. More...
 
NormalizedSection & getSectionByIndex (unsigned Index)
 Index is zero-based (MachO section indexes are usually one-based) and assumed to be in-range. More...
 
Expected< NormalizedSection & > findSectionByIndex (unsigned Index)
 Try to get the section at the given index. More...
 
Expected< NormalizedSymbol & > findSymbolByIndex (uint64_t Index)
 Try to get the symbol at the given index. More...
 
Symbol * getSymbolByAddress (JITTargetAddress Address)
 Returns the symbol with the highest address not greater than the search address, or null if no such symbol exists. More...
 
Expected< Symbol & > findSymbolByAddress (JITTargetAddress Address)
 Returns the symbol with the highest address not greater than the search address, or an error if no such symbol exists. More...
 

Static Protected Member Functions

static Linkage getLinkage (uint16_t Desc)
 
static Scope getScope (StringRef Name, uint8_t Type)
 
static bool isAltEntry (const NormalizedSymbol &NSym)
 

Detailed Description

Definition at line 27 of file MachOLinkGraphBuilder.h.

Member Typedef Documentation

◆ SectionParserFunction

Definition at line 76 of file MachOLinkGraphBuilder.h.

Constructor & Destructor Documentation

◆ ~MachOLinkGraphBuilder()

llvm::jitlink::MachOLinkGraphBuilder::~MachOLinkGraphBuilder ( )
virtual

Definition at line 22 of file MachOLinkGraphBuilder.cpp.

◆ MachOLinkGraphBuilder()

llvm::jitlink::MachOLinkGraphBuilder::MachOLinkGraphBuilder ( const object::MachOObjectFile &  Obj)
protected

Definition at line 48 of file MachOLinkGraphBuilder.cpp.

Member Function Documentation

◆ addCustomSectionParser()

void llvm::jitlink::MachOLinkGraphBuilder::addCustomSectionParser ( StringRef  SectionName,
SectionParserFunction  Parse 
)
protected

◆ addRelocations()

virtual Error llvm::jitlink::MachOLinkGraphBuilder::addRelocations ( )
protectedpure virtual

Referenced by getObject().

◆ buildGraph()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::MachOLinkGraphBuilder::buildGraph ( )

◆ createNormalizedSymbol()

template<typename... ArgTs>
NormalizedSymbol& llvm::jitlink::MachOLinkGraphBuilder::createNormalizedSymbol ( ArgTs &&...  Args)
inlineprotected

Create a symbol.

Definition at line 91 of file MachOLinkGraphBuilder.h.

References Allocator, and llvm::AMDGPU::HSAMD::Kernel::Key::Args.

Referenced by isAltEntry().

◆ findSectionByIndex()

Expected<NormalizedSection &> llvm::jitlink::MachOLinkGraphBuilder::findSectionByIndex ( unsigned  Index)
inlineprotected

Try to get the section at the given index.

Will return an error if the given index is out of range, or if no section has been added for the given index.

Definition at line 109 of file MachOLinkGraphBuilder.h.

References llvm::formatv(), and I.

Referenced by isAltEntry().

◆ findSymbolByAddress()

Expected<Symbol &> llvm::jitlink::MachOLinkGraphBuilder::findSymbolByAddress ( JITTargetAddress  Address)
inlineprotected

◆ findSymbolByIndex()

Expected<NormalizedSymbol &> llvm::jitlink::MachOLinkGraphBuilder::findSymbolByIndex ( uint64_t  Index)
inlineprotected

Try to get the symbol at the given index.

Will return an error if the given index is out of range, or if no symbol has been added for the given index.

Definition at line 120 of file MachOLinkGraphBuilder.h.

References llvm::formatv().

◆ getGraph()

LinkGraph& llvm::jitlink::MachOLinkGraphBuilder::getGraph ( ) const
inlineprotected

Definition at line 80 of file MachOLinkGraphBuilder.h.

References G.

◆ getLinkage()

Linkage llvm::jitlink::MachOLinkGraphBuilder::getLinkage ( uint16_t  Desc)
staticprotected

◆ getObject()

const object::MachOObjectFile& llvm::jitlink::MachOLinkGraphBuilder::getObject ( ) const
inlineprotected

Definition at line 82 of file MachOLinkGraphBuilder.h.

References addCustomSectionParser(), and addRelocations().

◆ getScope()

Scope llvm::jitlink::MachOLinkGraphBuilder::getScope ( StringRef  Name,
uint8_t  Type 
)
staticprotected

◆ getSectionByIndex()

NormalizedSection& llvm::jitlink::MachOLinkGraphBuilder::getSectionByIndex ( unsigned  Index)
inlineprotected

Index is zero-based (MachO section indexes are usually one-based) and assumed to be in-range.

Client is responsible for checking.

Definition at line 100 of file MachOLinkGraphBuilder.h.

References assert(), and I.

◆ getSymbolByAddress()

Symbol* llvm::jitlink::MachOLinkGraphBuilder::getSymbolByAddress ( JITTargetAddress  Address)
inlineprotected

Returns the symbol with the highest address not greater than the search address, or null if no such symbol exists.

Definition at line 132 of file MachOLinkGraphBuilder.h.

References I.

Referenced by findSymbolByAddress().

◆ isAltEntry()

bool llvm::jitlink::MachOLinkGraphBuilder::isAltEntry ( const NormalizedSymbol &  NSym)
staticprotected

Definition at line 76 of file MachOLinkGraphBuilder.cpp.

References llvm::MachO::section::addr, llvm::MachO::section_64::addr, llvm::Address, llvm::jitlink::MachOLinkGraphBuilder::NormalizedSection::Address, llvm::MachO::section::align, llvm::MachO::section_64::align, llvm::jitlink::MachOLinkGraphBuilder::NormalizedSection::Alignment, assert(), B, llvm::SmallVectorTemplateCommon< T >::back(), llvm::support::big, BlockSize, llvm::StringMap< ValueTy, AllocatorTy >::count(), createNormalizedSymbol(), llvm::Data, llvm::jitlink::MachOLinkGraphBuilder::NormalizedSection::Data, llvm::StringRef::data(), llvm::dbgs(), llvm::jitlink::Default, llvm::jitlink::MachOLinkGraphBuilder::NormalizedSymbol::Desc, E, llvm::SmallVectorBase::empty(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::find(), findSectionByIndex(), llvm::jitlink::MachOLinkGraphBuilder::NormalizedSection::Flags, llvm::MachO::section::flags, llvm::MachO::section_64::flags, llvm::formatv(), llvm::SmallVectorTemplateCommon< T >::front(), llvm::MachO::GET_COMM_ALIGN(), llvm::object::Binary::getData(), getLinkage(), getScope(), llvm::object::MachOObjectFile::getSection(), llvm::object::MachOObjectFile::getSection64(), llvm::object::MachOObjectFile::getSectionIndex(), llvm::object::MachOObjectFile::getSymbol64TableEntry(), llvm::object::MachOObjectFile::getSymbolIndex(), llvm::object::MachOObjectFile::getSymbolTableEntry(), llvm::jitlink::MachOLinkGraphBuilder::NormalizedSection::GraphSection, llvm::AArch64CC::HI, I, if(), llvm::object::MachOObjectFile::is64Bit(), llvm::object::Binary::isLittleEndian(), llvm::support::little, LLVM_DEBUG, llvm::sys::Memory::MF_EXEC, llvm::sys::Memory::MF_READ, llvm::sys::Memory::MF_WRITE, llvm::MachO::N_ABS, llvm::MachO::N_ALT_ENTRY, llvm::MachO::nlist::n_desc, llvm::MachO::nlist_64::n_desc, llvm::MachO::N_INDR, llvm::MachO::N_NO_DEAD_STRIP, llvm::MachO::N_PBUD, llvm::MachO::N_SECT, llvm::MachO::nlist::n_sect, llvm::MachO::nlist_64::n_sect, llvm::MachO::N_STAB, llvm::MachO::nlist::n_strx, llvm::MachO::nlist_64::n_strx, llvm::MachO::N_TYPE, llvm::MachO::nlist::n_type, llvm::MachO::nlist_64::n_type, llvm::MachO::N_UNDF, llvm::MachO::nlist::n_value, llvm::MachO::nlist_64::n_value, llvm::MachO::N_WEAK_REF, llvm::jitlink::MachOLinkGraphBuilder::NormalizedSymbol::Name, Name, llvm::MachO::section::offset, llvm::MachO::section_64::offset, llvm::SmallVectorTemplateBase< T >::pop_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::jitlink::MachOLinkGraphBuilder::NormalizedSymbol::S, llvm::MachO::S_ATTR_NO_DEAD_STRIP, llvm::MachO::S_ATTR_PURE_INSTRUCTIONS, llvm::MachO::S_GB_ZEROFILL, llvm::MachO::S_ZEROFILL, llvm::MachO::SECTION_TYPE, llvm::object::ObjectFile::sections(), Size, llvm::SmallVectorBase::size(), llvm::jitlink::MachOLinkGraphBuilder::NormalizedSection::Size, llvm::StringRef::size(), llvm::MachO::section::size, llvm::MachO::section_64::size, llvm::sort(), llvm::jitlink::Strong, llvm::Error::success(), llvm::object::ObjectFile::symbols(), llvm::jitlink::MachOLinkGraphBuilder::NormalizedSymbol::Value, and llvm::jitlink::Weak.

Referenced by findSymbolByAddress().


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