From be5d3711d6b14c5b0c551d7a3f91bb31b4d05b6b Mon Sep 17 00:00:00 2001 From: A 38D Bra Date: Sun, 18 May 2025 17:33:31 +0800 Subject: [PATCH 1/5] Fixed: HACL compilation failure on macOS Silicon --- configure | 4 ++-- configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 2649a800f91a48..6b16fed1b5f2a0 100755 --- a/configure +++ b/configure @@ -32419,7 +32419,7 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD128 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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; 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; } @@ -32496,7 +32496,7 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD256 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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; 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; } diff --git a/configure.ac b/configure.ac index 5525a5b0ed5240..d8a4a3b2d60d93 100644 --- a/configure.ac +++ b/configure.ac @@ -7936,7 +7936,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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; then [LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"] AC_MSG_RESULT([universal2]) else @@ -7968,7 +7968,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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; then [LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"] AC_MSG_RESULT([universal2]) else From 2f7b2db127370ce51b1ad01aa8158b2b655fa250 Mon Sep 17 00:00:00 2001 From: A 38D Bra Date: Mon, 19 May 2025 00:44:20 +0800 Subject: [PATCH 2/5] Fix: Update configure checks for HACL SIMD (addressing review feedback) --- configure | 4 ++-- configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 6b16fed1b5f2a0..b6be1cd4a4ab88 100755 --- a/configure +++ b/configure @@ -32419,7 +32419,7 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD128 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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; then + if test "$UNIVERSAL_ARCHS" = "universal2" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); 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; } @@ -32496,7 +32496,7 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD256 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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; then + if test "$UNIVERSAL_ARCHS" = "universal2" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); 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; } diff --git a/configure.ac b/configure.ac index d8a4a3b2d60d93..5d54ba64adbf11 100644 --- a/configure.ac +++ b/configure.ac @@ -7936,7 +7936,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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; then + if test "$UNIVERSAL_ARCHS" = "universal2" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); then [LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"] AC_MSG_RESULT([universal2]) else @@ -7968,7 +7968,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 [[ "$build_cpu" == "aarch64" && "$build_vendor" == "apple" ]]; then + if test "$UNIVERSAL_ARCHS" = "universal2" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); then [LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"] AC_MSG_RESULT([universal2]) else From c11f3488377e971dd0f5e08c30b8ec31f0d0582c Mon Sep 17 00:00:00 2001 From: A 38D Bra Date: Mon, 19 May 2025 16:33:58 +0800 Subject: [PATCH 3/5] Fix: Address feedback on HACL* universal2 configure checks --- configure | 11 +++++++++-- configure.ac | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/configure b/configure index b6be1cd4a4ab88..00a339a606a455 100755 --- a/configure +++ b/configure @@ -32366,6 +32366,13 @@ LIBHACL_CFLAGS="${LIBHACL_FLAG_I} ${LIBHACL_FLAG_D} \$(PY_STDMODULE_CFLAGS) \$(C LIBHACL_LDFLAGS= # for now, no specific linker flags are needed +# Determine if the specific HACL* universal2 implementation should be used +use_hacl_universal2_impl=no +if test "$UNIVERSAL_ARCHS" = "universal2" -o \ + \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); then + use_hacl_universal2_impl=yes +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. @@ -32419,7 +32426,7 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD128 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" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); 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; } @@ -32496,7 +32503,7 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD256 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" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); 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; } diff --git a/configure.ac b/configure.ac index 5d54ba64adbf11..d818e57566b654 100644 --- a/configure.ac +++ b/configure.ac @@ -7920,6 +7920,13 @@ AC_SUBST([LIBHACL_CFLAGS]) LIBHACL_LDFLAGS= # for now, no specific linker flags are needed AC_SUBST([LIBHACL_LDFLAGS]) +# Determine if the specific HACL* universal2 implementation should be used +use_hacl_universal2_impl=no +if test "$UNIVERSAL_ARCHS" = "universal2" -o \ + \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); then + use_hacl_universal2_impl=yes +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. @@ -7936,7 +7943,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" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); 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 @@ -7968,7 +7975,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" -o \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); 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 From b05d183f440ec196199b8dd542d1f3a7d7b1c893 Mon Sep 17 00:00:00 2001 From: Sam Ng Date: Mon, 19 May 2025 17:39:02 +0800 Subject: [PATCH 4/5] Update configure.ac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- configure.ac | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d818e57566b654..52843de374eca5 100644 --- a/configure.ac +++ b/configure.ac @@ -7920,11 +7920,13 @@ AC_SUBST([LIBHACL_CFLAGS]) LIBHACL_LDFLAGS= # for now, no specific linker flags are needed AC_SUBST([LIBHACL_LDFLAGS]) -# Determine if the specific HACL* universal2 implementation should be used -use_hacl_universal2_impl=no +dnl Check if universal2 HACL* implementation should be used. if test "$UNIVERSAL_ARCHS" = "universal2" -o \ - \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); then + \( "$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 From e89919d753982513bf08fc17c83128144888b2f9 Mon Sep 17 00:00:00 2001 From: A 38D Bra Date: Mon, 19 May 2025 17:43:54 +0800 Subject: [PATCH 5/5] update configure --- configure | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 00a339a606a455..692c74034800f0 100755 --- a/configure +++ b/configure @@ -32366,11 +32366,12 @@ LIBHACL_CFLAGS="${LIBHACL_FLAG_I} ${LIBHACL_FLAG_D} \$(PY_STDMODULE_CFLAGS) \$(C LIBHACL_LDFLAGS= # for now, no specific linker flags are needed -# Determine if the specific HACL* universal2 implementation should be used -use_hacl_universal2_impl=no if test "$UNIVERSAL_ARCHS" = "universal2" -o \ - \( "$build_cpu" = "aarch64" -a "$build_vendor" = "apple" \); then + \( "$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