aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-19 12:34:28 +0000
committer_ov4 <ov4@ov4.org>2026-10-19 12:34:28 +0000
commit51213a7166196f38080cde61224daba034d16c60 (patch)
treea95cfd5d66021616de4708d6c3acdbc9d51ef0f3 /tools
parenta5ce1af261ec3890d1ae16cc3a8785ffa8ad7b43 (diff)
fix(driver): bind MinGW JIT stdio locks to the host CRT
Resolve _lock_file and _unlock_file to the host compatibility functions so JIT stdio cannot pick incompatible locks from another CRT DLL. Cover fprintf inside a C++ catch with exact stderr expectations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/driver/EmbeddedRunner.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/driver/EmbeddedRunner.cc b/tools/driver/EmbeddedRunner.cc
index 5d82400..832616a 100644
--- a/tools/driver/EmbeddedRunner.cc
+++ b/tools/driver/EmbeddedRunner.cc
@@ -630,6 +630,10 @@ static llvm::Error defineRuntimeSymbols(llvm::orc::LLJIT &J) {
ExecutorSymbolDef::fromPtr(&std::strtoll);
// msvcrt.dll exports _write; MinGW archive members call its POSIX alias.
Symbols[Intern("write")] = ExecutorSymbolDef::fromPtr(&_write);
+ // Microsoft msvcrt.dll does not export these MinGW compatibility functions.
+ // Keep FILE locks in the host CRT instead of resolving another DLL's copies.
+ Symbols[Intern("_lock_file")] = ExecutorSymbolDef::fromPtr(&_lock_file);
+ Symbols[Intern("_unlock_file")] = ExecutorSymbolDef::fromPtr(&_unlock_file);
Symbols[Intern("__stack_chk_guard")] =
ExecutorSymbolDef::fromPtr(&__stack_chk_guard);
Symbols[Intern("__stack_chk_fail")] =