[llvm] [ORC] Mangle Dlfcn CI names as C (fixes MachO dlopen lookup) (PR #225392)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 06:11:33 PDT 2026


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/225392

The __orc_rt_jit_dl{open,update,close}_wrapper functions are C symbols in the ORC runtime, so on Darwin their linker names carry a leading underscore. The controller must resolve them under the C-mangled name. The original LLJIT code did this via mangleAndIntern; the Proxy conversion (#224881) used Verbatim by mistake, so on MachO the lookup searched for the unmangled name and failed ("Symbols not found: __orc_rt_jit_dlopen_wrapper"). Flip the Dlfcn descriptors to C to restore the mangling. No runtime change is needed -- compiler-rt already exports these as C symbols.

>From 2649a21ef94d705d64d1f207b13bef025325c9b0 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Tue, 22 Sep 2026 22:01:07 +1000
Subject: [PATCH] [ORC] Mangle Dlfcn CI names as C (fixes MachO dlopen lookup)

The __orc_rt_jit_dl{open,update,close}_wrapper functions are C symbols
in the ORC runtime, so on Darwin their linker names carry a leading
underscore. The controller must resolve them under the C-mangled name.
The original LLJIT code did this via mangleAndIntern; the Proxy
conversion (#224881) used Verbatim by mistake, so on MachO the lookup
searched for the unmangled name and failed ("Symbols not found:
__orc_rt_jit_dlopen_wrapper"). Flip the Dlfcn descriptors to C to
restore the mangling. No runtime change is needed -- compiler-rt already
exports these as C symbols.
---
 .../llvm/ExecutionEngine/Orc/Shared/SPSCI/DlfcnSPSCI.h      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/DlfcnSPSCI.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/DlfcnSPSCI.h
index 9850abfd238734..a16c704f131400 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/DlfcnSPSCI.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SPSCI/DlfcnSPSCI.h
@@ -26,7 +26,7 @@ namespace llvm::orc::rt::sps_ci {
 /// dso handle.
 struct DlfcnOpen {
   static constexpr SymbolNameSpec Name =
-      SymbolNameSpec::verbatim("__orc_rt_jit_dlopen_wrapper");
+      SymbolNameSpec::c("__orc_rt_jit_dlopen_wrapper");
   using SPSSig = shared::SPSExecutorAddr(shared::SPSString, int32_t);
 };
 
@@ -34,7 +34,7 @@ struct DlfcnOpen {
 /// failure.
 struct DlfcnUpdate {
   static constexpr SymbolNameSpec Name =
-      SymbolNameSpec::verbatim("__orc_rt_jit_dlupdate_wrapper");
+      SymbolNameSpec::c("__orc_rt_jit_dlupdate_wrapper");
   using SPSSig = int32_t(shared::SPSExecutorAddr);
 };
 
@@ -42,7 +42,7 @@ struct DlfcnUpdate {
 /// failure.
 struct DlfcnClose {
   static constexpr SymbolNameSpec Name =
-      SymbolNameSpec::verbatim("__orc_rt_jit_dlclose_wrapper");
+      SymbolNameSpec::c("__orc_rt_jit_dlclose_wrapper");
   using SPSSig = int32_t(shared::SPSExecutorAddr);
 };
 



More information about the llvm-commits mailing list