diff options
| -rw-r--r-- | AGENTS/ARCH.md | 5 | ||||
| -rw-r--r-- | tests/i/extern-cc-runtime/expected-stderr.txt | 1 | ||||
| -rw-r--r-- | tests/i/extern-cc-runtime/notes.md | 2 | ||||
| -rw-r--r-- | tests/i/extern-cc-runtime/runtime.cc | 2 | ||||
| -rw-r--r-- | tools/driver/EmbeddedRunner.cc | 4 |
5 files changed, 13 insertions, 1 deletions
diff --git a/AGENTS/ARCH.md b/AGENTS/ARCH.md index dbe9f30..7e284da 100644 --- a/AGENTS/ARCH.md +++ b/AGENTS/ARCH.md @@ -147,6 +147,11 @@ Driver behavior (`tools/driver/main.cc`): the host ABI function. The fallback is made local, and runtime archive interfaces are computed from the normalized object. The runner binds the host's initialized stack guard, stack-check failure handler and `write` alias (`_write`) on MinGW. + It also binds the host's `_lock_file`/`_unlock_file` compatibility functions, + keeping MinGW stdio locks compatible with the host's `FILE` objects. + Microsoft msvcrt.dll lacks these exports, so process-wide lookup can select + another CRT's incompatible functions. Wine's msvcrt.dll exports them and can + mask this defect; Wine success does not replace real Windows verification. Per-graph `__ImageBase` is shared by relocations and SEH registration, with default backend liveness for `.pdata` and associative code edges retaining the suffixed unwind sections. JITLink uses diff --git a/tests/i/extern-cc-runtime/expected-stderr.txt b/tests/i/extern-cc-runtime/expected-stderr.txt new file mode 100644 index 0000000..df288aa --- /dev/null +++ b/tests/i/extern-cc-runtime/expected-stderr.txt @@ -0,0 +1 @@ +string failure diff --git a/tests/i/extern-cc-runtime/notes.md b/tests/i/extern-cc-runtime/notes.md index 7ea9429..140c201 100644 --- a/tests/i/extern-cc-runtime/notes.md +++ b/tests/i/extern-cc-runtime/notes.md @@ -2,4 +2,4 @@ Review status: pending human review. -A C++ string starts with 4096 x bytes and appends the three digits 123, giving 4099. The second EXTERN function catches and rethrows invalid_argument; pseudocode catches it once. These are C++ object and exception extensions. +A C++ string starts with 4096 x bytes and appends the three digits 123, giving 4099. The second EXTERN function catches invalid_argument, prints its message followed by a newline to stderr using fprintf, and rethrows it; pseudocode catches it once. This also exercises MinGW stdio locking during exception handling. These are C++ object and exception extensions. diff --git a/tests/i/extern-cc-runtime/runtime.cc b/tests/i/extern-cc-runtime/runtime.cc index fd57538..be4e4c3 100644 --- a/tests/i/extern-cc-runtime/runtime.cc +++ b/tests/i/extern-cc-runtime/runtime.cc @@ -1,3 +1,4 @@ +#include <cstdio> #include <string> #include <stdexcept> extern "C" int string_length() { @@ -8,6 +9,7 @@ extern "C" int string_length() { extern "C" void string_throw() { try { throw std::invalid_argument("string failure"); } catch (const std::exception &e) { + std::fprintf(stderr, "%s\n", e.what()); if (std::string(e.what()) == "string failure") throw; } } 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")] = |
