diff --git a/Misc/NEWS.d/next/macOS/2024-09-11-08-00-19.gh-issue-123748.TOM9vt.rst b/Misc/NEWS.d/next/macOS/2024-09-11-08-00-19.gh-issue-123748.TOM9vt.rst new file mode 100644 index 00000000000000..f965a32b0d0a43 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2024-09-11-08-00-19.gh-issue-123748.TOM9vt.rst @@ -0,0 +1 @@ +HACL* Blake2 SIMD256 has been disabled for universal2 builds on macOS. diff --git a/configure b/configure index 746c3b074d1fc3..2cb94105104149 100755 --- a/configure +++ b/configure @@ -30568,11 +30568,16 @@ printf "%s\n" "$ax_cv_check_cflags__Werror__mavx2" >&6; } if test "x$ax_cv_check_cflags__Werror__mavx2" = xyes then : - LIBHACL_SIMD256_FLAGS="-mavx2" - LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o" + # macOS universal2 builds *support* the -mavx2 compiler flag because it's + # available on x86_64; but the HACL SIMD256 build then fails because the + # implementation requires symbols that aren't available on ARM64. + if test "$UNIVERSAL_ARCHS" != "universal2"; then + LIBHACL_SIMD256_FLAGS="-mavx2" + LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o" printf "%s\n" "#define HACL_CAN_COMPILE_SIMD256 1" >>confdefs.h + fi else $as_nop : diff --git a/configure.ac b/configure.ac index 9284350695c526..2593a49d2f8093 100644 --- a/configure.ac +++ b/configure.ac @@ -7813,9 +7813,14 @@ AC_SUBST([LIBHACL_SIMD128_FLAGS]) AC_SUBST([LIBHACL_SIMD128_OBJS]) AX_CHECK_COMPILE_FLAG([-mavx2],[ - [LIBHACL_SIMD256_FLAGS="-mavx2"] - [LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"] - AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations]) + # macOS universal2 builds *support* the -mavx2 compiler flag because it's + # available on x86_64; but the HACL SIMD256 build then fails because the + # implementation requires symbols that aren't available on ARM64. + if test "$UNIVERSAL_ARCHS" != "universal2"; then + [LIBHACL_SIMD256_FLAGS="-mavx2"] + [LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"] + AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations]) + fi ], [], [-Werror]) AC_SUBST([LIBHACL_SIMD256_FLAGS])