On 5/11/26 13:02, LIU Hao wrote:
在 2026-5-11 19:54, Jonathan Yong 写道:
---
  gcc/config/i386/cygming.h                     |  6 ++-
  .../g++.target/i386/seh-sysvabi-wrap1.C       | 50 +++++++++++++++++++
  2 files changed, 55 insertions(+), 1 deletion(-)
  create mode 100644 gcc/testsuite/g++.target/i386/seh-sysvabi-wrap1.C

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 6e5a301aee..c32f228044 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -26,7 +26,11 @@ along with GCC; see the file COPYING3.  If not see
  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
  #undef TARGET_SEH
-#define TARGET_SEH  (TARGET_64BIT_MS_ABI && flag_unwind_tables)
+/* Win64 uses SEH unwind metadata regardless of whether an individual
+  function is compiled with the default MS ABI or with sysv_abi.  Keep
                                                             ^~~~~~~~
nitpick: "SysV ABI"


+  SEH enabled for all 64-bit Windows functions whenever unwind tables are
+  requested so .seh_proc state stays consistent with EH emission.  */
+#define TARGET_SEH  (TARGET_64BIT && flag_unwind_tables)
  #undef PREFERRED_STACK_BOUNDARY_DEFAULT
  #define PREFERRED_STACK_BOUNDARY_DEFAULT \

This change looks to me.

SEH works in the particular case of SysV ABI, as the non-volatile registers are a subset of those in MS ABI and can be encoded in SEH unwinding data.



Thanks for the patch and review, pushed to master branch.

Reply via email to