LLVM 22.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::orc::EPCDynamicLibrarySearchGenerator Class Reference

#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"

Inheritance diagram for llvm::orc::EPCDynamicLibrarySearchGenerator:
[legend]

Public Types

using SymbolPredicate = unique_function< bool(const SymbolStringPtr &)>
 
using AddAbsoluteSymbolsFn = unique_function< Error(JITDylib &, SymbolMap)>
 

Public Member Functions

 EPCDynamicLibrarySearchGenerator (ExecutionSession &ES, tpctypes::DylibHandle H, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)
 Create an EPCDynamicLibrarySearchGenerator that searches for symbols in the library with the given handle.
 
 EPCDynamicLibrarySearchGenerator (ExecutionSession &ES, SymbolPredicate Allow, AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)
 Create an EPCDynamicLibrarySearchGenerator that resolves all symbols matching the Allow predicate to null.
 
Error tryToGenerate (LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override
 DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.
 
- Public Member Functions inherited from llvm::orc::DefinitionGenerator
virtual ~DefinitionGenerator ()
 
virtual Error tryToGenerate (LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &LookupSet)=0
 DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.
 

Static Public Member Functions

static Expected< std::unique_ptr< EPCDynamicLibrarySearchGenerator > > Load (ExecutionSession &ES, const char *LibraryPath, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)
 Permanently loads the library at the given path and, on success, returns an EPCDynamicLibrarySearchGenerator that will search it for symbol definitions in the library.
 
static Expected< std::unique_ptr< EPCDynamicLibrarySearchGenerator > > GetForTargetProcess (ExecutionSession &ES, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)
 Creates a EPCDynamicLibrarySearchGenerator that searches for symbols in the target process.
 

Detailed Description

Definition at line 26 of file EPCDynamicLibrarySearchGenerator.h.

Member Typedef Documentation

◆ AddAbsoluteSymbolsFn

Definition at line 29 of file EPCDynamicLibrarySearchGenerator.h.

◆ SymbolPredicate

Definition at line 28 of file EPCDynamicLibrarySearchGenerator.h.

Constructor & Destructor Documentation

◆ EPCDynamicLibrarySearchGenerator() [1/2]

llvm::orc::EPCDynamicLibrarySearchGenerator::EPCDynamicLibrarySearchGenerator ( ExecutionSession ES,
tpctypes::DylibHandle  H,
SymbolPredicate  Allow = SymbolPredicate(),
AddAbsoluteSymbolsFn  AddAbsoluteSymbols = nullptr 
)
inline

Create an EPCDynamicLibrarySearchGenerator that searches for symbols in the library with the given handle.

If the Allow predicate is given then only symbols matching the predicate will be searched for. If the predicate is not given then all symbols will be searched for.

If AddAbsoluteSymbols is provided, it is used to add the symbols to the JITDylib; otherwise it uses JD.define(absoluteSymbols(...)).

Definition at line 40 of file EPCDynamicLibrarySearchGenerator.h.

References llvm::move().

◆ EPCDynamicLibrarySearchGenerator() [2/2]

llvm::orc::EPCDynamicLibrarySearchGenerator::EPCDynamicLibrarySearchGenerator ( ExecutionSession ES,
SymbolPredicate  Allow,
AddAbsoluteSymbolsFn  AddAbsoluteSymbols = nullptr 
)
inline

Create an EPCDynamicLibrarySearchGenerator that resolves all symbols matching the Allow predicate to null.

This can be used to emulate linker options like -weak-l / -weak_library where the library is missing at runtime. (Note: here we're explicitly returning null for these symbols, rather than returning no value at all for them, which is the usual "missing symbol" behavior in ORC. This distinction shouldn't matter for most use-cases).

Definition at line 54 of file EPCDynamicLibrarySearchGenerator.h.

References llvm::move().

Member Function Documentation

◆ GetForTargetProcess()

static Expected< std::unique_ptr< EPCDynamicLibrarySearchGenerator > > llvm::orc::EPCDynamicLibrarySearchGenerator::GetForTargetProcess ( ExecutionSession ES,
SymbolPredicate  Allow = SymbolPredicate(),
AddAbsoluteSymbolsFn  AddAbsoluteSymbols = nullptr 
)
inlinestatic

Creates a EPCDynamicLibrarySearchGenerator that searches for symbols in the target process.

Definition at line 72 of file EPCDynamicLibrarySearchGenerator.h.

Referenced by llvm::orc::LLJITBuilderState::prepareForConstruction().

◆ Load()

Expected< std::unique_ptr< EPCDynamicLibrarySearchGenerator > > llvm::orc::EPCDynamicLibrarySearchGenerator::Load ( ExecutionSession ES,
const char LibraryPath,
SymbolPredicate  Allow = SymbolPredicate(),
AddAbsoluteSymbolsFn  AddAbsoluteSymbols = nullptr 
)
static

Permanently loads the library at the given path and, on success, returns an EPCDynamicLibrarySearchGenerator that will search it for symbol definitions in the library.

On failure returns the reason the library failed to load.

Definition at line 21 of file EPCDynamicLibrarySearchGenerator.cpp.

References llvm::orc::ExecutorProcessControl::getDylibMgr(), llvm::orc::ExecutionSession::getExecutorProcessControl(), and llvm::orc::DylibManager::loadDylib().

Referenced by llvm::orc::LLJIT::loadPlatformDynamicLibrary().

◆ tryToGenerate()

Error llvm::orc::EPCDynamicLibrarySearchGenerator::tryToGenerate ( LookupState LS,
LookupKind  K,
JITDylib JD,
JITDylibLookupFlags  JDLookupFlags,
const SymbolLookupSet LookupSet 
)
overridevirtual

DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.

K specifies the kind of this lookup. JD specifies the target JITDylib being searched, and JDLookupFlags specifies whether the search should match against hidden symbols. Finally, Symbols describes the set of unresolved symbols and their associated lookup flags.

Implements llvm::orc::DefinitionGenerator.

Definition at line 33 of file EPCDynamicLibrarySearchGenerator.cpp.

References llvm::orc::SymbolLookupSet::add(), assert(), llvm::dbgs(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::orc::ExecutorProcessControl::getDylibMgr(), LLVM_DEBUG, llvm::orc::DylibManager::lookupSymbolsAsync(), Name, llvm::orc::Result, llvm::orc::SymbolLookupSet::size(), llvm::Error::success(), and llvm::orc::WeaklyReferencedSymbol.


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