This matches what was done in 9718ecee1b95297b789b75a0be51bfd5905bcdcd for crt/crtexe.c. The .seh_handlerdata directive forces writing the .xdata entry immediately. On aarch64, the length of the function gets fixed at that point, and if the .seh_handlerdata directive is emitted too soon, it won't cover the function region where it's supposed to catch unwinds.
Signed-off-by: Martin Storsjö <[email protected]> --- mingw-w64-libraries/winpthreads/src/thread.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index e3edbae8a..62d0f4b56 100644 --- a/mingw-w64-libraries/winpthreads/src/thread.c +++ b/mingw-w64-libraries/winpthreads/src/thread.c @@ -1520,19 +1520,19 @@ pthread_create_wrapper (void *args) intptr_t trslt = (intptr_t) 128; /* Provide to this thread a default exception handler. */ #ifdef __SEH__ - asm ("\t.tl_start:\n" + asm ("\t.tl_start:\n"); + #endif /* Call function and save return value */ + pthread_mutex_unlock (&mtx_pthr_locked); + if (tv->func) + trslt = (intptr_t) tv->func(tv->ret_arg); + #ifdef __SEH__ + asm ("\tnop\n\t.tl_end: nop\n" "\t.seh_handler __C_specific_handler, @except\n" "\t.seh_handlerdata\n" "\t.long 1\n" "\t.rva .tl_start, .tl_end, _gnu_exception_handler ,.tl_end\n" "\t.text" ); - #endif /* Call function and save return value */ - pthread_mutex_unlock (&mtx_pthr_locked); - if (tv->func) - trslt = (intptr_t) tv->func(tv->ret_arg); - #ifdef __SEH__ - asm ("\tnop\n\t.tl_end: nop\n"); #endif pthread_mutex_lock (&mtx_pthr_locked); tv->ret_arg = (void*) trslt; -- 2.25.1 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
