summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/rust/files/0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch46
-rw-r--r--meta/recipes-devtools/rust/files/rustdoc-repro-issue-fix-cargo-config-for-codegenunits.patch26
-rw-r--r--meta/recipes-devtools/rust/rust-source.inc2
-rw-r--r--meta/recipes-devtools/rust/rust_1.81.0.bb1
4 files changed, 47 insertions, 28 deletions
diff --git a/meta/recipes-devtools/rust/files/0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch b/meta/recipes-devtools/rust/files/0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch
new file mode 100644
index 0000000000..e63cfb0719
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch
@@ -0,0 +1,46 @@
1From ce68809d41291f671b440abce41f8f71c95428aa Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Mon, 3 Feb 2025 20:06:46 +0100
4Subject: [PATCH] src/core/build_steps/tool.rs: switch off lto for rustdoc
5
6For reasons currently unknown, librustdoc binary ends up with
7non-reproducible .llvm.<number> suffixes in its symbols - but
8not any other binary.
9
10Disabling lto avoids creating these suffixes. More info about the option:
11https://doc.rust-lang.org/rustc/codegen-options/index.html#lto
12
13As seen below, there's a comment in the source tree saying not to tweak the options
14but this only creates a mix of lto and non-lto optimized binary objects from
15various crates, which should be safe to mix.
16
17Upstream-Status: Inappropriate [reported at https://github.com/rust-lang/rust/issues/134589]
18Signed-off-by: Alexander Kanavin <alex@linutronix.de>
19---
20 src/bootstrap/src/core/build_steps/tool.rs | 3 ++-
21 1 file changed, 2 insertions(+), 1 deletion(-)
22
23diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
24index 087df2f8a..00790affb 100644
25--- a/src/bootstrap/src/core/build_steps/tool.rs
26+++ b/src/bootstrap/src/core/build_steps/tool.rs
27@@ -635,7 +635,7 @@ impl Step for Rustdoc {
28 }
29
30 // NOTE: Never modify the rustflags here, it breaks the build cache for other tools!
31- let cargo = prepare_tool_cargo(
32+ let mut cargo = prepare_tool_cargo(
33 builder,
34 build_compiler,
35 Mode::ToolRustc,
36@@ -645,6 +645,7 @@ impl Step for Rustdoc {
37 SourceType::InTree,
38 features.as_slice(),
39 );
40+ cargo.rustflag("-Clto=off");
41
42 let _guard = builder.msg_tool(
43 Kind::Build,
44--
452.39.5
46
diff --git a/meta/recipes-devtools/rust/files/rustdoc-repro-issue-fix-cargo-config-for-codegenunits.patch b/meta/recipes-devtools/rust/files/rustdoc-repro-issue-fix-cargo-config-for-codegenunits.patch
deleted file mode 100644
index 0aab8772eb..0000000000
--- a/meta/recipes-devtools/rust/files/rustdoc-repro-issue-fix-cargo-config-for-codegenunits.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1rust: rustdoc reproducibility issue fix
2
3rust: rustdoc reproducibility issue fix
4
5The 'codegen-units' option split the crate into multiple compilation units for parallel compilation. Currently, this split is causing the rustdoc to generate differnt binary between the builds.
6To fix this the codegen-units & the lto options are disabled.
7
8More info about options:
9https://doc.rust-lang.org/cargo/reference/profiles.html#codegen-units
10https://doc.rust-lang.org/rustc/codegen-options/index.html#lto
11
12Upstream-Status: Inappropriate [oe specific]
13
14Signed-off-by: Sundeep KOKKONDA <sundeep.kokkonda@windriver.com>
15---
16--- a/.cargo/config.toml
17+++ b/.cargo/config.toml
18@@ -3,3 +3,7 @@
19
20 [source.vendored-sources]
21 directory = "vendor"
22+
23+[profile.release]
24+codegen-units = 1
25+
26
diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc
index 8484c94ef8..83355935fc 100644
--- a/meta/recipes-devtools/rust/rust-source.inc
+++ b/meta/recipes-devtools/rust/rust-source.inc
@@ -4,10 +4,10 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
4 file://zlib-off64_t.patch;patchdir=${RUSTSRC} \ 4 file://zlib-off64_t.patch;patchdir=${RUSTSRC} \
5 file://rv32-rustix-libc-backend.patch;patchdir=${RUSTSRC} \ 5 file://rv32-rustix-libc-backend.patch;patchdir=${RUSTSRC} \
6 file://rv32-cargo-rustix-0.38.28-fix.patch;patchdir=${RUSTSRC} \ 6 file://rv32-cargo-rustix-0.38.28-fix.patch;patchdir=${RUSTSRC} \
7 file://rustdoc-repro-issue-fix-cargo-config-for-codegenunits.patch;patchdir=${RUSTSRC} \
8 file://rust-oe-selftest.patch;patchdir=${RUSTSRC} \ 7 file://rust-oe-selftest.patch;patchdir=${RUSTSRC} \
9 file://repro-issue-fix-with-cc-crate-hashmap.patch;patchdir=${RUSTSRC} \ 8 file://repro-issue-fix-with-cc-crate-hashmap.patch;patchdir=${RUSTSRC} \
10 file://oeqa-selftest-Increase-timeout-in-process-sigpipe-ru.patch;patchdir=${RUSTSRC} \ 9 file://oeqa-selftest-Increase-timeout-in-process-sigpipe-ru.patch;patchdir=${RUSTSRC} \
10 file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \
11" 11"
12SRC_URI[rust.sha256sum] = "36217ef7e32f40a180e3d79bd666b4dfdaed49dd381023a5fb765fd12d0092ce" 12SRC_URI[rust.sha256sum] = "36217ef7e32f40a180e3d79bd666b4dfdaed49dd381023a5fb765fd12d0092ce"
13 13
diff --git a/meta/recipes-devtools/rust/rust_1.81.0.bb b/meta/recipes-devtools/rust/rust_1.81.0.bb
index 288b0fbb44..1038c275f6 100644
--- a/meta/recipes-devtools/rust/rust_1.81.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.81.0.bb
@@ -136,7 +136,6 @@ python do_configure() {
136 config.add_section("rust") 136 config.add_section("rust")
137 config.set("rust", "rpath", e(True)) 137 config.set("rust", "rpath", e(True))
138 config.set("rust", "remap-debuginfo", e(True)) 138 config.set("rust", "remap-debuginfo", e(True))
139 config.set("rust", "lto", "\"off\"")
140 config.set("rust", "channel", e(d.expand("${RUST_CHANNEL}"))) 139 config.set("rust", "channel", e(d.expand("${RUST_CHANNEL}")))
141 140
142 # Whether or not to optimize the compiler and standard library 141 # Whether or not to optimize the compiler and standard library