LLVM  14.0.0git
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
llvm::jitlink::ELFLinkGraphBuilder< ELFT > Class Template Referenceabstract

Ling-graph building code that's specific to the given ELFT, but common across all architectures. More...

#include "ExecutionEngine/JITLink/ELFLinkGraphBuilder.h"

Inheritance diagram for llvm::jitlink::ELFLinkGraphBuilder< ELFT >:
Inheritance graph
[legend]
Collaboration diagram for llvm::jitlink::ELFLinkGraphBuilder< ELFT >:
Collaboration graph
[legend]

Public Member Functions

 ELFLinkGraphBuilder (const object::ELFFile< ELFT > &Obj, Triple TT, StringRef FileName, LinkGraph::GetEdgeKindNameFunction GetEdgeKindName)
 
Expected< std::unique_ptr< LinkGraph > > buildGraph ()
 Attempt to construct and return the LinkGraph. More...
 
virtual Error addRelocations ()=0
 Call to derived class to handle relocations. More...
 

Protected Types

using ELFSectionIndex = unsigned
 
using ELFSymbolIndex = unsigned
 

Protected Member Functions

bool isRelocatable () const
 
void setGraphSection (ELFSectionIndex SecIndex, Section &Sec)
 
SectiongetGraphSection (ELFSectionIndex SecIndex)
 
void setGraphSymbol (ELFSymbolIndex SymIndex, Symbol &Sym)
 
SymbolgetGraphSymbol (ELFSymbolIndex SymIndex)
 
Expected< std::pair< Linkage, Scope > > getSymbolLinkageAndScope (const typename ELFT::Sym &Sym, StringRef Name)
 
Error prepare ()
 
Error graphifySections ()
 
Error graphifySymbols ()
 
template<typename RelocHandlerFunction >
Error forEachRelocation (const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func, bool ProcessDebugSections=false)
 Traverse all matching relocation records in the given section. More...
 
template<typename ClassT , typename RelocHandlerMethod >
Error forEachRelocation (const typename ELFT::Shdr &RelSect, ClassT *Instance, RelocHandlerMethod &&Method, bool ProcessDebugSections=false)
 Traverse all matching relocation records in the given section. More...
 

Protected Attributes

const ELFFileObj
 
ELFFile::Elf_Shdr_Range Sections
 
const ELFFile::Elf_Shdr * SymTabSec = nullptr
 
StringRef SectionStringTab
 
DenseMap< ELFSectionIndex, Section * > GraphSections
 
DenseMap< ELFSymbolIndex, Symbol * > GraphSymbols
 

Additional Inherited Members

Detailed Description

template<typename ELFT>
class llvm::jitlink::ELFLinkGraphBuilder< ELFT >

Ling-graph building code that's specific to the given ELFT, but common across all architectures.

Definition at line 59 of file ELFLinkGraphBuilder.h.

Member Typedef Documentation

◆ ELFSectionIndex

template<typename ELFT >
using llvm::jitlink::ELFLinkGraphBuilder< ELFT >::ELFSectionIndex = unsigned
protected

Definition at line 75 of file ELFLinkGraphBuilder.h.

◆ ELFSymbolIndex

template<typename ELFT >
using llvm::jitlink::ELFLinkGraphBuilder< ELFT >::ELFSymbolIndex = unsigned
protected

Definition at line 76 of file ELFLinkGraphBuilder.h.

Constructor & Destructor Documentation

◆ ELFLinkGraphBuilder()

template<typename ELFT >
llvm::jitlink::ELFLinkGraphBuilder< ELFT >::ELFLinkGraphBuilder ( const object::ELFFile< ELFT > &  Obj,
Triple  TT,
StringRef  FileName,
LinkGraph::GetEdgeKindNameFunction  GetEdgeKindName 
)

Definition at line 151 of file ELFLinkGraphBuilder.h.

Member Function Documentation

◆ addRelocations()

template<typename ELFT >
virtual Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::addRelocations ( )
pure virtual

Call to derived class to handle relocations.

These require architecture specific knowledge to map to JITLink edge kinds.

◆ buildGraph()

template<typename ELFT >
Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::ELFLinkGraphBuilder< ELFT >::buildGraph

◆ forEachRelocation() [1/2]

template<typename ELFT >
template<typename ClassT , typename RelocHandlerMethod >
Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelocation ( const typename ELFT::Shdr RelSect,
ClassT *  Instance,
RelocHandlerMethod &&  Method,
bool  ProcessDebugSections = false 
)
inlineprotected

