sdl2-compat: fix mingw link failures due to missing __chkstk_ms:

From 4e8a012f4b5bf4bf9de4802abf50438ce227e017 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 31 Jan 2024 22:40:50 +0300
Subject: [PATCH] fix mingw link failures due to missing __chkstk_ms:

remove x86 limitation from linkage to libgcc or clang_rt
---
 CMakeLists.txt | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0b6a7b..3237cdc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -312,12 +312,13 @@ if(MINGW)
     if(SDL_CPU_X86)
       target_link_libraries(SDL2 PRIVATE clang_rt.builtins-i386)
     endif()
-  else()
-    if(SDL_CPU_X86 OR SDL_CPU_ARM32)
-      # 32-bit architectures need libgcc for emulating 64-bit operations (e.g. 64-bit division)
-      target_link_libraries(SDL2 PRIVATE gcc)
-      set_property(TARGET SDL2 APPEND_STRING PROPERTY LINK_FALGS " -static-libgcc")
+    if(SDL_CPU_X64)
+      target_link_libraries(SDL2 PRIVATE clang_rt.builtins-x86_64)
     endif()
+  else()
+    # need libgcc for emulating 64-bit operations (e.g. 64-bit division) or __chkstk_ms()
+    target_link_libraries(SDL2 PRIVATE gcc)
+    set_property(TARGET SDL2 APPEND_STRING PROPERTY LINK_FALGS " -static-libgcc")
   endif()
 endif()
 if(WINDOWS_STORE)