在 2026-10-23 22:39, Peter Damianov via Mingw-w64-public 写道:
From: Peter Damianov <[email protected]>Since commit 4b5196714 ("crt: Define FE_DFL_ENV next to _fpreset"), fesetenv.o in libmingwex.a refers to __mingw_fe_dfl_env, which on x86 is defined next to _fpreset in CRT_fp10.o. CRT_fp10.o was in libmingw32.a, which GCC passes before libmingwex.a. An EXE always pulls in CRT_fp10.o through the _fpreset call in crtexe.c, but a DLL does not. When fesetenv.o is first pulled in by a library that comes after the last libmingw32.a on the command line, such as libpthread.a (pthread_create calls fesetenv), linking the DLL with GNU ld fails: undefined reference to `__mingw_fe_dfl_env' Build CRT_fp10.c into libmingwex.a, next to fesetenv.c. GNU ld rescans an archive until no more members are pulled in, so CRT_fp10.o is now found whenever fesetenv.o needs it. CRT_fp4.o and CRT_fp8.o, when linked explicitly, still take precedence, as they come before the libraries. LLD resolves archive members regardless of their order on the command line, so the testcases, which CI runs with LLD, cannot catch this. Reported-by: Evgeny Karpov <[email protected]> Signed-off-by: Peter Damianov <[email protected]> --- Evgeny, thanks for the report. I reproduced it with GNU ld by linking a DLL that calls pthread_create; with this patch it links again. If what you were linking is something else, let me know and I'll check that too. mingw-w64-crt/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Thanks for the patch. I have pushed it now. -- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
