diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2024-12-26 21:55:22 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2024-12-26 22:34:09 +0000 |
| commit | e5f676521ceb97388c0d1ca60a171548f8a0ef76 (patch) | |
| tree | 253034d633d9bb6ed8b5fab179ea1fc57761a7ea /src/bootstrap | |
| parent | 19e75f4fb3f960267996e8788459e97b8769aac7 (diff) | |
| download | rust-e5f676521ceb97388c0d1ca60a171548f8a0ef76.tar.gz rust-e5f676521ceb97388c0d1ca60a171548f8a0ef76.zip | |
Strip debuginfo from rustc-main and rustdoc
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 8 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/tool.rs | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index d30a0d028ff..bbb770a7a22 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -984,6 +984,7 @@ impl Step for Rustc { true, // Only ship rustc_driver.so and .rmeta files, not all intermediate .rlib files. ); + let target_root_dir = stamp.parent().unwrap(); // When building `librustc_driver.so` (like `libLLVM.so`) on linux, it can contain // unexpected debuginfo from dependencies, for example from the C++ standard library used in // our LLVM wrapper. Unless we're explicitly requesting `librustc_driver` to be built with @@ -992,11 +993,16 @@ impl Step for Rustc { if builder.config.rust_debuginfo_level_rustc == DebuginfoLevel::None && builder.config.rust_debuginfo_level_tools == DebuginfoLevel::None { - let target_root_dir = stamp.parent().unwrap(); let rustc_driver = target_root_dir.join("librustc_driver.so"); strip_debug(builder, target, &rustc_driver); } + if builder.config.rust_debuginfo_level_rustc == DebuginfoLevel::None { + // Due to LTO a lot of debug info from C++ dependencies such as jemalloc can make it into + // our final binaries + strip_debug(builder, target, &target_root_dir.join("rustc-main")); + } + builder.ensure(RustcLink::from_rustc( self, builder.compiler(compiler.stage, builder.config.build), diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 04f1e10f493..6b809a52bd2 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -5,7 +5,7 @@ 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}; -use crate::core::config::TargetSelection; +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}; @@ -671,6 +671,11 @@ impl Step for Rustdoc { // don't create a stage0-sysroot/bin directory. if target_compiler.stage > 0 { + if builder.config.rust_debuginfo_level_tools == DebuginfoLevel::None { + // Due to LTO a lot of debug info from C++ dependencies such as jemalloc can make it into + // our final binaries + compile::strip_debug(builder, target, &tool_rustdoc); + } let bin_rustdoc = bin_rustdoc(); builder.copy_link(&tool_rustdoc, &bin_rustdoc); bin_rustdoc |
