在 2026-6-16 08:35, Kirill Makurin 写道:
Hello,

Some time ago, in some discussion, I suggested that we add some "init" function which 
should be called from each test program in mingw-w64-crt/testcases/. This "init" 
function, for example, would call (among other things) `_set_error_mode` and `_set_abort_behavior` 
so that failed assert() and calls to abort() do not pop up a message box; it is annoying, and it 
also could have pretty bad effect in CI runs.

This patch series, among other changes, adds a small static library libtest.a which 
contains helper functions which can be used by the test programs; currently it just 
contains "init" function `mingw_test_init`, but it can be extended in future to 
avoid code duplication in test programs. This library is declared as check_LIBRARIES 
target, so it is only built with `make check` and is not installed.

These changes look good, so pushed now. Thanks.


I want to note that I had to disable three C++ tests (t_iostream, t_tls_cpp and 
t_wrongret) on arm64ec, where we link libc++ statically. The reason is that 
when we link libc++ statically with msvcrt.dll, libc++ contains references to 
functions which are not available in msvcrt.dll:

```
   CXXLD    t_iostream.exe
ld.lld: error: undefined symbol: __declspec(dllimport) _strftime_l (EC symbol)
referenced by 
libc++.a(locale.cpp.obj):(#_ZNKSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcPK2tmcc)
referenced by 
libc++.a(locale.cpp.obj):(#_ZNKSt3__18time_putIcNS_19ostreambuf_iteratorIcNS_11char_traitsIcEEEEE6do_putES4_RNS_8ios_baseEcPK2tmcc)
referenced by 
libc++.a(locale.cpp.obj):(#_ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc)
referenced 11 more times
clang-22: error: linker command failed with exit code 1 (use -v to see 
invocation)
make[3]: *** [Makefile:2908: t_iostream.exe] Error 1
```

Which is weird... how does libc++ builds with msvcrt.dll if it does not contain 
_strftime_l? Or maybe we link against wrong static libc++ (e.g. configured for 
UCRT)? I don't have access to aarch64 machine to investigate it myself. It is 
also possible that static libc++ is broken in this way on all archs, not only 
arm64ec.

MSVCRT exports no such function. Prebuilt libc++.dll from llvm-mingw doesn't 
import it:

   ```
   ~/Desktop/llvm-mingw-20260602-msvcrt-x86_64/arm64ec-w64-mingw32/bin
   $ llvm-readobj --coff-imports libc++.dll  | fgrep strftime
     Symbol: strftime (0)
   ```

So I suspect this is a misconfiguration.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to