Commit Graph

7553 Commits

Author SHA1 Message Date
Biswapriyo Nath
5fb9146b88 headers: Add new names in WHV_CAPABILITY_CODE in winhvplatformdefs.h
Existent enumerators have been updated a little to prevent a trailing comma.

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-12 22:52:56 +08:00
Biswapriyo Nath
4a2b747dc3 headers: Add new members in WHV_REGISTER_VALUE in winhvplatformdefs.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-12 22:13:19 +08:00
LIU Hao
74875157b0 crt/math: Reveal more names
This commit reveals names in three categories:

1) Names that start with an underscore and a letter in uppercase are reserved
   for implementations. These can be revealed even with strict standard
   conformance.

2) Names that start with an underscore and a letter in lowercase are reserved
   for implementations in file scopes (i.e. they are not eligible for macros).
   These can be revealed even with strict standard conformance.

3) Some names reference POSIX functions. These are revealed when a POSIX, GNU
   or BSD feature test macro is defined.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-12 22:13:18 +08:00
Biswapriyo Nath
55ced9c1c9 headers: Add aarch64 condition in WHV_DELIVERABILITY_NOTIFICATIONS_REGISTER in winhvplatformdefs.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-10 17:17:06 +08:00
Biswapriyo Nath
ef7c648a02 headers: Add new names in WHV_X64_PENDING_EVENT_TYPE in winhvplatformdefs.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-10 17:17:03 +08:00
Biswapriyo Nath
95a72435e5 headers: Add WHV_REGISTER_NAME for aarch64 in winhvplatformdefs.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-10 17:17:01 +08:00
Biswapriyo Nath
56f2a58850 headers: Add new names in WHV_REGISTER_NAME in winhvplatformdefs.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-10 17:16:55 +08:00
LIU Hao
96a45e3196 crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-06 22:56:38 +08:00
Biswapriyo Nath
611e7b6fdd crt: Unify winhvplatform.def for lib64 and libarm64
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-06 22:55:45 +08:00
Martin Storsjö
f97814b960 headers: Add new constants for IsProcessorFeaturePresent from WinSDK 10.0.26100
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-06 10:47:10 +03:00
Biswapriyo Nath
f977e1c382 headers: Add missing NTDDI_WIN10* defines
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-05 21:55:44 +08:00
Martin Storsjö
386fc6b04a headers: Fix the order of asm() and attribute((deprecated())) in time.h
This fixes build errors with GCC, after
e5ac8c5509cd729b97065733cf4b0df0ec732797; GCC doesn't accept
__asm__(), expanded from __MINGW_ASM_CALL(), after
__attribute__((deprecated())), while Clang accepts both orders.

By default, __MINGW_ATTRIB_DEPRECATED_SEC_WARN doesn't expand
to anything, but if built with defines that makes this expand to
a deprecation attribute, the build would fail with GCC.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-05 10:44:42 +03:00
Biswapriyo Nath
921d142f8e crt: Add new symbols in hyperv compute import libs
From cdf0e097290c4ca4fa21c2a136281d2e3b38db36 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Mon, 3 Jun 2024 06:43:03 +0000
Subject: [PATCH 2/2] crt: Add new symbols in hyperv compute import libs

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-04 22:07:12 +08:00
Biswapriyo Nath
4ad55c4393 headers: Add new symbols in hyperv compute headers
From 323e43aa70b0a3d7e8b1b42650b5a769337ab679 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Mon, 3 Jun 2024 06:40:09 +0000
Subject: [PATCH 1/2] headers: Add new symbols in hyperv compute headers

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-06-04 22:07:12 +08:00
Pali Rohár
633a8340de crt: Add guards in func.def.in file
Add once-guard to ensure that the file is processed only once.

Add arch-guard to ensure that DEF_<ARCH> is always defined to prevent an
issue that symbols defined via F32() macro completely disappeared and which
was fixed in previous change.

