crt: Replace amd64 mingw_getsp by inline gcc compound expression

Function mingw_getsp() is currently used only for amd64 builds in setjmp.h
when using older gcc or clang version. Replace it by the inline gcc
compound expression which takes current value of "rsp" register.
And then remove the unused function mingw_getsp.

Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index f08d80e..dc4ae03 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1307,7 +1307,6 @@
   \
   misc/arm64ec/__mingw_mxcsr_to_fpcsr.c \
   misc/mingw_longjmp.S \
-  misc/mingw_getsp.S \
   misc/alarm.c \
   misc/delay-f.c         misc/delay-n.c         \
   misc/delayimp.c        misc/dirent.c          \
diff --git a/mingw-w64-crt/misc/mingw_getsp.S b/mingw-w64-crt/misc/mingw_getsp.S
deleted file mode 100644
index 08dfc37..0000000
--- a/mingw-w64-crt/misc/mingw_getsp.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-#include <_mingw_mac.h>
-
-	.file	"mingw_getsp.S"
-	.text
-#ifdef _WIN64
-	.align 8
-#else
-	.align 4
-#endif
-	.globl __MINGW_USYMBOL(mingw_getsp)
-	.def	__MINGW_USYMBOL(mingw_getsp);	.scl	2;	.type	32;	.endef
-__MINGW_USYMBOL(mingw_getsp):
-#if defined(_ARM64_) || defined(__aarch64__) || defined(__arm64ec__)
-	mov	x0, sp
-	ret
-#elif defined(_AMD64_) || defined(__x86_64__)
-	leaq  8(%rsp),%rax
-	ret
-#elif defined(_X86_) || defined(__i386__)
-	lea	4(%esp),%eax
-	ret
-#elif defined(_ARM_) || defined(__arm__)
-	mov	r0, sp
-	bx	lr
-#endif
diff --git a/mingw-w64-headers/crt/setjmp.h b/mingw-w64-headers/crt/setjmp.h
index e768a26..65921b1 100644
--- a/mingw-w64-headers/crt/setjmp.h
+++ b/mingw-w64-headers/crt/setjmp.h
@@ -206,8 +206,6 @@
 __MINGW_ATTRIB_NORETURN __attribute__ ((__nothrow__)) void __cdecl __mingw_longjmp(jmp_buf _Buf, int _Value);
 #endif
 
-void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp (void);
-
 _CRT_END_C_HEADER
 
 #endif /* _INC_SETJMP */
@@ -227,13 +225,13 @@
 #    if (defined(__GNUC__) && __GNUC__ >= 14) || (defined(__clang__) && __clang_major__ >= 22)
 #      define setjmp(BUF) _setjmpex((BUF), __builtin_stack_address())
 #    else
-#      define setjmp(BUF) _setjmpex((BUF), mingw_getsp())
+#      define setjmp(BUF) _setjmpex((BUF), __MINGW_EXTENSION ({ register void *__mingw_rsp __asm__("rsp"); __asm__("" : "=r"(__mingw_rsp)); __mingw_rsp; }))
 #    endif
 #  elif defined(__SEH__) && !defined(__USE_MINGW_SETJMP_NON_SEH)
 #    if (defined(__GNUC__) && __GNUC__ >= 14) || (defined(__clang__) && __clang_major__ >= 22)
 #      define setjmp(BUF) _setjmp((BUF), __builtin_stack_address())
 #    else
-#      define setjmp(BUF) _setjmp((BUF), mingw_getsp())
+#      define setjmp(BUF) _setjmp((BUF), __MINGW_EXTENSION ({ register void *__mingw_rsp __asm__("rsp"); __asm__("" : "=r"(__mingw_rsp)); __mingw_rsp; }))
 #    endif
 #  else
 #    define setjmp(BUF) _setjmp((BUF), NULL)