LLVM 22.0.0git
|
#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
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. | |
![]() | |
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. | |
Definition at line 26 of file EPCDynamicLibrarySearchGenerator.h.
using llvm::orc::EPCDynamicLibrarySearchGenerator::AddAbsoluteSymbolsFn = unique_function<Error(JITDylib &, SymbolMap)> |
Definition at line 29 of file EPCDynamicLibrarySearchGenerator.h.
using llvm::orc::EPCDynamicLibrarySearchGenerator::SymbolPredicate = unique_function<bool(const SymbolStringPtr &)> |
Definition at line 28 of file EPCDynamicLibrarySearchGenerator.h.
|
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().
|
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().
|
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().
|
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().
|
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.