[PATCH] Cygwin: aarch64 SEH fixes and handler refactoring

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Mar 25 18:59:44 GMT 2026


Hi Thirumalai,

On Mar 24 12:42, Thirumalai Nagalingam wrote:
> In-lined patch:
> [...]
> diff --git a/winsup/cygwin/local_includes/exception.h b/winsup/cygwin/local_includes/exception.h
> index 19bb109de..b26f8ba17 100644
> --- a/winsup/cygwin/local_includes/exception.h
> +++ b/winsup/cygwin/local_includes/exception.h
> @@ -10,8 +10,19 @@ details. */
> 
>  #if defined (__aarch64__)
>  #define EXCEPTION_HANDLE_REF "_ZN9exception6handleEP17_EXCEPTION_RECORDPvP8_CONTEXTP25_DISPATCHER_CONTEXT_ARM64"
> - #else
> +#define EXCEPTION_HANDLER_DATA
> +#else
>  #define EXCEPTION_HANDLE_REF "_ZN9exception6handleEP17_EXCEPTION_RECORDPvP8_CONTEXTP19_DISPATCHER_CONTEXT"
> +#define EXCEPTION_HANDLER_DATA \
> +  asm volatile ("\n\
> +  1:                                                                   \n\
> +    .seh_handler "                                                       \
> +      EXCEPTION_HANDLE_REF ",                                            \
> +      @except                                                          \n\
> +    .seh_handlerdata                                                   \n\
> +    .long 1                                                            \n\
> +    .rva 1b, 2f, 2f, 2f                                                        \n\
> +    .seh_code                                                          \n")
>  #endif

This, I don't understand and looks wrong to me.

For aarch64, you're defining EXCEPTION_HANDLER_DATA as an empty macro.
EXCEPTION_HANDLE_REF is exclusively referenced from this macro, so given
it's empty, EXCEPTION_HANDLE_REF is entirely unused on aarch64.

Isn't there a non-empty definition for EXCEPTION_HANDLER_DATA on aarch64
missing from this patch?


Thanks,
Corinna


More information about the Cygwin-patches mailing list