File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -3175,6 +3175,29 @@ CPPINTEROP_API JitCall MakeFunctionCallable(TCppConstFunction_t func) {
31753175}
31763176
31773177namespace {
3178+ #if !defined(CPPINTEROP_USE_CLING) && !defined(EMSCRIPTEN)
3179+ bool DefineAbsoluteSymbol (compat::Interpreter& I,
3180+ const char * linker_mangled_name, uint64_t address) {
3181+ using namespace llvm ;
3182+ using namespace llvm ::orc;
3183+
3184+ llvm::orc::LLJIT& Jit = *compat::getExecutionEngine (I);
3185+ llvm::orc::ExecutionSession& ES = Jit.getExecutionSession ();
3186+ JITDylib& DyLib = *Jit.getProcessSymbolsJITDylib ().get ();
3187+
3188+ llvm::orc::SymbolMap InjectedSymbols{
3189+ {ES.intern (linker_mangled_name),
3190+ ExecutorSymbolDef (ExecutorAddr (address), JITSymbolFlags::Exported)}};
3191+
3192+ if (Error Err = DyLib.define (absoluteSymbols (InjectedSymbols))) {
3193+ logAllUnhandledErrors (std::move (Err), errs (),
3194+ " DefineAbsoluteSymbol error: " );
3195+ return true ;
3196+ }
3197+ return false ;
3198+ }
3199+ #endif
3200+
31783201static std::string MakeResourcesPath () {
31793202 StringRef Dir;
31803203#ifdef LLVM_BINARY_DIR
You can’t perform that action at this time.
0 commit comments