]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-130478: fix HACL* build for macOS Silicon (GH-134188) (#135009)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 11 Jul 2025 16:25:58 +0000 (18:25 +0200)
committerGitHub <noreply@github.com>
Fri, 11 Jul 2025 16:25:58 +0000 (16:25 +0000)
gh-130478: fix HACL* build for macOS Silicon (GH-134188)
(cherry picked from commit ac7511062bf8e16ad489b17990d99abd3b4351f5)

Co-authored-by: Sam Ng <hongsheng@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
configure
configure.ac

index d32ea2dabc2be7abf4b5f0fcf1c1185dfb7e7003..a62f1ae7cac52dc6a7597e415f3ef43ff3a4ed34 100755 (executable)
--- a/configure
+++ b/configure
@@ -32582,6 +32582,14 @@ LIBHACL_CFLAGS="${LIBHACL_FLAG_I} ${LIBHACL_FLAG_D} \$(PY_STDMODULE_CFLAGS) \$(C
 LIBHACL_LDFLAGS=  # for now, no specific linker flags are needed
 
 
+if test "$UNIVERSAL_ARCHS" = "universal2" -o \
+   \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \)
+then
+  use_hacl_universal2_impl=yes
+else
+  use_hacl_universal2_impl=no
+fi
+
 # The SIMD files use aligned_alloc, which is not available on older versions of
 # Android.
 # The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
@@ -32635,7 +32643,7 @@ printf "%s\n" "#define _Py_HACL_CAN_COMPILE_VEC128 1" >>confdefs.h
     # isn't great, so it's disabled on ARM64.
     { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for HACL* SIMD128 implementation" >&5
 printf %s "checking for HACL* SIMD128 implementation... " >&6; }
-    if test "$UNIVERSAL_ARCHS" == "universal2"; then
+    if test "$use_hacl_universal2_impl" = "yes"; then
       LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"
       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: universal2" >&5
 printf "%s\n" "universal2" >&6; }
@@ -32712,7 +32720,7 @@ printf "%s\n" "#define _Py_HACL_CAN_COMPILE_VEC256 1" >>confdefs.h
     # wrapped implementation if we're building for universal2.
     { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for HACL* SIMD256 implementation" >&5
 printf %s "checking for HACL* SIMD256 implementation... " >&6; }
-    if test "$UNIVERSAL_ARCHS" == "universal2"; then
+    if test "$use_hacl_universal2_impl" = "yes"; then
       LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"
       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: universal2" >&5
 printf "%s\n" "universal2" >&6; }
index ab688d93990a2d20d6626b130c65735398941e7d..d644c0ca772cd50b86495f260b0d9c7143a6e633 100644 (file)
@@ -8008,6 +8008,15 @@ AC_SUBST([LIBHACL_CFLAGS])
 LIBHACL_LDFLAGS=  # for now, no specific linker flags are needed
 AC_SUBST([LIBHACL_LDFLAGS])
 
+dnl Check if universal2 HACL* implementation should be used.
+if test "$UNIVERSAL_ARCHS" = "universal2" -o \
+   \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \)
+then
+  use_hacl_universal2_impl=yes
+else
+  use_hacl_universal2_impl=no
+fi
+
 # The SIMD files use aligned_alloc, which is not available on older versions of
 # Android.
 # The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
@@ -8025,7 +8034,7 @@ then
     # available on x86_64. However, performance of the HACL SIMD128 implementation
     # isn't great, so it's disabled on ARM64.
     AC_MSG_CHECKING([for HACL* SIMD128 implementation])
-    if test "$UNIVERSAL_ARCHS" == "universal2"; then
+    if test "$use_hacl_universal2_impl" = "yes"; then
       [LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"]
       AC_MSG_RESULT([universal2])
     else
@@ -8058,7 +8067,7 @@ then
     # implementation requires symbols that aren't available on ARM64. Use a
     # wrapped implementation if we're building for universal2.
     AC_MSG_CHECKING([for HACL* SIMD256 implementation])
-    if test "$UNIVERSAL_ARCHS" == "universal2"; then
+    if test "$use_hacl_universal2_impl" = "yes"; then
       [LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"]
       AC_MSG_RESULT([universal2])
     else