This change applied before the previous change cause compile errors.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-04 15:36:43 +03:00
Martin Storsjö
a94d694161 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-04 15:36:43 +03:00
Pali Rohár
93f81148ec crt: Preprocess all .def.in files with -DDEF_<ARCH>
Having -DDEF_<ARCH> is required by func.def.in which is used either
directly or indirectly by crt-aliases.def.in in all CRT def.in files.
Some symbols in crt-aliases.def.in are defined via F* macros and these
symbols are currently missing in versioned non-os msvcrt import libraries.

This change is fixing missing symbols in all CRT import libraries.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-04 15:35:37 +03:00
Pali Rohár
297146f1b7 crt: Declare aliased __MINGW_IMP_SYMBOL symbols via __attribute__((alias))
Currently __MINGW_IMP_SYMBOL symbols for aliased functions are defined as
a new plain global variable, just like for an original function.

GCC supports declaring global variable as an alias to other global
variable.

Change all aliases of import __MINGW_IMP_SYMBOL symbols via alias
attribute. This reduce memory usage as original symbol and aliased symbol
will share same global variable. Also it makes it clear that the aliased
import symbol is an alias to another import symbol.

Note that aliased symbol has to be declared with "extern" keyword even it
is not extern and gcc will emit this symbol (as described in documentation).

So for example:

  int var_non_alias = 1;
  int var_target = 2;
  extern int __attribute__ ((alias ("var_target"))) var_alias;

