summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-25 11:36:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-31 10:40:07 +0100
commit63232293428b14d70cbd2f700b1d34aade6f9c70 (patch)
tree84316dfd3a93138a4be60413f3246ae161cf515b /meta/recipes-devtools/rust
parenta19e278f2ec5fed8b4647c7541254bcb96bcdabc (diff)
downloadpoky-63232293428b14d70cbd2f700b1d34aade6f9c70.tar.gz
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust')
-rw-r--r--meta/recipes-devtools/rust/rust-source.inc1
-rw-r--r--meta/recipes-devtools/rust/rust/crossbeam_atomic.patch50
-rw-r--r--meta/recipes-devtools/rust/rust_1.63.0.bb3
3 files changed, 54 insertions, 0 deletions
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
3 3
4SRC_URI:append:class-target:pn-rust = " \ 4SRC_URI:append:class-target:pn-rust = " \
5 file://hardcodepaths.patch \ 5 file://hardcodepaths.patch \
6 file://crossbeam_atomic.patch \
6 file://0001-Add-ENOTSUP-constant-for-riscv32-musl.patch" 7 file://0001-Add-ENOTSUP-constant-for-riscv32-musl.patch"
7SRC_URI:append:class-nativesdk:pn-nativesdk-rust = " file://hardcodepaths.patch" 8SRC_URI:append:class-nativesdk:pn-nativesdk-rust = " file://hardcodepaths.patch"
8 9
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 @@
1crossbeam-utils is taking the target triplet and comparing it against a
2known list of platforms that have issues either with any atomics or with
364 bit atomics. Since OE encodes TARGET_VENDOR into the rust triplet (to
4differentiate host vs. target) this means that platforms that should match,
5don't.
6
7We could make a list of platforms and pass in configuration values but
8having one list in rust and another in our recipes is likely to cause
9problems in the future. We do already have this issue in the librsvg recipe.
10Instead, switch out the value of TARGET_VENDOR for "-unknown" which
11them makes the list in no_atomics.rs work correctly.
12
13Someone with more rust knowledge could split up the triplets in no_atmoics.rs
14and compare against the architecture/processor, or replace -unknown with a glob
15to create a patch that upstream might accept.
16
17Upstream-Status: Inappropriate [OE Specific tweak but could be rewritten]
18Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
19
20Index: rustc-1.63.0-src/vendor/crossbeam-utils/build.rs
21===================================================================
22--- rustc-1.63.0-src.orig/vendor/crossbeam-utils/build.rs
23+++ rustc-1.63.0-src/vendor/crossbeam-utils/build.rs
24@@ -29,7 +29,7 @@ use std::env;
25 include!("no_atomic.rs");
26
27 fn main() {
28- let target = match env::var("TARGET") {
29+ let mut target = match env::var("TARGET") {
30 Ok(target) => target,
31 Err(e) => {
32 println!(
33@@ -40,6 +40,8 @@ fn main() {
34 return;
35 }
36 };
37+ let vendor = env::var("TARGET_VENDOR").unwrap();
38+ target = target.replace(&vendor, "-unknown");
39
40 // Note that this is `no_*`, not `has_*`. This allows treating
41 // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
42Index: rustc-1.63.0-src/vendor/crossbeam-utils/.cargo-checksum.json
43===================================================================
44--- rustc-1.63.0-src.orig/vendor/crossbeam-utils/.cargo-checksum.json
45+++ rustc-1.63.0-src/vendor/crossbeam-utils/.cargo-checksum.json
46@@ -1 +1 @@
47-{"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"}
48\ No newline at end of file
49+{"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"}
50\ 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"
7FILES:${PN} += "${libdir}/*.so" 7FILES:${PN} += "${libdir}/*.so"
8FILES:${PN}-dev = "" 8FILES:${PN}-dev = ""
9 9
10# Used by crossbeam_atomic.patch
11export TARGET_VENDOR
12
10do_compile () { 13do_compile () {
11 rust_runx build --stage 2 14 rust_runx build --stage 2
12} 15}