Commit Graph

444 Commits

Author SHA1 Message Date
Biswapriyo Nath
dda4c5537f crt: Add winbrand import library
Fixes https://github.com/mingw-w64/mingw-w64/issues/63

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-10-13 19:19:00 +08:00
Pali Rohár
e36d0410e8 crt: Fix _onexit() function for DLL builds
MS documentation for _onexit function says:

  In the case when _onexit is called from within a DLL, routines registered
  with _onexit run when the DLL is unloaded, after DllMain is called with
  DLL_PROCESS_DETACH.

And for this functionality msvc statically links _onexit functionality for
DLL builds, and do not let applications to use msvcrt.dll's _onexit symbol
directly.

Fix this issue in mingw-w64 by redefining _onexit function to calls private
mingw-w64 atexit() function, which already distinguish between EXE and DLL
builds. Include this _onexit function into every CRT import library and
disable original _onexit symbol in all def files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-28 00:05:36 +03:00
Pali Rohár
37a5ac28da crt: Fix atexit() function for every import library
mingw-w64 startup code already provides its own atexit() functions.
Implementation for DLL and EXE builds differs because version for DLL
builds has to be called at the time when unloading DLL library whereas
version for EXE builds is called at process termination. DLL version of
atexit() stores atexit's function pointers into own table which is called
from DLL unload hook. EXE version just calls CRT's _onexit() function.

Some msvcrt def files provide atexit function symbol without DATA keyword,
which is than exported from msvcrt import library. And so it conflicts with
the atexit symbol from startup file and makes atexit function unusable.

UCRT libraries do not have this problem because they provide atexit
function under different name _crt_atexit.

Fix msvcrt symbol conflicts by renaming atexit function to _crt_atexit in
every CRT def file. This will ensure compatibility with UCRT and also that
applications would call atexit function from mingw-w64 startup file and not
from CRT import library.

Also change atexit implementation in exe startup file to directly call
_crt_atexit() function instead of _onexit(). This will simplify usage as
UCRT does not have _onexit() function (mingw-w64 provides only _onexit
wrapper around _crt_atexit) and msvcrt's atexit() function (renamed to
_crt_atexit() in def file) is doing same thing as msvcrt _onexit().

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
2024-09-11 00:13:30 +02:00
Biswapriyo Nath
b1ee648aa5 crt: Move wintrust to lib-common
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-02 22:59:54 +08:00
Marc-André Lureau
9f6cadc68f crt: Add bcryptprimitives.def for x86
Makefile.in regeneration not included, per request.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-07-28 20:12:06 +08:00
Pali Rohár
09c8ca1e1a crt: Add import library for msvcr110d.dll
msvcr110d.dll is debug version of the msvcr110.dll and provides additional
debugging functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-22 16:03:17 +03:00
Pali Rohár
c69cd03f47 crt: Add import library for msvcr100d.dll
msvcr100d.dll is debug version of the msvcr100.dll and provides additional
debugging functions.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-07-22 16:03:17 +03:00
Pali Rohár
b706fb8900 crt: msvcr120*.def.in: Don't provide long double _strtold_l and _wcstold_l functions on x86
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:50:15 +03:00
Pali Rohár
64b6736dc4 crt: Do not include nextafter symbol alias for msvcr120* and UCRT
msvcr120 and UCRT provides native nextafter symbol. So do not define
duplicate symbol nextafter via crt-aliases.def.in file for these import
libraries.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:25 +03:00
Pali Rohár
3d3c1bf04a crt: msvcr120*.def.in: Don't provide long double functions for x86
Long double type for msvc is 64-bit but for gcc it is 80-bit.
So these long double functions are not compatible with gcc.
Comment them in all msvcr120 def files for x86 platform.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:25 +03:00
Pali Rohár
701946a5cc crt: msvcr120*.def.in: Add missing nextafter symbol
All msvcr120 DLL libraries provides C99 nextafter() function. i386
msvcr120d.def.in already contains it. In other def files it is missing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:25 +03:00
Pali Rohár
ec070e49c9 crt: msvcr110.def.in: Add symbols introduced in Visual C++ 2012 Update 1
Visual C++ 2012 Update 1 introduced new symbols. Append them at the end of
def files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:24 +03:00
Pali Rohár
48313a6c73 crt: msvcr100.def.in: Make MSVCR100.dll library name upper case
Export name is upper case in the original Visual C++ library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:24 +03:00
Pali Rohár
bccadd27ae crt: msvcr90.def.in: Make MSVCR90.dll library name upper case
Export name is upper case in the original Visual C++ library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:24 +03:00
Pali Rohár
49172b600d crt: Fix some function symbols in msvcr90.def.in and msvcr100.def.in files
Following symbols represents functions. So remove DATA keyword from them.

