about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJ. Ryan Stinnett <jryans@gmail.com>2020-12-20 02:49:18 +0000
committerJ. Ryan Stinnett <jryans@gmail.com>2020-12-20 02:55:35 +0000
commite628fcfcb591ce78673d2736ebe936873ea5111d (patch)
tree64cd42056420a14a70947d5fe6e4ef58ed73d504
parent1f5bc176b0e54a8e464704adcd7e571700207fe9 (diff)
downloadrust-e628fcfcb591ce78673d2736ebe936873ea5111d.tar.gz
rust-e628fcfcb591ce78673d2736ebe936873ea5111d.zip
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. 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.
-rw-r--r--config.toml.example8
-rw-r--r--src/bootstrap/builder.rs13
-rw-r--r--src/bootstrap/config.rs3
3 files changed, 24 insertions, 0 deletions
diff --git a/config.toml.example b/config.toml.example
index 5b045d4e32d..b1fb8904ca9 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -426,6 +426,14 @@ changelog-seen = 2
 # FIXME(#61117): Some tests fail when this option is enabled.
 #debuginfo-level-tests = 0
 
+# Whether to run `dsymutil` on Apple platforms to gather debug info into .dSYM
+# bundles. `dsymutil` adds time to builds for no clear benefit, and also makes
+# it more difficult for debuggers to find debug info. 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.
+#run-dsymutil = false
+
 # Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
 #backtrace = true
 
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 9af79e20630..ab0c4a5c31b 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1126,6 +1126,19 @@ impl<'a> Builder<'a> {
             },
         );
 
+        // `dsymutil` adds time to builds on Apple platforms for no clear benefit, and also makes
+        // it more difficult for debuggers to find debug info. 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.
+        // See https://github.com/rust-lang/rust/issues/79361 for more info on this flag.
+        if target.contains("apple") {
+            if self.config.rust_run_dsymutil {
+                rustflags.arg("-Zrun-dsymutil=yes");
+            } else {
+                rustflags.arg("-Zrun-dsymutil=no");
+            }
+        }
+
         if self.config.cmd.bless() {
             // Bless `expect!` tests.
             cargo.env("UPDATE_EXPECT", "1");
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index fb2c6d1f92a..ece8a7494b5 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -123,6 +123,7 @@ pub struct Config {
     pub rust_debuginfo_level_std: u32,
     pub rust_debuginfo_level_tools: u32,
     pub rust_debuginfo_level_tests: u32,
+    pub rust_run_dsymutil: bool,
     pub rust_rpath: bool,
     pub rustc_parallel: bool,
     pub rustc_default_linker: Option<String>,
@@ -466,6 +467,7 @@ struct Rust {
     debuginfo_level_std: Option<u32>,
     debuginfo_level_tools: Option<u32>,
     debuginfo_level_tests: Option<u32>,
+    run_dsymutil: Option<bool>,
     backtrace: Option<bool>,
     incremental: Option<bool>,
     parallel_compiler: Option<bool>,
@@ -830,6 +832,7 @@ impl Config {
             debuginfo_level_std = rust.debuginfo_level_std;
             debuginfo_level_tools = rust.debuginfo_level_tools;
             debuginfo_level_tests = rust.debuginfo_level_tests;
+            config.rust_run_dsymutil = rust.run_dsymutil.unwrap_or(false);
             optimize = rust.optimize;
             ignore_git = rust.ignore_git;
             set(&mut config.rust_new_symbol_mangling, rust.new_symbol_mangling);