This reverts commit 8c2c00ef898f36d51613b45c2cab4f4448d35f0b.

These functions can unwind to the current frame, in which case they effectively 
return.
Therefore, they should not be marked as noreturn. Use __builtin_unreachable in 
the
ARM64EC longjmp implementation instead.

Fixes https://gitlab.winehq.org/mono/wine-mono/-/merge_requests/30.
---
 mingw-w64-crt/misc/arm64ec/longjmp.c |  1 +
 mingw-w64-headers/include/winnt.h    | 10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/mingw-w64-crt/misc/arm64ec/longjmp.c 
b/mingw-w64-crt/misc/arm64ec/longjmp.c
index 8510fdae9..4ad0435e0 100644
--- a/mingw-w64-crt/misc/arm64ec/longjmp.c
+++ b/mingw-w64-crt/misc/arm64ec/longjmp.c
@@ -25,6 +25,7 @@ void __cdecl longjmp( jmp_buf b, int retval )
     rec.NumberParameters = 1;
     rec.ExceptionInformation[0] = (DWORD_PTR)buf;
     RtlUnwind( (void *)buf->Frame, (void *)buf->Rip, &rec, IntToPtr(retval) );
+    __builtin_unreachable();
 }
 
 void (__cdecl *__MINGW_IMP_SYMBOL(longjmp))( jmp_buf b, int retval ) = longjmp;
diff --git a/mingw-w64-headers/include/winnt.h 
b/mingw-w64-headers/include/winnt.h
index 9e57bb100..38b4d4f38 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -9140,27 +9140,27 @@ 
DEFINE_ENUM_FLAG_OPERATORS(JOB_OBJECT_IO_RATE_CONTROL_FLAGS)
 #endif
 
 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
-    NTSYSAPI VOID NTAPI __MINGW_ATTRIB_NORETURN RtlUnwind (PVOID TargetFrame, 
PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue);
+    NTSYSAPI VOID NTAPI RtlUnwind (PVOID TargetFrame, PVOID TargetIp, 
PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue);
     NTSYSAPI PVOID NTAPI RtlPcToFileHeader (PVOID PcValue, PVOID *BaseOfImage);
 #if defined (__x86_64__)
     NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (DWORD64 
ControlPc, PDWORD64 ImageBase, PUNWIND_HISTORY_TABLE HistoryTable);
-    NTSYSAPI VOID NTAPI __MINGW_ATTRIB_NORETURN RtlUnwindEx (PVOID 
TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID 
ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable);
+    NTSYSAPI VOID NTAPI RtlUnwindEx (PVOID TargetFrame, PVOID TargetIp, 
PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, 
PUNWIND_HISTORY_TABLE HistoryTable);
     NTSYSAPI PEXCEPTION_ROUTINE NTAPI RtlVirtualUnwind (DWORD HandlerType, 
DWORD64 ImageBase, DWORD64 ControlPc, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT 
ContextRecord, PVOID *HandlerData, PDWORD64 EstablisherFrame, 
PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
     NTSYSAPI BOOLEAN NTAPI RtlIsEcCode(DWORD64 CodePointer);
 #endif
 #if defined (__arm__)
     NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (ULONG_PTR 
ControlPc, PDWORD ImageBase, PUNWIND_HISTORY_TABLE HistoryTable);
-    NTSYSAPI VOID NTAPI __MINGW_ATTRIB_NORETURN RtlUnwindEx (PVOID 
TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID 
ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable);
+    NTSYSAPI VOID NTAPI RtlUnwindEx (PVOID TargetFrame, PVOID TargetIp, 
PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, 
PUNWIND_HISTORY_TABLE HistoryTable);
     NTSYSAPI PEXCEPTION_ROUTINE NTAPI RtlVirtualUnwind (DWORD HandlerType, 
DWORD ImageBase, DWORD ControlPc, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT 
ContextRecord, PVOID *HandlerData, PDWORD EstablisherFrame, 
PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
 #endif
 #if defined (__aarch64__)
     NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (ULONG_PTR 
ControlPc, PULONG_PTR ImageBase, PUNWIND_HISTORY_TABLE HistoryTable);
-    NTSYSAPI VOID NTAPI __MINGW_ATTRIB_NORETURN RtlUnwindEx (PVOID 
TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID 
ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable);
+    NTSYSAPI VOID NTAPI RtlUnwindEx (PVOID TargetFrame, PVOID TargetIp, 
PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, 
PUNWIND_HISTORY_TABLE HistoryTable);
     NTSYSAPI PEXCEPTION_ROUTINE NTAPI RtlVirtualUnwind (DWORD HandlerType, 
ULONG_PTR ImageBase, ULONG_PTR ControlPc, PRUNTIME_FUNCTION FunctionEntry, 
PCONTEXT ContextRecord, PVOID *HandlerData, PULONG_PTR EstablisherFrame, 
PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
 #endif
 #if defined (__ia64__)
     NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (ULONGLONG 
ControlPc, PULONGLONG ImageBase, PULONGLONG TargetGp);
-    NTSYSAPI VOID NTAPI __MINGW_ATTRIB_NORETURN RtlUnwindEx (FRAME_POINTERS 
TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID 
ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable);
+    NTSYSAPI VOID NTAPI RtlUnwindEx (FRAME_POINTERS TargetFrame, PVOID 
TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT 
ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable);
     NTSYSAPI ULONGLONG NTAPI RtlVirtualUnwind (ULONGLONG ImageBase, ULONGLONG 
ControlPc, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN 
InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS 
ContextPointers);
 #endif
 #endif
-- 
2.49.0



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to