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

Namespaces

 

Classes

class  Atom
 Base Atom class. Used by absolute and undefined atoms. More...
 
class  AtomGraph
 
class  BasicGOTAndStubsBuilder
 
class  DefinedAtom
 Defined atom class. More...
 
class  Edge
 Edge class. More...
 
class  EHFrameParser
 A generic parser for eh-frame sections. More...
 
class  EHFrameRegistrar
 Supports registration/deregistration of EH-frames in a target process. More...
 
class  InProcessEHFrameRegistrar
 Registers / Deregisters EH-frames in the current process. More...
 
class  InProcessMemoryManager
 A JITLinkMemoryManager that allocates in-process memory. 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  MachOAtomGraphBuilder
 
class  MachOJITLinker_x86_64
 
struct  PassConfiguration
 An atom graph 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 DefinedAtom pointers to the first and last atoms in the section. More...
 

Typedefs

using StoreFrameAddressFunction = std::function< void(JITTargetAddress)>
 
using EdgeVector = std::vector< Edge >
 
using AtomGraphPassFunction = std::function< Error(AtomGraph &)>
 A function for mutating AtomGraphs. More...
 
using AtomGraphPassList = std::vector< AtomGraphPassFunction >
 A list of atom graph passes. More...
 
using AsyncLookupResult = DenseMap< StringRef, JITEvaluatedSymbol >
 A map of symbol names to resolved addresses. More...
 
using JITLinkAsyncLookupContinuation = std::function< void(Expected< AsyncLookupResult > LR)>
 A function to call with a resolved symbol map (See AsyncLookupResult) or an error if resolution failed. More...
 
using JITLinkAsyncLookupFunction = std::function< void(const DenseSet< StringRef > &Symbols, JITLinkAsyncLookupContinuation LookupContinuation)>
 An asynchronous symbol lookup. More...
 

Functions

Error registerEHFrameSection (const void *EHFrameSectionAddr)
 Registers all FDEs in the given eh-frame section with the current process. More...
 
Error deregisterEHFrameSection (const void *EHFrameSectionAddr)
 Deregisters all FDEs in the given eh-frame section with the current process. More...
 
AtomGraphPassFunction createEHFrameRecorderPass (const Triple &TT, StoreFrameAddressFunction StoreFrameAddress)
 Creates a pass that records the address of the EH frame section. More...
 
const StringRef getGenericEdgeKindName (Edge::Kind K)
 
raw_ostreamoperator<< (raw_ostream &OS, const Atom &A)
 
void printEdge (raw_ostream &OS, const Atom &FixupAtom, const Edge &E, StringRef EdgeKindName)
 
Error markAllAtomsLive (AtomGraph &G)
 Marks all atoms 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_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...
 
Error addEHFrame (AtomGraph &G, Section &EHFrameSection, StringRef EHFrameContent, JITTargetAddress EHFrameAddress, Edge::Kind FDEToCIERelocKind, Edge::Kind FDEToTargetRelocKind)
 
static Error registerFrameWrapper (const void *P)
 
static Error deregisterFrameWrapper (const void *P)
 
void prune (AtomGraph &G)
 Dead strips and replaces discarded definitions with external atoms. More...
 

Typedef Documentation

◆ AsyncLookupResult

A map of symbol names to resolved addresses.

Definition at line 849 of file JITLink.h.

◆ AtomGraphPassFunction

A function for mutating AtomGraphs.

Definition at line 814 of file JITLink.h.

◆ AtomGraphPassList

A list of atom graph passes.

Definition at line 817 of file JITLink.h.

◆ EdgeVector

using llvm::jitlink::EdgeVector = typedef std::vector<Edge>

Definition at line 97 of file JITLink.h.

◆ JITLinkAsyncLookupContinuation

A function to call with a resolved symbol map (See AsyncLookupResult) or an error if resolution failed.

Definition at line 854 of file JITLink.h.

◆ JITLinkAsyncLookupFunction

An asynchronous symbol lookup.

Performs a search (possibly asynchronously) for the given symbols, calling the given continuation with either the result (if the lookup succeeds), or an error (if the lookup fails).

Definition at line 861 of file JITLink.h.

◆ StoreFrameAddressFunction

Definition at line 65 of file EHFrameSupport.h.

Function Documentation

◆ addEHFrame()

Error llvm::jitlink::addEHFrame ( AtomGraph G,
Section EHFrameSection,
StringRef  EHFrameContent,
JITTargetAddress  EHFrameAddress,
Edge::Kind  FDEToCIERelocKind,
Edge::Kind  FDEToTargetRelocKind 
)

Definition at line 378 of file EHFrameSupport.cpp.

References llvm::jitlink::EHFrameParser::EHFrameParser().

◆ createEHFrameRecorderPass()

AtomGraphPassFunction llvm::jitlink::createEHFrameRecorderPass ( const Triple TT,
StoreFrameAddressFunction  StoreFrameAddress 
)

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

If no eh-frame section is found, it will set EHFrameAddr to zero.

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

Definition at line 521 of file EHFrameSupport.cpp.

References G, llvm::Triple::getObjectFormat(), llvm::Triple::MachO, and llvm::Error::success().

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

◆ deregisterEHFrameSection()

Error llvm::jitlink::deregisterEHFrameSection ( const void *  EHFrameSectionAddr)

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

Definition at line 502 of file EHFrameSupport.cpp.

References deregisterFrameWrapper().

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

◆ deregisterFrameWrapper()

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

◆ getGenericEdgeKindName()

const StringRef llvm::jitlink::getGenericEdgeKindName ( Edge::Kind  K)

◆ getMachOX86RelocationKindName()

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

◆ 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 161 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_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 557 of file MachO_x86_64.cpp.

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

Referenced by jitLink_MachO().

◆ markAllAtomsLive()

Error llvm::jitlink::markAllAtomsLive ( AtomGraph G)

Marks all atoms in a graph live.

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

Definition at line 155 of file JITLink.cpp.

References llvm::jitlink::AtomGraph::defined_atoms(), and llvm::Error::success().

Referenced by jitLink_MachO_x86_64().

◆ operator<<()

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

◆ printEdge()

void llvm::jitlink::printEdge ( raw_ostream OS,
const Atom FixupAtom,
const Edge E,
StringRef  EdgeKindName 
)

◆ prune()

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

Dead strips and replaces discarded definitions with external atoms.

Finds the set of nodes reachable from any node initially marked live (nodes marked should-discard are treated as not live, even if they are reachable). All nodes not marked as live at the end of this process, are deleted. Nodes that are live, but marked should-discard are replaced with external atoms and all edges to them are re-written.

Definition at line 387 of file JITLinkGeneric.cpp.

References llvm::jitlink::AtomGraph::absolute_atoms(), llvm::jitlink::AtomGraph::addExternalAtom(), assert(), llvm::dbgs(), llvm::jitlink::AtomGraph::defined_atoms(), E, llvm::jitlink::DefinedAtom::edges(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::jitlink::Atom::isLive(), LLVM_DEBUG, llvm::jitlink::AtomGraph::removeAbsoluteAtom(), llvm::jitlink::AtomGraph::removeDefinedAtom(), llvm::jitlink::Atom::setLive(), and llvm::jitlink::Atom::shouldDiscard().

Referenced by llvm::StripDebugInfo().

◆ registerEHFrameSection()

Error llvm::jitlink::registerEHFrameSection ( const void *  EHFrameSectionAddr)

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

Definition at line 487 of file EHFrameSupport.cpp.

References registerFrameWrapper().

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

◆ registerFrameWrapper()

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