The default setjmp/longjmp functions on arm/aarch64 require working SEH unwinding.
The tests that were failing (cancel3, cancel5 and cancel6a) trigger the "Dangerous asynchronous cancelling" codepath in pthread_cancel, which SuspendThread/SetThreadContext/ResumeThread to force the other thread to run _pthread_invoke_cancel. This probably leaves the stack and link registers in an unexpected state where unwinding doesn't work. Set a define that makes setjmp.h use the non-SEH versions of setjmp/longjmp. This fixes a few pthread_cancel tests on arm/aarch64 that were failing on some OS versions before. (Although on some OS versions, these tests did succeed.) Signed-off-by: Martin Storsjö <[email protected]> --- mingw-w64-libraries/winpthreads/src/thread.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index c0b36bb1f..195a8ed9d 100644 --- a/mingw-w64-libraries/winpthreads/src/thread.c +++ b/mingw-w64-libraries/winpthreads/src/thread.c @@ -20,6 +20,14 @@ DEALINGS IN THE SOFTWARE. */ +#if defined(__arm__) || defined(__aarch64__) +/* We use setjmp/longjmp through asynchronous function calls via + * SetThreadContext below. This makes unwinding from longjmp not + * work reliably; therefore use a version of setjmp/longjmp that doesn't + * rely on SEH. */ +#define __USE_MINGW_SETJMP_NON_SEH +#endif + #ifdef HAVE_CONFIG_H #include "config.h" #endif -- 2.43.0 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
