crt: Fix mingw-w64 emulation of _fstat64i32, _stat64i32 and _wstat64i32 functions
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.
Signed-off-by: Martin Storsjö <martin@martin.st>
4 files changed