On Tuesday 10 November 2026 22:38:15 LIU Hao wrote:
> 在 2026-11-10 22:07, Pali Rohár 写道:
> > > The other is that libucrtapp.a doesn't have `_longjmpex`. I see there are
> > > already patches in this series for ucrtapp, so you may have a look and try
> > > fixing that.
> > 
> > In later commits in this my series which I sent is already a patch which
> > adds _longjmpex implementation for ucrtapp. So libucrtapp.a will have it
> > and there is also CI test for ucrtapp in later changes which verifies it.
> 
> I see. However patch 18 'crt: Change amd64, arm32 and arm64 longjmp()'
> deletes longjmp.S, rendering all changes temporary. I'll try checking 13-17
> in first.

The i386 _longjmpex function for ucrtapp is in the '[PATCH 16/25] crt:
Provide msvcrt/UCRT compatible longjmp and  _longjmpex symbols for i386
ucrtapp builds'.

But you are right that for fixing non-i386 longjmp in ucrtapp is needed
'[PATCH 18/25] crt: Change amd64, arm32 and arm64 longjmp()
implementation for ucrtapp builds' which depends on previous changes.

> Patch 13 reuses parts of `_setjmp3`. There's an issue that it pops the
> argument for dllimport'd `_setjmp` from the stack into ECX, which doesn't
> conform to the ABI; the argument is considered destroyed after a function
> returns. That specific hunk should look like
> 
>  #if defined(__i386__)
>  __MINGW_USYMBOL(_setjmp3):
> +#ifdef I386_SETJMP3_ONLY
> +        /* local setjmp_common function is not being compiled, and we have 
> only CRT _setjmp function */
> +        /* _setjmp always inspects SEH try_level and we will overwrite 
> jmp_buf.TryLevel below if needed */
> +        pushl   4(%esp)
> +        calll   *__MINGW_USYMBOL(__MINGW_IMP_SYMBOL(_setjmp))
> +        addl    $4,%esp
> +        movl    4(%esp),%ecx         /* jmp_buf */

I see. I originally thought that the passed arguments on the stack are
not going to be overwritten. Which is not truth. So the %ecx needs to be
from the 4(%esp) as you wrote above.

> +#else
>          /* edx == -1 -> setjmp_common will NOT inspect SEH try_level */
>          /* edx != -1 -> setjmp_common will inspect SEH try_level */
>          /* Do not inspect SEH try_level when _Count >= 2 -> means that
> try_level is provided as _TryLevel param */
> @@ -71,6 +83,7 @@ __MINGW_USYMBOL(_setjmp3):
>          pushl   4(%esp)
>          calll   __MINGW_LSYMBOL(setjmp_common)
>          popl    %ecx                 /* jmp_buf */
> +#endif
> 
> I'll look into the remaining changes tomorrow.


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to