Hello, I addressed all mentioned issues and in the attachment I'm sending a new version of all changes. Issues with missing arm64ec symbols I solved by adding a new macro for .def.in files which does not filter symbols for arm64ec builds.
Kirill Makurin run the those changes on Github CI and they passed: https://github.com/maiddaisuki/mingw-w64/actions/runs/22062076993
>From 99b1dc6fcc165dbc1790b35c37f70536676ad3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 24 Jan 2026 01:38:09 +0100 Subject: [PATCH 01/14] crt: Update documentation about F_* arm64-ec related def macros --- mingw-w64-crt/def-include/func.def.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mingw-w64-crt/def-include/func.def.in b/mingw-w64-crt/def-include/func.def.in index 7663e01b63a9..139c28e6fb4e 100644 --- a/mingw-w64-crt/def-include/func.def.in +++ b/mingw-w64-crt/def-include/func.def.in @@ -3,14 +3,16 @@ // F32 - function available on all 32 bit architectures // F64 - function available on all 64 bit architectures -// F_X86_ANY - function available on i386 and x86_64 +// F_X86_ANY - function available on i386, x86_64 and arm64_ec +// F_X86_NATIVE- function available on i386 and x86_64 // F_I386 - function available only on i386 -// F_X64 - function available only on x86_64 +// F_X64 - function available only on x86_64 and arm64_ec // F_ARM32 - function available only on arm32 // F_ARM64 - function available only on arm64 -// F_ARM_ANY - function available on 32 and 64 bit arm +// F_ARM_ANY - function available on arm32, arm64 and arm64_ec +// F_ARM_NATIVE- function available on arm32 and arm64 // F_NON_I386 - function available on everything but i386 -// F_NON_X64 - function available on everything but x86_64 +// F_NON_X64 - function available on everything but x86_64 and arm64_ec // F_NON_ARM64 - function available on everything but arm64 #if defined(__x86_64__) #define F64(x) x -- 2.20.1 >From 4f7eead1e1a5e403c29e9a965263b08e1a630937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 24 Jan 2026 01:54:52 +0100 Subject: [PATCH 02/14] crt: Add F_X64_NATIVE and F_NON_X64_NATIVE def macros --- mingw-w64-crt/def-include/func.def.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mingw-w64-crt/def-include/func.def.in b/mingw-w64-crt/def-include/func.def.in index 139c28e6fb4e..d0e2585c955f 100644 --- a/mingw-w64-crt/def-include/func.def.in +++ b/mingw-w64-crt/def-include/func.def.in @@ -7,22 +7,27 @@ // F_X86_NATIVE- function available on i386 and x86_64 // F_I386 - function available only on i386 // F_X64 - function available only on x86_64 and arm64_ec +// F_X64_NATIVE- function available only on x86_64 // F_ARM32 - function available only on arm32 // F_ARM64 - function available only on arm64 // F_ARM_ANY - function available on arm32, arm64 and arm64_ec // F_ARM_NATIVE- function available on arm32 and arm64 // F_NON_I386 - function available on everything but i386 // F_NON_X64 - function available on everything but x86_64 and arm64_ec +// F_NON_X64_NATIVE - function available on everything but x86_64 // F_NON_ARM64 - function available on everything but arm64 #if defined(__x86_64__) #define F64(x) x #define F_X64(x) x +#define F_X64_NATIVE(x) x #define F_X86_ANY(x) x #define F_X86_NATIVE(x) x #define F_NON_I386(x) x #define F_NON_ARM64(x) x #if defined(__arm64ec__) #define F_ARM_ANY(x) x +#define F_NON_X64_NATIVE(x) x +#undef F_X64_NATIVE #undef F_X86_NATIVE #endif #elif defined(__i386__) @@ -31,6 +36,7 @@ #define F_X86_ANY(x) x #define F_X86_NATIVE(x) x #define F_NON_X64(x) x +#define F_NON_X64_NATIVE(x) x #define F_NON_ARM64(x) x #elif defined(__arm__) #define F32(x) x @@ -38,6 +44,7 @@ #define F_ARM_NATIVE(x) x #define F_NON_I386(x) x #define F_NON_X64(x) x +#define F_NON_X64_NATIVE(x) x #define F_NON_ARM64(x) x #elif defined(__aarch64__) #define F64(x) x @@ -45,6 +52,7 @@ #define F_ARM_NATIVE(x) x #define F_NON_I386(x) x #define F_NON_X64(x) x +#define F_NON_X64_NATIVE(x) x #else #error Unrecognized architecture #endif @@ -67,6 +75,9 @@ #ifndef F_X64 #define F_X64(x) #endif +#ifndef F_X64_NATIVE +#define F_X64_NATIVE(x) +#endif #ifndef F_ARM_NATIVE #define F_ARM_NATIVE(x) #endif @@ -85,6 +96,9 @@ #ifndef F_NON_X64 #define F_NON_X64(x) #endif +#ifndef F_NON_X64_NATIVE +#define F_NON_X64_NATIVE(x) +#endif #ifndef F_NON_ARM64 #define F_NON_ARM64(x) #endif -- 2.20.1 >From e2df6471ee409810854bd533e43b15224ae7a90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 00:35:16 +0200 Subject: [PATCH 03/14] crt: Provide _ctime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_ctime32.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_ctime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 4c63e17052ac..df87223a49cf 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -670,6 +670,7 @@ src_msvcrt64=\ misc/__timezone.c \ misc/__tzname.c \ misc/_create_locale.c \ + misc/_ctime32.c \ misc/_free_locale.c \ misc/_get_current_locale.c \ misc/_get_doserrno.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 0a76606e5555..c1edbca9eb93 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1383,7 +1383,7 @@ _crtDbgFlag _cscanf_l _cscanf_s _cscanf_s_l -_ctime32 F_I386(== ctime) ; i386 _ctime32 replaced by alias +F_NON_X64_NATIVE(_ctime32 F_I386(== ctime)) ; i386 _ctime32 replaced by alias and x64 _ctime32 replaced by emu F_ARM_ANY(_ctime32_s) ; i386 and x64 _ctime32_s replaced by emu F_ARM_ANY(_ctime64_s) ; i386 and x64 _ctime64_s replaced by emu _cwprintf_l diff --git a/mingw-w64-crt/misc/_ctime32.c b/mingw-w64-crt/misc/_ctime32.c new file mode 100644 index 000000000000..b668d4eddee3 --- /dev/null +++ b/mingw-w64-crt/misc/_ctime32.c @@ -0,0 +1,18 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <time.h> + +static char *__cdecl emu__ctime32(const __time32_t *timeptr) +{ + return _ctime64(&(__time64_t){ *timeptr }); +} + +#define RETT char * +#define FUNC _ctime32 +#define ARGS const __time32_t *timeptr +#define CALL timeptr +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From ad13424319d1368a259a4a6fc78905434d20246d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 00:50:29 +0200 Subject: [PATCH 04/14] crt: Provide _difftime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_difftime32.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_difftime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index df87223a49cf..3f31beefcdaa 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -671,6 +671,7 @@ src_msvcrt64=\ misc/__tzname.c \ misc/_create_locale.c \ misc/_ctime32.c \ + misc/_difftime32.c \ misc/_free_locale.c \ misc/_get_current_locale.c \ misc/_get_doserrno.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index c1edbca9eb93..74a2bfaacd0c 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1394,7 +1394,7 @@ F_ARM_ANY(_cwprintf_s_l) ; i386 and x64 _cwprintf_s_l replaced by emu _cwscanf_l _cwscanf_s _cwscanf_s_l -_difftime32 F_I386(== difftime) ; i386 _difftime32 replaced by alias +F_NON_X64_NATIVE(_difftime32 F_I386(== difftime)) ; i386 _difftime32 replaced by alias and x86 _difftime32 replaced by emu F_NON_I386(_difftime64 F_X64(== difftime)) ; i386 _difftime64 replaced by emu and x64 _difftime64 replaced by alias _ecvt_s F_I386(_except_handler4_common) diff --git a/mingw-w64-crt/misc/_difftime32.c b/mingw-w64-crt/misc/_difftime32.c new file mode 100644 index 000000000000..b20bd39798e9 --- /dev/null +++ b/mingw-w64-crt/misc/_difftime32.c @@ -0,0 +1,18 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <time.h> + +static double __cdecl emu__difftime32(__time32_t _Time1, __time32_t _Time2) +{ + return (double)(_Time1 - _Time2); +} + +#define RETT double +#define FUNC _difftime32 +#define ARGS __time32_t _Time1, __time32_t _Time2 +#define CALL _Time1, _Time2 +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From 19416af30f4321718abcb52e3c64872be5e44184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 00:56:09 +0200 Subject: [PATCH 05/14] crt: Provide _ftime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_ftime32.c | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_ftime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 3f31beefcdaa..b6d426dc6641 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -673,6 +673,7 @@ src_msvcrt64=\ misc/_ctime32.c \ misc/_difftime32.c \ misc/_free_locale.c \ + misc/_ftime32.c \ misc/_get_current_locale.c \ misc/_get_doserrno.c \ misc/_get_fmode.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 74a2bfaacd0c..8c792256b050 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1410,7 +1410,7 @@ F_X86_ANY(_freea_s) _fscanf_l _fscanf_s_l F_ARM_ANY(_fseeki64) ; i386 and x64 _fseeki64 replaced by emu -_ftime32 F_I386(== _ftime) ; i386 _ftime32 replaced by alias +F_NON_X64_NATIVE(_ftime32 F_I386(== _ftime)) ; i386 _ftime32 replaced by alias and x64 _ftime32 replaced by emu _ftime32_s _ftime64_s F_I386(_ftol2) diff --git a/mingw-w64-crt/misc/_ftime32.c b/mingw-w64-crt/misc/_ftime32.c new file mode 100644 index 000000000000..80059c5f6683 --- /dev/null +++ b/mingw-w64-crt/misc/_ftime32.c @@ -0,0 +1,23 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <sys/timeb.h> + +static void __cdecl emu__ftime32(struct __timeb32 *tb32) +{ + struct __timeb64 tb64; + _ftime64(&tb64); + tb32->time = (__time32_t)tb64.time; /* truncate */ + tb32->millitm = tb64.millitm; + tb32->timezone = tb64.timezone; + tb32->dstflag = tb64.dstflag; +} + +#define RETT void +#define FUNC _ftime32 +#define ARGS struct __timeb32 *tb +#define CALL tb +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From adcf48148bb6d3c184480fcd489d6ac6fbf26789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:10:10 +0200 Subject: [PATCH 06/14] crt: Provide _futime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_futime32.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_futime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index b6d426dc6641..faf1b3f94e78 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -674,6 +674,7 @@ src_msvcrt64=\ misc/_difftime32.c \ misc/_free_locale.c \ misc/_ftime32.c \ + misc/_futime32.c \ misc/_get_current_locale.c \ misc/_get_doserrno.c \ misc/_get_fmode.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 8c792256b050..8d5e717e96a3 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1417,7 +1417,7 @@ F_I386(_ftol2) F_I386(_ftol2_sse) F_I386(_ftol2_sse_excpt) _fullpath_dbg -_futime32 F_I386(== _futime) ; i386 _futime32 replaced by alias +F_NON_X64_NATIVE(_futime32 F_I386(== _futime)) ; i386 _futime32 replaced by alias and x64 _futime32 replaced by emu _fwprintf_l _fwprintf_p _fwprintf_p_l diff --git a/mingw-w64-crt/misc/_futime32.c b/mingw-w64-crt/misc/_futime32.c new file mode 100644 index 000000000000..9f961d8b29d9 --- /dev/null +++ b/mingw-w64-crt/misc/_futime32.c @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <utime.h> +#include <stddef.h> + +static int __cdecl emu__futime32(int fd, struct __utimbuf32 *times) +{ + return _futime64(fd, times ? &(struct __utimbuf64){ .actime = times->actime, .modtime = times->modtime } : NULL); +} + +#define RETT int +#define FUNC _futime32 +#define ARGS int fd, struct __utimbuf32 *times +#define CALL fd, times +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From 49e5eaa9ca80bd35c96363fd7a7c9b94ba32fd7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:14:16 +0200 Subject: [PATCH 07/14] crt: Provide _gmtime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_gmtime32.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_gmtime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index faf1b3f94e78..4f00d816748e 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -678,6 +678,7 @@ src_msvcrt64=\ misc/_get_current_locale.c \ misc/_get_doserrno.c \ misc/_get_fmode.c \ + misc/_gmtime32.c \ misc/_initterm_e.c \ misc/_mkgmtime32.c \ misc/_set_doserrno.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 8d5e717e96a3..31f3264ca0f9 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1439,7 +1439,7 @@ F_X86_ANY(_get_winmajor) F_X86_ANY(_get_winminor) F_X86_ANY(_get_winver) ; F_X86_ANY(_get_wpgmptr) ; i386 and x64 _get_wpgmptr replaced by emu, arm32 and arm64 provided by emu -_gmtime32 F_I386(== gmtime) ; i386 _gmtime32 replaced by alias +F_NON_X64_NATIVE(_gmtime32 F_I386(== gmtime)) ; i386 _gmtime32 replaced by alias and x64 _gmtime32 replaced by emu F_ARM_ANY(_gmtime32_s) ; i386 and x64 _gmtime32_s replaced by emu F_ARM_ANY(_gmtime64_s) ; i386 and x64 _gmtime64_s replaced by emu _i64toa_s diff --git a/mingw-w64-crt/misc/_gmtime32.c b/mingw-w64-crt/misc/_gmtime32.c new file mode 100644 index 000000000000..4734189ac276 --- /dev/null +++ b/mingw-w64-crt/misc/_gmtime32.c @@ -0,0 +1,18 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <time.h> + +static struct tm *__cdecl emu__gmtime32(const __time32_t *timeptr) +{ + return _gmtime64(&(__time64_t){ *timeptr }); +} + +#define RETT struct tm * +#define FUNC _gmtime32 +#define ARGS const __time32_t *timeptr +#define CALL timeptr +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From 6da6d32ee20ac20e002f098d02235e9e24e4ebf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:16:38 +0200 Subject: [PATCH 08/14] crt: Provide _localtime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_localtime32.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_localtime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 4f00d816748e..630624558cce 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -680,6 +680,7 @@ src_msvcrt64=\ misc/_get_fmode.c \ misc/_gmtime32.c \ misc/_initterm_e.c \ + misc/_localtime32.c \ misc/_mkgmtime32.c \ misc/_set_doserrno.c \ misc/_set_fmode.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 31f3264ca0f9..6e6be81cc3da 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1503,7 +1503,7 @@ _itoa_s _itow_s _lfind_s F_I386(_local_unwind4) -_localtime32 F_I386(== localtime) ; i386 _localtime32 replaced by alias +F_NON_X64_NATIVE(_localtime32 F_I386(== localtime)) ; i386 _localtime32 replaced by alias and x64 _localtime32 replaced by emu F_ARM_ANY(_localtime32_s) ; i386 and x64 _localtime32_s replaced by emu F_ARM_ANY(_localtime64_s) ; i386 and x64 _localtime64_s replaced by emu _lsearch_s diff --git a/mingw-w64-crt/misc/_localtime32.c b/mingw-w64-crt/misc/_localtime32.c new file mode 100644 index 000000000000..c4a5d79f3ed1 --- /dev/null +++ b/mingw-w64-crt/misc/_localtime32.c @@ -0,0 +1,18 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <time.h> + +static struct tm *__cdecl emu__localtime32(const __time32_t *timeptr) +{ + return _localtime64(&(__time64_t){ *timeptr }); +} + +#define RETT struct tm * +#define FUNC _localtime32 +#define ARGS const __time32_t *timeptr +#define CALL timeptr +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From b1e50dcbcb697b8f94917c53d1b73310a67f6751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:27:00 +0200 Subject: [PATCH 09/14] crt: Provide _mktime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_mktime32.c | 29 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_mktime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 630624558cce..3f64709e5826 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -682,6 +682,7 @@ src_msvcrt64=\ misc/_initterm_e.c \ misc/_localtime32.c \ misc/_mkgmtime32.c \ + misc/_mktime32.c \ misc/_set_doserrno.c \ misc/_set_fmode.c \ misc/output_format.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 6e6be81cc3da..bdc932b8dcbe 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1597,7 +1597,7 @@ _mbstrnlen _memicmp_l F_ARM_ANY(_mkgmtime32) ; i386 and x64 _mkgmtime32 replaced by emu F_ARM_ANY(_mktemp_s) ; i386 and x64 _mktemp_s replaced by emu -_mktime32 F_I386(== mktime) ; i386 _mktime32 replaced by alias +F_NON_X64_NATIVE(_mktime32 F_I386(== mktime)) ; i386 _mktime32 replaced by alias and x64 _mktime32 replaced by emu F_NON_I386(_msize_dbg) F_I386(_msize_debug) _printf_l diff --git a/mingw-w64-crt/misc/_mktime32.c b/mingw-w64-crt/misc/_mktime32.c new file mode 100644 index 000000000000..7b9ef1b73f8d --- /dev/null +++ b/mingw-w64-crt/misc/_mktime32.c @@ -0,0 +1,29 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <time.h> +#include <stdint.h> +#include <errno.h> + +static __time32_t __cdecl emu__mktime32(struct tm *tmptr) +{ + struct tm tmbuf = *tmptr; + __time64_t time64 = _mktime64(&tmbuf); + if (time64 == -1) + return -1; + if (time64 < 0 || time64 > INT32_MAX) { + errno = EINVAL; + return -1; + } + *tmptr = tmbuf; + return (__time32_t)time64; +} + +#define RETT __time32_t +#define FUNC _mktime32 +#define ARGS struct tm *tmptr +#define CALL tmptr +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From bd02b6660dd82c5879e21ff05ac93b2d28d77438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:31:06 +0200 Subject: [PATCH 10/14] crt: Provide _time32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_time32.c | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_time32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 3f64709e5826..ac6831c98b5e 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -688,6 +688,7 @@ src_msvcrt64=\ misc/output_format.c \ misc/_get_errno.c \ misc/_set_errno.c \ + misc/_time32.c \ misc/strnlen.c \ misc/wassert.c \ misc/wcsnlen.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index bdc932b8dcbe..5482725f5149 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1673,7 +1673,7 @@ _swprintf_s_l _swscanf_l _swscanf_s_l _tempnam_dbg -_time32 F_I386(== time) ; i386 _time32 replaced by alias +F_NON_X64_NATIVE(_time32 F_I386(== time)) ; i386 _time32 replaced by alias and x64 _time32 replaced by emu _tolower_l _toupper_l _towlower_l diff --git a/mingw-w64-crt/misc/_time32.c b/mingw-w64-crt/misc/_time32.c new file mode 100644 index 000000000000..1855ee225780 --- /dev/null +++ b/mingw-w64-crt/misc/_time32.c @@ -0,0 +1,24 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <time.h> +#include <stdint.h> + +static __time32_t __cdecl emu__time32(__time32_t *timeptr) +{ + __time64_t time64 = _time64(NULL); + if (time64 > INT32_MAX) + time64 = -1; + if (timeptr) + *timeptr = (__time32_t)time64; + return (__time32_t)time64; +} + +#define RETT __time32_t +#define FUNC _time32 +#define ARGS __time32_t *timeptr +#define CALL timeptr +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From a4610afd072309e7ca62940fcbd0009f1361eb5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:33:09 +0200 Subject: [PATCH 11/14] crt: Provide _utime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_utime32.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_utime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index ac6831c98b5e..ce69c3b281ff 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -689,6 +689,7 @@ src_msvcrt64=\ misc/_get_errno.c \ misc/_set_errno.c \ misc/_time32.c \ + misc/_utime32.c \ misc/strnlen.c \ misc/wassert.c \ misc/wcsnlen.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 5482725f5149..6121ea8f35d6 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1683,7 +1683,7 @@ _ui64tow_s _ultoa_s _ultow_s F_ARM_ANY(_umask_s) ; i386 and x64 _umask_s replaced by emu -_utime32 F_I386(== _utime) ; i386 _utime32 replaced by alias +F_NON_X64_NATIVE(_utime32 F_I386(== _utime)) ; i386 _utime32 replaced by alias and x64 _utime32 replaced by emu _vcprintf _vcprintf_l _vcprintf_p diff --git a/mingw-w64-crt/misc/_utime32.c b/mingw-w64-crt/misc/_utime32.c new file mode 100644 index 000000000000..947d5990e7d6 --- /dev/null +++ b/mingw-w64-crt/misc/_utime32.c @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <utime.h> +#include <stddef.h> + +static int __cdecl emu__utime32(const char *filename, struct __utimbuf32 *times) +{ + return _utime64(filename, times ? &(struct __utimbuf64){ .actime = times->actime, .modtime = times->modtime } : NULL); +} + +#define RETT int +#define FUNC _utime32 +#define ARGS const char *filename, struct __utimbuf32 *times +#define CALL filename, times +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From a207d7b2b11c354cbebbb49592761ce2b5d20b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:39:58 +0200 Subject: [PATCH 12/14] crt: Provide _wctime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_wctime32.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_wctime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index ce69c3b281ff..deae6efa8576 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -690,6 +690,7 @@ src_msvcrt64=\ misc/_set_errno.c \ misc/_time32.c \ misc/_utime32.c \ + misc/_wctime32.c \ misc/strnlen.c \ misc/wassert.c \ misc/wcsnlen.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 6121ea8f35d6..88ab23a01ea3 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1761,7 +1761,7 @@ _wcsupr_l _wcsupr_s _wcsupr_s_l _wcsxfrm_l -_wctime32 F_I386(== _wctime) ; i386 _wctime32 replaced by alias +F_NON_X64_NATIVE(_wctime32 F_I386(== _wctime)) ; i386 _wctime32 replaced by alias and x64 _wctime32 replaced by emu F_ARM_ANY(_wctime32_s) ; i386 and x64 _wctime32_s replaced by emu F_ARM_ANY(_wctime64_s) ; i386 and x64 _wctime64_s replaced by emu _wctomb_l diff --git a/mingw-w64-crt/misc/_wctime32.c b/mingw-w64-crt/misc/_wctime32.c new file mode 100644 index 000000000000..dc42894bcc70 --- /dev/null +++ b/mingw-w64-crt/misc/_wctime32.c @@ -0,0 +1,18 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <time.h> + +static wchar_t *__cdecl emu__wctime32(const __time32_t *timeptr) +{ + return _wctime64(&(__time64_t){ *timeptr }); +} + +#define RETT wchar_t * +#define FUNC _wctime32 +#define ARGS const __time32_t *timeptr +#define CALL timeptr +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From eab80832b473ff7f44545cbff26ace0ec2b9f5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sat, 25 Oct 2025 01:41:36 +0200 Subject: [PATCH 13/14] crt: Provide _wutime32 emulation for x64 msvcrt.dll --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/lib-common/msvcrt.def.in | 2 +- mingw-w64-crt/misc/_wutime32.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-crt/misc/_wutime32.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index deae6efa8576..ff881d80c168 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -691,6 +691,7 @@ src_msvcrt64=\ misc/_time32.c \ misc/_utime32.c \ misc/_wctime32.c \ + misc/_wutime32.c \ misc/strnlen.c \ misc/wassert.c \ misc/wcsnlen.c \ diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 88ab23a01ea3..591d33e124cb 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in @@ -1792,7 +1792,7 @@ _wtof_l _wtoi64_l _wtoi_l _wtol_l -_wutime32 F_I386(== _wutime) ; i386 _wutime32 replaced by alias +F_NON_X64_NATIVE(_wutime32 F_I386(== _wutime)) ; i386 _wutime32 replaced by alias and x64 _wutime32 replaced by emu F_ARM_ANY(asctime_s) ; i386 and x64 asctime_s replaced by emu bsearch_s ; btowc replaced by emu for consistency with wctob diff --git a/mingw-w64-crt/misc/_wutime32.c b/mingw-w64-crt/misc/_wutime32.c new file mode 100644 index 000000000000..f73ec9c5cbfa --- /dev/null +++ b/mingw-w64-crt/misc/_wutime32.c @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <utime.h> +#include <stddef.h> + +static int __cdecl emu__wutime32(const wchar_t *filename, struct __utimbuf32 *times) +{ + return _wutime64(filename, times ? &(struct __utimbuf64){ .actime = times->actime, .modtime = times->modtime } : NULL); +} + +#define RETT int +#define FUNC _wutime32 +#define ARGS const wchar_t *filename, struct __utimbuf32 *times +#define CALL filename, times +#include "msvcrt_or_emu_glue.h" -- 2.20.1 >From e4c75fe511f82fe2020b77ccdc0cee47eef5ea3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]> Date: Sun, 28 Dec 2025 17:36:07 +0100 Subject: [PATCH 14/14] crt: Add simple test to check that all 32-bit time functions are present --- mingw-w64-crt/testcases/Makefile.am | 1 + mingw-w64-crt/testcases/t_time32.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 mingw-w64-crt/testcases/t_time32.c diff --git a/mingw-w64-crt/testcases/Makefile.am b/mingw-w64-crt/testcases/Makefile.am index eb7044076f11..715c82f3e5fd 100644 --- a/mingw-w64-crt/testcases/Makefile.am +++ b/mingw-w64-crt/testcases/Makefile.am @@ -69,6 +69,7 @@ testcase_progs = \ t_stderr_buffering \ t_stdint \ t_time \ + t_time32 \ t_tls1 \ t_tmpfile \ t_trycatch \ diff --git a/mingw-w64-crt/testcases/t_time32.c b/mingw-w64-crt/testcases/t_time32.c new file mode 100644 index 000000000000..a92656b83ee0 --- /dev/null +++ b/mingw-w64-crt/testcases/t_time32.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <sys/timeb.h> +#include <time.h> +#include <utime.h> + +int main() { + /* Check that all 32-bit time functions are present and can be called */ + struct tm tm; + __time32_t t = 0; + struct __timeb32 tb; + struct __utimbuf32 utb; + _ctime32(&t); + _difftime32(t, t); + _ftime32(&tb); + _futime32(0, &utb); + _gmtime32(&t); + _localtime32(&t); + _mkgmtime32(&tm); + _mktime32(&tm); + _time32(&t); + _utime32("", &utb); + _wctime32(&t); + _wutime32(L"", &utb); + printf("TEST PASSED\n"); + return 0; +} -- 2.20.1
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
