1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
From ce68809d41291f671b440abce41f8f71c95428aa Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Mon, 3 Feb 2025 20:06:46 +0100
Subject: [PATCH] src/core/build_steps/tool.rs: switch off lto for rustdoc
For reasons currently unknown, librustdoc binary ends up with
non-reproducible .llvm.<number> suffixes in its symbols - but
not any other binary.
Disabling lto avoids creating these suffixes. More info about the option:
https://doc.rust-lang.org/rustc/codegen-options/index.html#lto
As seen below, there's a comment in the source tree saying not to tweak the options
but this only creates a mix of lto and non-lto optimized binary objects from
various crates, which should be safe to mix.
Upstream-Status: Inappropriate [reported at https://github.com/rust-lang/rust/issues/134589]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
src/bootstrap/src/core/build_steps/tool.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index 087df2f8a..00790affb 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -1,14 +1,11 @@
use std::path::PathBuf;
use std::{env, fs};
-use crate::core::build_steps::compile::is_lto_stage;
use crate::core::build_steps::toolstate::ToolState;
use crate::core::build_steps::{compile, llvm};
use crate::core::builder;
-use crate::core::builder::{
- Builder, Cargo as CargoCommand, RunConfig, ShouldRun, Step, cargo_profile_var,
-};
-use crate::core::config::{DebuginfoLevel, RustcLto, TargetSelection};
+use crate::core::builder::{Builder, Cargo as CargoCommand, RunConfig, ShouldRun, Step};
+use crate::core::config::{DebuginfoLevel, TargetSelection};
use crate::utils::channel::GitInfo;
use crate::utils::exec::{BootstrapCommand, command};
use crate::utils::helpers::{add_dylib_path, exe, t};
@@ -658,19 +655,7 @@
SourceType::InTree,
features.as_slice(),
);
-
- // rustdoc is performance sensitive, so apply LTO to it.
- if is_lto_stage(&build_compiler) {
- let lto = match builder.config.rust_lto {
- RustcLto::Off => Some("off"),
- RustcLto::Thin => Some("thin"),
- RustcLto::Fat => Some("fat"),
- RustcLto::ThinLocal => None,
- };
- if let Some(lto) = lto {
- cargo.env(cargo_profile_var("LTO", &builder.config), lto);
- }
- }
+ cargo.rustflag("-Clto=off");
let _guard = builder.msg_tool(
Kind::Build,
diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs
--- a/src/bootstrap/src/core/builder/mod.rs
+++ b/src/bootstrap/src/core/builder/mod.rs
@@ -11,7 +11,7 @@
use clap::ValueEnum;
-pub use self::cargo::{Cargo, cargo_profile_var};
+pub use self::cargo::Cargo;
pub use crate::Compiler;
use crate::core::build_steps::{
check, clean, clippy, compile, dist, doc, gcc, install, llvm, run, setup, test, tool, vendor,
|