[llvm] [ORC] Align GDB-JIT alloc-action names with the ORC runtime (PR #216024)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 05:17:46 PDT 2026


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

Align LLVM's GDB-JIT registration alloc-action names with the names added to the ORC runtime in 4a0fdbc25bb, and add a name for the deregistration action.

Look these names up in the Bootstrap JITDylib rather than the Process JITDylib. Since the lookup no longer depends on process symbols, drop the "requires process symbols" preconditions guarding MachO debugger support in llvm-jitlink and enableDebuggerSupport. GDBJITDebugInfoRegistrationPlugin::Create also loses its Triple parameter, which is now unused.

Together this lets GDBJITDebugInfoRegistrationPlugin work against either the LLVM OrcTargetProcess or ORC runtime implementation of these actions.

>From bb4a32ddf0aab803eb0faba8ef5d821d661f85e2 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Thu, 13 Aug 2026 16:18:09 +1000
Subject: [PATCH] [ORC] Align GDB-JIT alloc-action names with the ORC runtime

Align LLVM's GDB-JIT registration alloc-action names with the names
added to the ORC runtime in 4a0fdbc25bb, and add a name for the
deregistration action.

Look these names up in the Bootstrap JITDylib rather than the Process
JITDylib. Since the lookup no longer depends on process symbols, drop
the "requires process symbols" preconditions guarding MachO debugger
support in llvm-jitlink and enableDebuggerSupport.
GDBJITDebugInfoRegistrationPlugin::Create also loses its Triple
parameter, which is now unused.

Together this lets GDBJITDebugInfoRegistrationPlugin work against either
the LLVM OrcTargetProcess or ORC runtime implementation of these
actions.
---
 .../Orc/Debugging/DebuggerSupportPlugin.h           |  2 +-
 .../llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h   |  1 +
 .../Orc/Debugging/DebuggerSupport.cpp               |  9 ++-------
 .../Orc/Debugging/DebuggerSupportPlugin.cpp         | 13 +++++--------
 llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp |  4 +++-
 llvm/tools/llvm-jitlink/llvm-jitlink.cpp            |  7 +------
 6 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
index 80c2b95ca1c7b..8ec0f15354b3a 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
@@ -36,7 +36,7 @@ class LLVM_ABI GDBJITDebugInfoRegistrationPlugin
   };
 
   static Expected<std::unique_ptr<GDBJITDebugInfoRegistrationPlugin>>
-  Create(ExecutionSession &ES, JITDylib &ProcessJD, const Triple &TT);
+  Create(ExecutionSession &ES, JITDylib &BootstrapJD);
 
   GDBJITDebugInfoRegistrationPlugin(ExecutorAddr RegisterActionAddr)
       : RegisterActionAddr(RegisterActionAddr) {}
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
index d4370f79b2e75..a80c46afb6bea 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
@@ -41,6 +41,7 @@ LLVM_ABI extern const char *RegisterEHFrameSectionAllocActionName;
 LLVM_ABI extern const char *DeregisterEHFrameSectionAllocActionName;
 
 LLVM_ABI extern const char *RegisterJITLoaderGDBAllocActionName;
+LLVM_ABI extern const char *DeregisterJITLoaderGDBAllocActionName;
 
 LLVM_ABI extern const char *const DispatchName;
 LLVM_ABI extern const char *const DispatchCtxName;
diff --git a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp
index caee699feebc1..2338d6e7679a9 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp
@@ -24,12 +24,6 @@ Error enableDebuggerSupport(LLJIT &J) {
     return make_error<StringError>("Cannot enable LLJIT debugger support: "
                                    "Debugger support requires JITLink",
                                    inconvertibleErrorCode());
-  auto ProcessSymsJD = J.getProcessSymbolsJITDylib();
-  if (!ProcessSymsJD)
-    return make_error<StringError>("Cannot enable LLJIT debugger support: "
-                                   "Process symbols are not available",
-                                   inconvertibleErrorCode());
-
   auto &ES = J.getExecutionSession();
   const auto &TT = J.getTargetTriple();
 
@@ -41,7 +35,8 @@ Error enableDebuggerSupport(LLJIT &J) {
     return TargetSymErr;
   }
   case Triple::MachO: {
-    auto DS = GDBJITDebugInfoRegistrationPlugin::Create(ES, *ProcessSymsJD, TT);
+    auto DS = GDBJITDebugInfoRegistrationPlugin::Create(
+        ES, ES.getBootstrapJITDylib());
     if (!DS)
       return DS.takeError();
     ObjLinkingLayer->addPlugin(std::move(*DS));
diff --git a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
index 22be7e6ca17dd..93570625db0c3 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
@@ -11,6 +11,7 @@
 
 #include "llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h"
 #include "llvm/ExecutionEngine/Orc/MachOBuilder.h"
+#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/BinaryFormat/MachO.h"
@@ -326,14 +327,10 @@ namespace orc {
 
 Expected<std::unique_ptr<GDBJITDebugInfoRegistrationPlugin>>
 GDBJITDebugInfoRegistrationPlugin::Create(ExecutionSession &ES,
-                                          JITDylib &ProcessJD,
-                                          const Triple &TT) {
-  auto RegisterActionAddr =
-      TT.isOSBinFormatMachO()
-          ? ES.intern("_llvm_orc_registerJITLoaderGDBAllocAction")
-          : ES.intern("llvm_orc_registerJITLoaderGDBAllocAction");
-
-  if (auto RegisterSym = ES.lookup({&ProcessJD}, RegisterActionAddr))
+                                          JITDylib &BootstrapJD) {
+  auto RegisterActionName = ES.intern(rt::RegisterJITLoaderGDBAllocActionName);
+
+  if (auto RegisterSym = ES.lookup({&BootstrapJD}, RegisterActionName))
     return std::make_unique<GDBJITDebugInfoRegistrationPlugin>(
         RegisterSym->getAddress());
   else
diff --git a/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp b/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp
index 4dc9a8bb2ca35..a3c4e26684ff6 100644
--- a/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp
@@ -40,7 +40,9 @@ const char *DeregisterEHFrameSectionAllocActionName =
     "llvm_orc_deregisterEHFrameAllocAction";
 
 const char *RegisterJITLoaderGDBAllocActionName =
-    "llvm_orc_registerJITLoaderGDBAllocAction";
+    "orc_rt_ci_aa_sps_GDBJITRegistrar_register";
+const char *DeregisterJITLoaderGDBAllocActionName =
+    "orc_rt_ci_aa_sps_GDBJITRegistrar_deregister";
 
 const char *const DispatchName = "__orc_rt_jit_dispatch";
 const char *const DispatchCtxName = "__orc_rt_jit_dispatch_ctx";
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 17e63ff7aed47..64d2f6edb1ac3 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1277,13 +1277,8 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
   }
 
   if (DebuggerSupport && TT.isOSBinFormatMachO()) {
-    if (!ProcessSymsJD) {
-      Err = make_error<StringError>("MachO debugging requires process symbols",
-                                    inconvertibleErrorCode());
-      return;
-    }
     ObjLayer->addPlugin(ExitOnErr(GDBJITDebugInfoRegistrationPlugin::Create(
-        this->ES, *ProcessSymsJD, TT)));
+        this->ES, this->ES.getBootstrapJITDylib())));
   }
 
   if (PerfSupport && TT.isOSBinFormatELF()) {



More information about the llvm-commits mailing list