From: sunilkumar.dora@windriver.com
To: openembedded-core@lists.openembedded.org
Cc: richard.purdie@linuxfoundation.org,
sundeep.kokkonda@windriver.com, sunilkumar.dora@windriver.com,
Randy.Macleod@windriver.com, alejandro@enedino.org
Subject: [PATCH 3/5] rust: keep the build host triple out of cargo unit metadata
Date: Tue, 15 Sep 2026 19:48:32 +0530 [thread overview]
Message-ID: <20260915141834.1212812-4-sunilkumar.dora@windriver.com> (raw)
In-Reply-To: <20260915141834.1212812-1-sunilkumar.dora@windriver.com>
From: Sunil Dora <sunilkumar.dora@windriver.com>
cargo hashes the "host:" line of "rustc -vV" into the metadata of build
scripts and proc-macros. Every target crate that depends on one picks it
up, so the same crate gets a different -C metadata and StableCrateId on
an x86_64 and an aarch64 build host. The added patch drops the host line
from that hash.
Patch from Alejandro Enedino Hernandez Samaniego's strict-version-hash
series:
https://lists.openembedded.org/g/openembedded-core/topic/120939810
[YOCTO #16376]
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
...-host-triple-from-unit-metadata-hash.patch | 62 +++++++++++++++++++
meta/recipes-devtools/rust/rust-source.inc | 1 +
2 files changed, 63 insertions(+)
create mode 100644 meta/recipes-devtools/rust/files/0007-cargo-omit-host-triple-from-unit-metadata-hash.patch
diff --git a/meta/recipes-devtools/rust/files/0007-cargo-omit-host-triple-from-unit-metadata-hash.patch b/meta/recipes-devtools/rust/files/0007-cargo-omit-host-triple-from-unit-metadata-hash.patch
new file mode 100644
index 0000000000..d4cb48a7a3
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/0007-cargo-omit-host-triple-from-unit-metadata-hash.patch
@@ -0,0 +1,62 @@
+From 5c4fd7d8b85f4de5be387777a782fc3ddd1227d8 Mon Sep 17 00:00:00 2001
+From: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
+Date: Tue, 15 Sep 2026 17:05:36 +0530
+Subject: [PATCH] rust: keep the build host triple out of cargo unit metadata
+
+cargo hashes the "host:" line of "rustc -vV" into the metadata of host
+units, that is build scripts and proc-macros. Every target crate that
+depends on one picks that up through its own metadata, so the same crate
+gets a different -C metadata and StableCrateId on an x86_64 and an aarch64
+build host. Drop the host from the hash. The same class of problem is
+reported upstream, framed as OS differences, in
+https://github.com/rust-lang/cargo/issues/8140.
+
+Patch by Alejandro Enedino Hernandez Samaniego, from his strict-version-hash
+v5 series for openembedded-core:
+https://lists.openembedded.org/g/openembedded-core/topic/120939810
+
+Upstream-Status: Inappropriate [OE-specific]
+
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org>
+Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
+---
+ .../core/compiler/build_runner/compilation_files.rs | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/src/tools/cargo/src/cargo/core/compiler/build_runner/compilation_files.rs b/src/tools/cargo/src/cargo/core/compiler/build_runner/compilation_files.rs
+index 88cab85..9dbd203 100644
+--- a/src/tools/cargo/src/cargo/core/compiler/build_runner/compilation_files.rs
++++ b/src/tools/cargo/src/cargo/core/compiler/build_runner/compilation_files.rs
+@@ -877,7 +877,7 @@ fn has_remap_path_prefix(args: &[String]) -> bool {
+ }
+
+ /// Hash the version of rustc being used during the build process.
+-fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher, unit: &Unit) {
++fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher, _unit: &Unit) {
+ let vers = &bcx.rustc().version;
+ if vers.pre.is_empty() || bcx.gctx.cli_unstable().separate_nightlies {
+ // For stable, keep the artifacts separate. This helps if someone is
+@@ -886,7 +886,7 @@ fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher, uni
+ // omitted since rustc should produce the same output for each target
+ // regardless of the host.
+ for line in bcx.rustc().verbose_version.lines() {
+- if unit.kind.is_host() || !line.starts_with("host: ") {
++ if !line.starts_with("host: ") {
+ line.hash(hasher);
+ }
+ }
+@@ -899,12 +899,6 @@ fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher, uni
+ // This assumes that the first segment is the important bit ("nightly",
+ // "beta", "dev", etc.). Skip other parts like the `.3` in `-beta.3`.
+ vers.pre.split('.').next().hash(hasher);
+- // Keep "host" since some people switch hosts to implicitly change
+- // targets, (like gnu vs musl or gnu vs msvc). In the future, we may want
+- // to consider hashing `unit.kind.short_name()` instead.
+- if unit.kind.is_host() {
+- bcx.rustc().host.hash(hasher);
+- }
+ // None of the other lines are important. Currently they are:
+ // binary: rustc <-- or "rustdoc"
+ // commit-hash: 38114ff16e7856f98b2b4be7ab4cd29b38bed59a
+--
+2.43.0
diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc
index 54502ccc9e..a294201c6e 100644
--- a/meta/recipes-devtools/rust/rust-source.inc
+++ b/meta/recipes-devtools/rust/rust-source.inc
@@ -9,6 +9,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
file://0003-bootstrap-skip-StdarchVerify-when-remote-testing.patch;patchdir=${RUSTSRC} \
file://0004-Backport-commits-from-rust-Fix-selftest-llvm23.patch;patchdir=${RUSTSRC} \
file://0005-rustc_codegen_llvm-Do-not-pass-amx-tf32-to-LLVM-23.patch;patchdir=${RUSTSRC} \
+ file://0007-cargo-omit-host-triple-from-unit-metadata-hash.patch;patchdir=${RUSTSRC} \
"
SRC_URI[rust.sha256sum] = "be1816e7f6c40abb90245ad6e024bed2a7e88d7dda4561e4d5470207df616b9f"
--
2.43.0
next prev parent reply other threads:[~2026-09-15 14:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 14:18 [PATCH 0/5] rust: reproducibility fixes for arm build hosts sunilkumar.dora
2026-09-15 14:18 ` [PATCH 1/5] rust: drop the cc object-name reproducibility patch sunilkumar.dora
2026-09-15 14:18 ` [PATCH 2/5] rust: hash cc object names relative to their source roots sunilkumar.dora
2026-09-15 14:18 ` sunilkumar.dora [this message]
2026-09-15 14:18 ` [PATCH 4/5] rust: backport deterministic DocLinkResMap serialisation sunilkumar.dora
2026-09-15 14:18 ` [PATCH 5/5] rust: sort hygiene data before it is encoded sunilkumar.dora
2026-09-15 15:53 ` [OE-core] [PATCH 0/5] rust: reproducibility fixes for arm build hosts Alejandro Hernandez
2026-09-15 16:10 ` Dora, Sunil Kumar
[not found] ` <18D58A6B209991A8.1909126@lists.openembedded.org>
2026-09-15 17:55 ` Dora, Sunil Kumar
2026-09-16 7:11 ` Antonin Godard
2026-09-21 9:46 ` Richard Purdie
2026-09-21 21:43 ` Alejandro Hernandez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260915141834.1212812-4-sunilkumar.dora@windriver.com \
--to=sunilkumar.dora@windriver.com \
--cc=Randy.Macleod@windriver.com \
--cc=alejandro@enedino.org \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
--cc=sundeep.kokkonda@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox