LLVM  16.0.0git
Namespaces | Classes | Typedefs | Enumerations | Functions
llvm::jitlink Namespace Reference

Namespaces

 
 
 
 

Classes

class  Addressable
 Base class for Addressable entities (externals, absolutes, blocks). More...
 
class  AllocGroup
 A pair of memory protections and allocation policies. More...
 
class  AllocGroupSmallMap
 A specialized small-map for AllocGroups. More...
 
class  BasicLayout
 BasicLayout simplifies the implementation of JITLinkMemoryManagers. More...
 
class  Block
 An Addressable with content and edges. More...
 
class  BlockAddressMap
 Enables easy lookup of blocks by addresses. More...
 
class  COFFDirectiveParser
 Parser for the MSVC specific preprocessor directives. More...
 
class  COFFLinkGraphBuilder
 
class  CompactUnwindSplitter
 A pass to split up __LD,__compact_unwind sections. More...
 
class  DefineExternalSectionStartAndEndSymbols
 Pass implementation for the createDefineExternalSectionStartAndEndSymbols function. More...
 
class  DWARFRecordSectionSplitter
 A LinkGraph pass that splits blocks in a section that follows the DWARF Record format into sub-blocks where each header gets its own block. More...
 
class  Edge
 Represents fixups and constraints in the LinkGraph. More...
 
class  EHFrameCFIBlockInspector
 Inspect an eh-frame CFI record. More...
 
class  EHFrameEdgeFixer
 A LinkGraph pass that adds missing FDE-to-CIE, FDE-to-PC and FDE-to-LSDA edges. More...
 
class  EHFrameNullTerminator
 Add a 32-bit null-terminator to the end of the eh-frame section. More...
 
class  EHFrameRegistrar
 Supports registration/deregistration of EH-frames in a target process. More...
 
class  ELFJITLinker_i386
 
class  ELFJITLinker_riscv
 
class  ELFJITLinker_x86_64
 
class  ELFLinkGraphBuilder
 Ling-graph building code that's specific to the given ELFT, but common across all architectures. More...
 
class  ELFLinkGraphBuilder_i386
 
class  ELFLinkGraphBuilder_riscv
 
class  ELFLinkGraphBuilder_x86_64
 
class  ELFLinkGraphBuilderBase
 Common link-graph building code shared between all ELFFiles. More...
 
class  InProcessEHFrameRegistrar
 Registers / Deregisters EH-frames in the current process. More...
 
class  InProcessMemoryManager
 A JITLinkMemoryManager that allocates in-process memory. More...
 
class  JITLinkAsyncLookupContinuation
 A function object to call with a resolved symbol map (See AsyncLookupResult) or an error if resolution failed. More...
 
class  JITLinkContext
 Holds context for a single jitLink invocation. More...
 
class  JITLinkDylib
 
class  JITLinker
 
class  JITLinkerBase
 Base class for a JIT linker. More...
 
class  JITLinkError
 Base class for errors originating in JIT linker, e.g. More...
 
class  JITLinkMemoryManager
 Manages allocations of JIT memory. More...
 
class  LinkGraph
 
class  MachOJITLinker_arm64
 
class  MachOJITLinker_x86_64
 
class  MachOLinkGraphBuilder
 
struct  PassConfiguration
 An LinkGraph pass configuration, consisting of a list of pre-prune, post-prune, and post-fixup passes. More...
 
class  PerGraphGOTAndPLTStubsBuilder
 Per-object GOT and PLT Stub builder. More...
 
class  Section
 Represents an object file section. More...
 
class  SectionRange
 Represents a section address range via a pair of Block pointers to the first and last Blocks in the section. More...
 
struct  SectionRangeSymbolDesc
 
class  SEHFrameKeepAlivePass
 This pass adds keep-alive edge from SEH frame sections to the parent function content block. More...
 
class  SimpleSegmentAlloc
 A utility class for making simple allocations using JITLinkMemoryManager. More...
 
class  Symbol
 Symbol representation. More...
 
class  SymbolAddressMap
 A map of addresses to Symbols. More...
 
class  TableManager
 A CRTP base for tables that are built on demand, e.g. More...
 

Typedefs

using StoreFrameRangeFunction = std::function< void(orc::ExecutorAddr EHFrameSectionAddr, size_t EHFrameSectionSize)>
 
using SectionOrdinal = unsigned
 
using LinkGraphPassFunction = std::function< Error(LinkGraph &)>
 A function for mutating LinkGraphs. More...
 
using LinkGraphPassList = std::vector< LinkGraphPassFunction >
 A list of LinkGraph passes. More...
 
using AsyncLookupResult = DenseMap< StringRef, JITEvaluatedSymbol >
 A map of symbol names to resolved addresses. More...
 

Enumerations

enum  Linkage : uint8_t { Linkage::Strong, Linkage::Weak }
 Describes symbol linkage. More...
 
