在 2025-12-26 07:33, Pali Rohár 写道:
diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index 90304061ca78..105e9c20f54b 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -89,26 +94,11 @@ int WinMainCRTStartup (void)
      .Handler = __mingw_SEH_error_handler,
    };
    __writefsdword (0, (DWORD)&exception_record); /* register SEH handler */
-#endif
-  int ret = 255;
-#ifdef SEH_INLINE_ASM
-  asm ("\t.l_startw:\n");
+#elif defined(SEH_INLINE_ASM)
+  asm volatile (".seh_handler %p0, " ASM_EXCEPT :: "i" 
(__mingw_SEH_error_handler)); /* applies for the whole function */

This name should be hard-coded in the assembly string. Clang doesn't seem to support `%p` modifier with an `i` input: https://gcc.godbolt.org/z/7shcoGMWq

When you want to use a modifier in inline assembly, please do also test Clang. It's a much more risky area where occasionally wrong results can happen.



--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to