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

Namespaces

 
 

Classes

class  Addressable
 Base class for Addressable entities (externals, absolutes, blocks). More...
 
class  BasicGOTAndStubsBuilder
 
class  Block
 An Addressable with content and edges. More...
 
class  BlockAddressMap
 Enables easy lookup of blocks by addresses. More...
 
class  Edge
 Represents fixups and constraints in the LinkGraph. More...
 
class  EHFrameEdgeFixer
 A LinkGraph pass that adds missing FDE-to-CIE, FDE-to-PC and FDE-to-LSDA edges. More...
 
class  EHFrameRegistrar
 Supports registration/deregistration of EH-frames in a target process. More...
 
class  EHFrameSplitter
 A LinkGraph pass that splits blocks in an eh-frame section into sub-blocks representing individual eh-frames. 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  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  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...
 
class  Symbol
 Symbol representation. More...
 
class  SymbolAddressMap
 A map of addresses to Symbols. More...
 

Typedefs

using StoreFrameRangeFunction = std::function< void(JITTargetAddress 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...
 

Functions

Error registerEHFrameSection (const void *EHFrameSectionAddr, size_t EHFrameSectionSize)
 Registers all FDEs in the given eh-frame section with the current process. More...
 
Error deregisterEHFrameSection (const void *EHFrameSectionAddr, size_t EHFrameSectionSize)
 Deregisters all FDEs in the given eh-frame section with the current process. More...
 
LinkGraphPassFunction createEHFrameRecorderPass (const Triple &TT, StoreFrameRangeFunction StoreFrameRange)
 Creates a pass that records the address and size of the EH frame section. More...
 
const char * getGenericEdgeKindName (Edge::Kind K)
 Returns the string name of the given generic edge kind, or "unknown" otherwise. More...
 
const char * getLinkageName (Linkage L)
 For errors and debugging output. More...
 
const char * getScopeName (Scope S)
 For debugging output. More...
 
raw_ostream & operator<< (raw_ostream &OS, const Block &B)
 
raw_ostream & operator<< (raw_ostream &OS, const Symbol &A)
 
void printEdge (raw_ostream &OS, const Block &B, const Edge &E, StringRef EdgeKindName)
 
raw_ostream & operator<< (raw_ostream &OS, const SymbolLookupFlags &LF)
 
template<typename Continuation >
std::unique_ptr< JITLinkAsyncLookupContinuation > createLookupContinuation (Continuation Cont)
 Create a lookup continuation from a function object. More...
 
Error markAllSymbolsLive (LinkGraph &G)
 Marks all symbols in a graph live. More...
 
void jitLink (std::unique_ptr< JITLinkContext > Ctx)
 Basic JITLink implementation. More...
 
void jitLink_MachO (std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given ObjBuffer, which must be a MachO object file. More...
 
void jitLink_MachO_arm64 (std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a MachO arm64 object file. More...
 
StringRef getMachOARM64RelocationKindName (Edge::Kind R)
 Return the string name of the given MachO arm64 edge kind. More...
 
void jitLink_MachO_x86_64 (std::unique_ptr< JITLinkContext > Ctx)
 jit-link the given object buffer, which must be a MachO x86-64 object file. More...
 
StringRef getMachOX86RelocationKindName (Edge::Kind R)
 Return the string name of the given MachO x86-64 edge kind. More...
 
static Error registerFrameWrapper (const void *P)
 
static Error deregisterFrameWrapper (const void *P)
 
void prune (LinkGraph &G)
 Removes dead symbols/blocks/addressables. More...
 

Typedef Documentation

◆ AsyncLookupResult

A map of symbol names to resolved addresses.

Definition at line 1202 of file JITLink.h.

◆ LinkGraphPassFunction

A function for mutating LinkGraphs.

Definition at line 1159 of file JITLink.h.

◆ LinkGraphPassList

A list of LinkGraph passes.

Definition at line 1162 of file JITLink.h.

◆ SectionOrdinal

Definition at line 134 of file JITLink.h.

◆ StoreFrameRangeFunction

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

Definition at line 75 of file EHFrameSupport.h.

Enumeration Type Documentation

◆ 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 266 of file JITLink.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 278 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 1197 of file JITLink.h.

Function Documentation

◆ 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 774 of file EHFrameSupport.cpp.

References llvm::jitlink::LinkGraph::findSectionByName(), G, llvm::Triple::getObjectFormat(), llvm::Triple::MachO, Size, and llvm::Error::success().

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

◆ createLookupContinuation()

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

Create a lookup continuation from a function object.

Definition at line 1218 of file JITLink.h.

References C.

◆ deregisterEHFrameSection()

Error llvm::jitlink::deregisterEHFrameSection ( const void *  EHFrameSectionAddr,
size_t  EHFrameSectionSize 
)

Deregisters all FDEs in the given eh-frame section with the current process.

Definition at line 753 of file EHFrameSupport.cpp.

References deregisterFrameWrapper().

Referenced by llvm::jitlink::InProcessEHFrameRegistrar::deregisterEHFrames().

◆ deregisterFrameWrapper()

static Error llvm::jitlink::deregisterFrameWrapper ( const void *  P)
static

◆ 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 59 of file JITLink.cpp.

References llvm::Invalid, and llvm_unreachable.

Referenced by llvm::jitlink::LinkGraph::dump(), getMachOARM64RelocationKindName(), getMachOX86RelocationKindName(), and llvm::jitlink::Edge::setAddend().

◆ getLinkageName()

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

For errors and debugging output.

Definition at line 70 of file JITLink.cpp.

References llvm_unreachable.

◆ getMachOARM64RelocationKindName()

StringRef llvm::jitlink::getMachOARM64RelocationKindName ( Edge::Kind  R)

◆ getMachOX86RelocationKindName()

StringRef llvm::jitlink::getMachOX86RelocationKindName ( Edge::Kind  R)

◆ getScopeName()

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

For debugging output.

Definition at line 80 of file JITLink.cpp.

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

◆ jitLink()

void llvm::jitlink::jitLink ( std::unique_ptr< JITLinkContext >  Ctx)

Basic JITLink implementation.

This function will use sensible defaults for GOT and Stub handling.

Definition at line 302 of file JITLink.cpp.

References llvm::identify_magic(), jitLink_MachO(), llvm::file_magic::macho_object, and Magic.

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

◆ jitLink_MachO()

void llvm::jitlink::jitLink_MachO ( std::unique_ptr< JITLinkContext >  Ctx)

◆ jitLink_MachO_arm64()

void llvm::jitlink::jitLink_MachO_arm64 ( 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 663 of file MachO_arm64.cpp.

References G, markAllSymbolsLive(), llvm::jitlink::PassConfiguration::PostPrunePasses, llvm::jitlink::PassConfiguration::PrePrunePasses, llvm::Error::success(), and llvm::TT.

Referenced by jitLink_MachO().

◆ jitLink_MachO_x86_64()

void llvm::jitlink::jitLink_MachO_x86_64 ( std::unique_ptr< JITLinkContext >  Ctx)

jit-link the given object buffer, which must be a MachO x86-64 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 552 of file MachO_x86_64.cpp.

References llvm::jitlink::MachO_x86_64_Edges::Delta64, G, markAllSymbolsLive(), llvm::jitlink::MachO_x86_64_Edges::NegDelta32, llvm::jitlink::PassConfiguration::PostPrunePasses, llvm::jitlink::PassConfiguration::PrePrunePasses, llvm::Error::success(), and llvm::TT.

Referenced by jitLink_MachO().

◆ 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 296 of file JITLink.cpp.

References llvm::jitlink::LinkGraph::defined_symbols(), and llvm::Error::success().

Referenced by jitLink_MachO_arm64(), and jitLink_MachO_x86_64().

◆ operator<<() [1/3]

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

◆ operator<<() [2/3]

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

◆ operator<<() [3/3]

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

Definition at line 269 of file JITLink.cpp.

References llvm_unreachable.

◆ printEdge()

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

◆ 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 316 of file JITLinkGeneric.cpp.

References B, llvm::jitlink::LinkGraph::blocks(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::dbgs(), llvm::jitlink::LinkGraph::defined_symbols(), E, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), LLVM_DEBUG, llvm::jitlink::LinkGraph::removeBlock(), and llvm::jitlink::LinkGraph::removeDefinedSymbol().

Referenced by llvm::StripDebugInfo().

◆ registerEHFrameSection()

Error llvm::jitlink::registerEHFrameSection ( const void *  EHFrameSectionAddr,
size_t  EHFrameSectionSize 
)

Registers all FDEs in the given eh-frame section with the current process.

Definition at line 736 of file EHFrameSupport.cpp.

References registerFrameWrapper().

Referenced by llvm::jitlink::InProcessEHFrameRegistrar::registerEHFrames().

◆ registerFrameWrapper()

static Error llvm::jitlink::registerFrameWrapper ( const void *  P)
static