Skip to content

Commit 2ad5292

Browse files
committed
Auto merge of #80213 - jryans:bootstrap-skip-dsymutil, r=nagisa
Skip `dsymutil` by default for compiler bootstrap `dsymutil` adds time to builds on Apple platforms for no clear benefit, and also makes it more difficult for debuggers to find debug info (which `@pnkfelix` highlighted on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/does.20lldb.20%28or.20gdb%29.20work.20on.20rustc.20on.20Mac.3F/near/220482092)). The compiler currently defaults to running `dsymutil` to preserve its historical default, but when compiling the compiler itself, we skip it by default since we know it's safe to do so in that case. r? `@nagisa`
2 parents 59aaa2a + e628fcf commit 2ad5292

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

config.toml.example

+8
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,14 @@ changelog-seen = 2
426426
# FIXME(#61117): Some tests fail when this option is enabled.
427427
#debuginfo-level-tests = 0
428428

429+
# Whether to run `dsymutil` on Apple platforms to gather debug info into .dSYM
430+
# bundles. `dsymutil` adds time to builds for no clear benefit, and also makes
431+
# it more difficult for debuggers to find debug info. The compiler currently
432+
# defaults to running `dsymutil` to preserve its historical default, but when
433+
# compiling the compiler itself, we skip it by default since we know it's safe
434+
# to do so in that case.
435+
#run-dsymutil = false
436+
429437
# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
430438
#backtrace = true
431439

src/bootstrap/builder.rs

+13
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,19 @@ impl<'a> Builder<'a> {
11261126
},
11271127
);
11281128

1129+
// `dsymutil` adds time to builds on Apple platforms for no clear benefit, and also makes
1130+
// it more difficult for debuggers to find debug info. The compiler currently defaults to
1131+
// running `dsymutil` to preserve its historical default, but when compiling the compiler
1132+
// itself, we skip it by default since we know it's safe to do so in that case.
1133+
// See https://github.com/rust-lang/rust/issues/79361 for more info on this flag.
1134+
if target.contains("apple") {
1135+
if self.config.rust_run_dsymutil {
1136+
rustflags.arg("-Zrun-dsymutil=yes");
1137+
} else {
1138+
rustflags.arg("-Zrun-dsymutil=no");
1139+
}
1140+
}
1141+
11291142
if self.config.cmd.bless() {
11301143
// Bless `expect!` tests.
11311144
cargo.env("UPDATE_EXPECT", "1");

src/bootstrap/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ pub struct Config {
123123
pub rust_debuginfo_level_std: u32,
124124
pub rust_debuginfo_level_tools: u32,
125125
pub rust_debuginfo_level_tests: u32,
126+
pub rust_run_dsymutil: bool,
126127
pub rust_rpath: bool,
127128
pub rustc_parallel: bool,
128129
pub rustc_default_linker: Option<String>,
@@ -466,6 +467,7 @@ struct Rust {
466467
debuginfo_level_std: Option<u32>,
467468
debuginfo_level_tools: Option<u32>,
468469
debuginfo_level_tests: Option<u32>,
470+
run_dsymutil: Option<bool>,
469471
backtrace: Option<bool>,
470472
incremental: Option<bool>,
471473
parallel_compiler: Option<bool>,
@@ -830,6 +832,7 @@ impl Config {
830832
debuginfo_level_std = rust.debuginfo_level_std;
831833
debuginfo_level_tools = rust.debuginfo_level_tools;
832834
debuginfo_level_tests = rust.debuginfo_level_tests;
835+
config.rust_run_dsymutil = rust.run_dsymutil.unwrap_or(false);
833836
optimize = rust.optimize;
834837
ignore_git = rust.ignore_git;
835838
set(&mut config.rust_new_symbol_mangling, rust.new_symbol_mangling);

0 commit comments

Comments
 (0)