Emits symbols:

  SYMBOL TABLE:
  [  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x00000000 test.c
  File
  [  2](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
  AUX scnlen 0x0 nreloc 0 nlnno 0
  [  4](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
  AUX scnlen 0x8 nreloc 0 nlnno 0
  [  6](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
  AUX scnlen 0x0 nreloc 0 nlnno 0
  [  8](sec  4)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .rdata$zzz
  AUX scnlen 0x1e nreloc 0 nlnno 0
  [ 10](sec  2)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _var_non_alias
  [ 11](sec  2)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000004 _var_target
  [ 12](sec  2)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000004 _var_alias

  Contents of section .data:
   0000 01000000 02000000                    ........

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-04 15:32:59 +03:00
Pali Rohár
1e141bf8a1 crt: Move __uncaught_exception symbol out of the C++ mangled symbol section in all .def.in files
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:29:52 +03:00
Martin Storsjö
efbc4ffa51 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:28:28 +03:00
Pali Rohár
69a9944aef crt: Add import library for msvcr80d.dll
msvcr80d.dll is debug version of the msvcr80.dll and provides additional
debugging functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:27:29 +03:00
Martin Storsjö
1983edeafe crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:20 +03:00
Pali Rohár
fd242b3ae4 crt: crtdll.dll and msvcrt10.dll: Fix linking of the WinMain() function
WinMain() entry point provided by the application is called by mingw-w64
startup code, more precisely by function main() from crtexewin.c file.

mingw-w64 startup code in file crtexewin.c calls _ismbblead() function.
Function _ismbblead() is not available in some versions of crtdll.dll
and is completely missing in msvcrt10.dll library.

Version of crtdll.dll library stored in its PE resource directory is not
meaningful as two different libraries, one with _ismbblead symbol and one
without _ismbblead symbol has same version.

Seems that there are MBCS aware crtdll.dll versions with _ismbblead symbol
and versions which are not MBCS aware without _ismbblead symbol.

All checked msvcrt10.dll files do not have _ismbblead symbols, so
msvcrt10.dll is not MBCS awre.

For msvcrt10.dll import library provides simple dummy _ismbblead() function
which always returns false to satisfy mingw-w64 startup file crtexewin.c.

For crtdll.dll import library provides _ismbblead() wrapper function and
disable the real function in the def file to prevent symbol conflicts. The
wrapper function via GetProcAddress() checks if the real crtdll.dll
provides _ismbblead() function. If real function exists then it is called.
If not then wrapper function returns false like the msvcrt10.dll one.

This fixes linking WinMain() entry point with msvcrt10.dll.

  ld: /usr/local/lib/libmingw32.a(lib32_libmingw32_a-crtexewin.o): in function `main':
  mingw-w64/mingw-w64-crt/crt/crtexewin.c:43: undefined reference to `_ismbblead'
  collect2: error: ld returned 1 exit status

And fixes runtime error about missing _ismbblead symbol with some versions of crtdll.dll.

  Entry Point Not Found
  The procedure entry point _ismbblead could not be located in the
  dynamic link library CRTDLL.dll.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:19 +03:00
Martin Storsjö
6bddd5f9f1 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:19 +03:00
Pali Rohár
dace1a16b2 crt: msvcrt20: Fix calling __getmainargs() and __wgetmainargs() functions
API for __getmainargs() and __wgetmainargs() functions in msvcrt20.dll is
slightly different than in new msvcrt versions. In msvcrt20.dll these
functions return void and take new_mode parameter instead of the pointer to
the _startupinfo structure.

So for compatibility with mingw-w64 startup code, in msvcrt20 import
library rename exported __getmainargs/__wgetmainargs symbols to
__msvcrt20_getmainargs/__msvcrt20_wgetmainargs and provide mingw-w64
compatible wrappers named __getmainargs/__wgetmainargs around the
renamed symbols __msvcrt20_getmainargs/__msvcrt20_wgetmainargs.

See wine implementation for details:
https://gitlab.winehq.org/wine/wine/-/blob/wine-9.8/dlls/msvcrt20/msvcrt20.c
7f1e74a97a

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:19 +03:00
Martin Storsjö
afb559847d crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:19 +03:00
Pali Rohár
81557b004b crt: msvcrt10: Fix calling __getmainargs() function
API for __getmainargs() function in msvcrt10.dll is same as __GetMainArgs()
function in crtdll.dll. It is slightly different than in any other msvcrt
versions. It returns void and does not the pointer to the _startupinfo
structure as a last argument.

So for compatibility with mingw-w64 startup code, in msvcrt10 import
library rename the real __getmainargs symbol to __GetMainArgs and use
mingw-w64 crtdll.dll's wrapper __getmainargs around the __GetMainArgs for
providing the compatible __getmainargs() function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:19 +03:00
Martin Storsjö
2b4df01c65 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:19 +03:00
Pali Rohár
3a3dd8d178 crt: crtdll.dll: Rename crtdll_compat.c to crtdll_getmainargs.c
Filename crtdll_getmainargs.c better describe which function it provides.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:18 +03:00
Pali Rohár
db856f3073 crt: crtdll.dll: Define __GetMainArgs with _CRTIMP as the function is being imported
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:19:18 +03:00
Pali Rohár
18eb7fc2fa crt: Add missing __cdecl decoration for functions: mbrtowc mbsrtowcs mbrlen wcrtomb wcsrtombs
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-03 14:14:16 +03:00
Pali Rohár
561a057ceb crt: Document why the stat symbol alias is not used
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-30 15:52:48 +03:00
Martin Storsjö
f571c7f6d1 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-30 15:52:48 +03:00
Pali Rohár
c0f0630982 crt: Provide fstat function symbol via alias
For 32-bit time_t (detected by _USE_32BIT_TIME_T), functions _fstat32(),
_fstat() and fstat() are same. So fstat() can be defined as simple alias
in def file.

Same applies for functions _fstat64i32(), _fstat() and fstat() when time_t
is 64-bit.

Simplify fstat() function, remove it from mingw-w64-crt/stdio/_fstat.c file
and provide it via aliases in api-ms-win-crt-filesystem-l1-1-0.def.in and
crt-aliases.def.in for all CRT import libraries.

This fixes FIXME issue described in the fstat.c.

This change also ensures that fstat and _fstat symbols would results in the
same function calls.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-30 15:52:48 +03:00
Pali Rohár
4f9685299a headers: Fix *stat* macros in _mingw_stat64.h header file
All CRT import libraries provides UCRT-compatible *stat* symbols since
commit b463875615.

So define all stat* macros consistently with definitions of aliases in def
files based on UCRT. There is no need to have ifdef for non-UCRT version
anymore.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-30 15:52:48 +03:00
Martin Storsjö
cc6afd4919 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-29 23:49:08 +03:00
Pali Rohár
a38f376a5a crt: Add import library for msvcr71d.dll
msvcr71d.dll is debug version of the msvcr71.dll and provides additional
debugging functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-29 23:48:15 +03:00
Pali Rohár
d886427be8 crt: Add import library for msvcr70d.dll
msvcr70d.dll is debug version of the msvcr70.dll and provides additional
debugging functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-29 23:48:15 +03:00
Pali Rohár
4537b940c1 crt: Add import library for msvcrtd.dll
msvcrtd.dll is debug version of the Visual C++ 4.2, 5.x and 6.x msvcrt.dll
library and provides additional debugging functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-29 23:48:15 +03:00
Pali Rohár
4ca3182f6b crt: Add import library for msvcr40d.dll
msvcr40d.dll is debug version of the msvcrt40.dll and provides additional
debugging functions.

msvcr40d.def.in def file was generated by gendef from the original
msvcr40d.dll library version and modified with same changes (mostly
documentation) which were done to the msvcrt40.def.in def file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-29 23:48:15 +03:00
Pali Rohár
fd9f9b0d07 crt: getopt: Use argv[0] from getopt function argument instead from the global __argv[] array
getopt* functions receive also argv[0] argument. So use it for printing
program name instead of the global __argv[0] variable.

This avoids using and importing of the __argv[] DATA symbol from the linked
CRT library, as it is not needed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-29 16:01:02 +03:00
Jonathan Yong
dc42231f03 _mingw_mac.h: bump to 13.x
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2024-05-29 02:40:37 +00:00
Martin Storsjö
819a6ec2ea crt: Avoid warnings about ucrt _scprintf/_snprintf/_snscanf missing a prototype
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-22 10:07:14 +03:00
Pali Rohár
cff4b8fda1 crt: msvcrt.def.in: Move arch-specific comments in #ifdef sections
So comments unrelated to processing architecture would be dropped by preprocessor.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:16:26 +03:00
Pali Rohár
63252791b0 crt: msvcrt.def.in: Add comments about first X64 and ARM32 msvcrt.dll versions
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:16:26 +03:00
Pali Rohár
5f4833b66a crt: msvcrt.def.in: Fix definitions of _ctype and _mbcasemap symbols
Both symbols refers to global variable, not the function. So mark them with
DATA for all platforms. gendef detects that _mbcasemap is DATA for all I386
versions of msvcrt.dll (Visual C++ 5.0, 6.0, Win9x, 2000, XP, ... up to 10).
But gendef since Windows XP version of msvcrt.dll cannot autodetect that
_ctype is DATA symbol.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:16:26 +03:00
Pali Rohár
85e4f0727d crt: Rename msvcrt-common.def.in to crt-aliases.def.in
This file contains definitions of symbol aliases for any CRT library. It is
already used by msvcrt, crtdll and ucrt. So rename msvcrt-common.def.in to
crt-aliases.def.in as new name better match the purpose of the file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:16:26 +03:00
Pali Rohár
c503977c30 crt: Move C11 symbol alias timespec_get to def-include/msvcrt-common.def.in
Other symbol aliases for ISO C functions are already in msvcrt-common.def.in.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:16:26 +03:00
Pali Rohár
a9d687b211 crt: Move ARM long double symbol aliases to def-include/msvcrt-common.def.in
Deduplicate aliases from msvcrt.def.in and ucrtbase.def.in to
def-include/msvcrt-common.def.in.

Note that powl alias was defined only in ucrtbase.def.in, so do not define
it for non-UCRT builds.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:16:26 +03:00
Pali Rohár
99e78b9bd2 crt: Fix DATA aliases for crtdll.dll
crtdll.dll library has some DATA symbols with _dll suffix.
Fix generating aliases for these symbols.

With this change also document why those symbols are not for UCRTBASE.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:15:55 +03:00