crt: Fix missing fstat64 symbol in 64-bit msvcrt and 32-bit msvcr70/71 import libraries On 64-bit are _fstati64 and _fstat64 functions same, both uses 64-bit time_t and 64-bit off_t. On 32-bit is _fstati64 using 32-bit time_t. 64-bit msvcrt DLL library provides both native _fstati64 and _fstat64 symbols. And other 64-bit CRT DLL libraries (msvcr80+ and UCRT) are not categorized as FIXED_SIZE_SYMBOLS. 32-bit msvcr70 and msvcr71 DLL libraries provides native fixed-size symbols for 64-bit wide functions like _fstat64. Import library for 32-bit system os msvcrt uses emulation of _fstat64 function which also defines own alias for fstat64 in file stdio/_fstat64.c. So define fstat64 symbol as alias to _fstat64 (instead of as to _fstati64) in crt-aliases.def.in file for all import CRT libraries which provides native _fstat64 symbol (non-i386 msvcrt, msvcr70+ and ucrt). Current condition for fstat64 in crt-aliases.def.in is wrong because it does not take into account the 64-bit msvcrt case which defines the NO_FIXED_SIZE_64_ALIAS macro saying that DLL provides the native _fstat64 symbol (and hence crt-aliases.def.in must not define _fstat64 symbol). And there are also missing settings for NO_FIXED_SIZE_64_ALIAS in msvcr70 and msvcr71 def files as these DLL libraries provides _fstat64 function. Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/def-include/crt-aliases.def.in b/mingw-w64-crt/def-include/crt-aliases.def.in index 6335237..2c9090b 100644 --- a/mingw-w64-crt/def-include/crt-aliases.def.in +++ b/mingw-w64-crt/def-include/crt-aliases.def.in
@@ -309,8 +309,9 @@ ; stat for non-UCRT is provided by mingw to workaround trailing slash issue in _stat #endif #ifdef FIXED_SIZE_SYMBOLS -#if !defined(NO_I64_FIXED_SIZE) && !defined(NO_FIXED_SIZE_64_ALIAS) -F64(fstat64 == _fstati64) +// NO_FIXED_SIZE_64_ALIAS means that DLL provides the native _fstat64 symbol +#if defined(NO_FIXED_SIZE_64_ALIAS) && !defined(NO_FSTAT64_ALIAS) +fstat64 == _fstat64 #endif #else fstat64 == _fstat64
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 82694e4..ab7eeed 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1907,6 +1907,10 @@ ; This includes list of some symbol alises for compatibility with C99 and POSIX functions and symbols from other msvcr* libraries #define FIXED_SIZE_SYMBOLS #define NO_FIXED_SIZE_64_ALIAS +#ifdef __i386__ +; i386 fstat64 alias provided by emu +#define NO_FSTAT64_ALIAS +#endif #define NO_TIME_ALIAS #define NO_STRCMPI_ALIAS #define WITH_NEXTAFTER_ALIAS
diff --git a/mingw-w64-crt/lib32/msvcr70.def.in b/mingw-w64-crt/lib32/msvcr70.def.in index d4726d1..ec64df7 100644 --- a/mingw-w64-crt/lib32/msvcr70.def.in +++ b/mingw-w64-crt/lib32/msvcr70.def.in
@@ -901,6 +901,7 @@ wscanf #define FIXED_SIZE_SYMBOLS +#define NO_FIXED_SIZE_64_ALIAS #define NO_STRCMPI_ALIAS #define WITH_NEXTAFTER_ALIAS #define WITH_TZ_ALIASES
diff --git a/mingw-w64-crt/lib32/msvcr70d.def.in b/mingw-w64-crt/lib32/msvcr70d.def.in index 6ca4762..408f1e9 100644 --- a/mingw-w64-crt/lib32/msvcr70d.def.in +++ b/mingw-w64-crt/lib32/msvcr70d.def.in
@@ -945,6 +945,7 @@ wscanf #define FIXED_SIZE_SYMBOLS +#define NO_FIXED_SIZE_64_ALIAS #define NO_STRCMPI_ALIAS #define WITH_NEXTAFTER_ALIAS #define WITH_TZ_ALIASES
diff --git a/mingw-w64-crt/lib32/msvcr71.def.in b/mingw-w64-crt/lib32/msvcr71.def.in index 6df695c..6e3f540 100644 --- a/mingw-w64-crt/lib32/msvcr71.def.in +++ b/mingw-w64-crt/lib32/msvcr71.def.in
@@ -895,6 +895,7 @@ wscanf #define FIXED_SIZE_SYMBOLS +#define NO_FIXED_SIZE_64_ALIAS #define NO_STRCMPI_ALIAS #define WITH_NEXTAFTER_ALIAS #define WITH_TZ_ALIASES
diff --git a/mingw-w64-crt/lib32/msvcr71d.def.in b/mingw-w64-crt/lib32/msvcr71d.def.in index ba2a993..7f70c52 100644 --- a/mingw-w64-crt/lib32/msvcr71d.def.in +++ b/mingw-w64-crt/lib32/msvcr71d.def.in
@@ -939,6 +939,7 @@ wscanf #define FIXED_SIZE_SYMBOLS +#define NO_FIXED_SIZE_64_ALIAS #define NO_STRCMPI_ALIAS #define WITH_NEXTAFTER_ALIAS #define WITH_TZ_ALIASES