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 2/5] rust: hash cc object names relative to their source roots
Date: Tue, 15 Sep 2026 19:48:31 +0530 [thread overview]
Message-ID: <20260915141834.1212812-3-sunilkumar.dora@windriver.com> (raw)
In-Reply-To: <20260915141834.1212812-1-sunilkumar.dora@windriver.com>
From: Sunil Dora <sunilkumar.dora@windriver.com>
compiler-builtins compiles two sets of sources with cc: the
outline-atomics files it generates into OUT_DIR and the compiler-rt
intrinsics it reads from RUST_COMPILER_RT_ROOT. cc hashes the absolute
source directory into each object file name, so the names change with
the build location.
The added patch strips OUT_DIR or RUST_COMPILER_RT_ROOT before hashing,
falling back to CARGO_MANIFEST_DIR. It replaces
repro-issue-fix-with-cc-crate-hashmap.patch and covers both sets of
sources.
[YOCTO #16376]
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
...bject-names-relative-to-source-roots.patch | 71 +++++++++++++++++++
meta/recipes-devtools/rust/rust-source.inc | 1 +
2 files changed, 72 insertions(+)
create mode 100644 meta/recipes-devtools/rust/files/cc-hash-object-names-relative-to-source-roots.patch
diff --git a/meta/recipes-devtools/rust/files/cc-hash-object-names-relative-to-source-roots.patch b/meta/recipes-devtools/rust/files/cc-hash-object-names-relative-to-source-roots.patch
new file mode 100644
index 0000000000..bd32c8cda0
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/cc-hash-object-names-relative-to-source-roots.patch
@@ -0,0 +1,71 @@
+From afb2b50f588cc02042f50aadbd1c28f19bbcd586 Mon Sep 17 00:00:00 2001
+From: Sunil Dora <sunilkumar.dora@windriver.com>
+Date: Tue, 15 Sep 2026 17:05:37 +0530
+Subject: [PATCH] cc: hash object names relative to the root the source came
+ from
+
+compiler-builtins builds two sets of objects with the cc crate: the
+outline-atomics sources (lse_*.S) it generates into OUT_DIR, and the
+compiler-rt C intrinsics it reads from RUST_COMPILER_RT_ROOT. cc hashes the
+absolute source directory into each object file name, so the names change
+with the build location and the shipped rlib is not reproducible.
+
+Strip OUT_DIR or RUST_COMPILER_RT_ROOT before hashing, falling back to
+CARGO_MANIFEST_DIR as upstream already did.
+
+The OUT_DIR part is generic and is proposed upstream as
+rust-lang/cc-rs#1902. RUST_COMPILER_RT_ROOT is set by rust's own build
+system, so that part is not in the upstream submission.
+
+Upstream-Status: Submitted [https://github.com/rust-lang/cc-rs/pull/1902]
+
+Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
+---
+ vendor/cc-1.2.0/.cargo-checksum.json | 2 +-
+ vendor/cc-1.2.0/src/command_helpers.rs | 18 +++++++++++++++---
+ 2 files changed, 16 insertions(+), 4 deletions(-)
+
+diff --git a/vendor/cc-1.2.0/.cargo-checksum.json b/vendor/cc-1.2.0/.cargo-checksum.json
+index 470ecbb..2ff8a08 100644
+--- a/vendor/cc-1.2.0/.cargo-checksum.json
++++ b/vendor/cc-1.2.0/.cargo-checksum.json
+@@ -1 +1 @@
+-{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"d6e26674a9d7de87dab83262a14f2377988a1e087e4b514f3983f8dd141ea813","CHANGELOG.md":"fb0a3bcb34301d2578bef86feabe93057068cb1906a7f10b584f58ff6123e8c6","Cargo.lock":"b661254fadca74408d53742755b371f7ae29e501e851aeae13bcd14a51883321","Cargo.toml":"50debe1b2fc050e8b305bdd514509d98cdbc59e96e5f10888df4b6fca19d3a75","Cargo.toml.orig":"0aff9dc74ddbe3bfe89ad9698212a6a18d6124b9593780aad25e277d28e9a71f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"f1ddbede208a5b78333a25dac0a7598e678e9b601a7d99a791069bddaf180dfe","clippy.toml":"aa7850db4350883c8f373bd0d6b4d19bf3b75f13c1c238e24368c109cb52fb1d","src/command_helpers.rs":"b766a70e39b8ea7bb57afd288bcac205a23f6a26ac5619cb1d5b10f70c5dfdea","src/detect_compiler_family.c":"97ca4b021495611e828becea6187add37414186a16dfedd26c2947cbce6e8b2f","src/lib.rs":"221ba9475100303b5c694b2a02e5353452ee08a29e4e4d4d67ea8fcbd87605df","src/parallel/async_executor.rs":"4ce24435fff6b6555b43fee042c16bd65d4150d0346567f246b9190d85b45983","src/parallel/job_token.rs":"018a01cb00182270bbcb68e31e7a7c5c621a95f086e4c68cfa2bf557ac24e5f2","src/parallel/mod.rs":"bd9c1334d17d138c281961c690b8d8118a2d6295a7d6cd7296826255436fa063","src/parallel/stderr.rs":"74384d41198740a6fce0877f144262db09fb091225fa8fbfa771314bb11487c6","src/target.rs":"7313240db078ad85c1209a42a5fa96c3692b5d6e5093c7f366a1b99677247109","src/target/apple.rs":"6afbecac9f66aa72db55694413532f80b2753f28466a6213d1aa901a03c78bcd","src/target/generated.rs":"af067e1c291e895ddb591f92534eed0c48977cdb2b58f8239423e07c6de31cd3","src/target/llvm.rs":"e1db4a7fb8b905ee9853781f2fcc64a9d3b48154e4c8b6cb12f5373c5935da6e","src/target/parser.rs":"4f2129a24273d62bf8ab339098e7f758e4e42b0df369dd2b0eb1b20726be91f8","src/tempfile.rs":"ebafb5b0e5d08b0706916ed911d4245240e60c3e2d0c9a1630c520842988a2b3","src/tool.rs":"2e6550062e021f2b394388172bbb01e86fe6a94d2395bcb3c85a9e86690da1a9","src/utilities.rs":"52b30b24a1c31cdefb105309ee5220cfc9fca76eaf4e6d6509c3e19f431448fe","src/windows/com.rs":"a2800ddb81215fff2bf618336f5c4ff8e8bdb746dd18b795873c7304b3f2a5e3","src/windows/find_tools.rs":"0ff410bd71f08ee88e99609c15be5f1bc16ad7bd07a83918d13a70c8465642e2","src/windows/mod.rs":"34cfa201cfbcac7ccaa3ea5295d3e4200439af3cc5c6433baf81502596040a89","src/windows/registry.rs":"c521b72c825e8095843e73482ffa810ed066ad8bb9f86e6db0c5c143c171aba1","src/windows/setup_config.rs":"754439cbab492afd44c9755abcbec1a41c9b2c358131cee2df13c0e996dbbec8","src/windows/vs_instances.rs":"946527cf8fd32c3472f6a2884dcdec290763101097334c7478f9c24c3950db6b","src/windows/winapi.rs":"250d51c1826d1a2329e9889dd9f058cfce253dbf2a678b076147c6cdb5db046c","src/windows/windows_sys.rs":"e2714c8307bfa083b9745eb0e46cadd7f98d7b88abf45a7637172019324e34b8","src/windows/windows_targets.rs":"5b4648ebc22b028caca9f4b4bf8881fe2d094b7bec217264ba2e6e2c49d1ccee"},"package":"1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8"}
+\ No newline at end of file
++{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"d6e26674a9d7de87dab83262a14f2377988a1e087e4b514f3983f8dd141ea813","CHANGELOG.md":"fb0a3bcb34301d2578bef86feabe93057068cb1906a7f10b584f58ff6123e8c6","Cargo.lock":"b661254fadca74408d53742755b371f7ae29e501e851aeae13bcd14a51883321","Cargo.toml":"50debe1b2fc050e8b305bdd514509d98cdbc59e96e5f10888df4b6fca19d3a75","Cargo.toml.orig":"0aff9dc74ddbe3bfe89ad9698212a6a18d6124b9593780aad25e277d28e9a71f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"f1ddbede208a5b78333a25dac0a7598e678e9b601a7d99a791069bddaf180dfe","clippy.toml":"aa7850db4350883c8f373bd0d6b4d19bf3b75f13c1c238e24368c109cb52fb1d","src/command_helpers.rs":"010873ba1ab0ea4b7e3b5eac72aed5f50e535d42cb94da943d2aa3d74904aa0f","src/detect_compiler_family.c":"97ca4b021495611e828becea6187add37414186a16dfedd26c2947cbce6e8b2f","src/lib.rs":"221ba9475100303b5c694b2a02e5353452ee08a29e4e4d4d67ea8fcbd87605df","src/parallel/async_executor.rs":"4ce24435fff6b6555b43fee042c16bd65d4150d0346567f246b9190d85b45983","src/parallel/job_token.rs":"018a01cb00182270bbcb68e31e7a7c5c621a95f086e4c68cfa2bf557ac24e5f2","src/parallel/mod.rs":"bd9c1334d17d138c281961c690b8d8118a2d6295a7d6cd7296826255436fa063","src/parallel/stderr.rs":"74384d41198740a6fce0877f144262db09fb091225fa8fbfa771314bb11487c6","src/target.rs":"7313240db078ad85c1209a42a5fa96c3692b5d6e5093c7f366a1b99677247109","src/target/apple.rs":"6afbecac9f66aa72db55694413532f80b2753f28466a6213d1aa901a03c78bcd","src/target/generated.rs":"af067e1c291e895ddb591f92534eed0c48977cdb2b58f8239423e07c6de31cd3","src/target/llvm.rs":"e1db4a7fb8b905ee9853781f2fcc64a9d3b48154e4c8b6cb12f5373c5935da6e","src/target/parser.rs":"4f2129a24273d62bf8ab339098e7f758e4e42b0df369dd2b0eb1b20726be91f8","src/tempfile.rs":"ebafb5b0e5d08b0706916ed911d4245240e60c3e2d0c9a1630c520842988a2b3","src/tool.rs":"2e6550062e021f2b394388172bbb01e86fe6a94d2395bcb3c85a9e86690da1a9","src/utilities.rs":"52b30b24a1c31cdefb105309ee5220cfc9fca76eaf4e6d6509c3e19f431448fe","src/windows/com.rs":"a2800ddb81215fff2bf618336f5c4ff8e8bdb746dd18b795873c7304b3f2a5e3","src/windows/find_tools.rs":"0ff410bd71f08ee88e99609c15be5f1bc16ad7bd07a83918d13a70c8465642e2","src/windows/mod.rs":"34cfa201cfbcac7ccaa3ea5295d3e4200439af3cc5c6433baf81502596040a89","src/windows/registry.rs":"c521b72c825e8095843e73482ffa810ed066ad8bb9f86e6db0c5c143c171aba1","src/windows/setup_config.rs":"754439cbab492afd44c9755abcbec1a41c9b2c358131cee2df13c0e996dbbec8","src/windows/vs_instances.rs":"946527cf8fd32c3472f6a2884dcdec290763101097334c7478f9c24c3950db6b","src/windows/winapi.rs":"250d51c1826d1a2329e9889dd9f058cfce253dbf2a678b076147c6cdb5db046c","src/windows/windows_sys.rs":"e2714c8307bfa083b9745eb0e46cadd7f98d7b88abf45a7637172019324e34b8","src/windows/windows_targets.rs":"5b4648ebc22b028caca9f4b4bf8881fe2d094b7bec217264ba2e6e2c49d1ccee"},"package":"1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8"}
+\ No newline at end of file
+diff --git a/vendor/cc-1.2.0/src/command_helpers.rs b/vendor/cc-1.2.0/src/command_helpers.rs
+index adedab2..c911306 100644
+--- a/vendor/cc-1.2.0/src/command_helpers.rs
++++ b/vendor/cc-1.2.0/src/command_helpers.rs
+@@ -315,13 +315,25 @@ pub(crate) fn objects_from_files(files: &[Arc<Path>], dst: &Path) -> Result<Vec<
+
+ // Make the dirname relative (if possible) to avoid full system paths influencing the sha
+ // and making the output system-dependent
++ // compiler-builtins generates sources into OUT_DIR and reads the compiler-rt
++ // intrinsics from RUST_COMPILER_RT_ROOT, so try those before the manifest dir
+ //
+ // NOTE: Here we allow using std::env::var (instead of Build::getenv) because
+ // CARGO_* variables always trigger a rebuild when changed
+ #[allow(clippy::disallowed_methods)]
+- let dirname = if let Some(root) = std::env::var_os("CARGO_MANIFEST_DIR") {
+- let root = root.to_string_lossy();
+- Cow::Borrowed(dirname.strip_prefix(&*root).unwrap_or(&dirname))
++ let strip_root = |var: &str| {
++ std::env::var_os(var).and_then(|root| {
++ dirname
++ .strip_prefix(&*root.to_string_lossy())
++ .map(str::to_owned)
++ })
++ };
++ let dirname = if let Some(rel) = strip_root("OUT_DIR") {
++ Cow::Owned(rel)
++ } else if let Some(rel) = strip_root("RUST_COMPILER_RT_ROOT") {
++ Cow::Owned(rel)
++ } else if let Some(rel) = strip_root("CARGO_MANIFEST_DIR") {
++ Cow::Owned(rel)
+ } else {
+ dirname
+ };
+--
+2.43.0
diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc
index 28c6d0b1dc..54502ccc9e 100644
--- a/meta/recipes-devtools/rust/rust-source.inc
+++ b/meta/recipes-devtools/rust/rust-source.inc
@@ -3,6 +3,7 @@ RUST_VERSION ?= "${@d.getVar('PV').split('-')[0]}"
SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;name=rust \
file://0001-Define-more-ioctl-codes-on-riscv32gc-unknown-linux-g.patch;patchdir=${RUSTSRC} \
file://rust-oe-selftest.patch;patchdir=${RUSTSRC} \
+ file://cc-hash-object-names-relative-to-source-roots.patch;patchdir=${RUSTSRC} \
file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \
file://0002-Fix-rust-build-failure-with-unstable-options.patch;patchdir=${RUSTSRC} \
file://0003-bootstrap-skip-StdarchVerify-when-remote-testing.patch;patchdir=${RUSTSRC} \
--
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 ` sunilkumar.dora [this message]
2026-09-15 14:18 ` [PATCH 3/5] rust: keep the build host triple out of cargo unit metadata sunilkumar.dora
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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.