crt: UCRT: Change 32-bit mode time functions without suffix to use 32-bit time_t

CRT header files ensures that time symbols without 32/64 suffixes are not
emitted. And linker always sees time symbols with explicit 32 or 64 suffix
name.

When CRT header files are not included then 32-bit MSVC compiler + linker
treats symbols without "64" suffix name as functions which use 32-bit
time_t, even for UCRT builds.

Do the same in mingw-w64, change 32-bit mode time symbol aliases which do
not have "64" in symbol name, to point to symbols which use 32-bit time_t
type.

With this change, time symbols in 32-bit mode have same meaning across all
CRT libraries provided by mingw-w64. For example symbol "time" points to
function "time" function which always takes 32-bit time_t.

This change fixes previous commits 42aa3325fcfee934d7b706b701e49ee7a3c94982
and e37b315bc039a10507c5cb1046d6b891506022be

Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 97ba61e..08f5055 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1114,7 +1114,7 @@
 				  lib32/msvcr80.def lib32/msvcr90.def lib32/msvcr90d.def lib32/msvcr100.def lib32/msvcr110.def lib32/msvcr120.def lib32/msvcr120d.def \
 				  lib32/msvcr120_app.def lib32/msvcp120_app.def lib32/ucrtbase.def \
 				  lib32/api-ms-win-crt-math-l1-1-0.def lib32/api-ms-win-crt-private-l1-1-0.def lib32/api-ms-win-crt-runtime-l1-1-0.def \
-				  lib32/api-ms-win-crt-filesystem-l1-1-0.def \
+				  lib32/api-ms-win-crt-filesystem-l1-1-0.def lib32/api-ms-win-crt-time-l1-1-0.def \
 				  lib32/vcruntime140_app.def
 
 endif
@@ -1491,7 +1491,7 @@
 				  lib64/advapi32.def lib64/clbcatq.def lib64/kernel32.def lib64/ole32.def \
 				  lib64/oleaut32.def lib64/user32.def lib64/ws2_32.def \
 				  lib64/api-ms-win-crt-math-l1-1-0.def lib64/api-ms-win-crt-private-l1-1-0.def lib64/api-ms-win-crt-runtime-l1-1-0.def \
-				  lib64/api-ms-win-crt-filesystem-l1-1-0.def \
+				  lib64/api-ms-win-crt-filesystem-l1-1-0.def lib64/api-ms-win-crt-time-l1-1-0.def \
 				  lib64/vcruntime140_app.def
 
 endif
@@ -1834,7 +1834,7 @@
 				  libarm32/advapi32.def libarm32/clbcatq.def libarm32/kernel32.def libarm32/ole32.def libarm32/oleaut32.def \
 				  libarm32/user32.def libarm32/ws2_32.def \
 				  libarm32/api-ms-win-crt-math-l1-1-0.def libarm32/api-ms-win-crt-private-l1-1-0.def libarm32/api-ms-win-crt-runtime-l1-1-0.def \
-				  libarm32/api-ms-win-crt-filesystem-l1-1-0.def \
+				  libarm32/api-ms-win-crt-filesystem-l1-1-0.def libarm32/api-ms-win-crt-time-l1-1-0.def \
 				  libarm32/vcruntime140_app.def
 
 endif
@@ -2129,7 +2129,7 @@
 				  libarm64/advapi32.def libarm64/clbcatq.def libarm64/kernel32.def libarm64/ole32.def libarm64/oleaut32.def \
 				  libarm64/user32.def libarm64/ws2_32.def \
 				  libarm64/api-ms-win-crt-math-l1-1-0.def libarm64/api-ms-win-crt-private-l1-1-0.def libarm64/api-ms-win-crt-runtime-l1-1-0.def \
-				  libarm64/api-ms-win-crt-filesystem-l1-1-0.def \
+				  libarm64/api-ms-win-crt-filesystem-l1-1-0.def libarm64/api-ms-win-crt-time-l1-1-0.def \
 				  libarm64/vcruntime140_app.def
 
 endif
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def.in b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def.in
index 219361b..d676251 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def.in
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def.in
@@ -14,13 +14,13 @@
 _chmod
 chmod == _chmod
 _findclose
-F32(_findfirst == _findfirst64)
+F32(_findfirst == _findfirst32)
 F64(_findfirst == _findfirst64i32)
 _findfirst32
 _findfirst32i64
 _findfirst64
 _findfirst64i32
-F32(_findnext == _findnext64)
+F32(_findnext == _findnext32)
 F64(_findnext == _findnext64i32)
 _findnext32
 _findnext32i64
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-time-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-time-l1-1-0.def.in
similarity index 60%
rename from mingw-w64-crt/lib-common/api-ms-win-crt-time-l1-1-0.def
rename to mingw-w64-crt/lib-common/api-ms-win-crt-time-l1-1-0.def.in
index 0e30b11..3b12e61 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-time-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-time-l1-1-0.def.in
@@ -2,6 +2,8 @@
 
 EXPORTS
 
