[Mingw-w64-public] [PATCH] headers: Import wia.h from wine

2025-02-13 Thread Biswapriyo Nath
There is a `__wia_h__` macro check in wiadef.h. The new wia.h does not have that macro. I am not sure if the check should be removed in wiadef.h or be changed something else. Please feel free to change it as you like. Test case https://github.com/msys2/MINGW-packages/issues/17451 From 02bd0321d8388

[Mingw-w64-public] [PATCH] crt/fesetexceptflag: Fix MXCSR operation

2025-02-13 Thread LIU Hao
-- Best regards, LIU Hao From 8959c30982e0802fc3d12c9e1688145ac5708cf0 Mon Sep 17 00:00:00 2001 From: LIU Hao Date: Fri, 14 Feb 2025 10:57:36 +0800 Subject: [PATCH] crt/fesetexceptflag: Fix MXCSR operation It should set the exception bits, rather than the exception mask bits. Code on line 38-4

Re: [Mingw-w64-public] [PATCH 00/10] crt: dirent changes

2025-02-13 Thread Lasse Collin
On 2025-02-12 Martin Storsjö wrote: > (One could maybe even consider the struct to be a struct with an > unspecified length of the d_name field? That'd make it clearer to > callers that they'd better not try to allocate it themselves with a > static size.) This is the intention in POSIX. d_name ha

Re: [Mingw-w64-public] [PATCH 04/15] crt: Guard nested _CRT_INIT(DLL_PROCESS_DETACH) call for DLL builds

2025-02-13 Thread Pali Rohár
On Thursday 13 February 2025 14:16:06 Martin Storsjö wrote: > On Fri, 7 Feb 2025, Pali Rohár wrote: > > > This will report runtime error if _CRT_INIT(DLL_PROCESS_DETACH) is called > > by the current thread from some atexit_table hook. > > Btw, I forgot to ask; how would one practically do in orde

Re: [Mingw-w64-public] [PATCH 04/15] crt: Guard nested _CRT_INIT(DLL_PROCESS_DETACH) call for DLL builds

2025-02-13 Thread Pali Rohár
On Thursday 13 February 2025 14:10:44 Martin Storsjö wrote: > On Fri, 7 Feb 2025, Pali Rohár wrote: > > > This will report runtime error if _CRT_INIT(DLL_PROCESS_DETACH) is called > > by the current thread from some atexit_table hook. > > In which way will it report a runtime error? Do you mean t

Re: [Mingw-w64-public] [PATCH 11/15] crt: Remove usage of CRTDLL macro

2025-02-13 Thread Pali Rohár
On Thursday 13 February 2025 14:26:30 Martin Storsjö wrote: > On Fri, 7 Feb 2025, Pali Rohár wrote: > > > This macro is used only on few places in .c files, not in .h files. > > So remove its usage and dead code. > > --- > > mingw-w64-crt/crt/crtdll.c | 7 --- > > mingw-w64-crt/crt/crtexe.c

Re: [Mingw-w64-public] [PATCH] crt/delayimp: Make IAT temporarily writeable before modifying it

2025-02-13 Thread Jacek Caban
On 13.02.2025 11:17, Jacek Caban wrote: That’s unfortunate. If anyone has a better idea, please let me know. Ideally, I’d like to restore the previous behavior for delay load imports. Wine doesn’t use dlltool to create delay load import libraries; it generates them itself. In theory, this gives

Re: [Mingw-w64-public] [PATCH 15/15] crt: Remove DllEntryPoint from DLL builds

2025-02-13 Thread Martin Storsjö
On Fri, 7 Feb 2025, Pali Rohár wrote: Function with name DllEntryPoint is entry point of the DLL library, an alternative or aliased name to DllMainCRTStartup. So calling entry point (DllEntryPoint) from entry point (DllMainCRTStartup) is just wrong. Default DLL entry point function varies betwe

Re: [Mingw-w64-public] [PATCH 11/15] crt: Remove usage of CRTDLL macro

2025-02-13 Thread Martin Storsjö
On Fri, 7 Feb 2025, Pali Rohár wrote: This macro is used only on few places in .c files, not in .h files. So remove its usage and dead code. --- mingw-w64-crt/crt/crtdll.c | 7 --- mingw-w64-crt/crt/crtexe.c | 1 - mingw-w64-crt/crt/dll_argv.c | 4 mingw-w64-crt/crt/dllargv.c | 4

[Mingw-w64-public] fesetexceptflag enables floating point exception trapping

2025-02-13 Thread Luca Bacci
Consider the following code: test-fesetexceptflag.c: #include #include #include #include #pragma STDC FENV_ACCESS ON static void handle_signal (int sig) { printf ("SIGFPE\n"); _Exit (1); } int main() { fexcept_t fexcept; fegetexceptflag(&fexcept, FE_ALL_EXCE

Re: [Mingw-w64-public] [PATCH 04/15] crt: Guard nested _CRT_INIT(DLL_PROCESS_DETACH) call for DLL builds

2025-02-13 Thread Martin Storsjö
On Fri, 7 Feb 2025, Pali Rohár wrote: This will report runtime error if _CRT_INIT(DLL_PROCESS_DETACH) is called by the current thread from some atexit_table hook. Btw, I forgot to ask; how would one practically do in order to trigger this case? I know it's a kinda pathological case that one i

Re: [Mingw-w64-public] [PATCH 04/15] crt: Guard nested _CRT_INIT(DLL_PROCESS_DETACH) call for DLL builds

2025-02-13 Thread Martin Storsjö
On Fri, 7 Feb 2025, Pali Rohár wrote: This will report runtime error if _CRT_INIT(DLL_PROCESS_DETACH) is called by the current thread from some atexit_table hook. In which way will it report a runtime error? Do you mean the call to _amsg_exit(31), which gets called if (__native_startup_state

Re: [Mingw-w64-public] [PATCH] crt/delayimp: Make IAT temporarily writeable before modifying it

2025-02-13 Thread Jacek Caban
On 13.02.2025 12:01, LIU Hao wrote: 在 2025-02-13 18:17, Jacek Caban 写道: This isn't entirely true for other linkers. While those linkers do place .idata sections, including the IAT itself, in .rdata, they don’t use .idata sections for delay imports. Instead, they implement delay loading within

Re: [Mingw-w64-public] [PATCH] crt/delayimp: Make IAT temporarily writeable before modifying it

2025-02-13 Thread Martin Storsjö
On Thu, 13 Feb 2025, LIU Hao wrote: A writeable IAT is a conspicuous target for code injection. If MSVC makes it read-only, LLD makes it read-only, and there have been few issues with MSVC in practice (see the Old New Thing article), then there's no reason for us to not do that; do you agree?

Re: [Mingw-w64-public] [PATCH] crt/delayimp: Make IAT temporarily writeable before modifying it

2025-02-13 Thread LIU Hao
在 2025-02-13 18:17, Jacek Caban 写道: This isn't entirely true for other linkers. While those linkers do place .idata sections, including the IAT itself, in .rdata, they don’t use .idata sections for delay imports. Instead, they implement delay loading within the linker itself rather than relying

Re: [Mingw-w64-public] [PATCH] crt/delayimp: Make IAT temporarily writeable before modifying it

2025-02-13 Thread Jacek Caban
Hi, Thanks for looking into this. We probably need something like that in mingw-w64, but unfortunately, it's more complicated for Wine. On 11.02.2025 04:18, LIU Hao wrote: Since Binutils 2.44, the import address table (abbr. IAT) is now read-only, in alignment with Microsoft LINK and LLD. It