Skip to content

[clang-repl] Set up native platform support if ORC Runtime available - #217988

Open
khanxmetu wants to merge 2 commits into
llvm:mainfrom
khanxmetu:clang-repl-use-orc
Open

[clang-repl] Set up native platform support if ORC Runtime available#217988
khanxmetu wants to merge 2 commits into
llvm:mainfrom
khanxmetu:clang-repl-use-orc

Conversation

@khanxmetu

Copy link
Copy Markdown
Contributor

Previously, only out-of-process execution used the native platform/ORCPlatformSupport while in-process used GenericLLVMIRPlatformSupport. This change also attempts to use native platform support for in-process execution when the ORC Runtime is available or displays a warning otherwise.

Fixes #213425

@khanxmetu

Copy link
Copy Markdown
Contributor Author

Further to this, I think its worth removing if (!IsOutOfProcess) guard in UpdateOrcRuntimePath to allow for runtime path discovery - when its not specified - regardless of oop flag.

@llvmorg-github-actions llvmorg-github-actions Bot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 21, 2026
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-clang

Author: khanxmetu (khanxmetu)

Changes

Previously, only out-of-process execution used the native platform/ORCPlatformSupport while in-process used GenericLLVMIRPlatformSupport. This change also attempts to use native platform support for in-process execution when the ORC Runtime is available or displays a warning otherwise.

Fixes #213425


Full diff: https://github.com/llvm/llvm-project/pull/217988.diff

1 Files Affected:

  • (modified) clang/lib/Interpreter/IncrementalExecutor.cpp (+10)
diff --git a/clang/lib/Interpreter/IncrementalExecutor.cpp b/clang/lib/Interpreter/IncrementalExecutor.cpp
index 6d337e7848699..1a63e8a0e1817 100644
--- a/clang/lib/Interpreter/IncrementalExecutor.cpp
+++ b/clang/lib/Interpreter/IncrementalExecutor.cpp
@@ -413,6 +413,16 @@ IncrementalExecutorBuilder::create(llvm::orc::ThreadSafeContext &TSC,
     if (!JB)
       return JB.takeError();
     JITBuilder = std::move(*JB);
+    if (!OrcRuntimePath.empty()) {
+      JITBuilder->setPlatformSetUp(
+          llvm::orc::ExecutorNativePlatform(OrcRuntimePath));
+    } else {
+      auto Err = llvm::make_error<llvm::StringError>(
+          "OrcRuntime not found, running JIT without native platform support "
+          "and some features may not work.",
+          std::error_code());
+      llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "warning: ");
+    }
     // TODO: Switch to native TLS once clang-repl can adopt the ORC runtime
     // (which provides __emutls_get_address and supports the full TLS
     // lifecycle). That will also remove the in-process-only constraint below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clang-repl: Objective-C message sends abort ("unrecognized selector") because JIT ObjC selrefs are not registered

1 participant