enum  Scope : uint8_t { Scope::Default, Scope::Hidden, Scope::Local }
 Defines the scope in which this symbol should be visible: Default – Visible in the public interface of the linkage unit. More...
 
enum  SymbolLookupFlags { SymbolLookupFlags::RequiredSymbol, SymbolLookupFlags::WeaklyReferencedSymbol }
 Flags for symbol lookup. More...
 
enum  MemProt { MemProt::None = 0, MemProt::Read = 1U << 0, MemProt::Write = 1U << 1, MemProt::Exec = 1U << 2 }
 Describes Read/Write/Exec permissions for memory. More...
 
enum  MemDeallocPolicy { MemDeallocPolicy::Standard, MemDeallocPolicy::Finalize }
 Describes a memory deallocation policy for memory to be allocated by a JITLinkMemoryManager. More...
 
enum  { COFF_OPT_INVALID = 0 }
 

Functions

Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromCOFFObject (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from an COFF relocatable object. More...
 
void link_COFF (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 Link the given graph. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromCOFFObject_x86_64 (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from an COFF/x86-64 relocatable object. More...
 
void link_COFF_x86_64 (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a COFF x86-64 object file. More...
 
const char * getCOFFX86RelocationKindName (Edge::Kind R)
 Return the string name of the given COFF x86-64 edge kind. More...
 
LinkGraphPassFunction createEHFrameRecorderPass (const Triple &TT, StoreFrameRangeFunction StoreFrameRange)
 Creates a pass that records the address and size of the EH frame section. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromELFObject (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from an ELF relocatable object. More...
 
void link_ELF (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 Link the given graph. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromELFObject_aarch64 (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from an ELF/aarch64 relocatable object. More...
 
void link_ELF_aarch64 (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a ELF aarch64 relocatable object file. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromELFObject_i386 (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from an ELF/i386 relocatable object. More...
 
void link_ELF_i386 (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a ELF i386 relocatable object file. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromELFObject_riscv (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from an ELF/riscv relocatable object. More...
 
void link_ELF_riscv (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a ELF riscv object file. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromELFObject_x86_64 (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from an ELF/x86-64 relocatable object. More...
 
void link_ELF_x86_64 (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a ELF x86-64 object file. More...
 
const char * getGenericEdgeKindName (Edge::Kind K)
 Returns the string name of the given generic edge kind, or "unknown" otherwise. More...
 
uint64_t alignToBlock (uint64_t Addr, Block &B)
 
orc::ExecutorAddr alignToBlock (orc::ExecutorAddr Addr, Block &B)
 
const char * getLinkageName (Linkage L)
 For errors and debugging output. More...
 
const char * getScopeName (Scope S)
 For debugging output. More...
 
raw_ostreamoperator<< (raw_ostream &OS, const Block &B)
 
raw_ostreamoperator<< (raw_ostream &OS, const Symbol &A)
 
void printEdge (raw_ostream &OS, const Block &B, const Edge &E, StringRef EdgeKindName)
 
raw_ostreamoperator<< (raw_ostream &OS, const SymbolLookupFlags &LF)
 
template<typename Continuation >
std::unique_ptr< JITLinkAsyncLookupContinuationcreateLookupContinuation (Continuation Cont)
 Create a lookup continuation from a function object. More...
 
Error markAllSymbolsLive (LinkGraph &G)
 Marks all symbols in a graph live. More...
 
Error makeTargetOutOfRangeError (const LinkGraph &G, const Block &B, const Edge &E)
 Create an out of range error for the given edge in the given block. More...
 
Error makeAlignmentError (llvm::orc::ExecutorAddr Loc, uint64_t Value, int N, const Edge &E)
 
void visitEdge (LinkGraph &G, Block *B, Edge &E)
 Base case for edge-visitors where the visitor-list is empty. More...
 
template<typename VisitorT , typename... VisitorTs>
void visitEdge (LinkGraph &G, Block *B, Edge &E, VisitorT &&V, VisitorTs &&...Vs)
 Applies the first visitor in the list to the given edge. More...
 
template<typename... VisitorTs>
void visitExistingEdges (LinkGraph &G, VisitorTs &&...Vs)
 For each edge in the given graph, apply a list of visitors to the edge, stopping when the first visitor's visitEdge method returns true. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromObject (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from the given object buffer. More...
 
void link (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 Link the given graph. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromMachOObject (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from a MachO relocatable object. More...
 
void link_MachO (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given ObjBuffer, which must be a MachO object file. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromMachOObject_arm64 (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from a MachO/arm64 relocatable object. More...
 
void link_MachO_arm64 (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a MachO arm64 object file. More...
 
LinkGraphPassFunction createEHFrameSplitterPass_MachO_arm64 ()
 Returns a pass suitable for splitting __eh_frame sections in MachO/x86-64 objects. More...
 
LinkGraphPassFunction createEHFrameEdgeFixerPass_MachO_arm64 ()
 Returns a pass suitable for fixing missing edges in an __eh_frame section in a MachO/x86-64 object. More...
 
Expected< std::unique_ptr< LinkGraph > > createLinkGraphFromMachOObject_x86_64 (MemoryBufferRef ObjectBuffer)
 Create a LinkGraph from a MachO/x86-64 relocatable object. More...
 
void link_MachO_x86_64 (std::unique_ptr< LinkGraph > G, std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given LinkGraph. More...
 
LinkGraphPassFunction createEHFrameSplitterPass_MachO_x86_64 ()
 Returns a pass suitable for splitting __eh_frame sections in MachO/x86-64 objects. More...
 
LinkGraphPassFunction createEHFrameEdgeFixerPass_MachO_x86_64 ()
 Returns a pass suitable for fixing missing edges in an __eh_frame section in a MachO/x86-64 object. More...
 
raw_ostreamoperator<< (raw_ostream &OS, MemProt MP)
 Print a MemProt as an RWX triple. More...
 
sys::Memory::ProtectionFlags toSysMemoryProtectionFlags (MemProt MP)
 Convert a MemProt value to a corresponding sys::Memory::ProtectionFlags value. More...
 
MemProt fromSysMemoryProtectionFlags (sys::Memory::ProtectionFlags PF)
 Convert a sys::Memory::ProtectionFlags value to a corresponding MemProt value. More...
 
raw_ostreamoperator<< (raw_ostream &OS, MemDeallocPolicy MDP)
 Print a MemDeallocPolicy. More...
 
raw_ostreamoperator<< (raw_ostream &OS, AllocGroup AG)
 Print an AllocGroup. More...
 
static StringRef getMachineName (uint16_t Machine)
 
static Triple createTripleWithCOFFFormat (Triple T)
 
template<typename SymbolIdentifierFunction >
DefineExternalSectionStartAndEndSymbols< SymbolIdentifierFunction > createDefineExternalSectionStartAndEndSymbolsPass (SymbolIdentifierFunction &&F)
 Returns a JITLink pass (as a function class) that uses the given symbol identification function to identify external section start and end symbols (and their associated Section*s) and transform the identified externals into defined symbols pointing to the start of the first block in the section and the end of the last (start and end symbols for empty sections will be transformed into absolute symbols at address 0). More...
 
static Expected< size_treadCFIRecordLength (const Block &B, BinaryStreamReader &R)
 
Expected< uint16_treadTargetMachineArch (StringRef Buffer)
 
static Expected< const Edge & > getRISCVPCRelHi20 (const Edge &E)
 
static uint32_t extractBits (uint32_t Num, unsigned Low, unsigned Size)
 
static bool isAlignmentCorrect (uint64_t Value, int N)
 
static bool isInRangeForImm (int64_t Value, int N)
 
static SectionRangeSymbolDesc identifyELFSectionStartAndEndSymbols (LinkGraph &G, Symbol &Sym)
 
void prune (LinkGraph &G)
 Removes dead symbols/blocks/addressables. More...
 
Error buildTables_MachO_arm64 (LinkGraph &G)
 

Typedef Documentation

◆ AsyncLookupResult

A map of symbol names to resolved addresses.

Definition at line 1643 of file JITLink.h.

◆ LinkGraphPassFunction

A function for mutating LinkGraphs.

Definition at line 1573 of file JITLink.h.

◆ LinkGraphPassList

A list of LinkGraph passes.

Definition at line 1576 of file JITLink.h.

◆ SectionOrdinal

using llvm::jitlink::SectionOrdinal = typedef unsigned

Definition at line 147 of file JITLink.h.

◆ StoreFrameRangeFunction

using llvm::jitlink::StoreFrameRangeFunction = typedef std::function<void( orc::ExecutorAddr EHFrameSectionAddr, size_t EHFrameSectionSize)>

Definition at line 103 of file EHFrameSupport.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
COFF_OPT_INVALID 

Definition at line 27 of file COFFDirectiveParser.h.

◆ Linkage

enum llvm::jitlink::Linkage : uint8_t
strong

Describes symbol linkage.

This can be used to make resolve definition clashes.

Enumerator
Strong 
Weak 

Definition at line 365 of file JITLink.h.

◆ MemDeallocPolicy

Describes a memory deallocation policy for memory to be allocated by a JITLinkMemoryManager.

All memory allocated by a call to JITLinkMemoryManager::allocate should be deallocated if a call is made to JITLinkMemoryManager::InFlightAllocation::abandon. The policies below apply to finalized allocations.

Enumerator
Standard 

Standard memory should be deallocated when the deallocate method is called for the finalized allocation.

Finalize 

Finalize memory should be overwritten and then deallocated after all finalization functions have been run.

Definition at line 71 of file MemoryFlags.h.

◆ MemProt

Describes Read/Write/Exec permissions for memory.

Enumerator
None 
Read 
Write 
Exec 

Definition at line 27 of file MemoryFlags.h.

◆ Scope

enum llvm::jitlink::Scope : uint8_t
strong

Defines the scope in which this symbol should be visible: Default – Visible in the public interface of the linkage unit.

Hidden – Visible within the linkage unit, but not exported from it. Local – Visible only within the LinkGraph.

Enumerator
Default 
Hidden 
Local 

Definition at line 377 of file JITLink.h.

◆ SymbolLookupFlags

Flags for symbol lookup.

FIXME: These basically duplicate orc::SymbolLookupFlags – We should merge the two types once we have an OrcSupport library.

Enumerator
RequiredSymbol 
WeaklyReferencedSymbol 

Definition at line 1638 of file JITLink.h.

Function Documentation

◆ alignToBlock() [1/2]

orc::ExecutorAddr llvm::jitlink::alignToBlock ( orc::ExecutorAddr  Addr,
Block B 
)
inline

Definition at line 359 of file JITLink.h.

References Addr, alignToBlock(), and B.

◆ alignToBlock() [2/2]

uint64_t llvm::jitlink::alignToBlock ( uint64_t  Addr,
Block B 
)
inline

Definition at line 353 of file JITLink.h.

References Addr, and B.

Referenced by alignToBlock(), llvm::jitlink::BasicLayout::apply(), and llvm::jitlink::BasicLayout::BasicLayout().

◆ buildTables_MachO_arm64()

Error llvm::jitlink::buildTables_MachO_arm64 ( LinkGraph G)

◆ createDefineExternalSectionStartAndEndSymbolsPass()

template<typename SymbolIdentifierFunction >
DefineExternalSectionStartAndEndSymbols<SymbolIdentifierFunction> llvm::jitlink::createDefineExternalSectionStartAndEndSymbolsPass ( SymbolIdentifierFunction &&  F)

Returns a JITLink pass (as a function class) that uses the given symbol identification function to identify external section start and end symbols (and their associated Section*s) and transform the identified externals into defined symbols pointing to the start of the first block in the section and the end of the last (start and end symbols for empty sections will be transformed into absolute symbols at address 0).

The identification function should be callable as

SectionRangeSymbolDesc (LinkGraph &G, Symbol &Sym)

If Sym is not a section range start or end symbol then a default constructed SectionRangeSymbolDesc should be returned. If Sym is a start symbol then SectionRangeSymbolDesc(Sec, true), where Sec is a reference to the target Section. If Sym is an end symbol then SectionRangeSymbolDesc(Sec, false) should be returned.

This pass should be run in the PostAllocationPass pipeline, at which point all blocks should have been assigned their final addresses.

Definition at line 105 of file DefineExternalSectionStartAndEndSymbols.h.

References F.

Referenced by link_ELF_x86_64().

◆ createEHFrameEdgeFixerPass_MachO_arm64()

LinkGraphPassFunction llvm::jitlink::createEHFrameEdgeFixerPass_MachO_arm64 ( )

Returns a pass suitable for fixing missing edges in an __eh_frame section in a MachO/x86-64 object.

Definition at line 584 of file MachO_arm64.cpp.

References llvm::jitlink::aarch64::Delta32, llvm::jitlink::aarch64::Delta64, llvm::jitlink::aarch64::NegDelta32, llvm::jitlink::aarch64::Pointer32, llvm::jitlink::aarch64::Pointer64, and llvm::jitlink::aarch64::PointerSize.

Referenced by link_MachO_arm64().

◆ createEHFrameEdgeFixerPass_MachO_x86_64()

LinkGraphPassFunction llvm::jitlink::createEHFrameEdgeFixerPass_MachO_x86_64 ( )

Returns a pass suitable for fixing missing edges in an __eh_frame section in a MachO/x86-64 object.

Definition at line 510 of file MachO_x86_64.cpp.

References llvm::jitlink::x86_64::Delta32, llvm::jitlink::x86_64::Delta64, llvm::jitlink::x86_64::NegDelta32, llvm::jitlink::x86_64::Pointer32, llvm::jitlink::x86_64::Pointer64, and llvm::jitlink::x86_64::PointerSize.

Referenced by link_MachO_x86_64().

◆ createEHFrameRecorderPass()

LinkGraphPassFunction llvm::jitlink::createEHFrameRecorderPass ( const Triple TT,
StoreFrameRangeFunction  StoreFrameRange 
)

Creates a pass that records the address and size of the EH frame section.

If no eh-frame section is found then the address and size will both be given as zero.

Authors of JITLinkContexts can use this function to register a post-fixup pass that records the range of the eh-frame section. This range can be used after finalization to register and deregister the frame.

Definition at line 692 of file EHFrameSupport.cpp.

References Addr, G, llvm::Triple::MachO, move, S, and llvm::Error::success().

Referenced by llvm::orc::EHFrameRegistrationPlugin::modifyPassConfig().

◆ createEHFrameSplitterPass_MachO_arm64()

LinkGraphPassFunction llvm::jitlink::createEHFrameSplitterPass_MachO_arm64 ( )

Returns a pass suitable for splitting __eh_frame sections in MachO/x86-64 objects.

Definition at line 580 of file MachO_arm64.cpp.

Referenced by link_MachO_arm64().

◆ createEHFrameSplitterPass_MachO_x86_64()

LinkGraphPassFunction llvm::jitlink::createEHFrameSplitterPass_MachO_x86_64 ( )

Returns a pass suitable for splitting __eh_frame sections in MachO/x86-64 objects.

Definition at line 506 of file MachO_x86_64.cpp.

Referenced by link_MachO_x86_64().

◆ createLinkGraphFromCOFFObject()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromCOFFObject ( MemoryBufferRef  ObjectBuffer)

◆ createLinkGraphFromCOFFObject_x86_64()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromCOFFObject_x86_64 ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from an COFF/x86-64 relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 308 of file COFF_x86_64.cpp.

References llvm::object::ObjectFile::createCOFFObjectFile(), llvm::dbgs(), llvm::MemoryBufferRef::getBufferIdentifier(), and LLVM_DEBUG.

Referenced by createLinkGraphFromCOFFObject().

◆ createLinkGraphFromELFObject()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromELFObject ( MemoryBufferRef  ObjectBuffer)

◆ createLinkGraphFromELFObject_aarch64()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromELFObject_aarch64 ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from an ELF/aarch64 relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 529 of file ELF_aarch64.cpp.

References llvm::Triple::aarch64, assert(), llvm::object::ObjectFile::createELFObjectFile(), llvm::dbgs(), llvm::MemoryBufferRef::getBufferIdentifier(), and LLVM_DEBUG.

Referenced by createLinkGraphFromELFObject().

◆ createLinkGraphFromELFObject_i386()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromELFObject_i386 ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from an ELF/i386 relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 77 of file ELF_i386.cpp.

References assert(), llvm::jitlink::ELFLinkGraphBuilder< ELFT >::buildGraph(), llvm::object::ObjectFile::createELFObjectFile(), llvm::dbgs(), llvm::MemoryBufferRef::getBufferIdentifier(), LLVM_DEBUG, and llvm::Triple::x86.

Referenced by createLinkGraphFromELFObject().

◆ createLinkGraphFromELFObject_riscv()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromELFObject_riscv ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from an ELF/riscv relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 556 of file ELF_riscv.cpp.

References assert(), llvm::jitlink::ELFLinkGraphBuilder< ELFT >::buildGraph(), llvm::object::ObjectFile::createELFObjectFile(), llvm::dbgs(), llvm::MemoryBufferRef::getBufferIdentifier(), LLVM_DEBUG, llvm::Triple::riscv32, and llvm::Triple::riscv64.

Referenced by createLinkGraphFromELFObject().

◆ createLinkGraphFromELFObject_x86_64()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromELFObject_x86_64 ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from an ELF/x86-64 relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 345 of file ELF_x86_64.cpp.

References llvm::jitlink::ELFLinkGraphBuilder< ELFT >::buildGraph(), llvm::object::ObjectFile::createELFObjectFile(), llvm::dbgs(), llvm::MemoryBufferRef::getBufferIdentifier(), and LLVM_DEBUG.

Referenced by createLinkGraphFromELFObject().

◆ createLinkGraphFromMachOObject()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromMachOObject ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from a MachO relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 30 of file MachO.cpp.

References llvm::ByteSwap_32(), llvm::MachO::CPU_TYPE_ARM64, llvm::MachO::CPU_TYPE_X86_64, createLinkGraphFromMachOObject_arm64(), createLinkGraphFromMachOObject_x86_64(), llvm::Data, llvm::dbgs(), llvm::format(), llvm::MemoryBufferRef::getBuffer(), llvm::MemoryBufferRef::getBufferIdentifier(), LLVM_DEBUG, llvm::msf::Magic, memcpy(), llvm::MachO::MH_CIGAM, llvm::MachO::MH_CIGAM_64, llvm::MachO::MH_MAGIC, and llvm::MachO::MH_MAGIC_64.

Referenced by createLinkGraphFromObject().

◆ createLinkGraphFromMachOObject_arm64()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromMachOObject_arm64 ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from a MachO/arm64 relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 540 of file MachO_arm64.cpp.

References llvm::object::ObjectFile::createMachOObjectFile().

Referenced by createLinkGraphFromMachOObject().

◆ createLinkGraphFromMachOObject_x86_64()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromMachOObject_x86_64 ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from a MachO/x86-64 relocatable object.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 465 of file MachO_x86_64.cpp.

References llvm::object::ObjectFile::createMachOObjectFile().

Referenced by createLinkGraphFromMachOObject().

◆ createLinkGraphFromObject()

Expected< std::unique_ptr< LinkGraph > > llvm::jitlink::createLinkGraphFromObject ( MemoryBufferRef  ObjectBuffer)

Create a LinkGraph from the given object buffer.

Note: The graph does not take ownership of the underlying buffer, nor copy its contents. The caller is responsible for ensuring that the object buffer outlives the graph.

Definition at line 405 of file JITLink.cpp.

References llvm::file_magic::coff_object, createLinkGraphFromCOFFObject(), createLinkGraphFromELFObject(), createLinkGraphFromMachOObject(), llvm::file_magic::elf_relocatable, llvm::MemoryBufferRef::getBuffer(), llvm::identify_magic(), llvm::file_magic::macho_object, and llvm::msf::Magic.

Referenced by llvm::orc::ObjectLinkingLayer::emit().

◆ createLookupContinuation()

template<typename Continuation >
std::unique_ptr<JITLinkAsyncLookupContinuation> llvm::jitlink::createLookupContinuation ( Continuation  Cont)

Create a lookup continuation from a function object.

Definition at line 1659 of file JITLink.h.

References move, and llvm::dxil::PointerTypeAnalysis::run().

◆ createTripleWithCOFFFormat()

static Triple llvm::jitlink::createTripleWithCOFFFormat ( Triple  T)
static

Definition at line 21 of file COFFLinkGraphBuilder.cpp.

References llvm::Triple::COFF, and T.

◆ extractBits()

static uint32_t llvm::jitlink::extractBits ( uint32_t  Num,
unsigned  Low,
unsigned  Size 
)
static

Definition at line 162 of file ELF_riscv.cpp.

References llvm::Low.

◆ fromSysMemoryProtectionFlags()

MemProt llvm::jitlink::fromSysMemoryProtectionFlags ( sys::Memory::ProtectionFlags  PF)
inline

Convert a sys::Memory::ProtectionFlags value to a corresponding MemProt value.

Definition at line 53 of file MemoryFlags.h.

References llvm::sys::Memory::MF_EXEC, llvm::sys::Memory::MF_READ, llvm::sys::Memory::MF_WRITE, None, Read, and Write.

◆ getCOFFX86RelocationKindName()

const char * llvm::jitlink::getCOFFX86RelocationKindName ( Edge::Kind  R)

Return the string name of the given COFF x86-64 edge kind.

Return the string name of the given COFF x86_64 edge kind.

Definition at line 290 of file COFF_x86_64.cpp.

References llvm::jitlink::x86_64::getEdgeKindName(), llvm::jitlink::x86_64::PCRel32, and llvm::jitlink::aarch64::Pointer64.

◆ getGenericEdgeKindName()

const char * llvm::jitlink::getGenericEdgeKindName ( Edge::Kind  K)

Returns the string name of the given generic edge kind, or "unknown" otherwise.

Useful for debugging.

Definition at line 58 of file JITLink.cpp.

References Invalid.

Referenced by llvm::jitlink::i386::getEdgeKindName(), llvm::jitlink::x86_64::getEdgeKindName(), llvm::jitlink::riscv::getEdgeKindName(), and llvm::jitlink::aarch64::getEdgeKindName().

◆ getLinkageName()

const char * llvm::jitlink::getLinkageName ( Linkage  L)

For errors and debugging output.

Definition at line 69 of file JITLink.cpp.

References llvm_unreachable.

◆ getMachineName()

static StringRef llvm::jitlink::getMachineName ( uint16_t  Machine)
static

◆ getRISCVPCRelHi20()

static Expected<const Edge &> llvm::jitlink::getRISCVPCRelHi20 ( const Edge E)
static

◆ getScopeName()

const char * llvm::jitlink::getScopeName ( Scope  S)

For debugging output.

Definition at line 79 of file JITLink.cpp.

References llvm::TargetStackID::Default, llvm::cl::Hidden, llvm_unreachable, and S.

Referenced by operator<<().

◆ identifyELFSectionStartAndEndSymbols()

static SectionRangeSymbolDesc llvm::jitlink::identifyELFSectionStartAndEndSymbols ( LinkGraph G,
Symbol Sym 
)
static

Definition at line 362 of file ELF_x86_64.cpp.

References G, and llvm::jitlink::Symbol::getName().

Referenced by link_ELF_x86_64().

◆ isAlignmentCorrect()

static bool llvm::jitlink::isAlignmentCorrect ( uint64_t  Value,
int  N 
)
inlinestatic

Definition at line 166 of file ELF_riscv.cpp.

References false, and N.

◆ isInRangeForImm()

static bool llvm::jitlink::isInRangeForImm ( int64_t  Value,
int  N 
)
inlinestatic

Definition at line 171 of file ELF_riscv.cpp.

References N, and llvm::SignExtend64().

◆ link()

void llvm::jitlink::link ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

Link the given graph.

Definition at line 419 of file JITLink.cpp.

References llvm::Triple::COFF, llvm::Triple::ELF, G, link_COFF(), link_ELF(), link_MachO(), llvm::Triple::MachO, and move.

Referenced by llvm::orc::ObjectLinkingLayer::emit().

◆ link_COFF()

void llvm::jitlink::link_COFF ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

Link the given graph.

Uses conservative defaults for GOT and stub handling based on the target platform.

Definition at line 122 of file COFF.cpp.

References G, link_COFF_x86_64(), move, and llvm::Triple::x86_64.

Referenced by link().

◆ link_COFF_x86_64()

void llvm::jitlink::link_COFF_x86_64 ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

jit-link the given object buffer, which must be a COFF x86-64 object file.

Definition at line 322 of file COFF_x86_64.cpp.

References G, markAllSymbolsLive(), move, llvm::jitlink::PassConfiguration::PreFixupPasses, and llvm::jitlink::PassConfiguration::PrePrunePasses.

Referenced by link_COFF().

◆ link_ELF()

void llvm::jitlink::link_ELF ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

Link the given graph.

Uses conservative defaults for GOT and stub handling based on the target platform.

Definition at line 84 of file ELF.cpp.

References llvm::Triple::aarch64, G, link_ELF_aarch64(), link_ELF_i386(), link_ELF_riscv(), link_ELF_x86_64(), move, llvm::Triple::riscv32, llvm::Triple::riscv64, llvm::Triple::x86, and llvm::Triple::x86_64.

Referenced by link().

◆ link_ELF_aarch64()

void llvm::jitlink::link_ELF_aarch64 ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

◆ link_ELF_i386()

void llvm::jitlink::link_ELF_i386 ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

jit-link the given object buffer, which must be a ELF i386 relocatable object file.

Definition at line 97 of file ELF_i386.cpp.

References G, markAllSymbolsLive(), move, and llvm::jitlink::PassConfiguration::PrePrunePasses.

Referenced by link_ELF().

◆ link_ELF_riscv()

void llvm::jitlink::link_ELF_riscv ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

jit-link the given object buffer, which must be a ELF riscv object file.

Definition at line 583 of file ELF_riscv.cpp.

References G, markAllSymbolsLive(), move, llvm::jitlink::PassConfiguration::PostPrunePasses, and llvm::jitlink::PassConfiguration::PrePrunePasses.

Referenced by link_ELF().

◆ link_ELF_x86_64()

void llvm::jitlink::link_ELF_x86_64 ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

◆ link_MachO()

void llvm::jitlink::link_MachO ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

jit-link the given ObjBuffer, which must be a MachO object file.

Uses conservative defaults for GOT and stub handling based on the target platform.

Definition at line 75 of file MachO.cpp.

References llvm::Triple::aarch64, G, link_MachO_arm64(), link_MachO_x86_64(), move, and llvm::Triple::x86_64.

Referenced by link().

◆ link_MachO_arm64()

void llvm::jitlink::link_MachO_arm64 ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

jit-link the given object buffer, which must be a MachO arm64 object file.

If PrePrunePasses is empty then a default mark-live pass will be inserted that will mark all exported atoms live. If PrePrunePasses is not empty, the caller is responsible for including a pass to mark atoms as live.

If PostPrunePasses is empty then a default GOT-and-stubs insertion pass will be inserted. If PostPrunePasses is not empty then the caller is responsible for including a pass to insert GOT and stub edges.

Definition at line 547 of file MachO_arm64.cpp.

References buildTables_MachO_arm64(), createEHFrameEdgeFixerPass_MachO_arm64(), createEHFrameSplitterPass_MachO_arm64(), G, markAllSymbolsLive(), move, llvm::jitlink::PassConfiguration::PostPrunePasses, and llvm::jitlink::PassConfiguration::PrePrunePasses.

Referenced by link_MachO().

◆ link_MachO_x86_64()

void llvm::jitlink::link_MachO_x86_64 ( std::unique_ptr< LinkGraph G,
std::unique_ptr< JITLinkContext Ctx 
)

jit-link the given LinkGraph.

If PrePrunePasses is empty then a default mark-live pass will be inserted that will mark all exported atoms live. If PrePrunePasses is not empty, the caller is responsible for including a pass to mark atoms as live.

If PostPrunePasses is empty then a default GOT-and-stubs insertion pass will be inserted. If PostPrunePasses is not empty then the caller is responsible for including a pass to insert GOT and stub edges.

Definition at line 472 of file MachO_x86_64.cpp.

References createEHFrameEdgeFixerPass_MachO_x86_64(), createEHFrameSplitterPass_MachO_x86_64(), G, markAllSymbolsLive(), move, llvm::jitlink::x86_64::optimizeGOTAndStubAccesses(), llvm::jitlink::PassConfiguration::PostPrunePasses, llvm::jitlink::PassConfiguration::PreFixupPasses, and llvm::jitlink::PassConfiguration::PrePrunePasses.

Referenced by link_MachO().

◆ makeAlignmentError()

Error llvm::jitlink::makeAlignmentError ( llvm::orc::ExecutorAddr  Loc,
uint64_t  Value,
int  N,
const Edge E 
)

Definition at line 395 of file JITLink.cpp.

References E, llvm::formatv(), llvm::orc::ExecutorAddr::getValue(), and N.

◆ makeTargetOutOfRangeError()

Error llvm::jitlink::makeTargetOutOfRangeError ( const LinkGraph G,
const Block B,
const Edge E 
)

◆ markAllSymbolsLive()

Error llvm::jitlink::markAllSymbolsLive ( LinkGraph G)

Marks all symbols in a graph live.

This can be used as a default, conservative mark-live implementation.

Definition at line 353 of file JITLink.cpp.

References G, and llvm::Error::success().

Referenced by link_COFF_x86_64(), link_ELF_aarch64(), link_ELF_i386(), link_ELF_riscv(), link_ELF_x86_64(), link_MachO_arm64(), and link_MachO_x86_64().

◆ operator<<() [1/6]

raw_ostream & llvm::jitlink::operator<< ( raw_ostream OS,
AllocGroup  AG 
)

◆ operator<<() [2/6]

raw_ostream & llvm::jitlink::operator<< ( raw_ostream OS,
const Block B 
)

Definition at line 91 of file JITLink.cpp.

References B, and llvm::formatv().

◆ operator<<() [3/6]

raw_ostream & llvm::jitlink::operator<< ( raw_ostream OS,
const Symbol A 
)

◆ operator<<() [4/6]

raw_ostream & llvm::jitlink::operator<< ( raw_ostream OS,
const SymbolLookupFlags LF 
)

Definition at line 326 of file JITLink.cpp.

References llvm_unreachable.

◆ operator<<() [5/6]

raw_ostream & llvm::jitlink::operator<< ( raw_ostream OS,
MemDeallocPolicy  MDP 
)

Print a MemDeallocPolicy.

Definition at line 23 of file MemoryFlags.cpp.

References Standard.

◆ operator<<() [6/6]

raw_ostream & llvm::jitlink::operator<< ( raw_ostream OS,
MemProt  MP 
)

Print a MemProt as an RWX triple.

Definition at line 17 of file MemoryFlags.cpp.

References Exec, None, Read, and Write.

◆ printEdge()

void llvm::jitlink::printEdge ( raw_ostream OS,
const Block B,
const Edge E,
StringRef  EdgeKindName 
)

Definition at line 112 of file JITLink.cpp.

References B, E, and llvm::formatv().

Referenced by llvm::jitlink::x86_64::optimizeGOTAndStubAccesses().

◆ prune()

void llvm::jitlink::prune ( LinkGraph G)

Removes dead symbols/blocks/addressables.

Finds the set of symbols and addressables reachable from any symbol initially marked live. All symbols/addressables not marked live at the end of this process are removed.

Definition at line 246 of file JITLinkGeneric.cpp.

References B, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::dbgs(), E, G, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), and LLVM_DEBUG.

◆ readCFIRecordLength()

static Expected<size_t> llvm::jitlink::readCFIRecordLength ( const Block B,
BinaryStreamReader R 
)
static

Definition at line 88 of file EHFrameSupport.cpp.

◆ readTargetMachineArch()

Expected<uint16_t> llvm::jitlink::readTargetMachineArch ( StringRef  Buffer)

◆ toSysMemoryProtectionFlags()

sys::Memory::ProtectionFlags llvm::jitlink::toSysMemoryProtectionFlags ( MemProt  MP)
inline

◆ visitEdge() [1/2]

void llvm::jitlink::visitEdge ( LinkGraph G,
Block B,
Edge E 
)
inline

Base case for edge-visitors where the visitor-list is empty.

Definition at line 1750 of file JITLink.h.

Referenced by llvm::SampleProfileLoaderBaseImpl< MachineBasicBlock >::propagateThroughEdges(), visitEdge(), and visitExistingEdges().

◆ visitEdge() [2/2]

template<typename VisitorT , typename... VisitorTs>
void llvm::jitlink::visitEdge ( LinkGraph G,
Block B,
Edge E,
VisitorT &&  V,
VisitorTs &&...  Vs 
)

Applies the first visitor in the list to the given edge.

If the visitor's visitEdge method returns true then we return immediately, otherwise we apply the next visitor.

Definition at line 1756 of file JITLink.h.

References B, E, G, and visitEdge().

◆ visitExistingEdges()

template<typename... VisitorTs>
void llvm::jitlink::visitExistingEdges ( LinkGraph G,
VisitorTs &&...  Vs 
)

For each edge in the given graph, apply a list of visitors to the edge, stopping when the first visitor's visitEdge method returns true.

Only visits edges that were in the graph at call time: if any visitor adds new edges those will not be visited. Visitors are not allowed to remove edges (though they can change their kind, target, and addend).

Definition at line 1769 of file JITLink.h.

References B, E, G, and visitEdge().

Referenced by buildTables_MachO_arm64().