On Sunday 13 April 2025 18:34:33 Pali Rohár wrote: > All 64-bit CRT import libraries already provides _fstat64i32, _stat64i32 > and _wstat64i32 function symbols. These symbols are either directly > exported from 64-bit CRT DLL library or def file contains alias to other > ABI compatible symbols (_fstat, _stat and _wstat). > > Also all these functions _fstat64i32, _stat64i32 and _wstat64i32 are > provided by msvcr80+ and UCRT, so ensure that mingw-w64 does not provide > any replacement for msvcr80+ import libraries. And ensure that libmingwex.a > library does not provide duplication of these symbols. > > For 32-bit pre-msvcr80 CRT import libraries provides mingw-w64 emulation > via _fstat64, _stat64 and _wstat64, which just truncates 64-bit st_size > (returned by _*stat64 function) to 32-bit st_size (which is ABI of > _*stat64i32). Do not use any _mingw_no_trailing_slash workaround as for all > these functions with underscore prefix, it is expected that behavior is > same as for other stat functions with underscore prefix. > > These _fstat64i32, _stat64i32 and _wstat64i32 functions in msvcr80+ and > UCRT DLL libraries do not touch output struct stat buffer on error. So do > same thing in mingw-w64 emulation and remove memset(stat, 0, sizeof(stat)) > call in failure path. > > And add missing __MINGW_IMP_SYMBOL import symbols into mingw-w64 emulation > code for these functions as msvcr80+ import libraries already have them. > --- > mingw-w64-crt/Makefile.am | 10 +++- > mingw-w64-crt/stdio/_fstat64i32.c | 27 +++++++--- > mingw-w64-crt/stdio/_stat64i32.c | 88 +++++++------------------------ > mingw-w64-crt/stdio/_wstat64i32.c | 88 +++++++------------------------ > 4 files changed, 66 insertions(+), 147 deletions(-) > > diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am > index 6987e6a93873..2b5c6e83d83d 100644 > --- a/mingw-w64-crt/Makefile.am > +++ b/mingw-w64-crt/Makefile.am > @@ -548,9 +548,11 @@ src_msvcrt32=\ > stdio/_scprintf.c \ > stdio/_scwprintf.c \ > stdio/_stat64.c \ > + stdio/_stat64i32.c \ > stdio/_vscprintf.c \ > stdio/_vscwprintf.c \ > stdio/_wstat64.c \ > + stdio/_wstat64i32.c \ > string/wcstok.c > > # Files included in libmsvcrt-os.a (for msvcrt.dll) on x86_64 > @@ -632,6 +634,8 @@ src_msvcrtarm32=\ > misc/__winitenv.c \ > stdio/_fstat64i32.c \ > stdio/_setmaxstdio.c \ > + stdio/_stat64i32.c \ > + stdio/_wstat64i32.c \
Hello Martin, the above change stdio/_stat64i32.c + stdio/_wstat64i32.c for the src_msvcrtarm32 section you have merged in git into the src_msvcrtarm64 section. I think that this is a rebase issue as it should really go to the arm32. arm64 import library libmsvcrt.a already contains both symbols _stat64i32 and _wstat64i32 which are defined via crt-aliases.def.in: F64(_stat64i32 == _stat) F64(_wstat64i32 == _wstat) Could you look at it? > stdio/gets.c > > if !ENABLE_SOFTMATH > @@ -842,6 +846,8 @@ src_pre_msvcr80=\ > stdio/_fseeki64.c \ > stdio/_fstat64i32.c \ > stdio/_ftelli64.c \ > + stdio/_stat64i32.c \ > + stdio/_wstat64i32.c \ > stdio/mingw_lock.c \ > string/wcstok.c > > @@ -1041,8 +1047,8 @@ src_libmingwex=\ > \ > stdio/strtok_r.c \ > stdio/_Exit.c stdio/_findfirst64i32.c stdio/_findnext64i32.c \ > - stdio/_stat.c stdio/_stat64i32.c > stdio/_wfindfirst64i32.c stdio/_wfindnext64i32.c \ > - stdio/_wstat.c stdio/_wstat64i32.c stdio/asprintf.c \ > + stdio/_stat.c stdio/_wfindfirst64i32.c stdio/_wfindnext64i32.c > \ > + stdio/_wstat.c stdio/asprintf.c \ > stdio/fopen64.c stdio/fseeko32.c stdio/fseeko64.c > stdio/ftello.c \ > stdio/ftello64.c stdio/ftruncate64.c stdio/lltoa.c > stdio/lltow.c stdio/lseek64.c \ > \ _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public