__report_gsfailure
_byteswap_uint64
_byteswap_ulong
_byteswap_ushort
_get_errno
_rotl64
_rotr64
_set_errno
btowc
mbrlen
mbrtowc
mbsrtowcs
strnlen
wcrtomb
wcsnlen
wcsrtombs
wctob

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:24 +03:00
Pali Rohár
8436ad5f79 crt: Move $I10_OUTPUT symbol out of the C++ mangled section in lib64 def.in files
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-26 15:27:24 +03:00
Pali Rohár
0edff2af86 crt: Fix _wctype definitions in def files
_wctype is global variable exported from DLL library, so mark it with
DATA and removes false-positive function stdcall @size decoration.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-06-15 00:07:24 +03: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
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
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
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
57833c3b0b crt: Include msvcrt-common.def.in after declaring all library symbols
File msvcrt-common.def.in adds just symbol aliases, so include it in CRT
def files after having all symbols declared.

Note that some def files use macros from func.def.in file,
so include func.def.in at beginning of the file when needed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-20 23:15:07 +03:00
Pali Rohár
b463875615 crt: Move find, stat and time aliases to def-include/msvcrt-common.def.in
Add 4 new macros FIXED_SIZE_SYMBOLS, NO_I64_FIXED_SIZE,
NO_FIXED_SIZE_64_ALIAS and NO_TIME_ALIAS to distinguish
between different crt versions.

This change adds new symbol aliases which were missing.
There is no symbol change or removal.

For reference here is list of changes between individual outputs from:

  cpp -x c $FILE -Wp,-w -undef -P -Imingw-w64-crt/def-include -D$PLAT | sed -E 's/\s*;.*//' | LC_ALL=C sort -u

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-08 17:50:51 +03:00
Pali Rohár
2104ad77b0 crt: msvcr120 and UCRT: Fix 64 bit _(w)findfirst and _(w)findnext symbol aliases
These symbols on 64 bit should resolve to _findfirst64i32/_findnext64i32
functions, like in other CRT libraries and header files.

The UCRT 32 bit aliases are kept as they were before (even if
they are known to be incorrect); they are corrected in a separate
later commit.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-08 17:50:50 +03:00
Pali Rohár
2d63c96653 crt: msvcr90d.def.in: Fix X64 ctime symbol alias to use 64-bit time_t
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-05-08 17:50:50 +03:00
Pali Rohár
e34877e10b crt: Move strto[u]ll(_l)/strto[iu]max(_l) aliases to def-include/msvcrt-common.def.in
Define symbol aliases based on a new WITH_STRTO64_ALIAS and
WITH_STRTO64_L_ALIAS macros.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
eec0b9444e crt: Move imaxdiv alias to def-include/msvcrt-common.def.in
Define imaxdiv alias based on a new WITH_IMAXDIV_ALIAS macro.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
926e8674d0 crt: Move llabs and imaxabs aliases to def-include/msvcrt-common.def.in
Define llabs and imaxabs aliases based on a new WITH_LLABS_ALIAS and
WITH_IMAXABS_ALIAS macros.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
ca85c88e29 crt: Move _atoi64 and _atoi64_l aliases to def-include/msvcrt-common.def.in
Define _atoi64 and _atoi64_l aliases based on a new WITH_ATOLL_ALIAS and
WITH_ATOLL_L_ALIAS macros.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
b159b8647b crt: Move _strcmpi alias to def-include/msvcrt-common.def.in
Define _strcmpi alias based on a new NO_STRCMPI_ALIAS macro.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
82312bcf4a crt: Move __ms_* symbol aliases to def-include/msvcrt-common.def.in
def-include/msvcrt-common.def.in is included into every msvcr*.def.in file.
So move them all common __ms_* symbol aliases which removes definition
duplication.

msvcr* library before version 8.0 have symbols swprintf/vswprintf which
represents pre-C95 variants of these functions without maxlen argument.
Since version 8.0, symbols swprintf/vswprintf are not present anymore,
they were renamed and have have leading underscore.

