[packages/maturin] - build fixes for x32
baggins
baggins at pld-linux.org
Sun May 25 06:13:57 CEST 2025
commit 05d270d55309e5b0f6b7832530e5a94c7f158041
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sun May 25 06:42:17 2025 +0200
- build fixes for x32
x32.patch | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 139 insertions(+), 3 deletions(-)
---
diff --git a/x32.patch b/x32.patch
index a90f645..c052224 100644
--- a/x32.patch
+++ b/x32.patch
@@ -1,6 +1,130 @@
---- maturin-1.8.6/vendor/ring/src/cpu/intel.rs~ 2025-05-18 23:33:31.000000000 +0200
-+++ maturin-1.8.6/vendor/ring/src/cpu/intel.rs 2025-05-18 23:35:17.330970855 +0200
-@@ -25,9 +25,9 @@ mod abi_assumptions {
+diff -ur maturin-1.8.6/vendor/ring/src/arithmetic/bigint.rs maturin-1.8.6-x32/vendor/ring/src/arithmetic/bigint.rs
+--- maturin-1.8.6/vendor/ring/src/arithmetic/bigint.rs 2025-05-18 23:33:31.000000000 +0200
++++ maturin-1.8.6-x32/vendor/ring/src/arithmetic/bigint.rs 2025-05-25 06:27:39.333330551 +0200
+@@ -127,7 +127,7 @@
+ }
+ }
+
+-#[cfg(any(test, not(target_arch = "x86_64")))]
++#[cfg(any(test, not(all(target_arch = "x86_64", target_pointer_width = "64"))))]
+ impl<M> Elem<M, R> {
+ #[inline]
+ pub fn into_unencoded(self, m: &Modulus<M>) -> Elem<M, Unencoded> {
+@@ -490,7 +491,7 @@
+ const TABLE_ENTRIES: usize = 1 << WINDOW_BITS;
+ const STORAGE_ENTRIES: usize = TABLE_ENTRIES + if cfg!(target_arch = "x86_64") { 3 } else { 0 };
+
+-#[cfg(not(target_arch = "x86_64"))]
++#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "64")))]
+ fn elem_exp_consttime_inner<N, M, const STORAGE_LIMBS: usize>(
+ out: Storage<M>,
+ base_mod_n: &Elem<N>,
+@@ -611,7 +613,7 @@
+ Ok(acc.into_unencoded(m))
+ }
+
+-#[cfg(target_arch = "x86_64")]
++#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+ fn elem_exp_consttime_inner<N, M, const STORAGE_LIMBS: usize>(
+ out: Storage<M>,
+ base_mod_n: &Elem<N>,
+diff -ur maturin-1.8.6/vendor/ring/src/arithmetic/limbs/x86_64/mod.rs maturin-1.8.6-x32/vendor/ring/src/arithmetic/limbs/x86_64/mod.rs
+--- maturin-1.8.6/vendor/ring/src/arithmetic/limbs/x86_64/mod.rs 2025-05-18 23:33:31.000000000 +0200
++++ maturin-1.8.6-x32/vendor/ring/src/arithmetic/limbs/x86_64/mod.rs 2025-05-25 06:15:43.269996946 +0200
+@@ -12,6 +12,6 @@
+ // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+-#![cfg(target_arch = "x86_64")]
++#![cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+
+ pub(in super::super::super) mod mont;
+diff -ur maturin-1.8.6/vendor/ring/src/arithmetic/limbs/x86_64/mont.rs maturin-1.8.6-x32/vendor/ring/src/arithmetic/limbs/x86_64/mont.rs
+--- maturin-1.8.6/vendor/ring/src/arithmetic/limbs/x86_64/mont.rs 2025-05-18 23:33:31.000000000 +0200
++++ maturin-1.8.6-x32/vendor/ring/src/arithmetic/limbs/x86_64/mont.rs 2025-05-25 06:15:22.526663601 +0200
+@@ -12,7 +12,7 @@
+ // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+-#![cfg(target_arch = "x86_64")]
++#![cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+
+ use super::super::super::{
+ inout::{AliasingSlices2, AliasingSlices3},
+diff -ur maturin-1.8.6/vendor/ring/src/arithmetic/montgomery.rs maturin-1.8.6-x32/vendor/ring/src/arithmetic/montgomery.rs
+--- maturin-1.8.6/vendor/ring/src/arithmetic/montgomery.rs 2025-05-18 23:33:31.000000000 +0200
++++ maturin-1.8.6-x32/vendor/ring/src/arithmetic/montgomery.rs 2025-05-25 06:24:12.009997134 +0200
+@@ -167,7 +167,7 @@
+ bn_mul_mont_fallback)
+ }
+ }
+- } else if #[cfg(target_arch = "x86_64")] {
++ } else if #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] {
+ use crate::{cpu::GetFeature as _, polyfill::slice};
+ use super::limbs::x86_64;
+ if n.len() >= x86_64::mont::MIN_4X {
+@@ -193,10 +194,10 @@
+ if #[cfg(not(any(
+ all(target_arch = "aarch64", target_endian = "little"),
+ all(target_arch = "arm", target_endian = "little"),
+- target_arch = "x86_64")))] {
++ all(target_arch = "x86_64", target_pointer_width = "64"))))] {
+
+ // TODO: Stop calling this from C and un-export it.
+- #[cfg(not(target_arch = "x86"))]
++ #[cfg(any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "32")))]
+ prefixed_export! {
+ unsafe extern "C" fn bn_mul_mont(
+ r: *mut Limb,
+@@ -210,6 +213,8 @@
+ }
+ }
+
++ #[cfg_attr(target_arch = "x86_64", cold)]
++ #[cfg_attr(target_arch = "x86_64", inline(never))]
+ #[cfg_attr(target_arch = "x86", cold)]
+ #[cfg_attr(target_arch = "x86", inline(never))]
+ unsafe extern "C" fn bn_mul_mont_fallback(
+@@ -251,7 +256,7 @@
+ not(any(
+ all(target_arch = "aarch64", target_endian = "little"),
+ all(target_arch = "arm", target_endian = "little"),
+- target_arch = "x86_64"
++ all(target_arch = "x86_64", target_pointer_width = "64")
+ ))
+ ))]
+ pub(super) fn limbs_from_mont_in_place(r: &mut [Limb], tmp: &mut [Limb], m: &[Limb], n0: &N0) {
+@@ -283,7 +289,7 @@
+ #[cfg(not(any(
+ all(target_arch = "aarch64", target_endian = "little"),
+ all(target_arch = "arm", target_endian = "little"),
+- target_arch = "x86_64"
++ all(target_arch = "x86_64", target_pointer_width = "64")
+ )))]
+ fn limbs_mul(r: &mut [Limb], a: &[Limb], b: &[Limb]) {
+ debug_assert_eq!(r.len(), 2 * a.len());
+@@ -303,7 +310,7 @@
+ not(any(
+ all(target_arch = "aarch64", target_endian = "little"),
+ all(target_arch = "arm", target_endian = "little"),
+- target_arch = "x86_64",
++ all(target_arch = "x86_64", target_pointer_width = "64")
+ ))
+ ))]
+ prefixed_extern! {
+@@ -328,7 +336,7 @@
+ }
+ }
+
+- #[cfg(target_arch = "x86_64")]
++ #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+ {
+ use super::limbs::x86_64;
+ use crate::{cpu::GetFeature as _, polyfill::slice};
+diff -ur maturin-1.8.6/vendor/ring/src/cpu/intel.rs maturin-1.8.6-x32/vendor/ring/src/cpu/intel.rs
+--- maturin-1.8.6/vendor/ring/src/cpu/intel.rs 2025-05-18 23:33:31.000000000 +0200
++++ maturin-1.8.6-x32/vendor/ring/src/cpu/intel.rs 2025-05-25 06:03:26.039996833 +0200
+@@ -25,9 +25,9 @@
const _ASSUMES_SSE2: () =
assert!(cfg!(target_feature = "sse") && cfg!(target_feature = "sse2"));
@@ -12,3 +136,15 @@
const _ASSUMED_POINTER_SIZE: usize = 4;
const _ASSUMED_USIZE_SIZE: () = assert!(size_of::<usize>() == _ASSUMED_POINTER_SIZE);
const _ASSUMED_REF_SIZE: () = assert!(size_of::<&'static u8>() == _ASSUMED_POINTER_SIZE);
+diff -ur maturin-1.8.6/vendor/ring/src/prefixed.rs maturin-1.8.6-x32/vendor/ring/src/prefixed.rs
+--- maturin-1.8.6/vendor/ring/src/prefixed.rs 2025-05-18 23:33:31.000000000 +0200
++++ maturin-1.8.6-x32/vendor/ring/src/prefixed.rs 2025-05-25 06:32:25.553330583 +0200
+@@ -85,8 +85,6 @@
+ #[cfg(not(any(
+ all(target_arch = "aarch64", target_endian = "little"),
+ all(target_arch = "arm", target_endian = "little"),
+- target_arch = "x86",
+- target_arch = "x86_64"
+ )))]
+ macro_rules! prefixed_export {
+ // A function.
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/maturin.git/commitdiff/05d270d55309e5b0f6b7832530e5a94c7f158041
More information about the pld-cvs-commit
mailing list