diff mbox series

[meta-lts-mixins,scarthgap/rust,27/37] rust: patch uninative loader into snapshot's self-contained lld

Message ID 38ac6945a437a41aea3f5281e4823776ce071d5b.1789156653.git.scott.murray@konsulko.com
State New
Headers show
Series Update to 1.98.1 | expand

Commit Message

Scott Murray Sept. 11, 2026, 8:13 p.m. UTC
From: Markus Volk <f_l_k@t-online.de>

Since Rust 1.90, rustc defaults to using the self-contained lld
linker (lib/rustlib/<triple>/bin/gcc-ld/ld.lld, which execs
rust-lld) on x86_64-unknown-linux-gnu.

https://blog.rust-lang.org/2025/09/01/rust-lld-on-1.90.0-stable/

This applies to the snapshot compiler used to bootstrap the target
rustc, before the rust.lld/use-lld settings in the config.toml we
generate for the target compiler can take effect. Without patching
these too, they fail to exec on build hosts without a /lib64
compatibility path.

collect2: fatal error: posix_spawnp: No such file or directory
|           compilation terminated.
|
|
| error: linking with
`/home/flk/bitbake/bitbake-builds/master/build/tmp/work/x86_64-linux/rust-native/1.96.1/wrapper/target-rust-ccld`
failed: exit status: 1

Signed-off-by: Markus Volk <f_l_k@t-online.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit 9db020032ee1f328bfab7ca7842d7725777e487e)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 recipes-devtools/rust/rust_1.96.1.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/recipes-devtools/rust/rust_1.96.1.bb b/recipes-devtools/rust/rust_1.96.1.bb
index 581523a..a6374f9 100644
--- a/recipes-devtools/rust/rust_1.96.1.bb
+++ b/recipes-devtools/rust/rust_1.96.1.bb
@@ -66,8 +66,12 @@  do_rust_setup_snapshot () {
     # Need to use uninative's loader if enabled/present since the library paths
     # are used internally by rust and result in symbol mismatches if we don't
     if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then
-        for bin in cargo rustc rustdoc; do
-            patchelf ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER}
+        for bin in ${WORKDIR}/rust-snapshot/bin/cargo \
+                   ${WORKDIR}/rust-snapshot/bin/rustc \
+                   ${WORKDIR}/rust-snapshot/bin/rustdoc \
+                   ${WORKDIR}/rust-snapshot/lib/rustlib/*/bin/rust-lld \
+                   ${WORKDIR}/rust-snapshot/lib/rustlib/*/bin/gcc-ld/*; do
+            [ -f "$bin" ] && patchelf "$bin" --set-interpreter ${UNINATIVE_LOADER}
         done
     fi
 }