From 51213a7166196f38080cde61224daba034d16c60 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Mon, 19 Oct 2026 12:34:28 +0000 Subject: 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 --- tools/driver/EmbeddedRunner.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') 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")] = -- cgit v1.3.1-4-g156e