From 88524edfc69863883bbc9c2375b657edc66d59c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 7 Sep 2023 10:26:51 +0200 Subject: [PATCH] mbedtls: Fix UWP arm32 build after 2.28.3 enabled AES-NI intrinsics on MSVC (cherry picked from commit a9710a2a9bceb3f7e2811566aa025713606447c8) --- thirdparty/README.md | 3 ++- thirdparty/mbedtls/include/mbedtls/aesni.h | 5 +++-- .../patches/aesni-no-arm-intrinsics.patch | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 thirdparty/mbedtls/patches/aesni-no-arm-intrinsics.patch diff --git a/thirdparty/README.md b/thirdparty/README.md index 2b19c565847..b9bf1e69ad0 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -289,7 +289,8 @@ File extracted from upstream release tarball: - The `LICENSE` file. - Applied the patch in `patches/1453.diff` to fix UWP build (upstream PR: https://github.com/ARMmbed/mbedtls/pull/1453). - Applied the patch in `patches/windows-arm64-hardclock.diff` + Applied the patch in `patches/windows-arm64-hardclock.diff`. + Applied the patch in `aesni-no-arm-intrinsics.patch` also to fix UWP build. - Added 2 files `godot_core_mbedtls_platform.c` and `godot_core_mbedtls_config.h` providing configuration for light bundling with core. diff --git a/thirdparty/mbedtls/include/mbedtls/aesni.h b/thirdparty/mbedtls/include/mbedtls/aesni.h index 6741dead05b..6c545bd4a31 100644 --- a/thirdparty/mbedtls/include/mbedtls/aesni.h +++ b/thirdparty/mbedtls/include/mbedtls/aesni.h @@ -54,9 +54,10 @@ * macros that may change in future releases. */ #undef MBEDTLS_AESNI_HAVE_INTRINSICS -#if defined(_MSC_VER) +#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86)) /* Visual Studio supports AESNI intrinsics since VS 2008 SP1. We only support - * VS 2013 and up for other reasons anyway, so no need to check the version. */ + * VS 2013 and up for other reasons anyway, so no need to check the version. + * Only supported on x64 and x86. */ #define MBEDTLS_AESNI_HAVE_INTRINSICS #endif /* GCC-like compilers: currently, we only support intrinsics if the requisite diff --git a/thirdparty/mbedtls/patches/aesni-no-arm-intrinsics.patch b/thirdparty/mbedtls/patches/aesni-no-arm-intrinsics.patch new file mode 100644 index 00000000000..7edfa072d89 --- /dev/null +++ b/thirdparty/mbedtls/patches/aesni-no-arm-intrinsics.patch @@ -0,0 +1,17 @@ +diff --git a/thirdparty/mbedtls/include/mbedtls/aesni.h b/thirdparty/mbedtls/include/mbedtls/aesni.h +index 6741dead05..6c545bd4a3 100644 +--- a/thirdparty/mbedtls/include/mbedtls/aesni.h ++++ b/thirdparty/mbedtls/include/mbedtls/aesni.h +@@ -54,9 +54,10 @@ + * macros that may change in future releases. + */ + #undef MBEDTLS_AESNI_HAVE_INTRINSICS +-#if defined(_MSC_VER) ++#if defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86)) + /* Visual Studio supports AESNI intrinsics since VS 2008 SP1. We only support +- * VS 2013 and up for other reasons anyway, so no need to check the version. */ ++ * VS 2013 and up for other reasons anyway, so no need to check the version. ++ * Only supported on x64 and x86. */ + #define MBEDTLS_AESNI_HAVE_INTRINSICS + #endif + /* GCC-like compilers: currently, we only support intrinsics if the requisite