Distinguish aliased symbol by a new PRE_C95_SWPRINTF macro in .def.in file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
fa1485a35b crt: Remove _fgetc_nolock symbol alias
Symbol _fgetc_nolock is provided via mingw-w64-crt/stdio/_getc_nolock.c

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
42f8faf1d5 crt: Remove _getwc_nolock symbol alias
Symbol _getwc_nolock is provided via mingw-w64-crt/stdio/_getwc_nolock.c

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
1206778c36 crt: Remove duplicate symbol alises for strlwr and wcslwr
These aliases are automatically added by including msvcrt-common.def.in
file into every msvcr*.def.in file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-25 13:55:30 +03:00
Pali Rohár
153965f33b crt: msvcr80.def.in: Sort symbols as are in original def file and document SP1 version
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-19 10:24:07 +03:00
Pali Rohár
4c98a538c3 crt: msvcr80.def.in: Define X64 pow and powf as DATA
In all other msvcr* versions is X64 pow and powf defined as DATA. Do it
also in msvcr80.def.in.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-19 00:25:33 +03:00
Pali Rohár
90bc2fcd42 crt: msvcr80.def.in: Remove symbols not present in msvcr80.dll library
Symbols __p__fileinfo, _ctype, _fileinfo, _ftime, _futime, _mbscat,
_mbscpy, _mbsdup, _strcmpi, _utime, _wutime, difftime, swprintf, vswprintf,
__buffer_overrun, __security_error_handler, __set_buffer_overrun_handler,
_set_security_error_handler and _wctype are not present in any variant of
msvcr80.dll library. So they are not usable in the current form.

Symbols _ftime, _futime, _utime, _wutime, difftime and _strcmpi can be
defined as aliases to other existing symbols. For I386 time functions is
used 32-bit time_t, for X64 time functions is used 64-bit time_t, like in
other msvcr*.dll libraries.

Functions swprintf() and vswprintf() have already replacement inline
variants defined in header file <swprintf.inl>.

Functions __ms_swprintf() and __ms_vswprintf() are defined without size_t
argument, which corresponds to msvcr80.dll's _swprintf() and _vswprintf()
functions. So add appropriate aliases.

But remaining symbols __p__fileinfo, _ctype, _fileinfo, _mbscat, _mbscpy,
_mbsdup and _wctype do not have replacement, so completely remove them from
msvcr80.def.in files.

Also I386 symbols __buffer_overrun, __security_error_handler,
__set_buffer_overrun_handler and _set_security_error_handler do not have
any replacement, so remove them too.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-19 00:25:33 +03:00
Pali Rohár
e0426704cc crt: msvcr80.def.in: Import all symbols from Visual C++ 2005 SP1
All symbols are extracted from the latest version of msvcr80.dll library
which is Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package
MFC Security Update available for download at page:
https://www.microsoft.com/download/details.aspx?id=26347

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-19 00:25:32 +03:00
Pali Rohár
fd02fef827 crt: msvcr80.def.in: Fix X64 C++ symbols
It looks like that lib64/msvcr80.def.in file contains X64 C++ symbols not
from the msvcr80.dll library but from the Windows XP x64 msvcrt.dll
library. X64 version of msvcrt.dll and msvcr80.dll have different C++
symbols but relatively same set of C symbols.

Replace incorrect X64 C++ symbols in lib64/msvcr80.def.in file by the
correct symbols from Visual C++ 2005 SP1 X64 msvcr80.dll library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-04-19 00:25:32 +03:00
Pali Rohár
5a28a0560c crt: Do not export DllMain from def files
Trying to use or link DllMain symbol from some random system DLL library is
in most cases a mistake. So hide all DllMain definitions from all def files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-02 22:57:10 +02:00
Pali Rohár
e0a38b59e9 crt: Do not export DllEntryPoint from def files
If application does not specify its own DllEntryPoint function then the
default DllEntryPoint provided by libmingwex library should be used. And
not from some random system DLL library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-02 22:57:10 +02:00
Mark Harmstone
ffe9d251d6 crt: Add onecoreuap_apiset
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-16 10:48:53 +02:00
Mark Harmstone
56805a5985 crt: Add wsmsvc to all architectures
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-01-16 10:25:46 +02:00
Mark Harmstone
8164cfd647 crt: Add xinputuap
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-12-12 22:07:44 +08:00
Mark Harmstone
7f76103759 crt: Add coremessaging
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-12-12 22:07:44 +08:00
Mark Harmstone
2801fb7236 crt: Add windows.networking for all architectures
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-12-12 22:07:43 +08:00
Mark Harmstone
66f693e452 crt: Add windows.data.pdf for all architectures
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-12-12 22:07:43 +08:00
Mark Harmstone
7b77f735f1 crt: Add rometadata for all architectures
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-12-12 22:07:43 +08:00
Mark Harmstone
e76de61d34 crt: Add windows.ai.machinelearning
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-12-12 22:07:42 +08:00
Mark Harmstone
b021d60c45 crt: Add inkobjcore
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2023-12-12 22:07:42 +08:00