LLVM 20.0.0git
|
LinkGraph building code that's specific to the given ELFT, but common across all architectures. More...
#include "ExecutionEngine/JITLink/ELFLinkGraphBuilder.h"
Public Member Functions | |
ELFLinkGraphBuilder (const object::ELFFile< ELFT > &Obj, Triple TT, SubtargetFeatures Features, StringRef FileName, LinkGraph::GetEdgeKindNameFunction GetEdgeKindName) | |
ELFLinkGraphBuilder & | setProcessDebugSections (bool ProcessDebugSections) |
Debug sections are included in the graph by default. | |
Expected< std::unique_ptr< LinkGraph > > | buildGraph () |
Attempt to construct and return the LinkGraph. | |
virtual Error | addRelocations ()=0 |
Call to derived class to handle relocations. | |
template<typename RelocHandlerFunction > | |
Error | forEachRelaRelocation (const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) |
template<typename RelocHandlerFunction > | |
Error | forEachRelRelocation (const typename ELFT::Shdr &RelSect, RelocHandlerFunction &&Func) |
Public Member Functions inherited from llvm::jitlink::ELFLinkGraphBuilderBase | |
ELFLinkGraphBuilderBase (std::unique_ptr< LinkGraph > G) | |
virtual | ~ELFLinkGraphBuilderBase () |
Protected Types | |
using | ELFSectionIndex = unsigned |
using | ELFSymbolIndex = unsigned |
Protected Member Functions | |
bool | isRelocatable () const |
void | setGraphBlock (ELFSectionIndex SecIndex, Block *B) |
Block * | getGraphBlock (ELFSectionIndex SecIndex) |
void | setGraphSymbol (ELFSymbolIndex SymIndex, Symbol &Sym) |
Symbol * | getGraphSymbol (ELFSymbolIndex SymIndex) |
Expected< std::pair< Linkage, Scope > > | getSymbolLinkageAndScope (const typename ELFT::Sym &Sym, StringRef Name) |
virtual TargetFlagsType | makeTargetFlags (const typename ELFT::Sym &Sym) |
Set the target flags on the given Symbol. | |
virtual orc::ExecutorAddrDiff | getRawOffset (const typename ELFT::Sym &Sym, TargetFlagsType Flags) |
Get the physical offset of the symbol on the target platform. | |
Error | prepare () |
Error | graphifySections () |
Error | graphifySymbols () |
virtual bool | excludeSection (const typename ELFT::Shdr &Sect) const |
Override in derived classes to suppress certain sections in the link graph. | |
template<typename RelocHandlerMethod > | |
Error | forEachRelaRelocation (const typename ELFT::Shdr &RelSect, RelocHandlerMethod &&Func) |
Traverse all matching ELFT::Rela relocation records in the given section. | |
template<typename RelocHandlerMethod > | |
Error | forEachRelRelocation (const typename ELFT::Shdr &RelSect, RelocHandlerMethod &&Func) |
Traverse all matching ELFT::Rel relocation records in the given section. | |
template<typename ClassT , typename RelocHandlerMethod > | |
Error | forEachRelaRelocation (const typename ELFT::Shdr &RelSect, ClassT *Instance, RelocHandlerMethod &&Method) |
Traverse all matching rela relocation records in the given section. | |
template<typename ClassT , typename RelocHandlerMethod > | |
Error | forEachRelRelocation (const typename ELFT::Shdr &RelSect, ClassT *Instance, RelocHandlerMethod &&Method) |
Traverse all matching rel relocation records in the given section. | |
Protected Member Functions inherited from llvm::jitlink::ELFLinkGraphBuilderBase | |
Section & | getCommonSection () |
Protected Attributes | |
const ELFFile & | Obj |
ELFFile::Elf_Shdr_Range | Sections |
const ELFFile::Elf_Shdr * | SymTabSec = nullptr |
StringRef | SectionStringTab |
bool | ProcessDebugSections = true |
DenseMap< ELFSectionIndex, Block * > | GraphBlocks |
DenseMap< ELFSymbolIndex, Symbol * > | GraphSymbols |
DenseMap< const typename ELFFile::Elf_Shdr *, ArrayRef< typename ELFFile::Elf_Word > > | ShndxTables |
Protected Attributes inherited from llvm::jitlink::ELFLinkGraphBuilderBase | |
std::unique_ptr< LinkGraph > | G |
Additional Inherited Members | |
Static Protected Member Functions inherited from llvm::jitlink::ELFLinkGraphBuilderBase | |
static bool | isDwarfSection (StringRef SectionName) |
LinkGraph building code that's specific to the given ELFT, but common across all architectures.
Definition at line 57 of file ELFLinkGraphBuilder.h.
|
protected |
Definition at line 81 of file ELFLinkGraphBuilder.h.
|
protected |
Definition at line 82 of file ELFLinkGraphBuilder.h.
llvm::jitlink::ELFLinkGraphBuilder< ELFT >::ELFLinkGraphBuilder | ( | const object::ELFFile< ELFT > & | Obj, |
Triple | TT, | ||
SubtargetFeatures | Features, | ||
StringRef | FileName, | ||
LinkGraph::GetEdgeKindNameFunction | GetEdgeKindName | ||
) |
Definition at line 191 of file ELFLinkGraphBuilder.h.
References llvm::dbgs(), and LLVM_DEBUG.
|
pure virtual |
Call to derived class to handle relocations.
These require architecture specific knowledge to map to JITLink edge kinds.
Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::ELFLinkGraphBuilder< ELFT >::buildGraph |
Attempt to construct and return the LinkGraph.
Definition at line 204 of file ELFLinkGraphBuilder.h.
Referenced by llvm::jitlink::createLinkGraphFromELFObject_aarch32(), llvm::jitlink::createLinkGraphFromELFObject_i386(), llvm::jitlink::createLinkGraphFromELFObject_ppc64(), llvm::jitlink::createLinkGraphFromELFObject_riscv(), and llvm::jitlink::createLinkGraphFromELFObject_x86_64().
|
inlineprotectedvirtual |
Override in derived classes to suppress certain sections in the link graph.
Definition at line 126 of file ELFLinkGraphBuilder.h.
|
inlineprotected |
Traverse all matching rela relocation records in the given section.
Convenience wrapper to allow passing a member function for the handler.
Definition at line 152 of file ELFLinkGraphBuilder.h.
References llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelaRelocation().
Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelaRelocation | ( | const typename ELFT::Shdr & | RelSect, |
RelocHandlerFunction && | Func | ||
) |
Definition at line 595 of file ELFLinkGraphBuilder.h.
References llvm::dbgs(), llvm::inconvertibleErrorCode(), isDwarfSection(), LLVM_DEBUG, Name, llvm::ELF::SHT_RELA, and llvm::Error::success().
|
protected |
Traverse all matching ELFT::Rela 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 &)
Referenced by llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelaRelocation().
|
inlineprotected |
Traverse all matching rel relocation records in the given section.
Convenience wrapper to allow passing a member function for the handler.
Definition at line 165 of file ELFLinkGraphBuilder.h.
References llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelRelocation().
Error llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelRelocation | ( | const typename ELFT::Shdr & | RelSect, |
RelocHandlerFunction && | Func | ||
) |
Definition at line 645 of file ELFLinkGraphBuilder.h.
References llvm::dbgs(), llvm::inconvertibleErrorCode(), isDwarfSection(), LLVM_DEBUG, Name, llvm::ELF::SHT_REL, and llvm::Error::success().
|
protected |
Traverse all matching ELFT::Rel relocation records in the given section.
The handler function Func should be callable with this signature: Error(const typename ELFT::Rel &, const typename ELFT::Shdr &, Section &)
Referenced by llvm::jitlink::ELFLinkGraphBuilder< ELFT >::forEachRelRelocation().
|
inlineprotected |
Definition at line 93 of file ELFLinkGraphBuilder.h.
References llvm::jitlink::ELFLinkGraphBuilder< ELFT >::GraphBlocks.
|
inlineprotected |
Definition at line 102 of file ELFLinkGraphBuilder.h.
References llvm::jitlink::ELFLinkGraphBuilder< ELFT >::GraphSymbols.
|
inlineprotectedvirtual |
Get the physical offset of the symbol on the target platform.
Definition at line 115 of file ELFLinkGraphBuilder.h.
References Sym.
|
protected |
Definition at line 225 of file ELFLinkGraphBuilder.h.
References llvm::jitlink::Default, llvm::jitlink::Hidden, llvm::inconvertibleErrorCode(), llvm::jitlink::Local, Name, llvm::ELF::STB_GLOBAL, llvm::ELF::STB_GNU_UNIQUE, llvm::ELF::STB_LOCAL, llvm::ELF::STB_WEAK, llvm::jitlink::Strong, llvm::ELF::STV_DEFAULT, llvm::ELF::STV_HIDDEN, llvm::ELF::STV_INTERNAL, llvm::ELF::STV_PROTECTED, Sym, and llvm::jitlink::Weak.
|
protected |
Definition at line 312 of file ELFLinkGraphBuilder.h.
References B, llvm::Data, llvm::dbgs(), llvm::orc::Exec, G, isDwarfSection(), LLVM_DEBUG, Name, llvm::orc::NoAlloc, llvm::orc::Read, llvm::ELF::SHF_ALLOC, llvm::ELF::SHF_EXECINSTR, llvm::ELF::SHF_WRITE, llvm::ELF::SHT_ARM_EXIDX, llvm::ELF::SHT_NOBITS, llvm::ELF::SHT_NULL, llvm::Error::success(), and llvm::orc::Write.
|
protected |
Definition at line 412 of file ELFLinkGraphBuilder.h.
References B, llvm::dbgs(), llvm::jitlink::Default, llvm::formatv(), G, llvm::jitlink::Symbol::getName(), llvm::inconvertibleErrorCode(), llvm::jitlink::Symbol::isDefined(), llvm::jitlink::Symbol::isExternal(), LLVM_DEBUG, llvm::jitlink::Local, Name, llvm::Offset, llvm::ELF::SHN_XINDEX, llvm::ELF::STB_GLOBAL, llvm::ELF::STB_LOCAL, llvm::ELF::STB_WEAK, llvm::jitlink::Strong, llvm::ELF::STT_FILE, llvm::ELF::STT_FUNC, llvm::ELF::STT_NOTYPE, llvm::ELF::STT_OBJECT, llvm::ELF::STT_SECTION, llvm::ELF::STT_TLS, llvm::Error::success(), Sym, llvm::dwarf::toString(), and llvm::jitlink::Weak.
|
inlineprotected |
Definition at line 84 of file ELFLinkGraphBuilder.h.
References llvm::ELF::ET_REL, llvm::object::ELFFile< ELFT >::getHeader(), and llvm::jitlink::ELFLinkGraphBuilder< ELFT >::Obj.
|
inlineprotectedvirtual |
Set the target flags on the given Symbol.
Definition at line 110 of file ELFLinkGraphBuilder.h.
|
protected |
Definition at line 270 of file ELFLinkGraphBuilder.h.
References llvm::dbgs(), G, LLVM_DEBUG, llvm::ELF::SHT_SYMTAB, llvm::ELF::SHT_SYMTAB_SHNDX, and llvm::Error::success().
|
inlineprotected |
Definition at line 88 of file ELFLinkGraphBuilder.h.
References assert(), B, and llvm::jitlink::ELFLinkGraphBuilder< ELFT >::GraphBlocks.
|
inlineprotected |
Definition at line 97 of file ELFLinkGraphBuilder.h.
References assert(), llvm::jitlink::ELFLinkGraphBuilder< ELFT >::GraphSymbols, and Sym.
|
inline |
Debug sections are included in the graph by default.
Use setProcessDebugSections(false) to ignore them if debug info is not needed.
Definition at line 68 of file ELFLinkGraphBuilder.h.
References llvm::jitlink::ELFLinkGraphBuilder< ELFT >::ProcessDebugSections.
|
protected |
Definition at line 183 of file ELFLinkGraphBuilder.h.
Referenced by llvm::jitlink::ELFLinkGraphBuilder< ELFT >::getGraphBlock(), and llvm::jitlink::ELFLinkGraphBuilder< ELFT >::setGraphBlock().
|
protected |
Definition at line 184 of file ELFLinkGraphBuilder.h.
Referenced by llvm::jitlink::ELFLinkGraphBuilder< ELFT >::getGraphSymbol(), and llvm::jitlink::ELFLinkGraphBuilder< ELFT >::setGraphSymbol().
|
protected |
Definition at line 174 of file ELFLinkGraphBuilder.h.
Referenced by llvm::jitlink::ELFLinkGraphBuilder< ELFT >::isRelocatable().
|
protected |
Definition at line 179 of file ELFLinkGraphBuilder.h.
Referenced by llvm::jitlink::ELFLinkGraphBuilder< ELFT >::setProcessDebugSections().
|
protected |
Definition at line 176 of file ELFLinkGraphBuilder.h.
|
protected |
Definition at line 178 of file ELFLinkGraphBuilder.h.
|
protected |
Definition at line 187 of file ELFLinkGraphBuilder.h.
|
protected |
Definition at line 177 of file ELFLinkGraphBuilder.h.