Traverse all matching relocation records in the given section.

Convenience wrapper to allow passing a member function for the handler.

Definition at line 127 of file ELFLinkGraphBuilder.h.

◆ forEachRelocation() [2/2]

template<typename ELFT >
template<typename RelocHandlerFunction >
Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelocation ( const typename ELFT::Shdr RelSect,
RelocHandlerFunction &&  Func,
bool  ProcessDebugSections = false 
)
protected

Traverse all matching relocation records in the given section.

The handler function Func should be callable with this signature: Error(const typename ELFT::Rela &, const typename ELFT::Shdr &, Section &)

Definition at line 456 of file ELFLinkGraphBuilder.h.

Referenced by llvm::jitlink::ELFLinkGraphBuilder< object::ELF64LE >::forEachRelocation().

◆ getGraphSection()

template<typename ELFT >
Section* llvm::jitlink::ELFLinkGraphBuilder< ELFT >::getGraphSection ( ELFSectionIndex  SecIndex)
inlineprotected

Definition at line 87 of file ELFLinkGraphBuilder.h.

◆ getGraphSymbol()

template<typename ELFT >
Symbol* llvm::jitlink::ELFLinkGraphBuilder< ELFT >::getGraphSymbol ( ELFSymbolIndex  SymIndex)
inlineprotected

Definition at line 99 of file ELFLinkGraphBuilder.h.

◆ getSymbolLinkageAndScope()

template<typename ELFT >
Expected< std::pair< Linkage, Scope > > llvm::jitlink::ELFLinkGraphBuilder< ELFT >::getSymbolLinkageAndScope ( const typename ELFT::Sym &  Sym,
StringRef  Name 
)
protected

Definition at line 185 of file ELFLinkGraphBuilder.h.

◆ graphifySections()

template<typename ELFT >
Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::graphifySections
protected

Definition at line 258 of file ELFLinkGraphBuilder.h.

◆ graphifySymbols()

template<typename ELFT >
Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::graphifySymbols
protected

Definition at line 328 of file ELFLinkGraphBuilder.h.

◆ isRelocatable()

template<typename ELFT >
bool llvm::jitlink::ELFLinkGraphBuilder< ELFT >::isRelocatable ( ) const
inlineprotected

Definition at line 78 of file ELFLinkGraphBuilder.h.

◆ prepare()

template<typename ELFT >
Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::prepare
protected

Definition at line 230 of file ELFLinkGraphBuilder.h.

◆ setGraphSection()

template<typename ELFT >
void llvm::jitlink::ELFLinkGraphBuilder< ELFT >::setGraphSection ( ELFSectionIndex  SecIndex,
Section Sec 
)
inlineprotected

Definition at line 82 of file ELFLinkGraphBuilder.h.

◆ setGraphSymbol()

template<typename ELFT >
void llvm::jitlink::ELFLinkGraphBuilder< ELFT >::setGraphSymbol ( ELFSymbolIndex  SymIndex,
Symbol Sym 
)
inlineprotected

Definition at line 94 of file ELFLinkGraphBuilder.h.

Member Data Documentation

◆ GraphSections

template<typename ELFT >
DenseMap<ELFSectionIndex, Section *> llvm::jitlink::ELFLinkGraphBuilder< ELFT >::GraphSections
protected

◆ GraphSymbols

template<typename ELFT >
DenseMap<ELFSymbolIndex, Symbol *> llvm::jitlink::ELFLinkGraphBuilder< ELFT >::GraphSymbols
protected

◆ Obj

template<typename ELFT >
const ELFFile& llvm::jitlink::ELFLinkGraphBuilder< ELFT >::Obj
protected

◆ Sections

template<typename ELFT >
ELFFile::Elf_Shdr_Range llvm::jitlink::ELFLinkGraphBuilder< ELFT >::Sections
protected

Definition at line 140 of file ELFLinkGraphBuilder.h.

◆ SectionStringTab

template<typename ELFT >
StringRef llvm::jitlink::ELFLinkGraphBuilder< ELFT >::SectionStringTab
protected

Definition at line 142 of file ELFLinkGraphBuilder.h.

◆ SymTabSec

template<typename ELFT >
const ELFFile::Elf_Shdr* llvm::jitlink::ELFLinkGraphBuilder< ELFT >::SymTabSec = nullptr
protected

Definition at line 141 of file ELFLinkGraphBuilder.h.


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