+#include "func.def.in"
+
 __daylight
 __dstbias
 __timezone
@@ -12,12 +14,14 @@
 _ctime64_s
 _difftime32
 _difftime64
-_ftime == _ftime64
+F32(_ftime == _ftime32)
+F64(_ftime == _ftime64)
 _ftime32
 _ftime32_s
 _ftime64
 _ftime64_s
-_futime == _futime64
+F32(_futime == _futime32)
+F64(_futime == _futime64)
 _futime32
 _futime64
 _get_daylight
@@ -53,8 +57,10 @@
 _timespec64_get
 ; This is wrapped in the compat code.
 _tzset DATA
-_utime == _utime64
-utime == _utime64
+F32(_utime == _utime32)
+F64(_utime == _utime64)
+F32(utime == _utime32)
+F64(utime == _utime64)
 _utime32
 _utime64
 _W_Getdays
@@ -72,7 +78,8 @@
 _wstrdate_s
 _wstrtime
 _wstrtime_s
-_wutime == _wutime64
+F32(_wutime == _wutime32)
+F64(_wutime == _wutime64)
 _wutime32
 _wutime64
 asctime
@@ -81,9 +88,15 @@
 strftime
 wcsftime
 ; These functions may satisfy configure scripts.
-ctime == _ctime64
-gmtime == _gmtime64
-localtime == _localtime64
-mktime == _mktime64
-time == _time64
-timespec_get == _timespec64_get
+F32(ctime == _ctime32)
+F64(ctime == _ctime64)
+F32(gmtime == _gmtime32)
+F64(gmtime == _gmtime64)
+F32(localtime == _localtime32)
+F64(localtime == _localtime64)
+F32(mktime == _mktime32)
+F64(mktime == _mktime64)
+F32(time == _time32)
+F64(time == _time64)
+F32(timespec_get == _timespec32_get)
+F64(timespec_get == _timespec64_get)
diff --git a/mingw-w64-crt/lib-common/ucrtbase.def.in b/mingw-w64-crt/lib-common/ucrtbase.def.in
index 4a7d644..3060363 100644
--- a/mingw-w64-crt/lib-common/ucrtbase.def.in
+++ b/mingw-w64-crt/lib-common/ucrtbase.def.in
@@ -327,13 +327,13 @@
 _filelengthi64
 _fileno
 _findclose
-F32(_findfirst == _findfirst64)
+F32(_findfirst == _findfirst32)
 F64(_findfirst == _findfirst64i32)
 _findfirst32
 _findfirst32i64
 _findfirst64
 _findfirst64i32
-F32(_findnext == _findnext64)
+F32(_findnext == _findnext32)
 F64(_findnext == _findnext64i32)
 _findnext32
 _findnext32i64
@@ -366,14 +366,16 @@
 _ftell_nolock
 _ftelli64
 _ftelli64_nolock
-_ftime == _ftime64
+F32(_ftime == _ftime32)
+F64(_ftime == _ftime64)
 _ftime32
 _ftime32_s
 _ftime64
 _ftime64_s
 F_I386(_ftol)
 _fullpath
-_futime == _futime64
+F32(_futime == _futime32)
+F64(_futime == _futime64)
 _futime32
 _futime64
 _fwrite_nolock
@@ -2028,7 +2030,8 @@
 _unloaddll
 _unlock_file
 _unlock_locales
-_utime == _utime64
+F32(_utime == _utime32)
+F64(_utime == _utime64)
 _utime32
 _utime64
 _waccess
@@ -2172,7 +2175,8 @@
 _wtoll
 _wtoll_l
 _wunlink
-_wutime == _wutime64
+F32(_wutime == _wutime32)
+F64(_wutime == _wutime64)
 _wutime32
 _wutime64
 _y0
@@ -2606,7 +2610,8 @@
 unexpected
 ungetc
 ungetwc
-utime == _utime64
+F32(utime == _utime32)
+F64(utime == _utime64)
 wcrtomb
 wcrtomb_s
 wcscat
@@ -2655,9 +2660,15 @@
 wmemcpy_s
 wmemmove_s
 ; These functions may satisfy configure scripts.
-ctime == _ctime64
-gmtime == _gmtime64
-localtime == _localtime64
-mktime == _mktime64
-time == _time64
-timespec_get == _timespec64_get
+F32(ctime == _ctime32)
+F64(ctime == _ctime64)
+F32(gmtime == _gmtime32)
+F64(gmtime == _gmtime64)
+F32(localtime == _localtime32)
+F64(localtime == _localtime64)
+F32(mktime == _mktime32)
+F64(mktime == _mktime64)
+F32(time == _time32)
+F64(time == _time64)
+F32(timespec_get == _timespec32_get)
+F64(timespec_get == _timespec64_get)