aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-16 16:00:03 +0000
committer_ov4 <ov4@ov4.org>2026-10-16 16:00:03 +0000
commitb5b1e5a2a684a1ec96fae3408d322b92c38354e6 (patch)
tree8e740bd5629289c335777b2b3c523b29f7b66768 /tools
parent959e4ba0fe15685f329691356205a0c26301e1cb (diff)
fix(jit): resolve MinGW stack probe for embedded execution
Windows runner failed with missing ___chkstk_ms. Reference it weakly so platforms without it see null while MinGW exposes its host address. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/driver/EmbeddedRunner.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/driver/EmbeddedRunner.cc b/tools/driver/EmbeddedRunner.cc
index 317e900..8ebffab 100644
--- a/tools/driver/EmbeddedRunner.cc
+++ b/tools/driver/EmbeddedRunner.cc
@@ -276,6 +276,11 @@ __gxx_personality_v0
extern "C" void __cps_jit_noop__main() {}
#endif
+// MinGW inserts ___chkstk_ms stack probes into large frames. dlsym cannot see
+// this static runtime symbol, so reference it weakly: null on platforms
+// without it, host address where present. Same code on all platforms.
+extern "C" void ___chkstk_ms() __attribute__((weak));
+
static llvm::Error defineRuntimeSymbols(llvm::orc::LLJIT &J) {
llvm::orc::SymbolMap Symbols;
auto Intern = [&](llvm::StringRef Name) { return J.mangleAndIntern(Name); };
@@ -317,6 +322,9 @@ static llvm::Error defineRuntimeSymbols(llvm::orc::LLJIT &J) {
Symbols[Intern("__main")] =
ExecutorSymbolDef::fromPtr(&__cps_jit_noop__main);
#endif
+ if (___chkstk_ms)
+ Symbols[Intern("___chkstk_ms")] =
+ ExecutorSymbolDef::fromPtr(reinterpret_cast<void *>(&___chkstk_ms));
return J.getMainJITDylib().define(
llvm::orc::absoluteSymbols(std::move(Symbols)));
}