From 63232293428b14d70cbd2f700b1d34aade6f9c70 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 25 Aug 2022 11:36:57 +0100 Subject: rust: Fix crossbeam-utils for arches without atomics crossbeam-utils tries to use the triplet to look up whether the target supports various forms of atomics. We use TARGET_VENDOR and not "-unknown" in the target case which means this fails and breaks platforms like mips and powerpc 32 bit. Add a patch to handle TARGET_VENDOR in this case. (From OE-Core rev: 5d8c01dfed4c82fcc5d504c728a51fb98a262300) Signed-off-by: Richard Purdie --- meta/recipes-devtools/rust/rust-source.inc | 1 + .../rust/rust/crossbeam_atomic.patch | 50 ++++++++++++++++++++++ meta/recipes-devtools/rust/rust_1.63.0.bb | 3 ++ 3 files changed, 54 insertions(+) create mode 100644 meta/recipes-devtools/rust/rust/crossbeam_atomic.patch (limited to 'meta/recipes-devtools') diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index d8be270136..ce6c983fc0 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -3,6 +3,7 @@ SRC_URI[rust.sha256sum] = "8f44af6dc44cc4146634a4dd5e4cc5470b3052a2337019b870c0e SRC_URI:append:class-target:pn-rust = " \ file://hardcodepaths.patch \ + file://crossbeam_atomic.patch \ file://0001-Add-ENOTSUP-constant-for-riscv32-musl.patch" SRC_URI:append:class-nativesdk:pn-nativesdk-rust = " file://hardcodepaths.patch" diff --git a/meta/recipes-devtools/rust/rust/crossbeam_atomic.patch b/meta/recipes-devtools/rust/rust/crossbeam_atomic.patch new file mode 100644 index 0000000000..7097bb9087 --- /dev/null +++ b/meta/recipes-devtools/rust/rust/crossbeam_atomic.patch @@ -0,0 +1,50 @@ +crossbeam-utils is taking the target triplet and comparing it against a +known list of platforms that have issues either with any atomics or with +64 bit atomics. Since OE encodes TARGET_VENDOR into the rust triplet (to +differentiate host vs. target) this means that platforms that should match, +don't. + +We could make a list of platforms and pass in configuration values but +having one list in rust and another in our recipes is likely to cause +problems in the future. We do already have this issue in the librsvg recipe. +Instead, switch out the value of TARGET_VENDOR for "-unknown" which +them makes the list in no_atomics.rs work correctly. + +Someone with more rust knowledge could split up the triplets in no_atmoics.rs +and compare against the architecture/processor, or replace -unknown with a glob +to create a patch that upstream might accept. + +Upstream-Status: Inappropriate [OE Specific tweak but could be rewritten] +Signed-off-by: Richard Purdie + +Index: rustc-1.63.0-src/vendor/crossbeam-utils/build.rs +=================================================================== +--- rustc-1.63.0-src.orig/vendor/crossbeam-utils/build.rs ++++ rustc-1.63.0-src/vendor/crossbeam-utils/build.rs +@@ -29,7 +29,7 @@ use std::env; + include!("no_atomic.rs"); + + fn main() { +- let target = match env::var("TARGET") { ++ let mut target = match env::var("TARGET") { + Ok(target) => target, + Err(e) => { + println!( +@@ -40,6 +40,8 @@ fn main() { + return; + } + }; ++ let vendor = env::var("TARGET_VENDOR").unwrap(); ++ target = target.replace(&vendor, "-unknown"); + + // Note that this is `no_*`, not `has_*`. This allows treating + // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't +Index: rustc-1.63.0-src/vendor/crossbeam-utils/.cargo-checksum.json +=================================================================== +--- rustc-1.63.0-src.orig/vendor/crossbeam-utils/.cargo-checksum.json ++++ rustc-1.63.0-src/vendor/crossbeam-utils/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"CHANGELOG.md":"665a9f2c5fd37c98bef7c1b6eda753b58bb925d87e5b42d7298df973d7590631","Cargo.toml":"fe22292acd6a868e65baf225f90d5678678971642814d2d8e92a03954b8bdb40","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"dfa9fbed47c344c134a63c84b7c0e4651baeac1554b7b3266d0e38643743fc33","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"7e74dc72343ff57e83d0a84a9fbdd9ff1645894165909999b4c3d2fba94bc96c","no_atomic.rs":"71b5f78fd701ce604aa766dd3d825fa5bed774282aae4d6c31d7acb01b1b242f","src/atomic/atomic_cell.rs":"01185588e0e16ba81425677966d0c11887dedc4ac0d4a65991a34057c418adc4","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"7cc7754e15f69b52e92a70d4f49d1bc274693455a0933a2d7eb0605806566af3","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"3f997f5b41fec286ccedcf3d36f801d741387badb574820b8e3456117ecd9154","src/sync/sharded_lock.rs":"14be659744918d0b27db24c56b41c618b0f0484b6761da46561023d96c4c120f","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"6a7676fd4e50af63aec6f655121a10cd6e8c704f4677125388186ba58dc5842d","tests/atomic_cell.rs":"d64faa1ca8896373468308031220940d988aa3a1679ea25d2291a7a7d22bc51a","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"eb6c5b59f007e0d290dd0f58758e8ccb5cacd38af34e3341368ced815f0c41be","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"ad8f0cdfed31f9594a2e0737234d418f8b924d784a4db8d7e469deab8c95f5f8"},"package":"0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"} +\ No newline at end of file ++{"files":{"CHANGELOG.md":"665a9f2c5fd37c98bef7c1b6eda753b58bb925d87e5b42d7298df973d7590631","Cargo.toml":"fe22292acd6a868e65baf225f90d5678678971642814d2d8e92a03954b8bdb40","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","README.md":"dfa9fbed47c344c134a63c84b7c0e4651baeac1554b7b3266d0e38643743fc33","benches/atomic_cell.rs":"c927eb3cd1e5ecc4b91adbc3bde98af15ffab4086190792ba64d5cde0e24df3d","build.rs":"d983d511c89607ce89473779d1ee195e3eb509cc4d3043b9efe6aa2f94c98158","no_atomic.rs":"71b5f78fd701ce604aa766dd3d825fa5bed774282aae4d6c31d7acb01b1b242f","src/atomic/atomic_cell.rs":"01185588e0e16ba81425677966d0c11887dedc4ac0d4a65991a34057c418adc4","src/atomic/consume.rs":"7a7736fcd64f6473dfea7653559ffc5e1a2a234df43835f8aa8734862145ac15","src/atomic/mod.rs":"94193895fa03cece415e8d7be700b73a9a8a7015774ca821253438607f9b0736","src/atomic/seq_lock.rs":"27182e6b87a9db73c5f6831759f8625f9fcdec3c2828204c444aef04f427735a","src/atomic/seq_lock_wide.rs":"9888dd03116bb89ca36d4ab8d5a0b5032107a2983a7eb8024454263b09080088","src/backoff.rs":"7cc7754e15f69b52e92a70d4f49d1bc274693455a0933a2d7eb0605806566af3","src/cache_padded.rs":"6a512698115ad0d5a5b163dbd7a83247e1f1c146c4a30f3fc74b952e3b767b59","src/lib.rs":"6f1bcf157abe06ad8458a53e865bf8efab9fad4a9424790147cee8fefb3795d8","src/sync/mod.rs":"59986f559a8f170a4b3247ab2eea2460b09809d87c8110ed88e4e7103d3519dc","src/sync/parker.rs":"3f997f5b41fec286ccedcf3d36f801d741387badb574820b8e3456117ecd9154","src/sync/sharded_lock.rs":"14be659744918d0b27db24c56b41c618b0f0484b6761da46561023d96c4c120f","src/sync/wait_group.rs":"32e946a7581c55f8aa9904527b92b177c538fa0cf7cbcfa1d1f25990582cb6ea","src/thread.rs":"6a7676fd4e50af63aec6f655121a10cd6e8c704f4677125388186ba58dc5842d","tests/atomic_cell.rs":"d64faa1ca8896373468308031220940d988aa3a1679ea25d2291a7a7d22bc51a","tests/cache_padded.rs":"1bfaff8354c8184e1ee1f902881ca9400b60effb273b0d3f752801a483d2b66d","tests/parker.rs":"6def4721287d9d70b1cfd63ebb34e1c83fbb3376edbad2bc8aac6ef69dd99d20","tests/sharded_lock.rs":"eb6c5b59f007e0d290dd0f58758e8ccb5cacd38af34e3341368ced815f0c41be","tests/thread.rs":"9a7d7d3028c552fd834c68598b04a1cc252a816bc20ab62cec060d6cd09cab10","tests/wait_group.rs":"ad8f0cdfed31f9594a2e0737234d418f8b924d784a4db8d7e469deab8c95f5f8"},"package":"0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"} +\ No newline at end of file diff --git a/meta/recipes-devtools/rust/rust_1.63.0.bb b/meta/recipes-devtools/rust/rust_1.63.0.bb index 3081cd5ef3..401d51041e 100644 --- a/meta/recipes-devtools/rust/rust_1.63.0.bb +++ b/meta/recipes-devtools/rust/rust_1.63.0.bb @@ -7,6 +7,9 @@ FILES:${PN} += "${libdir}/rustlib" FILES:${PN} += "${libdir}/*.so" FILES:${PN}-dev = "" +# Used by crossbeam_atomic.patch +export TARGET_VENDOR + do_compile () { rust_runx build --stage 2 } -- cgit v1.2.3-54-g00ecf