@@ -73,31 +73,29 @@ struct LLVMInitializer {
7373
7474static LLVMInitializer llvm_initializer;
7575
76- /* !
77- * \brief Custom ObjectLinkingLayer plugin for init/fini section handling.
78- *
79- * Collects function pointers from init/fini sections (.init_array, .fini_array,
80- * .ctors, .dtors, .CRT$XC*, .CRT$XT*) and runs them in priority order.
81- *
82- * Three-platform init/fini strategy:
83- *
84- * - **macOS**: MachOPlatform (via orc_rt) handles __mod_init_func/__mod_term_func
85- * and __cxa_atexit natively. We delegate to jit_->initialize()/deinitialize().
86- * No InitFiniPlugin needed.
87- *
88- * - **Windows**: COFFPlatform is unusable — it requires MSVC CRT symbols
89- * (_CxxThrowException, RTTI vtables, etc.) that LLVM's COFF ORC runtime
90- * cannot provide (stalled for 2+ years). Our plugin handles .CRT$XC*/ .CRT $XT *
91- * sections instead.
92- *
93- * - **Linux**: ELFNixPlatform does not handle .init_array/.fini_array correctly
94- * prior to https:// github.com/llvm/llvm-project/pull/175981. Once a new LLVM
95- * release includes that patch, we can switch Linux to ELFNixPlatform and
96- * remove the plugin for that platform.
97- *
98- * The plugin is gated behind `#if defined (__linux__) || defined(_WIN32)` so it
99- * can be removed per-platform as LLVM's native platform support matures.
100- */
76+ // Custom ObjectLinkingLayer plugin for init/fini section handling.
77+ //
78+ // Collects function pointers from init/fini sections (.init_array, .fini_array,
79+ // .ctors, .dtors, .CRT$XC*, .CRT$XT*) and runs them in priority order.
80+ //
81+ // Three-platform init/fini strategy:
82+ //
83+ // macOS: MachOPlatform (via orc_rt) handles __mod_init_func/__mod_term_func
84+ // and __cxa_atexit natively. We delegate to jit_->initialize() and
85+ // deinitialize(). No InitFiniPlugin needed.
86+ //
87+ // Windows: COFFPlatform is unusable -- it requires MSVC CRT symbols
88+ // (_CxxThrowException, RTTI vtables, etc.) that LLVM's COFF ORC
89+ // runtime cannot provide (stalled for 2+ years). Our plugin handles
90+ // .CRT$XC*/.CRT$XT* sections instead.
91+ //
92+ // Linux: ELFNixPlatform does not handle .init_array/.fini_array correctly
93+ // prior to llvm/llvm-project#175981. Once a new LLVM release includes
94+ // that patch, we can switch Linux to ELFNixPlatform and remove the
95+ // plugin for that platform.
96+ //
97+ // The plugin is compiled only on Linux/Windows and can be removed per-platform
98+ // as LLVM's native platform support matures.
10199class InitFiniPlugin : public llvm ::orc::ObjectLinkingLayer::Plugin {
102100 // Store a raw pointer to avoid a reference cycle:
103101 // Session → LLJIT → ObjectLinkingLayer → Plugin → Session
0 commit comments