Commit Graph

178 Commits

Author SHA1 Message Date
Martin Jansa
765333686d rust-llvm: fix build with gcc-15
As in meta-clang for clang-native:
f915bbfc71

(From OE-Core rev: 818750db213dc2c0daac4757d078092be6de3fe6)

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-09-01 08:30:56 -07:00
Virendra Thakur
dc767c786b rust-cross-canadian: Set CVE_STATUS ignore for CVE-2024-43402
This CVE was created because fix for CVE-2024-24576 was incomplete.
Ignore the new CVE in the same way as the old one.

See https://nvd.nist.gov/vuln/detail/CVE-2024-43402

As per NVD, this CVE only affects to Windows platform

Reference: https://git.yoctoproject.org/meta-lts-mixins/commit/?h=scarthgap/rust&id=13f045acf6388d1e320fd4c0f3ca19ca7a75ef44

(From OE-Core rev: ef2ba1f04f6f21530dc4efe5c4f61cbb0c76c032)

Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-04-07 06:34:44 -07:00
Harish Sadineni
fbaa6a601f rust: remove redundant cargo config file
YOCTO [#15061]
The rust target and linker are getting setting from the sdk environment and
so the config file is not needed. The redundant config file geneartion is removed.

Backport from oe-core master: https://git.openembedded.org/openembedded-core/commit/?id=d5f78816d2ad0f3e43ce883eef199d1683cfcbb4

(From OE-Core rev: 12fd08cf4009d0284ab951cc48a479dcbc74db42)

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-02-12 06:25:37 -08:00
Harish Sadineni
c61736066e rust: fix for rust multilib sdk configuration
YOCTO [#15061]
The rust sdk installs both 'rust.sh' and 'cargo.sh' for lib32 and lib64 in the same location.
This causes below error while installing the lib32 & lib64 binaries:

Error: Transaction test error:
  file /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/cargo.sh
conflicts between attempted installs of rust-cross-canadian-arm-1.67.1-r0.x86_64_nativesdk and
 rust-cross-canadian-aarch64-1.67.1-r0.x86_64_nativesdk
  file /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/environment-setup.d/rust.sh
conflicts between attempted installs of rust-cross-canadian-arm-1.67.1-r0.x86_64_nativesdk and
rust-cross-canadian-aarch64-1.67.1-r0.x86_64_nativesdk
ERROR: Task (virtual:multilib:lib32:/media/build/poky/meta/recipes-sato/images/core-image-sato.bb:do_populate_sdk)
failed with exit code '1'

The change includes:
- Prepending '${RUST_TARGET_SYS}' to 'rust.sh' to differentiate between target systems.
- Moving the non-target-specific environment variables to 'nativesdk-cargo' and 'nativesdk-rust',
instead of being managed by the cross-canadian recipe.

Backport from oe-core master: https://git.openembedded.org/openembedded-core/commit/?id=40eb4bfe2f100ba5301046ca25110fcc55a640bb

(From OE-Core rev: 889cda30baccd43e5c82b38752b462aef4ce626c)

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-02-12 06:25:37 -08:00
Alexander Kanavin
dd941e5746 rust: correctly link rust-snapshot into build/stage0
This does not seem to be used in regular builds, but is beneficial
in rust selftest, where it allows dropping a custom patch
that is unsuitable for upstream (and was rejected by them).

Also remove an obsolete comment that seems related to the code
but describes something that was resolved long time ago.

I have confirmed that the rust selftest continues to pass with just
this one commit on top of master (as the following changes do break
the selftest).

(From OE-Core rev: 9b23f995fbc1886c36f02b0c6e1ccaf2ee0f6daa)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit bf5732e2b235ce06fa1f24fe8f0dbcbc068500e3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-01-26 14:04:46 -08:00
Alexander Kanavin
04976a1e40 rust: use rust-snapshot binaries only in rust-native
Otherwise, use rust-native and cargo-native binaries as that allows
our native tweaks in them to be used for target/nativesdk rust -
same as for everything else written in rust.

In particular, this allows building target rust with
cargo-native that includes important reproducibility tweaks.

Unfortunately, this also breaks rust selftest, and that
is partially addressed by the following commit.

[YOCTO #15185]

(From OE-Core rev: d592bc02b0846411796c1d481c09833559d1d29f)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 8f2230cb51fe22ef4711a56fecfab4858c04e35b)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-01-26 14:04:46 -08:00
Alexander Kanavin
e4de7259e4 rust: build the default set of tools
Setting it explicitly replaces rust's default choice which is rustdoc
(needed for example in selftests and otherwise expected to be present
in typical rust installations):

https://github.com/rust-lang/rust/blob/master/config.example.toml#L320

This addresses some of the rust selftest failures but not all. Help
is appreciate to restore the selftest.

Unfortunately, this also breaks rust reproducibility (or rather exposes
that it was never properly fixed, as explained here:
https://lists.openembedded.org/g/openembedded-core/message/199288
)

(From OE-Core rev: 4d739fe248d1023eb2c3c040fc4d33273dd16bc1)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 58eaf2ee6c0809bf0a0d3c1d177e62bda7241651)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-01-26 14:04:46 -08:00
Steve Sakoman
e3b771d7b6 Revert "rust: Add new varaible RUST_ENABLE_EXTRA_TOOLS"
This reverts commit 136a25567499191b23a4d000a06bf83a473224ca.

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-01-26 14:04:46 -08:00
Alexander Kanavin
52a2a1101a rust: add reproducibility patch to eliminate host leakage
[YOCTO #15185]

(From OE-Core rev: 01423828248b75e1f5afe2e5959ccd971df875cd)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 924df18b47e9a69fa295bafe37bdb39d8eaea2bb)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-12-23 05:46:32 -08:00
Deepthi Hemraj
43955da4e1 rust-llvm: Fix CVE-2024-0151
(From OE-Core rev: 175e22f2df542b0e1eb638c43c11eeefe794b0b7)

Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-11-09 05:53:57 -08:00
Peter Marko
fc449a98b6 rust: ignore CVE-2024-43402
This CVE was created because fix for CVE-2024-24576 was incomplete.
Ignore the new CVE in the same way as the old one.

See https://nvd.nist.gov/vuln/detail/CVE-2024-43402

(From OE-Core rev: 6ed9968bf3e35aca316227ee23294c683f77055d)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-10-18 06:04:40 -07:00
Ranjitsinh Rathod
6ced2e7ca3 rust: Add new varaible RUST_ENABLE_EXTRA_TOOLS
There is a need to enable some extra tools from the rust for the build
and so this new variable will help for that

This varaible then we can use during do_configure task to add overall
values as per json format in build -> tools

(From OE-Core rev: 136a25567499191b23a4d000a06bf83a473224ca)

Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-08-06 19:11:18 -07:00
Peter Marko
fc596da0c2 libstd-rs,rust-cross-canadian: set CVE_PRODUCT to rust
These recipes come from rust sources and CVEs are reported for them
under rust-lang:rust vendor:product touple.
Especially libstd-rs needs correct CVE_PRODUCT as is it installed on
target devices (being statically linked to rust compiled binaries).

before:
cargo: CVE_PRODUCT="cargo"
cargo-c-native: CVE_PRODUCT="cargo-c"
libstd-rs: CVE_PRODUCT="libstd-rs"
rust: CVE_PRODUCT="rust"
rust-cross-canadian: CVE_PRODUCT="rust-cross-canadian-<arch>"
rust-llvm: CVE_PRODUCT="rust-llvm"

after:
cargo: CVE_PRODUCT="cargo"
cargo-c-native: CVE_PRODUCT="cargo-c"
libstd-rs: CVE_PRODUCT="rust"
rust: CVE_PRODUCT="rust"
rust-cross-canadian-x86-64: CVE_PRODUCT="rust"
rust-llvm: CVE_PRODUCT="rust-llvm"

Product for rust-llvm is uncertain and, should be handled in another
commit if it is desired to align it, too.

sqlite> select vendor, product, count(product) from products where vendor="rust-lang" group by product;
rust-lang|async-h1|2
rust-lang|cargo|5
rust-lang|future-utils|2
rust-lang|futures-task|2
rust-lang|mdbook|1
rust-lang|regex|2
rust-lang|rsa|2
rust-lang|rust|45
rust-lang|socket2|1

(From OE-Core rev: 91bfe1f64ee3e2b8534baa8a3eb2fb7fa3521657)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e8cf1df16a6ec2785cacaf608bec5cd8496103af)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-08-06 19:11:18 -07:00
Harish Sadineni
0304adce22 rust: set CVE_STATUS for CVE-2024-24576
CVE-2024-24576 only applies when invoking batch files (with the `bat` and `cmd` extensions) on Windows & No other platform or use is affected.
More details about CVE is here: https://nvd.nist.gov/vuln/detail/CVE-2024-24576

