[packages/uv] Try to fix 'error: passing argument 1 of 'aws_lc_0_39_0_RSAZ_mod_exp_avx512_x2'' on x32

arekm arekm at pld-linux.org
Fri May 1 02:20:41 CEST 2026


commit 2b8ddf602ab33eb322bdee5d96e3262e1f8fb456
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri May 1 02:20:35 2026 +0200

    Try to fix 'error: passing argument 1 of 'aws_lc_0_39_0_RSAZ_mod_exp_avx512_x2'' on x32

 aws-lc-x32.patch | 22 ++++++++++++++++++++++
 uv.spec          | 10 ++++++++++
 2 files changed, 32 insertions(+)
---
diff --git a/uv.spec b/uv.spec
index 0fc25e1..7997703 100644
--- a/uv.spec
+++ b/uv.spec
@@ -26,6 +26,7 @@ Source0:	https://github.com/astral-sh/uv/archive/%{version}/%{name}-%{version}.t
 Source1:	%{name}-crates-%{crates_ver}.tar.xz
 # Source1-md5:	2ff89da4d7c0cdb37b70d94652dd815d
 Patch0:		lto.patch
+Patch1:		aws-lc-x32.patch
 URL:		https://github.com/astral-sh/uv
 BuildRequires:	bzip2-devel
 BuildRequires:	cargo
@@ -100,6 +101,15 @@ Zshowe dopełnianie składni dla polecenia uv.
 %patch -P0 -p1
 %endif
 
+# aws-lc-sys vendored source: skip RSAZ_mod_exp_avx512_x2 on x32
+# (BN_BITS2 != 64). Refresh the vendored crate checksum so cargo
+# accepts the modified file in offline mode.
+awslc_c=vendor/aws-lc-sys/aws-lc/crypto/fipsmodule/bn/exponentiation.c
+old_sum=$(sha256sum "$awslc_c" | cut -f1 -d' ')
+%patch -P1 -p1
+new_sum=$(sha256sum "$awslc_c" | cut -f1 -d' ')
+%{__sed} -i -e "s/$old_sum/$new_sum/" vendor/aws-lc-sys/.cargo-checksum.json
+
 # use our offline registry
 export CARGO_HOME="$(pwd)/.cargo"
 
diff --git a/aws-lc-x32.patch b/aws-lc-x32.patch
new file mode 100644
index 0000000..eb01d93
--- /dev/null
+++ b/aws-lc-x32.patch
@@ -0,0 +1,22 @@
+aws-lc's RSAZ_mod_exp_avx512_x2 fast path is declared with uint64_t*
+parameters and is called from BN_mod_exp_mont_consttime_x2 with
+BN_ULONG*. On x86_64-gnu BN_ULONG == uint64_t so the call typechecks.
+On x32 (x86_64 ISA, 32-bit pointers) BN_ULONG == uint32_t but
+RSAZ_512_ENABLED is still set because the AVX-512 instructions exist —
+gcc then refuses with -Werror=incompatible-pointer-types.
+
+Gate the fast path on BN_BITS2 == 64 so x32 (and any future ABI with
+32-bit BN_ULONG on x86_64-class hardware) falls back to the generic
+constant-time modular exponentiation path.
+
+--- a/vendor/aws-lc-sys/aws-lc/crypto/fipsmodule/bn/exponentiation.c
++++ b/vendor/aws-lc-sys/aws-lc/crypto/fipsmodule/bn/exponentiation.c
+@@ -1176,7 +1176,7 @@
+ {
+   int ret = 0;
+
+-#ifdef RSAZ_512_ENABLED
++#if defined(RSAZ_512_ENABLED) && BN_BITS2 == 64
+   if (CRYPTO_is_AVX512IFMA_capable() &&
+      (((a1->width == 16) && (p1->width == 16) && (BN_num_bits(m1) == 1024) &&
+        (a2->width == 16) && (p2->width == 16) && (BN_num_bits(m2) == 1024)) ||
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/uv.git/commitdiff/2b8ddf602ab33eb322bdee5d96e3262e1f8fb456



More information about the pld-cvs-commit mailing list