Fix Windows ARM64 builds crashing on every HTTPS connection (#16073)

This commit is contained in:
SoftFever
2026-10-02 19:04:55 +08:00
committed by GitHub
parent 79a89f817f
commit e63c6d0594
+10
View File
@@ -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