(From OE-Core rev: 28eddfa53494c7560861feff84be3f3a5a46aecb)

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-10 18:35:09 +01:00
Alexander Kanavin
8139216000 cargo-c-native: update 0.9.18 -> 0.9.30
(From OE-Core rev: 772cb94c9ab0645714e182f0141dc6c8b26b05ef)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-18 12:21:45 +00:00
Alexander Kanavin
2db6df6f2e cargo-c-native: convert from git fetcher to crate fetcher
Fetching from git requires manually maintaining Cargo.lock
which is tedious and unclear how to do correctly,
especially with version updates. On the other hand, crates
do include Cargo.lock, and this way the revisions would match
upstream's and crate users (which requires regenerating
crates.inc to match the lock file).

(From OE-Core rev: 03c1954404bf56470935b12cb3aeb02199f68ded)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-18 12:21:45 +00:00
Sundeep KOKKONDA
3dc62ba4a8 rust: reproducibility issue fix with v1.75
Patch updated with upstream fix.
a9a979839b

(From OE-Core rev: 2eceaa4b6ca398ec233b18c1064970bdf68a9258)

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-18 12:21:45 +00:00
Khem Raj
7b64530439 rust: Fix build failure re-appeared on riscv32
Refresh the rustix-0.38.19 patch to include FICLONE definition
which fixes the build issue surfaced with rust 1.75

