Module: wine Branch: master Commit: 4a138da761160da3fb4d5e98ed5f6de0aa1e6270 URL: https://gitlab.winehq.org/wine/wine/-/commit/4a138da761160da3fb4d5e98ed5f6de...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Dec 4 12:57:48 2023 +0100
configure: Require SEH support for PE builds.
---
configure | 49 ++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 13 ++++++++++++ dlls/ntdll/signal_x86_64.c | 6 +++--- include/wine/asm.h | 13 ++---------- 4 files changed, 67 insertions(+), 14 deletions(-)
diff --git a/configure b/configure index 718b0dd777c..9219276d336 100755 --- a/configure +++ b/configure @@ -10819,6 +10819,55 @@ printf "%s\n" "$res" >&6; } as_fn_append ${wine_arch}_CC " $res" ;; esac
+ if test "x$wine_arch" = xi386 +then : + +else $as_nop + as_wine_cv_seh_support=`printf "%s\n" "ac_cv_${wine_arch}_seh_support" | $as_tr_sh` + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports SEH directives" >&5 +printf %s "checking whether $CC supports SEH directives... " >&6; } +if eval test ${$as_wine_cv_seh_support+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +asm(".text\nac_test:\t.seh_proc ac_test\n\tnop\n\t.seh_stackalloc 16\n\t.seh_endprologue\n\t.seh_endproc"); +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$as_wine_cv_seh_support=yes" +else $as_nop + eval "$as_wine_cv_seh_support=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=$$as_wine_cv_seh_support + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval res=$$as_wine_cv_seh_support + + if test "x$res" = xyes +then : + +else $as_nop + if test ${enable_archs+y} +then : + as_fn_error $? "The $wine_arch cross-compiler doesn't support SEH directives. +This is an error since --enable-archs=$wine_arch was requested." "$LINENO" 5 +fi + continue +fi +fi + as_fn_append PE_ARCHS " $wine_arch" { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-fno-strict-aliasing" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-strict-aliasing" >&5 diff --git a/configure.ac b/configure.ac index 47918e4bd18..26bcc3f6c21 100644 --- a/configure.ac +++ b/configure.ac @@ -954,6 +954,19 @@ This is an error since --enable-archs=$wine_arch was requested.])]) AS_VAR_APPEND([${wine_arch}_CC],[" $res"]) ;; esac
+ AS_VAR_IF([wine_arch],[i386],[], + [AS_VAR_PUSHDEF([wine_cv_seh_support],[ac_cv_${wine_arch}_seh_support]) + AC_CACHE_CHECK([whether $CC supports SEH directives], wine_cv_seh_support, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\nac_test:\t.seh_proc ac_test\n\tnop\n\t.seh_stackalloc 16\n\t.seh_endprologue\n\t.seh_endproc");]])], + [AS_VAR_SET([wine_cv_seh_support],[yes])],[AS_VAR_SET([wine_cv_seh_support],[no])])) + AS_VAR_COPY([res],[wine_cv_seh_support]) + AS_VAR_POPDEF([wine_cv_seh_support]) + AS_VAR_IF([res],[yes],[], + [AS_VAR_SET_IF([enable_archs], + [AC_MSG_ERROR([The $wine_arch cross-compiler doesn't support SEH directives. +This is an error since --enable-archs=$wine_arch was requested.])]) + continue])]) + AS_VAR_APPEND([PE_ARCHS],[" $wine_arch"]) WINE_TRY_PE_CFLAGS([-fno-strict-aliasing]) dnl clang needs to be told to fail on unknown options diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index ceb9d948f67..379d011bf88 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -369,7 +369,7 @@ DWORD __cdecl nested_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTR /*********************************************************************** * exception_handler_call_wrapper */ -#ifdef __ASM_SEH_SUPPORTED +#ifdef __WINE_PE_BUILD DWORD WINAPI exception_handler_call_wrapper( EXCEPTION_RECORD *rec, void *frame, CONTEXT *context, DISPATCHER_CONTEXT *dispatch );
@@ -1077,7 +1077,7 @@ DWORD __cdecl unwind_exception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTR /*********************************************************************** * unwind_handler_call_wrapper */ -#ifdef __ASM_SEH_SUPPORTED +#ifdef __WINE_PE_BUILD DWORD WINAPI unwind_handler_call_wrapper( EXCEPTION_RECORD *rec, void *frame, CONTEXT *context, DISPATCHER_CONTEXT *dispatch );
@@ -1666,7 +1666,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, /*********************************************************************** * RtlUserThreadStart (NTDLL.@) */ -#ifdef __ASM_SEH_SUPPORTED +#ifdef __WINE_PE_BUILD __ASM_GLOBAL_FUNC( RtlUserThreadStart, "subq $0x28,%rsp\n\t" ".seh_stackalloc 0x28\n\t" diff --git a/include/wine/asm.h b/include/wine/asm.h index 41c469a5436..0fa2dfcd1b7 100644 --- a/include/wine/asm.h +++ b/include/wine/asm.h @@ -45,17 +45,8 @@ # define __ASM_EHABI(str) #endif
-#if defined(__SEH__) || (defined(_MSC_VER) && defined(__clang__) && (defined(__x86_64__) || defined(__aarch64__))) -# if defined(__aarch64__) && defined(__clang_major__) && (__clang_major__ < 12 || defined(__apple_build_version__)) - /* Clang got support for aarch64 SEH assembly directives in Clang 12, - * before that, only .seh_startproc/.seh_endproc but nothing else was - * supported. Support for it doesn't exist in any Apple branded version - * of Clang yet. */ -# define __ASM_SEH(str) -# else -# define __ASM_SEH(str) str -# define __ASM_SEH_SUPPORTED -# endif +#if defined(__WINE_PE_BUILD) && !defined(__i386__) +# define __ASM_SEH(str) str #else # define __ASM_SEH(str) #endif