From 9a11bb6f534c943cbe56a6632c59aa8a335cb69d Mon Sep 17 00:00:00 2001 From: Christopher Wellons Date: Fri, 10 Jul 2026 20:24:08 -0400 Subject: [PATCH] crt: __MINGW_IMP_SYMBOL for _strtof_l and _wcstof_l These functions are static emulations present in every libmsvcr*.a, but the headers declare them dllimport (_CRTIMP), so callers reference __imp__strtof_l and __imp__wcstof_l, which nothing defines, and the link fails. Define fake import pointers alongside the definitions, as already done for other statically-emulated functions such as __acrt_iob_func and _initialize_onexit_table. The _strtof_l half was merged upstream after v14.0.0 as 373c7dd0 ("crt: Add missing __MINGW_IMP_SYMBOL for _strtof_l()"). The _wcstof_l half is the same fix for the wide variant, which remains broken upstream. --- Dockerfile | 3 +++ src/mingw-imp-strtof_l.patch | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/mingw-imp-strtof_l.patch diff --git a/Dockerfile b/Dockerfile index a8fbb5c..308c628 100644 --- a/Dockerfile +++ b/Dockerfile @@ -251,6 +251,9 @@ RUN /dl/binutils/configure \ # https://sourceforge.net/p/mingw-w64/bugs/821/ RUN sed -i /OpenThreadToken/d /dl/mingw/mingw-w64-crt/lib32/kernel32.def +COPY src/mingw-*.patch $PREFIX/src/ +RUN cat $PREFIX/src/mingw-*.patch | patch -d/dl/mingw -p1 + WORKDIR /x-mingw-headers RUN printf '#include \n#if __has_include_next()\n#include_next \n#endif\n' \ >/dl/mingw/mingw-w64-headers/crt/stddef.h \ diff --git a/src/mingw-imp-strtof_l.patch b/src/mingw-imp-strtof_l.patch new file mode 100644 index 0000000..6394937 --- /dev/null +++ b/src/mingw-imp-strtof_l.patch @@ -0,0 +1,30 @@ +crt: add missing __MINGW_IMP_SYMBOL for _strtof_l and _wcstof_l + +These functions are static emulations present in every libmsvcr*.a, +but the headers declare them dllimport (_CRTIMP), so callers reference +__imp__strtof_l and __imp__wcstof_l, which nothing defines, and the +link fails. Define fake import pointers alongside the definitions, as +already done for other statically-emulated functions such as +__acrt_iob_func and _initialize_onexit_table. + +The _strtof_l half was merged upstream after v14.0.0 as 373c7dd0 +("crt: Add missing __MINGW_IMP_SYMBOL for _strtof_l()"). The +_wcstof_l half is the same fix for the wide variant, which remains +broken upstream. + +--- a/mingw-w64-crt/stdio/_strtof_l.c ++++ b/mingw-w64-crt/stdio/_strtof_l.c +@@ -26,3 +26,5 @@ + } + return ret; + } ++ ++float (*__MINGW_IMP_SYMBOL(_strtof_l))(const char *, char **, _locale_t) = _strtof_l; +--- a/mingw-w64-crt/stdio/_wcstof_l.c ++++ b/mingw-w64-crt/stdio/_wcstof_l.c +@@ -26,3 +26,5 @@ + } + return ret; + } ++ ++float (*__MINGW_IMP_SYMBOL(_wcstof_l))(const wchar_t *, wchar_t **, _locale_t) = _wcstof_l;