(From OE-Core rev: 693e7cb3eb0cdc715a45ddcba8eb09dc9c5c31b8)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-05 12:24:49 +00:00
Yash Shinde
3970a48885 rust: reproducibility issue fix with v1.75
With 1.75 rust release, the '.rustc' section of shared object libs are embedded with absolute path names which is casuing reproducibiluty issues.
This change will fix the path name format back to '/rust/$hash' as in earlier versions.

Below are the links for detailed bug description & discusssion with upstream rust.
https://github.com/rust-lang/rust/issues/120825#issuecomment-1964307219
https://github.com/rust-lang/rust/issues/120825#issuecomment-1964652656

(From OE-Core rev: a80ce6e3c023809d1ec13d19e8acb25770b54737)

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-01 09:31:11 +00:00
Yash Shinde
694b85a217 rust: Revert PGO to it's default
The rust profiler PGO (Profile-guided Optimization) options was disabled as a part rustdoc reproducibility fix.
https://git.yoctoproject.org/poky/commit/meta/recipes-devtools/rust?id=321aebfa281bd28e368c684ece57867f6bd0cbe7

But, other applications (such as to build chromium with poky) requires PGO enabled (https://github.com/OSSystems/meta-browser/issues/786).

For reproducibility issue fix only "rust-demangler" change is sufficient in commit#321aebfa281. The PGO is reverted to it's default.

(From OE-Core rev: 83bd5e12e069a60a870a7c7ed046a2827eb777a1)

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-01 09:31:10 +00:00
Yash Shinde
a62cee4479 rust: Upgrade 1.74.1 -> 1.75.0
* Drop backported musl fixes.

* Set `change-id` rather than `changelog-seen`
to fix build warning.

* Add fixes for 4b7e0a0b56aa24 ("Handle vendored sources
when remapping paths") which otherwise cause build failures:

| thread 'main' panicked at src/core/builder.rs:1795:26:
| std::fs::read_dir(registry_src) failed with No such file or directory (os=
 error 2)

https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html

(From OE-Core rev: 9aec2c6c777388bb3129aa4c4f27a40f912522b4)

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-03-01 09:31:10 +00:00
Khem Raj
f31fe0b5b5 rust/cargo: Build fixes to rust for rv32 target
(From OE-Core rev: 0b1666b921b99732798b62b900436ab79876a6a2)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-08 10:59:06 +00:00
Khem Raj
f697dc7baf rust: Re-write RPATHs in the copies llvm-config
Ensure that it can still access the native-sysroot for dependencies,
use ORIGIN to indicate this relative its install location, this also
helps in this not getting into the output of llvm-config which could
otherwise provide incorrect library paths

target rust recipe builds ( cross compile ) calls llvm-config from
target sysroot which works ok as long as C++ runtime it needs is
available on build host e.g. libstdc++ etc. which is commonly the
case, however when using clang and llvm runtime this falters since
it should be using libc++ from native sysroot and if this does not
exist on build machine this fails to find libc++ shared object and
llvm-config fails to run. This ensures that llvm-config version in
use is correctly relocated and can use shared libraries from native
sysroot correctly. Adding ORIGIN to sysroot will look for the .so in
same dir as the binary and there is the libc++.so.1 copied in place

Fixes rust build with clang compiler.

| /mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/rust/1.74.1/recipe-sysroot/usr/lib/llvm-rust/bin/llvm-config: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or director
y
| thread 'main' panicked at llvm.rs:551:19:
| command did not execute successfully: "/mnt/b/yoe/master/build/tmp/work/riscv64-yoe-linux/rust/1.74.1/recipe-sysroot/usr/lib/llvm-rust/bin/llvm-config" "--version"
| expected success, got: exit status: 127

(From OE-Core rev: 178ad50bf36f244f96159bb2f94e0d8849487931)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-26 16:06:29 +00:00
Yash Shinde
bb630c3e29 rust: Enable rust oe-selftest.
* Enable rust oe-selftest.

* Include the dependent patches for rust oe-selftest in
  meta/recipes-devtools/rust/rust-source.inc

* Disable rust oe-selftest for mips32 target (Rust upstream has classified it into tier 3 target,
  for which the Rust project does not build or test automatically) as it is unstable with rust tests.
  https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3

* The testing is done on arm32, arm64, mips64, x86 and  x86_64 targets on Ubuntu 22.04.

(From OE-Core rev: 8f3a2841540fc4779bbd7e11d910edcdc8b47683)

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-26 14:06:55 +00:00
Yash Shinde
ac7375e02f rust: Fix assertion failure error on oe-selftest
Fixes: thread 'main' panicked at 'assertion failed: `(left == right)`
       left: `x86_64-unknown-linux-gnu`,
       right: `x86_64-poky-linux-gnu`: Cannot obtain compiler for non-native build triple at stage 0', compile.rs:1474:13

Add correct target value for cross-compiled targets on stage1 during rust oe-selfest.

(From OE-Core rev: b8c1091276b6b9b1ae162dd19b2652f493a686d8)

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-26 14:06:55 +00:00
Yash Shinde
208b3bee78 rust: Enable RUSTC_BOOTSTRAP to use nightly features during rust oe-selftest.
Fixes: error: the option `Z` is only accepted on the nightly compiler

When rust.channel is set to either beta or stable, we can't use
nightly features on bootstrap without RUSTC_BOOTSTRAP.
Set RUSTC_BOOTSTRAP=1 to use nightly features on stable or beta.

(From OE-Core rev: 01a411223fb85fedf85472402f63f6cb2f32ed6b)

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-26 14:06:55 +00:00
Yash Shinde
0a066f7526 rust: detect user-specified custom targets in compiletest
Fixes: thread 'main' panicked at 'failed to gather the target spec
       for '<arch>-unknown-linux-gnu', synthetic_targets.rs:66:9

Detect and fetch custom target configurations when rustc is
bootstrapped in rust oe-selftest.

(From OE-Core rev: fdd9385d9845d628e10179598fc42d29519c5dfd)

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-26 14:06:55 +00:00
Yash Shinde
357651377f rust: Fetch cargo from rust-snapshot dir.
Fixes: Exception: no cargo executable found at
       `${B}/rustc-1.74.1-src/build/x86_64-unknown-linux-gnu/stage0/bin/cargo`

Fix the cargo binary path error on oe-selftest and path set to rust-snapshot dir.

Patch sent to upstream- https://github.com/rust-lang/rust/pull/120125

(From OE-Core rev: 1a048b5ab7f891911beaa14eb9269033c84088dc)

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-26 14:06:55 +00:00
Alex Kiernan
f00d4c3029 rust: Upgrade 1.74.0 -> 1.74.1
https://blog.rust-lang.org/2023/12/07/Rust-1.74.1.html

(From OE-Core rev: b98373075c6cc416bd0375b98b6bbdddf599d9a1)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-30 11:03:08 +00:00
Alex Kiernan
8fd396bc3d rust: Upgrade 1.73.0 -> 1.74.0
Replace musl fixes with backports from upstream.

Add sysconfdir to config.toml to fix:

| thread 'main' panicked at install.rs:92:9:
| User doesn't have write access on `install.sysconfdir` path in `config.toml`.

https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html

(From OE-Core rev: 84f46dd2503bb0ef238fef0097c66fda88f6cbda)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-30 11:03:08 +00:00
Alex Kiernan
537ed2b654 rust: Upgrade 1.72.1 -> 1.73.0
https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html

(From OE-Core rev: 728c40b939c6af6358a483237298ca834cbb8993)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-30 11:03:08 +00:00
Alex Kiernan
aa0b0d0cc2 rust: Upgrade 1.72.0 -> 1.72.1
https://blog.rust-lang.org/2023/09/19/Rust-1.72.1.html

(From OE-Core rev: d1386bbf2211c7616527e62f2f7b069a935b0d68)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-30 11:03:08 +00:00
Alex Kiernan
6eabf7e4b4 rust: Upgrade 1.71.1 -> 1.72.0
Drop getrandom-open64.patch (merged upstream).

Revert c4f414f449
("Map source absolute paths to OUT_DIR as relative. (#684)") which
causes hashed versions of the build path to be used as part of the
filename of generated objects and hence reproducibility issues.

https://blog.rust-lang.org/2023/08/24/Rust-1.72.0.html

(From OE-Core rev: 30637cdeb31fae02544fdc643a455d0ebb126ee6)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-30 11:03:08 +00:00
Sundeep KOKKONDA
321aebfa28 rust: rustdoc reproducibility issue fix - disable PGO
The PGO (Profile-guided Optimization) collect data about the typical execution of a program
and then use this data to inform optimizations such as inlining, machine-code layout,
register allocation, etc.

This optimization is by default disabled in rust sources but enabled in Yocto and causing
the reproducibility issue in rustdoc binary. To fix the issue this optimization is set to
it's default 'false'.

More about the optimization: https://doc.rust-lang.org/rustc/profile-guided-optimization.html

With the reproducibility issue fixed, we can enable the reproducibility tests again.

(From OE-Core rev: 189c266378c8c4a918cb205b3888577c7ce76856)

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-21 10:38:30 +00:00
Alex Kiernan
66ba893285 rust: Upgrade 1.71.0 -> 1.71.1
https://blog.rust-lang.org/2023/08/03/Rust-1.71.1.html

(From OE-Core rev: ad4369d7901c1239e5f07473b1f2517edc4a23ea)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-13 11:49:43 +00:00
Alex Kiernan
93292feac4 rust: Upgrade 1.70.0 -> 1.71.0
Switch libstd-rs to use the dummy `sysroot` crate which represents the
standard library crates. Target getrandom-open64.patch at 0.2.8 (merged
for 0.2.9). Drop bootstrap_fail.patch (backport merged).

https://blog.rust-lang.org/2023/07/13/Rust-1.71.0.html

(From OE-Core rev: c3eba94ee44adcd3a0aa61f6b087c15c02e4697f)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-13 11:49:42 +00:00
Alex Kiernan
de401f80ae rust: Drop targets and hosts override magic
`targets` and `hosts` could be overridden prior to 0a01b5ab97
("rust-cross-canadian: Simplify and fix"), that commit deleted this
usage, remove the remnant of it from here.

(From OE-Core rev: 6c93a71a9855cb0231d2f90f0412b6a49e3b1d99)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-04 11:23:37 +00:00
Niko Mauno
8bea1bd57c rust-llvm: Allow overriding LLVM target archs
Move the default value into a variable which can be overridden to
match more accurately the use case specific scenario.

(From OE-Core rev: 645370e85d8742d0614cd52ca7507b5df2d38ad8)

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-04 11:23:37 +00:00
Alex Kiernan
8078310674 rust: Drop TARGET_VENDOR export
This was used by crossbeam_atomic.patch, but that patch was removed as
part of the 1.69.0 upgrade.

(From OE-Core rev: 3753997d6ec19e8cd082f9a602ebe4a7c1308c36)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-01 11:48:25 +00:00
Alex Kiernan
505dad0d67 rust: Delete python2 configparser code path
We no longer support python2, remove the python2 fallback code.

(From OE-Core rev: c7c17dcaf452abbf49fd05c15cd56aa4b4382284)

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-01 11:48:25 +00:00
Sundeep KOKKONDA
3e50e45917 rust: Split rustdoc into a separate package
The 'rustdoc' is moved to a separate 'rust-rustdoc' package. This is a
workaround to test if the main rust binary is reproducible even if
rustdoc isn't.

(From OE-Core rev: dfed7e63e199009ecca8e2e34f6a823c6e1677e0)

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-27 22:54:59 +00:00
Ross Burton
84e68041a2 rust-llvm: remove python3native dependency
LLVM doesn't actually need a native Python3 as the host Python is
sufficient, but as it then looks at the host for optional Python
dependencies explicitly disable their detection so that rust-llvm
remains deterministic.  As this is a minimal LLVM for Rust, we don't
need the optviewer tool.

(From OE-Core rev: c6971d9d9a9d9a83615508d244778ddc89a94b8a)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-23 12:46:42 +00:00
Martin Jansa
d7a8a51cf5 rust: drop PE, PR from /usr/src/debug paths
(From OE-Core rev: e4931b1d6f147fc7ced080e30c63f0aaf0d1e7ff)

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-20 15:30:53 +00:00
Khem Raj
769abe5702 rust-cross-canadian: Add riscv64 to cross-canadian hosts
(From OE-Core rev: c0bf5dd2f3ef11df35130283853017ba69d0e9c1)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-05 11:28:34 +00:00
Sean Nyekjaer
1a44c1ad59 rust-cross-canadian: set CARGO_TARGET_<triple>_RUNNER for nativesdk
This will enable us to build and run rust programs on the sdk host.

% cargo run --target x86_64-oesdk-linux-gnu -vv
       Fresh hello v0.1.0 (~/development/hello)
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `/usr/local/sdk/sysroots/x86_64-oesdk-linux/lib/ld-linux-x86-64.so.2 target/x86_64-oesdk-linux-gnu/debug/hello`
Hello, world

(From OE-Core rev: 0dc848e0b560947f93a780f4bf7b6d1926a570eb)

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-19 13:38:56 +01:00
Sean Nyekjaer
791468b7ab rust-cross-canadian: set CARGO_TARGET_<triple>_RUSTFLAGS
Avoid setting sdk-wide RUSTFLAGS as these flags only are valid when
building for target.
This will enable building for different targets with different
RUSTFLAGS.

(From OE-Core rev: 25627606aadacae3a2ab805a6098c81fed154b27)

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-19 13:38:56 +01:00
Sundeep KOKKONDA
b36cbd3f2b rust: reproducibility issue fix
The '--remap-path-prefix' option removes all references to build directory
structure in the debug information within the compiled output for Cargo
dependencies and the project's binary.

However, some references to build directories remains in the final binary
in .rustc section in the form of compressed metadata and this makes the
build output dependent on the folder structure of the computer it's compiled on.

So, for reproducible builds, use the configuration option
'remap-debuginfo = true' along with the '--remap-path-prefix'.

[YOCTO# 14875]

(From OE-Core rev: 6ae62259afbbe861ed74211dab18a27b8c8d8b7a)

Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-11 09:36:53 +01:00
Richard Purdie
1b94ea8b25 recipes: Drop remaining PR values from recipes
We've been removing PR values from recipes at upgrade time for a while. In general
anyone maintaining a binary distro would end up having to curate these themselves
so the values in OE-Core aren't really that useful anymore. In many ways it makes
sense to clear out the remaining ones (which are mostly for 'config' recipes that
are unlikely to increase in PV) and leave a clean slate for anyone implementing
a binary distro config.

References are left in meta-selftest since the tests there do involve them and
their removal upon upgrade.

(From OE-Core rev: d4c346e8ab8f3cae25d1b01c7331ed9f6d4f96ef)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-22 07:45:17 +01:00
Alexander Kanavin
6772cb4a15 cargo-c-native: fix version check
(From OE-Core rev: 6176f8c95e444766fd3e8b89f0be686a03800268)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-12 07:45:52 +01:00
Frederic Martinsons
ed5702223b rust: add cargo-c native recipe
This package make it easier to generate C/C++ ABI compatible
header, library and also generate package config file.

It is built around cbindgen (https://github.com/mozilla/cbindgen)
for the header generation, it compiles the library (static or dynamic)
through cargo and finally handle the generation of a custom
package config file.

(From OE-Core rev: dfce5f9ffb5240aadae311c2a2e912a315afc703)

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-08-21 16:15:35 +01:00