[llvm] [ORC] Drive COFFPlatform bootstrap calls via proxies (PR #225007)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 20 22:58:03 PDT 2026


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

Replace the three callSPSWrapper sites in bootstrapCOFFRuntime (platform bootstrap, register_jitdylib, register_object_sections) with Proxy dispatch. CI descriptors are kept local to the .cpp, since these are COFFPlatform specific.

>From efdfb1aa11b58e633d1a8bb5fed803b4abb99756 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Sun, 20 Sep 2026 23:25:46 +1000
Subject: [PATCH] [ORC] Drive COFFPlatform bootstrap calls via proxies

Replace the three callSPSWrapper sites in bootstrapCOFFRuntime (platform
bootstrap, register_jitdylib, register_object_sections) with Proxy
dispatch. CI descriptors are kept local to the .cpp, since these are
COFFPlatform specific.
---
 llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp | 58 ++++++++++++++++---
 1 file changed, 50 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
index a183e2570c4a8..d3c46063c431a 100644
--- a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp
@@ -44,6 +44,29 @@ using SPSCOFFDeregisterObjectSectionsArgs =
 } // namespace shared
 } // namespace orc
 } // namespace llvm
+// Controller-interface descriptors for the COFF platform runtime's
+// bootstrap-time SPS wrapper calls. Kept in the .cpp (the COFF platform's
+// private contract with its runtime; the SPS arg types live here too), and in
+// a named namespace so the constexpr Name members -- read only as constants by
+// ProxySpec -- don't trip -Wunused-const-variable.
+namespace llvm::orc::coff_sps_ci {
+struct PlatformBootstrap {
+  static constexpr SymbolNameSpec Name =
+      SymbolNameSpec::verbatim("__orc_rt_coff_platform_bootstrap");
+  using SPSSig = void();
+};
+struct RegisterJITDylib {
+  static constexpr SymbolNameSpec Name =
+      SymbolNameSpec::verbatim("__orc_rt_coff_register_jitdylib");
+  using SPSSig = void(SPSString, SPSExecutorAddr);
+};
+struct RegisterObjectSections {
+  static constexpr SymbolNameSpec Name =
+      SymbolNameSpec::verbatim("__orc_rt_coff_register_object_sections");
+  using SPSSig = void(SPSExecutorAddr, SPSCOFFObjectSectionsMap, bool);
+};
+} // namespace llvm::orc::coff_sps_ci
+
 namespace {
 
 class COFFHeaderMaterializationUnit : public MaterializationUnit {
@@ -703,24 +726,43 @@ Error COFFPlatform::bootstrapCOFFRuntime(JITDylib &PlatformJD) {
                       &orc_rt_coff_deregister_object_sections)}))
     return Err;
 
+  // These runtime entry points are held as addresses because their primary use
+  // is as alloc-action tags (see the register/deregister sites below). The
+  // direct dispatches here are a bootstrap-time artifact, so rather than
+  // holding proxies as members we build them over the resolved addresses.
+  // TODO: drop these dispatches once bootstrap no longer needs them.
+  using PlatformBootstrapProxy = Proxy<void()>;
+  using RegisterJITDylibProxy = Proxy<void(std::string, ExecutorAddr)>;
+  using RegisterObjectSectionsProxy =
+      Proxy<void(ExecutorAddr, COFFObjectSectionsMap, bool)>;
+  using sps::ProxySpec;
+
+  PlatformBootstrapProxy PlatformBootstrap(
+      ProxySpec<PlatformBootstrapProxy,
+                coff_sps_ci::PlatformBootstrap>::dispatch,
+      orc_rt_coff_platform_bootstrap);
+  RegisterJITDylibProxy RegisterJITDylib(
+      ProxySpec<RegisterJITDylibProxy, coff_sps_ci::RegisterJITDylib>::dispatch,
+      orc_rt_coff_register_jitdylib);
+  RegisterObjectSectionsProxy RegisterObjectSections(
+      ProxySpec<RegisterObjectSectionsProxy,
+                coff_sps_ci::RegisterObjectSections>::dispatch,
+      orc_rt_coff_register_object_sections);
+
   // Call bootstrap functions
-  if (auto Err = ES.callSPSWrapper<void()>(orc_rt_coff_platform_bootstrap))
+  if (auto Err = PlatformBootstrap(ES))
     return Err;
 
   // Do the pending jitdylib registration actions that we couldn't do
   // because orc runtime was not linked fully.
   for (auto KV : JDBootstrapStates) {
     auto &JDBState = KV.second;
-    if (auto Err = ES.callSPSWrapper<void(SPSString, SPSExecutorAddr)>(
-            orc_rt_coff_register_jitdylib, JDBState.JDName,
-            JDBState.HeaderAddr))
+    if (auto Err = RegisterJITDylib(ES, JDBState.JDName, JDBState.HeaderAddr))
       return Err;
 
     for (auto &ObjSectionMap : JDBState.ObjectSectionsMaps)
-      if (auto Err = ES.callSPSWrapper<void(SPSExecutorAddr,
-                                            SPSCOFFObjectSectionsMap, bool)>(
-              orc_rt_coff_register_object_sections, JDBState.HeaderAddr,
-              ObjSectionMap, false))
+      if (auto Err = RegisterObjectSections(ES, JDBState.HeaderAddr,
+                                            ObjSectionMap, false))
         return Err;
   }
 



More information about the llvm-commits mailing list