From e63c6d0594d93f70750b4baa9e3b25624eea9db6 Mon Sep 17 00:00:00 2001 From: SoftFever <103989404+SoftFever@users.noreply.github.com> Date: Fri, 2 Oct 2026 19:04:55 +0800 Subject: [PATCH] Fix Windows ARM64 builds crashing on every HTTPS connection (#16073) --- deps/OpenSSL/OpenSSL.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deps/OpenSSL/OpenSSL.cmake b/deps/OpenSSL/OpenSSL.cmake index 4a2d49572b..2bbf2b81b7 100644 --- a/deps/OpenSSL/OpenSSL.cmake +++ b/deps/OpenSSL/OpenSSL.cmake @@ -29,6 +29,15 @@ if(WIN32) # driven through nmake from a Ninja configure step. set(_conf_cmd ${CMAKE_COMMAND} -E env ${_openssl_msvc_env} perl Configure ) set(_cross_comp_prefix_line "") + if("${DEPS_ARCH}" STREQUAL "arm64") + # OpenSSL's VC configs pass /Gs0, which puts a __chkstk probe in every + # function. MSVC 14.51 and 14.52 (VS 2026) for ARM64 emit that call + # before the prologue saves LR, so the function returns into itself; + # in tls_parse_all_extensions that breaks every TLS handshake. 14.44 + # (VS 2022) is unaffected. Restore cl's default threshold: Configure + # appends /Gs4096 after /Gs0, and the later option wins. + set(_openssl_extra_cflags /Gs4096) + endif() set(_make_cmd ${CMAKE_COMMAND} -E env ${_openssl_msvc_env} nmake) set(_install_cmd ${CMAKE_COMMAND} -E env ${_openssl_msvc_env} nmake install_sw ) else() @@ -71,6 +80,7 @@ ExternalProject_Add(dep_OpenSSL # prefix stays single-layout. "--libdir=lib" ${_cross_comp_prefix_line} + ${_openssl_extra_cflags} no-shared no-asm no-ssl3-method