pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
rust185: fix cross-build of mipsel-unknown-netbsd target.
Module Name: pkgsrc-wip
Committed By: Havard Eidnes <he%NetBSD.org@localhost>
Pushed By: he
Date: Thu Feb 27 09:44:08 2025 +0000
Changeset: e0d6a419aa7c845a1cc57be8d2ccb84155059ea4
Modified Files:
rust185/distinfo
Added Files:
rust185/patches/patch-src_tools_clippy_clippy__utils_src_consts.rs
rust185/patches/patch-src_tools_clippy_clippy__utils_src_lib.rs
Log Message:
rust185: fix cross-build of mipsel-unknown-netbsd target.
Following on from https://github.com/rust-lang/rust/issues/137630
apply patch gracefully supplied in
https://github.com/beetrees/rust/commit/21f8bda79b2904c827b9d8d769a1307acfd855a1
.patch
by @beetrees.
Fixes cross-build for the mipsel-unknown-netbsd target on NetBSD
which does not (yet?) support the f16 data type, at least not with
the LLVM embedded in 1.85.0 (which is LLVM version 19.1.7).
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e0d6a419aa7c845a1cc57be8d2ccb84155059ea4
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
rust185/distinfo | 2 +
...ch-src_tools_clippy_clippy__utils_src_consts.rs | 91 ++++++++++++++++++++++
...patch-src_tools_clippy_clippy__utils_src_lib.rs | 20 +++++
3 files changed, 113 insertions(+)
diffs:
diff --git a/rust185/distinfo b/rust185/distinfo
index ebf6863c8d..2dac55a571 100644
--- a/rust185/distinfo
+++ b/rust185/distinfo
@@ -133,6 +133,8 @@ SHA1 (patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h) = 39d
SHA1 (patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp) = 2587c2f4d11ad8f75bf8a16de625135b26bacc15
SHA1 (patch-src_tools_cargo_src_cargo_core_profiles.rs) = e1af7fde97416e0a269ee34efd37f4f47fcf7a95
SHA1 (patch-src_tools_cargo_tests_testsuite_build.rs) = 333ec513b9b94750b2424a7c1b21c809e6ea25b8
+SHA1 (patch-src_tools_clippy_clippy__utils_src_consts.rs) = bfebd1fa83be18626751d1059eaf32c275f43d28
+SHA1 (patch-src_tools_clippy_clippy__utils_src_lib.rs) = 68df85b3758a03860ec38b8d0b2cca30d4b02286
SHA1 (patch-src_tools_rust-installer_install-template.sh) = 6984546c34a2e4d55a6dbe59baa0d4958184e0b7
SHA1 (patch-tests_assembly_targets_targets-elf.rs) = ee7d036c055ed2a2b3b303f381ad4694327c739b
SHA1 (patch-tools_rust-analyzer_lib_line-index-src_lib.rs) = 4ed527174447ee23fa81dd6840e18b9949d5a273
diff --git a/rust185/patches/patch-src_tools_clippy_clippy__utils_src_consts.rs b/rust185/patches/patch-src_tools_clippy_clippy__utils_src_consts.rs
new file mode 100644
index 0000000000..559021d901
--- /dev/null
+++ b/rust185/patches/patch-src_tools_clippy_clippy__utils_src_consts.rs
@@ -0,0 +1,91 @@
+$NetBSD$
+
+Following on from https://github.com/rust-lang/rust/issues/137630
+apply patch gracefully supplied in
+https://github.com/beetrees/rust/commit/21f8bda79b2904c827b9d8d769a1307acfd855a1.patch
+
+Fixes cross-build for 32-bit mips on NetBSD which
+does not (yet?) support the f16 data type.
+
+--- src/tools/clippy/clippy_utils/src/consts.rs.orig 2025-02-17 18:17:27.000000000 +0000
++++ src/tools/clippy/clippy_utils/src/consts.rs
+@@ -41,14 +41,16 @@ pub enum Constant<'tcx> {
+ Char(char),
+ /// An integer's bit representation.
+ Int(u128),
+- /// An `f16`.
+- F16(f16),
++ /// An `f16` bitcast to a `u16`.
++ // FIXME(f16_f128): use `f16` once builtins are available on all host tools platforms.
++ F16(u16),
+ /// An `f32`.
+ F32(f32),
+ /// An `f64`.
+ F64(f64),
+- /// An `f128`.
+- F128(f128),
++ /// An `f128` bitcast to a `u128`.
++ // FIXME(f16_f128): use `f128` once builtins are available on all host tools platforms.
++ F128(u128),
+ /// `true` or `false`.
+ Bool(bool),
+ /// An array of constants.
+@@ -175,7 +177,7 @@ impl Hash for Constant<'_> {
+ },
+ Self::F16(f) => {
+ // FIXME(f16_f128): once conversions to/from `f128` are available on all platforms,
+- f.to_bits().hash(state);
++ f.hash(state);
+ },
+ Self::F32(f) => {
+ f64::from(f).to_bits().hash(state);
+@@ -184,7 +186,7 @@ impl Hash for Constant<'_> {
+ f.to_bits().hash(state);
+ },
+ Self::F128(f) => {
+- f.to_bits().hash(state);
++ f.hash(state);
+ },
+ Self::Bool(b) => {
+ b.hash(state);
+@@ -290,12 +292,12 @@ impl Constant<'_> {
+
+ fn parse_f16(s: &str) -> Self {
+ let f: Half = s.parse().unwrap();
+- Self::F16(f16::from_bits(f.to_bits().try_into().unwrap()))
++ Self::F16(f.to_bits().try_into().unwrap())
+ }
+
+ fn parse_f128(s: &str) -> Self {
+ let f: Quad = s.parse().unwrap();
+- Self::F128(f128::from_bits(f.to_bits()))
++ Self::F128(f.to_bits())
+ }
+ }
+
+@@ -851,10 +853,10 @@ pub fn mir_to_const<'tcx>(tcx: TyCtxt<'t
+ ty::Adt(adt_def, _) if adt_def.is_struct() => Some(Constant::Adt(result)),
+ ty::Bool => Some(Constant::Bool(int == ScalarInt::TRUE)),
+ ty::Uint(_) | ty::Int(_) => Some(Constant::Int(int.to_bits(int.size()))),
+- ty::Float(FloatTy::F16) => Some(Constant::F16(f16::from_bits(int.into()))),
++ ty::Float(FloatTy::F16) => Some(Constant::F16(int.into())),
+ ty::Float(FloatTy::F32) => Some(Constant::F32(f32::from_bits(int.into()))),
+ ty::Float(FloatTy::F64) => Some(Constant::F64(f64::from_bits(int.into()))),
+- ty::Float(FloatTy::F128) => Some(Constant::F128(f128::from_bits(int.into()))),
++ ty::Float(FloatTy::F128) => Some(Constant::F128(int.into())),
+ ty::RawPtr(_, _) => Some(Constant::RawPtr(int.to_bits(int.size()))),
+ _ => None,
+ },
+@@ -875,10 +877,10 @@ pub fn mir_to_const<'tcx>(tcx: TyCtxt<'t
+ let range = alloc_range(offset + size * idx, size);
+ let val = alloc.read_scalar(&tcx, range, /* read_provenance */ false).ok()?;
+ res.push(match flt {
+- FloatTy::F16 => Constant::F16(f16::from_bits(val.to_u16().discard_err()?)),
++ FloatTy::F16 => Constant::F16(val.to_u16().discard_err()?),
+ FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().discard_err()?)),
+ FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().discard_err()?)),
+- FloatTy::F128 => Constant::F128(f128::from_bits(val.to_u128().discard_err()?)),
++ FloatTy::F128 => Constant::F128(val.to_u128().discard_err()?),
+ });
+ }
+ Some(Constant::Vec(res))
diff --git a/rust185/patches/patch-src_tools_clippy_clippy__utils_src_lib.rs b/rust185/patches/patch-src_tools_clippy_clippy__utils_src_lib.rs
new file mode 100644
index 0000000000..2d285353f6
--- /dev/null
+++ b/rust185/patches/patch-src_tools_clippy_clippy__utils_src_lib.rs
@@ -0,0 +1,20 @@
+$NetBSD$
+
+Following on from https://github.com/rust-lang/rust/issues/137630
+apply patch gracefully supplied in
+https://github.com/beetrees/rust/commit/21f8bda79b2904c827b9d8d769a1307acfd855a1
+.patch
+
+Fixes cross-build for 32-bit mips on NetBSD which
+does not (yet?) support the f16 data type.
+
+--- src/tools/clippy/clippy_utils/src/lib.rs.orig 2025-02-17 18:17:27.000000000 +0000
++++ src/tools/clippy/clippy_utils/src/lib.rs
+@@ -1,7 +1,5 @@
+ #![feature(array_chunks)]
+ #![feature(box_patterns)]
+-#![feature(f128)]
+-#![feature(f16)]
+ #![feature(if_let_guard)]
+ #![feature(macro_metavar_expr_concat)]
+ #![feature(let_chains)]
Home |
Main Index |
Thread Index |
Old Index