[Mingw-w64-public] [PATCH v3 3/3] crt: Add ARM64EC setjmp and longjmp implementation

2025-04-23 Thread Jacek Caban
Based on Wine code by Alexandre Julliard. --- mingw-w64-crt/Makefile.am| 8 +- mingw-w64-crt/misc/arm64ec/longjmp.c | 30 mingw-w64-crt/misc/arm64ec/setjmp.c | 106 +++ mingw-w64-crt/misc/longjmp.S | 2 + mingw-w64-crt/misc/setjmp.S

[Mingw-w64-public] [PATCH v3 2/3] headers: Mark RtlUnwind* functions as noreturn

2025-04-23 Thread Jacek Caban
--- mingw-w64-headers/include/winnt.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h index 7da4c40d8..4d920fdbd 100644 --- a/mingw-w64-headers/include/winnt.h +++ b/mingw-w64-headers/include/winn

[Mingw-w64-public] [PATCH v3 1/3] headers: Use __builtin_sponentry for setjmp when available.

2025-04-23 Thread Jacek Caban
Instead of for specific architectures. Fixes setjmp on ARM64EC. --- mingw-w64-headers/crt/setjmp.h | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mingw-w64-headers/crt/setjmp.h b/mingw-w64-headers/crt/setjmp.h index 2dc7d8739..11d736492 100644 --- a/

Re: [Mingw-w64-public] [PATCH 3/3] crt: Build __guard_dispatch_icall_dummy on ARM64EC

2025-04-23 Thread Jacek Caban
On 23.04.2025 19:30, Martin Storsjö wrote: So, I agree with the direction here; this patch also is fine. Thanks! Pushed, thanks! Jacek ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/l

Re: [Mingw-w64-public] [PATCH v2 1/2] headers: Use __builtin_sponentry for setjmp when available.

2025-04-23 Thread Jacek Caban
On 23.04.2025 18:50, Martin Storsjö wrote: On Wed, 23 Apr 2025, Martin Storsjö wrote: On Wed, 23 Apr 2025, Jacek Caban wrote: Instead of for specific architectures. Fixes setjmp on ARM64EC. --- v2: Reorder checks to simplify the code a bit. We could probably simplify it further by removing

Re: [Mingw-w64-public] [PATCH v2 2/2] crt: Add ARM64EC setjmp and longjmp implementation

2025-04-23 Thread Jacek Caban
On 23.04.2025 18:57, Martin Storsjö wrote: On Wed, 23 Apr 2025, Jacek Caban wrote: Based on Wine code by Alexandre Julliard. --- v2: - extended a comment about unwinding entry thunk in setjmp - __imp_ symbol more consistent with the codebase - added a local RtlUnwind declaration with __MINGW_AT

Re: [Mingw-w64-public] [PATCH 3/3] crt: Build __guard_dispatch_icall_dummy on ARM64EC

2025-04-23 Thread Martin Storsjö
On Wed, 23 Apr 2025, Jacek Caban wrote: On 22.04.2025 17:38, Martin Storsjö wrote: On Sat, 12 Apr 2025, Jacek Caban wrote: --- There's an alternative way to handle this, see: https://github.com/llvm/llvm-project/pull/135280 It would work in this case, but I'm not convinced it's the right

Re: [Mingw-w64-public] [PATCH 1/3] crt: Build scanf.S as an x86_64 object on ARM64EC

2025-04-23 Thread Martin Storsjö
On Wed, 23 Apr 2025, Jacek Caban wrote: On 22.04.2025 17:21, Martin Storsjö wrote: On Sat, 12 Apr 2025, Jacek Caban wrote: A proper ARM64EC implementation would be tricky, as it would need to handle a different calling convention and possibly use exit thunks for imported functions. Instead,

Re: [Mingw-w64-public] [PATCH v2 2/2] crt: Add ARM64EC setjmp and longjmp implementation

2025-04-23 Thread Martin Storsjö
On Wed, 23 Apr 2025, Jacek Caban wrote: Based on Wine code by Alexandre Julliard. --- v2: - extended a comment about unwinding entry thunk in setjmp - __imp_ symbol more consistent with the codebase - added a local RtlUnwind declaration with __MINGW_ATTRIB_NORETURN to avoid -Winvalid-noreturn w

Re: [Mingw-w64-public] [PATCH 2/2] crt: Add ARM64EC setjmp and longjmp implementation

2025-04-23 Thread Martin Storsjö
On Tue, 22 Apr 2025, Jacek Caban wrote: +    memcpy( &context.Xmm6, &buf->Xmm6, 10 * sizeof(context.Xmm6) ); +    unwind_one_frame( &context ); +    if (!RtlIsEcCode( context.Rip ))  /* caller is x64, use its context instead of the ARM one */ +    { +    buf->Rbx = context.Rbx; +    bu

Re: [Mingw-w64-public] [PATCH v2 1/2] headers: Use __builtin_sponentry for setjmp when available.

2025-04-23 Thread Martin Storsjö
On Wed, 23 Apr 2025, Martin Storsjö wrote: On Wed, 23 Apr 2025, Jacek Caban wrote: Instead of for specific architectures. Fixes setjmp on ARM64EC. --- v2: Reorder checks to simplify the code a bit. We could probably simplify it further by removing defined(__SEH__) checks. mingw-w64-headers/

Re: [Mingw-w64-public] [PATCH v2 1/2] headers: Use __builtin_sponentry for setjmp when available.

2025-04-23 Thread Martin Storsjö
On Wed, 23 Apr 2025, Jacek Caban wrote: Instead of for specific architectures. Fixes setjmp on ARM64EC. --- v2: Reorder checks to simplify the code a bit. We could probably simplify it further by removing defined(__SEH__) checks. mingw-w64-headers/crt/setjmp.h | 16 +++- 1 file chan

Re: [Mingw-w64-public] [PATCH 3/3] crt: Build __guard_dispatch_icall_dummy on ARM64EC

2025-04-23 Thread Jacek Caban
On 22.04.2025 17:38, Martin Storsjö wrote: On Sat, 12 Apr 2025, Jacek Caban wrote: --- There's an alternative way to handle this, see: https://github.com/llvm/llvm-project/pull/135280 It would work in this case, but I'm not convinced it's the right approach overall. While extending the ass

Re: [Mingw-w64-public] [PATCH 1/3] crt: Build scanf.S as an x86_64 object on ARM64EC

2025-04-23 Thread Jacek Caban
On 22.04.2025 17:21, Martin Storsjö wrote: On Sat, 12 Apr 2025, Jacek Caban wrote: A proper ARM64EC implementation would be tricky, as it would need to handle a different calling convention and possibly use exit thunks for imported functions. Instead, we can simply use the x86_64 version. ---

[Mingw-w64-public] [PATCH v2 1/2] headers: Use __builtin_sponentry for setjmp when available.

2025-04-23 Thread Jacek Caban
Instead of for specific architectures. Fixes setjmp on ARM64EC. --- v2: Reorder checks to simplify the code a bit. We could probably simplify it further by removing defined(__SEH__) checks. mingw-w64-headers/crt/setjmp.h | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) dif

[Mingw-w64-public] [PATCH v2 2/2] crt: Add ARM64EC setjmp and longjmp implementation

2025-04-23 Thread Jacek Caban
Based on Wine code by Alexandre Julliard. --- v2: - extended a comment about unwinding entry thunk in setjmp - __imp_ symbol more consistent with the codebase - added a local RtlUnwind declaration with __MINGW_ATTRIB_NORETURN to avoid -Winvalid-noreturn warning mingw-w64-crt/Makefile.am