[clang] [llvm] [ORC] Remove now unused EPCDebugObjectRegistrar (NFC) (PR #167868)
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 03:20:53 PST 2025
https://github.com/weliveindetail updated https://github.com/llvm/llvm-project/pull/167868
>From 88ec9ced61c45fa8375c49ffc1fb2ad34b3d6275 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Thu, 13 Nov 2025 11:09:41 +0100
Subject: [PATCH 1/2] [ORC] Remove now unused EPCDebugObjectRegistrar
---
.../RemoteJITUtils.cpp | 1 -
.../Orc/Debugging/DebuggerSupportPlugin.h | 1 -
.../Orc/EPCDebugObjectRegistrar.h | 69 -------------------
.../Orc/TargetProcess/JITLoaderGDB.h | 3 -
llvm/lib/ExecutionEngine/Orc/CMakeLists.txt | 1 -
.../Orc/EPCDebugObjectRegistrar.cpp | 61 ----------------
.../Orc/TargetProcess/JITLoaderGDB.cpp | 16 -----
llvm/tools/lli/lli.cpp | 1 -
.../llvm-jitlink-executor.cpp | 1 -
llvm/tools/llvm-jitlink/llvm-jitlink.cpp | 2 -
.../ExecutionEngine/Orc/OrcCAPITest.cpp | 1 -
.../llvm/lib/ExecutionEngine/Orc/BUILD.gn | 1 -
12 files changed, 158 deletions(-)
delete mode 100644 llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
delete mode 100644 llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
index 83c5899852d64..2f000445292a6 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
@@ -10,7 +10,6 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ExecutionEngine/Orc/DebugObjectManagerPlugin.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
#include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h"
#include "llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h"
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
index 3ca3afa122836..cdb168bd61d32 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
@@ -14,7 +14,6 @@
#define LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H
#include "llvm/ExecutionEngine/Orc/Core.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
#include "llvm/Support/Compiler.h"
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
deleted file mode 100644
index 3a92eee0430c5..0000000000000
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//===- EPCDebugObjectRegistrar.h - EPC-based debug registration -*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// ExecutorProcessControl based registration of debug objects.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
-#define LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
-
-#include "llvm/ExecutionEngine/JITSymbol.h"
-#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
-#include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Error.h"
-#include "llvm/Support/Memory.h"
-
-#include <cstdint>
-#include <memory>
-
-namespace llvm {
-namespace orc {
-
-class ExecutionSession;
-
-/// Abstract interface for registering debug objects in the executor process.
-class DebugObjectRegistrar {
-public:
- virtual Error registerDebugObject(ExecutorAddrRange TargetMem,
- bool AutoRegisterCode) = 0;
- virtual ~DebugObjectRegistrar() = default;
-};
-
-/// Use ExecutorProcessControl to register debug objects locally or in a remote
-/// executor process.
-class LLVM_ABI EPCDebugObjectRegistrar : public DebugObjectRegistrar {
-public:
- EPCDebugObjectRegistrar(ExecutionSession &ES, ExecutorAddr RegisterFn)
- : ES(ES), RegisterFn(RegisterFn) {}
-
- Error registerDebugObject(ExecutorAddrRange TargetMem,
- bool AutoRegisterCode) override;
-
-private:
- ExecutionSession &ES;
- ExecutorAddr RegisterFn;
-};
-
-/// Create a ExecutorProcessControl-based DebugObjectRegistrar that emits debug
-/// objects to the GDB JIT interface. This will use the EPC's lookupSymbols
-/// method to find the registration/deregistration function addresses by name.
-///
-/// If RegistrationFunctionsDylib is non-None then it will be searched to find
-/// the registration functions. If it is None then the process dylib will be
-/// loaded to find the registration functions.
-LLVM_ABI Expected<std::unique_ptr<EPCDebugObjectRegistrar>>
-createJITLoaderGDBRegistrar(
- ExecutionSession &ES,
- std::optional<ExecutorAddr> RegistrationFunctionDylib = std::nullopt);
-
-} // end namespace orc
-} // end namespace llvm
-
-#endif // LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
index 5a9517b1ce7cc..bc3c6fa332a2d 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
@@ -43,9 +43,6 @@ struct jit_descriptor {
};
}
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
-llvm_orc_registerJITLoaderGDBWrapper(const char *ArgData, size_t ArgSize);
-
extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
llvm_orc_registerJITLoaderGDBAllocAction(const char *ArgData, size_t ArgSize);
diff --git a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
index f34392538a7cb..b71f0627fcb27 100644
--- a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
@@ -18,7 +18,6 @@ add_llvm_component_library(LLVMOrcJIT
DebugUtils.cpp
EHFrameRegistrationPlugin.cpp
EPCDynamicLibrarySearchGenerator.cpp
- EPCDebugObjectRegistrar.cpp
EPCGenericDylibManager.cpp
EPCGenericJITLinkMemoryManager.cpp
EPCGenericRTDyldMemoryManager.cpp
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
deleted file mode 100644
index 08bef37b06c82..0000000000000
--- a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//===----- EPCDebugObjectRegistrar.cpp - EPC-based debug registration -----===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
-
-#include "llvm/ExecutionEngine/Orc/Core.h"
-
-namespace llvm {
-namespace orc {
-
-Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
- ExecutionSession &ES,
- std::optional<ExecutorAddr> RegistrationFunctionDylib) {
- auto &EPC = ES.getExecutorProcessControl();
-
- if (!RegistrationFunctionDylib) {
- if (auto D = EPC.getDylibMgr().loadDylib(nullptr))
- RegistrationFunctionDylib = *D;
- else
- return D.takeError();
- }
-
- SymbolStringPtr RegisterFn =
- EPC.getTargetTriple().isOSBinFormatMachO()
- ? EPC.intern("_llvm_orc_registerJITLoaderGDBWrapper")
- : EPC.intern("llvm_orc_registerJITLoaderGDBWrapper");
-
- SymbolLookupSet RegistrationSymbols;
- RegistrationSymbols.add(RegisterFn);
-
- auto Result = EPC.getDylibMgr().lookupSymbols(
- {{*RegistrationFunctionDylib, RegistrationSymbols}});
- if (!Result)
- return Result.takeError();
-
- assert(Result->size() == 1 && "Unexpected number of dylibs in result");
- assert((*Result)[0].size() == 1 &&
- "Unexpected number of addresses in result");
-
- if (!(*Result)[0][0].has_value())
- return make_error<StringError>(
- "Expected a valid address in the lookup result",
- inconvertibleErrorCode());
-
- ExecutorAddr RegisterAddr = (*Result)[0][0]->getAddress();
- return std::make_unique<EPCDebugObjectRegistrar>(ES, RegisterAddr);
-}
-
-Error EPCDebugObjectRegistrar::registerDebugObject(ExecutorAddrRange TargetMem,
- bool AutoRegisterCode) {
- return ES.callSPSWrapper<void(shared::SPSExecutorAddrRange, bool)>(
- RegisterFn, TargetMem, AutoRegisterCode);
-}
-
-} // namespace orc
-} // namespace llvm
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
index cb1b3b05cd24d..f255de093b24f 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
@@ -88,19 +88,3 @@ llvm_orc_registerJITLoaderGDBAllocAction(const char *ArgData, size_t ArgSize) {
})
.release();
}
-
-extern "C" orc::shared::CWrapperFunctionResult
-llvm_orc_registerJITLoaderGDBWrapper(const char *ArgData, size_t ArgSize) {
- using namespace orc::shared;
- return WrapperFunction<SPSError(SPSExecutorAddrRange, bool)>::handle(
- ArgData, ArgSize,
- [](ExecutorAddrRange R, bool AutoRegisterCode) {
- appendJITDebugDescriptor(R.Start.toPtr<const char *>(),
- R.size());
- // Run into the rendezvous breakpoint.
- if (AutoRegisterCode)
- __jit_debug_register_code();
- return Error::success();
- })
- .release();
-}
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index f1cf87fc88cee..847ee3263c02f 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -283,7 +283,6 @@ static ExitOnError ExitOnErr;
LLVM_ATTRIBUTE_USED static void linkComponents() {
errs() << (void *)&llvm_orc_registerEHFrameSectionAllocAction
<< (void *)&llvm_orc_deregisterEHFrameSectionAllocAction
- << (void *)&llvm_orc_registerJITLoaderGDBWrapper
<< (void *)&llvm_orc_registerJITLoaderGDBAllocAction;
}
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
index 8d33ae1edcaaa..2cffca27623e9 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
@@ -44,7 +44,6 @@ ExitOnError ExitOnErr;
LLVM_ATTRIBUTE_USED void linkComponents() {
errs() << (void *)&llvm_orc_registerEHFrameSectionAllocAction
<< (void *)&llvm_orc_deregisterEHFrameSectionAllocAction
- << (void *)&llvm_orc_registerJITLoaderGDBWrapper
<< (void *)&llvm_orc_registerJITLoaderGDBAllocAction;
}
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 50b4ac372b4e4..8610fd042705e 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -24,7 +24,6 @@
#include "llvm/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.h"
#include "llvm/ExecutionEngine/Orc/EHFrameRegistrationPlugin.h"
#include "llvm/ExecutionEngine/Orc/ELFNixPlatform.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include "llvm/ExecutionEngine/Orc/GetDylibInterface.h"
@@ -348,7 +347,6 @@ static LLVM_ATTRIBUTE_USED void linkComponents() {
errs() << "Linking in runtime functions\n"
<< (void *)&llvm_orc_registerEHFrameSectionAllocAction << '\n'
<< (void *)&llvm_orc_deregisterEHFrameSectionAllocAction << '\n'
- << (void *)&llvm_orc_registerJITLoaderGDBWrapper << '\n'
<< (void *)&llvm_orc_registerJITLoaderGDBAllocAction << '\n'
<< (void *)&llvm_orc_registerJITLoaderPerfStart << '\n'
<< (void *)&llvm_orc_registerJITLoaderPerfEnd << '\n'
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index d3fcb948fafb8..0ddbb33c4bac5 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -547,7 +547,6 @@ TEST_F(OrcCAPITestBase, DISABLED_EnableDebugSupport) {
#else
static LLVM_ATTRIBUTE_USED void linkComponents() {
errs() << "Linking in runtime functions\n"
- << (void *)&llvm_orc_registerJITLoaderGDBWrapper << '\n'
<< (void *)&llvm_orc_registerJITLoaderGDBAllocAction << '\n';
}
TEST_F(OrcCAPITestBase, EnableDebugSupport) {
diff --git a/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
index 84384217897c4..f7d635fe4eb90 100644
--- a/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
@@ -26,7 +26,6 @@ static_library("Orc") {
"DebugUtils.cpp",
"EHFrameRegistrationPlugin.cpp",
"ELFNixPlatform.cpp",
- "EPCDebugObjectRegistrar.cpp",
"EPCDynamicLibrarySearchGenerator.cpp",
"EPCGenericDylibManager.cpp",
"EPCGenericJITLinkMemoryManager.cpp",
>From 851ceb00ab99222fa559f852b8dbd75580fe78fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Mon, 17 Nov 2025 11:49:57 +0100
Subject: [PATCH 2/2] fixup! [ORC] Remove now unused EPCDebugObjectRegistrar
---
clang/lib/Interpreter/IncrementalExecutor.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/clang/lib/Interpreter/IncrementalExecutor.cpp b/clang/lib/Interpreter/IncrementalExecutor.cpp
index 45620fcd358c8..c2d6dadda662f 100644
--- a/clang/lib/Interpreter/IncrementalExecutor.cpp
+++ b/clang/lib/Interpreter/IncrementalExecutor.cpp
@@ -20,7 +20,6 @@
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
#include "llvm/ExecutionEngine/Orc/DebugObjectManagerPlugin.h"
#include "llvm/ExecutionEngine/Orc/Debugging/DebuggerSupport.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
More information about the llvm-commits
mailing list