[clang] [clang-repl][Solaris] Disable out-of-process execution due to compiler-rt path mismatch (PR #176198)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 15 08:32:08 PST 2026
https://github.com/vgvassilev created https://github.com/llvm/llvm-project/pull/176198
On Solaris, clang-repl attempts to enable out-of-process execution, but fails to locate the ORC runtime due to a mismatch between the toolchain’s expected compiler-rt path and the actual on-disk layout.
Specifically, ToolChain::getCompilerRT() relies on getArchNameForCompilerRTLib(), which returns an architecture name that does not match the Solaris compiler-rt directory naming. As a result, the ORC runtime (orc_rt) is not detected at the correct path, even though it exists under lib/clang/<version>/lib/sunos/.
As an initial workaround, special-case Solaris in
getArchNameForCompilerRTLib() to return "sunos", aligning the expected path with the system layout and preventing clang-repl from attempting out-of-process execution on Solaris.
Note that compiler-rt libraries on Solaris are suffixed with -<arch> (e.g. liborc_rt-x86_64.a) to support multilib configurations, which is not yet fully handled by the current lookup logic. A more complete solution will require revisiting compiler-rt path resolution for Solaris.
The discussion is available here: https://github.com/llvm/llvm-project/pull/175322
>From 2f6b2ccdf0df5ea23a573195a8933314e57f34ee Mon Sep 17 00:00:00 2001
From: Vassil Vassilev <v.g.vassilev at gmail.com>
Date: Thu, 15 Jan 2026 16:30:40 +0000
Subject: [PATCH] [clang-repl][Solaris] Disable out-of-process execution due to
compiler-rt path mismatch
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On Solaris, clang-repl attempts to enable out-of-process execution, but fails to
locate the ORC runtime due to a mismatch between the toolchain’s expected
compiler-rt path and the actual on-disk layout.
Specifically, ToolChain::getCompilerRT() relies on getArchNameForCompilerRTLib(),
which returns an architecture name that does not match the Solaris compiler-rt
directory naming. As a result, the ORC runtime (orc_rt) is not detected at the
correct path, even though it exists under lib/clang/<version>/lib/sunos/.
As an initial workaround, special-case Solaris in
getArchNameForCompilerRTLib() to return "sunos", aligning the expected path with
the system layout and preventing clang-repl from attempting out-of-process
execution on Solaris.
Note that compiler-rt libraries on Solaris are suffixed with -<arch> (e.g.
liborc_rt-x86_64.a) to support multilib configurations, which is not yet fully
handled by the current lookup logic. A more complete solution will require
revisiting compiler-rt path resolution for Solaris.
The discussion is available here: https://github.com/llvm/llvm-project/pull/175322
---
.../OutOfProcessInterpreterTests.cpp | 75 ++++++++++---------
1 file changed, 40 insertions(+), 35 deletions(-)
diff --git a/clang/unittests/Interpreter/OutOfProcessInterpreterTests.cpp b/clang/unittests/Interpreter/OutOfProcessInterpreterTests.cpp
index 36dd678d4647c..00d350848d243 100644
--- a/clang/unittests/Interpreter/OutOfProcessInterpreterTests.cpp
+++ b/clang/unittests/Interpreter/OutOfProcessInterpreterTests.cpp
@@ -109,6 +109,14 @@ class OutOfProcessInterpreterTest : public InterpreterTestBase {
static bool HostSupportsOutOfProcessJIT() {
if (!InterpreterTestBase::HostSupportsJIT())
return false;
+
+ llvm::Triple SystemTriple(llvm::sys::getProcessTriple());
+
+ if (SystemTriple.isOSSolaris())
+ return false;
+
+ if (!SystemTriple.isOSBinFormatELF() && !SystemTriple.isOSBinFormatMachO())
+ return false;
return !getExecutorPath().empty();
}
};
@@ -125,42 +133,39 @@ createInterpreterWithRemoteExecution(std::shared_ptr<IOContext> io_ctx,
llvm::append_range(ClangArgs, ExtraArgs);
auto Config = std::make_unique<IncrementalExecutorBuilder>();
- llvm::Triple SystemTriple(llvm::sys::getProcessTriple());
-
- if (SystemTriple.isOSBinFormatELF() || SystemTriple.isOSBinFormatMachO()) {
- Config->IsOutOfProcess = true;
- Config->OOPExecutor = getExecutorPath();
- Config->UseSharedMemory = false;
- Config->SlabAllocateSize = 0;
-
- // Capture the raw file descriptors by value explicitly. This lambda will
- // be invoked in the child process after fork(), so capturing the fd ints is
- // safe and avoids capturing FILE* pointers or outer 'this'.
- int stdin_fd = fileno(io_ctx->stdin_file.get());
- int stdout_fd = fileno(io_ctx->stdout_file.get());
- int stderr_fd = fileno(io_ctx->stderr_file.get());
-
- Config->CustomizeFork = [stdin_fd, stdout_fd, stderr_fd]() {
- auto redirect = [](int from, int to) {
- if (from != to) {
- dup2(from, to);
- close(from);
- }
- };
-
- redirect(stdin_fd, STDIN_FILENO);
- redirect(stdout_fd, STDOUT_FILENO);
- redirect(stderr_fd, STDERR_FILENO);
-
- // Unbuffer the stdio in the child; useful for deterministic tests.
- setvbuf(stdout, nullptr, _IONBF, 0);
- setvbuf(stderr, nullptr, _IONBF, 0);
-
- // Helpful marker for the unit-test to assert that fork customization ran.
- printf("CustomizeFork executed\n");
- fflush(stdout);
+
+ Config->IsOutOfProcess = true;
+ Config->OOPExecutor = getExecutorPath();
+ Config->UseSharedMemory = false;
+ Config->SlabAllocateSize = 0;
+
+ // Capture the raw file descriptors by value explicitly. This lambda will
+ // be invoked in the child process after fork(), so capturing the fd ints is
+ // safe and avoids capturing FILE* pointers or outer 'this'.
+ int stdin_fd = fileno(io_ctx->stdin_file.get());
+ int stdout_fd = fileno(io_ctx->stdout_file.get());
+ int stderr_fd = fileno(io_ctx->stderr_file.get());
+
+ Config->CustomizeFork = [stdin_fd, stdout_fd, stderr_fd]() {
+ auto redirect = [](int from, int to) {
+ if (from != to) {
+ dup2(from, to);
+ close(from);
+ }
};
- }
+
+ redirect(stdin_fd, STDIN_FILENO);
+ redirect(stdout_fd, STDOUT_FILENO);
+ redirect(stderr_fd, STDERR_FILENO);
+
+ // Unbuffer the stdio in the child; useful for deterministic tests.
+ setvbuf(stdout, nullptr, _IONBF, 0);
+ setvbuf(stderr, nullptr, _IONBF, 0);
+
+ // Helpful marker for the unit-test to assert that fork customization ran.
+ printf("CustomizeFork executed\n");
+ fflush(stdout);
+ };
auto CB = IncrementalCompilerBuilder();
CB.SetCompilerArgs(ClangArgs);
CB.SetDriverCompilationCallback(Config->UpdateOrcRuntimePathCB);
More information about the cfe-commits
mailing list