On 2023-06-06 10:26, Martin Storsjö wrote:
On Thu, 1 Jun 2023, Steve Lhomme wrote:

The parameters size in lib32 were generated from values found in other .def
files of lib32.
---

I'm sorry to say, but this patch removed a lot of manual handmade customizations to the api-ms-win-crt-*.def files.

In particular, this now shows up as linker errors when trying to bootstrap a new toolchain:

         ld.lld: error: duplicate symbol: __tzset
         >>> defined at ../crt/ucrtbase_compat.c:135
        >>> libmsvcrt.a(lib32_libucrt_extra_a-ucrtbase_compat.o)
         >>> defined at api-ms-win-crt-time-l1-1-0.dll

Let's have a look at the questionable bits here:

diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def b/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
index ddbdd1d6c..a4901802f 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
@@ -4,5 +4,5 @@ EXPORTS

GetFileVersionInfoExW
GetFileVersionInfoSizeExW
-VerFindFileW
+GetFileVersionInfoW
VerQueryValueW

This removes a function that used to be here. Is that right/expected?

VerFindFileW may be in there, the doc [1] says it's in Api-ms-win-core-version-l1-1-0. Although the markdown says it's in api-ms-win-core-version-l1-1-1 as well [2]. But it's not part of any WindowsApp.lib at all. IMO it should only be winver.def. I think WindowsApp.lib is the more accurate doc of all (see other email about bogus doc).

We may decide to add the API's that are actually in the DLLs on our system. But then that means that our libwindowsapp.a allows more API than the MS one.

diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
index bd5ef539c..2c70f3d9b 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
@@ -9,8 +9,6 @@ RoClearError
RoFailFastWithErrorContext
RoGetErrorReportingFlags
RoGetMatchingRestrictedErrorInfo
-RoInspectCapturedStackBackTrace
-RoInspectThreadErrorInfo
RoOriginateError
RoOriginateErrorW
RoOriginateLanguageException

This removes functions, is that right/expected?

Yes, they are not in any WindowsApp.lib.

diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def
index c1636e1c6..127d74961 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def
@@ -19,7 +19,6 @@ WindowsDeleteStringBuffer
WindowsDuplicateString
WindowsGetStringLen
WindowsGetStringRawBuffer
-WindowsInspectString
WindowsIsStringEmpty
WindowsPreallocateStringBuffer
WindowsPromoteStringBuffer

Also a removal.

Also not in any WindowsApp.lib.

diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
index 45ae728ba..8d70bd626 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
@@ -3,8 +3,7 @@ LIBRARY api-ms-win-crt-filesystem-l1-1-0
EXPORTS

_access
-; access is provided as an alias for __mingw_access
-; access == _access
+access == _access

Here we explicitly say that this is commented out, manually, for specific reasons. Please don't undo such things!

Yes, sorry about that. My script had fixes for some of them, but not all of them. My intention was to updated things for libwindowsapp.a. I didn't realize a lot of these are used for ucrt instead.

_access_s
_chdir
chdir == _chdir
@@ -12,12 +11,12 @@ _chdrive
_chmod
chmod == _chmod
_findclose
-_findfirst == _findfirst64
+_findfirst == _findfirst32

These are intentionally set to the 64 bit version, since our UCRT environments default to 64 bit time_t, iirc. Lots of similar changes below.

_fstat64i32
_fullpath
+_getcwd
+getcwd == _getcwd
+_getdcwd
_getdiskfree

These symbols are in api-ms-win-crt-stdio-l1-1-0.def already, are they duplicated in api-ms-win-crt-filesystem-l1-1-0.def now too?

Given these 2 DLLs are part of ucrt, I suppose a duplicate is not good there. So these duplicates should be reverted. Basically, anything that is not included in windowsapp should be reverted for now.

diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
index fd793fe82..344acd56e 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
@@ -18,13 +18,13 @@ _get_heap_handle
_heapchk
_heapmin
_heapwalk
-heapwalk == _heapwalk

This was a manually set up alias, don't remove.

_malloc_base
_msize
_query_new_handler
_query_new_mode
_realloc_base
_recalloc
+_resetstkoflw
_set_new_mode
calloc
free
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
index 86d22500b..9ae47af16 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
@@ -70,8 +70,7 @@ _mbbtombc
_mbbtombc_l
_mbbtype
_mbbtype_l
-; DATA added manually
-_mbcasemap DATA
+_mbcasemap

Another case of manual changes removed.

_mbccpy
_mbccpy_l
_mbccpy_s
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
index dafa456a5..a3ad9d75f 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
@@ -4,40 +4,23 @@ EXPORTS

