Commit Graph

7917 Commits

Author SHA1 Message Date
LIU Hao
b3be4c155a Revert "headers: use inline version of RtlSecureZeroMemory for UCRT builds"
This reverts commit 2a7e9255df.

Reference: https://sourceforge.net/p/mingw-w64/mailman/message/58812487/
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-04 11:40:10 +08:00
Pali Rohár
6a33003ead crt: Fix return value of IMAGE_TLS_CALLBACK functions and remove explicit pointer casting
Fixes compile warnings:

    crt/tlssup.c:104:53: warning: cast between incompatible function types from ‘BOOL (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ to ‘void (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ [-Wcast-function-type]
     const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback = (const PIMAGE_TLS_CALLBACK) __dyn_tls_init;
                                                         ^
    crt/tlssup.c:105:52: warning: cast between incompatible function types from ‘BOOL (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ to ‘void (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ [-Wcast-function-type]
     _CRTALLOC(".CRT$XLC") PIMAGE_TLS_CALLBACK __xl_c = (PIMAGE_TLS_CALLBACK) __dyn_tls_init;
                                                        ^
    crt/tlssup.c:171:52: warning: cast between incompatible function types from ‘BOOL (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ to ‘void (__attribute__((stdcall)) *)(void *, DWORD,  void *)’ [-Wcast-function-type]
     _CRTALLOC(".CRT$XLD") PIMAGE_TLS_CALLBACK __xl_d = (PIMAGE_TLS_CALLBACK) __dyn_tls_dtor;
                                                        ^

TLS callback function must return void, not BOOL.

`__dyn_tls_init` and `__dyn_tls_dtor` have external linkage in Microsoft UCRT.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-04 11:33:33 +08:00
Pali Rohár
1b554dec06 doc: ucrt-vs-msvcrt.txt: Update information about CRT options and links how to obtain UCRT
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-09-02 23:17:51 +03:00
LIU Hao
83429508ff crt: Regenerate Makefile.in
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-09-02 23:00:24 +08:00
Biswapriyo Nath
fd33149ac4 crt: Add new functions in wintrust import library
Required for https://sourceforge.net/p/mingw-w64/bugs/993/

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
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
Isuru Fernando
c6bf4bdf65 winpthreads: Include pthread_compat.h in sched.h
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-27 09:53:18 +08:00
Biswapriyo Nath
4cf86b8792 crt/libsrc: Enable scrnsave code
Required for https://sourceforge.net/p/mingw-w64/mailman/message/58809472/

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-26 10:14:43 +08:00
Martin Storsjö
b2bac2bb07 crt: Avoid using powf in UCRT on i386, temporarily
This reverts parts of 52c98b1273.

While powf indeed is available in UCRT on i386 too, it's missing
in Wine's i386 ucrtbase.dll (as of Wine 9.15). This probably stems
from the same mistake originally. (Most of the float math functions,
suffixed with -f, are unavailable in the i386 UCRT, but powf is
available.)

This was fixed in upstream Wine in commit
5393ba55464f3346bad7b98e11733348f2b64c6f, which will be part of
the upcoming Wine 9.16.

Thus, to allow built executables to run on current Wine versions,
avoid linking against this function, as a temporary workaround.

After a grace period, to let fixed versions of Wine become more
widely available, we can revert this, to link against powf
on i386 too.

At that point, we can stop including math/powf.c in src_ucrtbase32
in Makefile.am too.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-23 10:42:40 +03:00
Pali Rohár
121331cffd crt: Deduplicate symbols from ucrtbase.def.in and ucrtbased.def.in files into ucrtbase-common.def.in
List of symbols in ucrtbase.def.in and ucrtbased.def.in are very similar.
So move them into one common file ucrtbase-common.def.in and based on
DEF_DEBUG definition choose if the symbol list is for debug ucrtbased.dll
or release ucrtbase.dll library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:45:04 +03:00
Martin Storsjö
536d7e5d6c crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:19:20 +03:00
Pali Rohár
2c4efc3374 crt: Add import library for ucrtbased.dll
ucrtbased.dll is debug version of the ucrtbase.dll and provides additional
debugging functions.

Specify symbols for all 4 platforms: x86, x64, arm32, arm64.

All symbols in ucrtbase.dll are available also in ucrtbased.dll with one
exception for ARM64 version of ucrtbased.dll. It does not provide
__unDName, __unDNameEx and _is_exception_typeof symbols which are available
in non-debug version ucrtbase.dll.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
e0114c0cc1 crt: ucrtbase.def.in: Include symbols added after Windows 10 Anniversary Update
List of symbols should be now up-to-date with ucrtbase.dll version 10.0.26100.1.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
d0887fa24e crt: ucrtbase.def.in: Document which symbols were added in later ucrtbase.dll versions
This change just split symbols into two sections, it does not add or delete
any symbol.

It looks like that all newer versions of ucrtbase.dll do not change set of
symbols, they do not add any new or remove any existing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
c1533322d1 crt: ucrtbase.def.in: Remove comment about DATA for _mbcasemap
_mbcasemap is global variable, not function. So it has to be marked with
DATA, not just manually.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
ff3837006e crt: Update comment about UCRT _HUGE in crt-aliases.def.in
Since commit 527522b8b0 _HUGE variable is provided by math/_huge.c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
c323fc1fac crt: Move two UCRT aliases from ucrtbase.def.in to crt-aliases.def.in
In file crt-aliases.def.in are defined all UCRT symbol aliases except two.
Move those two remaning.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
d60d431d26 crt: ucrtbase.def.in: Fix ARM64 symbols
__intrinsic_setjmp and _set_FMA3_enable are not available, but _local_unwind is.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
78969c62a9 crt: ucrtbase.def.in: Add missing ARM32 symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
52c98b1273 crt: ucrtbase.def.in: Fix symbols not available on I386 and X64
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Pali Rohár
96f33f701b crt: UCRT __dcrt_initial_narrow_environment is global variable
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-19 23:14:53 +03:00
Biswapriyo Nath
7a6c241e46 include: Add new DebugSystemObjects4 interface in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Biswapriyo Nath
fc03403f74 include: Add new DebugRegisters2 interface in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Biswapriyo Nath
91d3c26477 include: Add new DebugDataSpaces4 interface in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Biswapriyo Nath
4a2cbfaca0 include: Add new DebugPlmClient interfaces in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Biswapriyo Nath
cb910bb502 include: Add new DebugAdvanced interfaces in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:52:20 +08:00
Pali Rohár
a20b17848e crt: Fix profil.c compile warning: cast between incompatible function types
profile/profil.c:140:36: warning: cast between incompatible function types from ‘void (__attribute__((stdcall)) *)(void *)’ to ‘DWORD (__attribute__((stdcall)) *)(void *)’ [-Wcast-function-type]

Callback thread function must return DWORD, not void.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:26:03 +08:00
Rafael Kitover
5d453b075b headers: Disable conflicting OLE methods on Cygwin
On inclusion of the header `comutil.h` on Cygwin platforms errors such
as:

include/comutil.h:413:3: error: '_variant_t::_variant_t(unsigned int)' cannot be overloaded with '_variant_t::_variant_t(unsigned int)'

, are produced because on Cygwin some methods are duplicates via a type
alias.

Disable these methods under `__CYGWIN__`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-13 22:11:01 +08:00
Martin Storsjö
167b4f97cb crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 23:15:38 +03:00
Pali Rohár
27945804fa crt: Split UCRT at_quick_exit() into separate file
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 23:15:33 +03:00
Pali Rohár
3d84b7e11d crt: Split UCRT _onexit() into separate file
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 23:15:13 +03:00
Pali Rohár
040ab170f2 crt: Split UCRT _getmainargs() and _wgetmainargs() functions into separate files
Every executable references only one of those functions. So if functions
are split into separate files, linker includes only the one which is used.

Replace magic numbers 2 and 1 for DoWildCard by the named enum values.

Remove check for NULL value of StartInfo because StartInfo cannot be NULL.
MS implementation of _(w)getmainargs() requires StartInfo to be valid
pointer and mingw-w64 startup code always calls _(w)getmainargs() with
non-NULL StartInfo.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 23:14:48 +03:00
Pali Rohár
9c7ff03518 headers: Declare missing UCRT corecrt_startup.h functions
These missing functions are available in MS UCRT corecrt_startup.h header file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 23:14:00 +03:00
Pali Rohár
f2893d4904 headers: Fix new.h to work also in C mode
UCRT <new.h> header file exports C functions not only in C++ mode, but also
in C mode. Do same in mingw-w64 <new.h> header file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 23:14:00 +03:00
Martin Storsjö
eea00c0087 headers: Fix nesting of version guards around SyntheticPointer APIs
If the user has hardcoded WINVER to a version number less than
0x0602, while _WIN32_WINNT is set to 0xA00, and NTDDI_VERSION
is larger than NTDDI_WIN10_RS3, we would earlier hide the
definition of POINTER_INPUT_TYPE, but include the declarations
of functions that take a POINTER_INPUT_TYPE parameter,
leading to errors.

Since 6cfc1fd2ca, we would set
NTDDI_VERSION to a higher version, if _WIN32_WINNT is set to 0xA00,
exposing this issue.

Change the nesting of ifdefs; include the block for checking
NTDDI_VERSION in the outer scope checking for WINVER >= 0x602.
That way, if they are set inconsistently, we'd skip the
declaration of the SyntheticPointer functions.

This matches how the ifdefs around these declarations are nested
in WinSDK.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 22:47:02 +03:00
Biswapriyo Nath
039ff2e4cc include: Add new DebugSymbols interfaces in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-12 22:47:47 +08:00
Biswapriyo Nath
c37b1cd205 include: Add new DebugControl interfaces in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-12 22:47:47 +08:00
Biswapriyo Nath
aa30600399 include: Add new DebugClient interfaces in dbgeng.h
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2024-08-12 22:47:47 +08:00
Martin Storsjö
ce76be04c8 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 11:12:52 +03:00
Pali Rohár
78358b77da crt: Move non-startup files out of the mingw-w64-crt/crt/ directory
mingw-w64-crt/crt/ contains mostly startup files which are part of the
libmingw32.a library or crtX.o object files. But there are also few files
which are either part of libmingwex.a or some CRT import library.

Do cleanup of these few files which are not in libmingw32.a or crtX.o and
move them from mingw-w64-crt/crt/ to mingw-w64-crt/misc/ directory.

So after this change mingw-w64-crt/crt/ will contain only source code for
startup files which are part of the libmingw32.a library or crtX.o object
files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 11:11:10 +03:00
Martin Storsjö
ccffe2276e headers: Indent the preprocessor directives around setting NTDDI_VERSION
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-12 11:08:37 +03:00
Martin Storsjö
8704184f6e crt: Remove leftover DATA marking for wcsnlen in api-ms-win-crt-string-l1-1-0.def
This was missed in 6b28ca10e2.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-10 07:18:34 +03:00
Martin Storsjö
ab8816efa4 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:40:36 +03:00
Pali Rohár
d2b3213753 crt: Add import library for vcruntime140d.dll
It looks like that vcruntime140d.dll has same set of symbols as vcruntime140.dll.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:40:03 +03:00
Pali Rohár
2874018356 crt: Add import library for vcruntime140.dll
List of symbols is generated from I386, X64, ARM32 and ARM64 versions
of vcruntime140.dll library by gendef and merged to one def.in file.

All versions 14.00 - 14.40 of vcruntime140.dll for specific architecture
contains same set of symbols.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:40:03 +03:00
Pali Rohár
fc8f453e67 crt: vcruntime140_app.def.in: Use F_NON_ARM64 for __intrinsic_setjmp
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:40:03 +03:00
Martin Storsjö
3fa78e9669 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:21:22 +03:00
Pali Rohár
5277a007a4 crt: Access errno directly instead of _get_errno/_set_errno functions
Functions _get_errno() and _set_errno() are not available before msvcr80.
mingw-w64 provides emulations of these functions for older msvcr libraries.
But there is no reason to use emulations, just access errno directly which
is implemented as dereferncing return value of _errno() function (which is
available in all CRT libraries).

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:20:46 +03:00
Pali Rohár
f25a200297 crt: Split mingw-w64 _get_errno and _set_errno implementations into separate files
Before this change linker had to statically bundle both _get_errno and
_set_errno functions when only one of them was used. With this change
linker includes only one function if just one is used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:20:46 +03:00
Martin Storsjö
2f63d213c4 crt: Regenerate Makefile.in
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-08-09 14:14:48 +03:00