diff options
| author | Stefan Gränitz <stefan.graenitz@gmail.com> | 2025-11-19 10:39:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-19 10:39:08 +0100 |
| commit | 907e8514b188abb0e4d4d16b1e0e847a163762cd (patch) | |
| tree | b07f4a956088dab368fa480fbdd52a5f3cc085ea | |
| parent | a2af185b96071154b93f6c00319feee9b1f270f4 (diff) | |
[ORC] Remove now unused EPCDebugObjectRegistrar (NFC) (#167868)
EPCDebugObjectRegistrar is unused now that the ELF debugger support plugin uses AllocActions
https://github.com/llvm/llvm-project/pull/167866
15 files changed, 5 insertions, 164 deletions
diff --git a/clang/lib/Interpreter/IncrementalExecutor.cpp b/clang/lib/Interpreter/IncrementalExecutor.cpp index 74a489f4b3ac..11ab2cfaac17 100644 --- a/clang/lib/Interpreter/IncrementalExecutor.cpp +++ b/clang/lib/Interpreter/IncrementalExecutor.cpp @@ -19,7 +19,6 @@ #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/Orc/CompileUtils.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" @@ -47,8 +46,7 @@ // Force linking some of the runtimes that helps attaching to a debugger. LLVM_ATTRIBUTE_USED void linkComponents() { - llvm::errs() << (void *)&llvm_orc_registerJITLoaderGDBWrapper - << (void *)&llvm_orc_registerJITLoaderGDBAllocAction; + llvm::errs() << (void *)&llvm_orc_registerJITLoaderGDBAllocAction; } namespace clang { diff --git a/llvm/include/llvm-c/LLJITUtils.h b/llvm/include/llvm-c/LLJITUtils.h index 4064d5907bc8..4d6641f40b71 100644 --- a/llvm/include/llvm-c/LLJITUtils.h +++ b/llvm/include/llvm-c/LLJITUtils.h @@ -40,7 +40,7 @@ LLVM_C_EXTERN_C_BEGIN /** * Install the plugin that submits debug objects to the executor. Executors must - * expose the llvm_orc_registerJITLoaderGDBWrapper symbol. + * expose the llvm_orc_registerJITLoaderGDBAllocAction symbol. */ LLVM_C_ABI LLVMErrorRef LLVMOrcLLJITEnableDebugSupport(LLVMOrcLLJITRef J); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h index 1581f7aca211..80c2b95ca1c7 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 3a92eee0430c..000000000000 --- 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 5a9517b1ce7c..bc3c6fa332a2 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h @@ -44,9 +44,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); #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERGDB_H diff --git a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt index 41402f7a69cc..422b20c649c7 100644 --- a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt @@ -17,7 +17,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 08bef37b06c8..000000000000 --- 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 cb1b3b05cd24..f255de093b24 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 f1cf87fc88ce..847ee3263c02 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 8d33ae1edcaa..2cffca27623e 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 cf5200a73e5c..b8de817ec16c 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/IndirectionUtils.h" @@ -347,7 +346,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 d3fcb948fafb..0ddbb33c4bac 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 ab3b717eed69..106db8349144 100644 --- a/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn @@ -25,7 +25,6 @@ static_library("Orc") { "DebugUtils.cpp", "EHFrameRegistrationPlugin.cpp", "ELFNixPlatform.cpp", - "EPCDebugObjectRegistrar.cpp", "EPCDynamicLibrarySearchGenerator.cpp", "EPCGenericDylibManager.cpp", "EPCGenericJITLinkMemoryManager.cpp", diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel index 643f8ab03f72..c936670168b9 100644 --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel @@ -4558,7 +4558,7 @@ cc_binary( "-Wl,--export-dynamic-symbol=__gxx_personality_v0", "-Wl,--export-dynamic-symbol=__cxa_allocate_exception", "-Wl,--export-dynamic-symbol=__cxa_throw", - "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper", + "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBAllocAction", "-Wl,--export-dynamic-symbol=llvm_orc_registerEHFrameSectionWrapper", "-Wl,--export-dynamic-symbol=llvm_orc_deregisterEHFrameSectionWrapper", ], @@ -5108,7 +5108,7 @@ cc_binary( "-Wl,--export-dynamic-symbol=__gxx_personality_v0", "-Wl,--export-dynamic-symbol=__cxa_allocate_exception", "-Wl,--export-dynamic-symbol=__cxa_throw", - "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper", + "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBAllocAction", ], }), stamp = 0, diff --git a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel index bfdf37b0c969..0ecd704fe0a6 100644 --- a/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel @@ -408,7 +408,7 @@ cc_test( "@platforms//os:macos": [], "@platforms//os:windows": [], "//conditions:default": [ - "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBWrapper", + "-Wl,--export-dynamic-symbol=llvm_orc_registerJITLoaderGDBAllocAction", ], }), deps = [ |