_beep
_cwait
-cwait == _cwait
_execl
-execl == _execl
_execle
-execle == _execle
_execlp
-execlp == _execlp
_execlpe
-execlpe == _execlpe
_execv
-execv == _execv
_execve
-execve == _execve
_execvp
-execvp == _execvp
_execvpe
-execvpe == _execvpe
_loaddll
_spawnl
-spawnl == _spawnl
_spawnle
-spawnle == _spawnle
_spawnlp
-spawnlp == _spawnlp
_spawnlpe
-spawnlpe == _spawnlpe
_spawnv
-spawnv == _spawnv
_spawnve
-spawnve == _spawnve
_spawnvp
-spawnvp == _spawnvp
_spawnvpe
-spawnvpe == _spawnvpe

Lots of aliases are removed here.

_unloaddll
_wexecl
_wexecle
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
index d59859ced..460fd12ef 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
@@ -85,7 +85,6 @@ _getws_s
_isatty
isatty == _isatty
_kbhit
-kbhit == _kbhit
_locking
_lseek
lseek == _lseek
@@ -97,10 +96,8 @@ _open
open == _open
_open_osfhandle
_pclose
-pclose == _pclose
_pipe
_popen
-popen == _popen
_putc_nolock
_putw
putw == _putw
@@ -137,7 +134,6 @@ _wmktemp
_wmktemp_s
_wopen
_wpopen
-wpopen == _wpopen
_write
write == _write
_wsopen
@@ -179,6 +175,7 @@ getwc
getwchar
putc
putchar
+putenv
puts

putenv used to exist as an alias in api-ms-win-crt-environment-l1-1-0.def already. Is this right?

Correct.

putwc
putwchar
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def
index dcce58dbc..78c9d163c 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def
@@ -51,10 +51,7 @@ _strcoll_l
_strdup
strdup == _strdup
_stricmp
-_strcmpi == _stricmp
-strcmpi == _stricmp
stricmp == _stricmp
-strcasecmp == _stricmp
_stricmp_l
_stricoll
stricoll == _stricoll
@@ -67,8 +64,6 @@ _strlwr_s_l
_strncoll
_strncoll_l
_strnicmp
-strnicmp == _strnicmp
-strncasecmp == _strnicmp
_strnicmp_l
_strnicoll
_strnicoll_l
@@ -97,7 +92,6 @@ _wcsdup
wcsdup == _wcsdup
_wcsicmp
wcsicmp == _wcsicmp
-wcscmpi == _wcsicmp
_wcsicmp_l
_wcsicoll
wcsicoll == _wcsicoll
@@ -175,7 +169,7 @@ strncat_s
strncmp
strncpy
strncpy_s
-; strnlen replaced by emu
+strnlen
strpbrk
strspn
strtok
@@ -199,8 +193,7 @@ wcsncat_s
wcsncmp
wcsncpy
wcsncpy_s
-; We provide replacement implementation in libmingwex
-wcsnlen DATA
+wcsnlen
wcspbrk
wcsspn
wcstok
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
index 0e30b1127..a8c7114dd 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
@@ -12,21 +12,21 @@ _ctime64
_ctime64_s
_difftime32
_difftime64
-_ftime == _ftime64
+_ftime == _ftime32
_ftime32
_ftime32_s
_ftime64
_ftime64_s
-_futime == _futime64
+_futime == _futime32
_futime32
_futime64
_get_daylight
_get_dstbias
_get_timezone
_get_tzname
-_getsystime
_Getdays
_Getmonths
+_getsystime
_Gettnames
_gmtime32
_gmtime32_s
@@ -51,10 +51,8 @@ _time32
_time64
_timespec32_get
_timespec64_get
-; This is wrapped in the compat code.
-_tzset DATA
-_utime == _utime64
-utime == _utime64
+_tzset
+_utime == _utime32

Here we explicitly say that we intentionally don't expose _tzset here.

_utime32
_utime64
_W_Getdays
@@ -72,7 +70,7 @@ _wstrdate
_wstrdate_s
_wstrtime
_wstrtime_s
-_wutime == _wutime64
+_wutime == _wutime32
_wutime32
_wutime64
asctime
@@ -80,10 +78,3 @@ asctime_s
clock
strftime
wcsftime
-; These functions may satisfy configure scripts.
-ctime == _ctime64
-gmtime == _gmtime64
-localtime == _localtime64
-mktime == _mktime64
-time == _time64
-timespec_get == _timespec64_get

These were also added manually, for a reason.


I think it would be best to just revert all the changes to api-ms-win-crt-*.def done in this patch. Steve, if there are changes that you actually want to do to those files, please do it carefully manually.

I 100% agree. I didn't intend to impact ucrt at all.

// Martin

[1] https://learn.microsoft.com/en-us/windows/win32/api/winver/nf-winver-verfindfilew [2] https://github.com/MicrosoftDocs/sdk-api/blob/780ec86ec4992638894e184beed82690d84b0308/sdk-api-src/content/winver/nf-winver-verfindfilew.md?plain=1#L42


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to