about summary refs log tree commit diff
path: root/compiler/rustc_session/src
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-06-13 11:40:28 +0100
committerDavid Wood <david.wood@huawei.com>2022-08-18 15:19:40 +0100
commitcf2c492ef8c87c049b4e3a62f43c841aafc88cba (patch)
treeec6ee935cb54a462d017d19dccbf2f7697708044 /compiler/rustc_session/src
parent8556e6620e4866526b3cea767ad8c20ae877a569 (diff)
downloadrust-cf2c492ef8c87c049b4e3a62f43c841aafc88cba.tar.gz
rust-cf2c492ef8c87c049b4e3a62f43c841aafc88cba.zip
session: stabilize split debuginfo on linux
Stabilize the `-Csplit-debuginfo` flag...

- ...on Linux for all values of the flag. Split DWARF has been
  implemented for a few months, hasn't had any bug reports and has had
  some promising benchmarking for incremental debug build performance.
- ..on other platforms for the default value. It doesn't make any sense
  that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when
  that's the default behaviour, but keep the other values unstable.

Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_session/src')
-rw-r--r--compiler/rustc_session/src/config.rs7
-rw-r--r--compiler/rustc_session/src/session.rs14
2 files changed, 12 insertions, 9 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 68519c8fa82..162fc9aa0a6 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -2423,13 +2423,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
 
     let pretty = parse_pretty(&unstable_opts, error_format);
 
-    if !unstable_opts.unstable_options
-        && !target_triple.triple().contains("apple")
-        && cg.split_debuginfo.is_some()
-    {
-        early_error(error_format, "`-Csplit-debuginfo` is unstable on this platform");
-    }
-
     // Try to find a directory containing the Rust `src`, for more details see
     // the doc comment on the `real_rust_source_base_dir` field.
     let tmp_buf;
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index 80de451276c..e9092d7abdf 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -31,7 +31,7 @@ use rustc_span::{sym, SourceFileHashAlgorithm, Symbol};
 use rustc_target::asm::InlineAsmArch;
 use rustc_target::spec::{CodeModel, PanicStrategy, RelocModel, RelroLevel};
 use rustc_target::spec::{
-    SanitizerSet, SplitDebuginfo, StackProtector, Target, TargetTriple, TlsModel,
+    DebuginfoKind, SanitizerSet, SplitDebuginfo, StackProtector, Target, TargetTriple, TlsModel,
 };
 
 use std::cell::{self, RefCell};
@@ -661,8 +661,9 @@ impl Session {
             )
     }
 
+    /// Returns `true` if the target can use the current split debuginfo configuration.
     pub fn target_can_use_split_dwarf(&self) -> bool {
-        !self.target.is_like_windows && !self.target.is_like_osx
+        self.target.debuginfo_kind == DebuginfoKind::Dwarf
     }
 
     pub fn generate_proc_macro_decls_symbol(&self, stable_crate_id: StableCrateId) -> String {
@@ -1543,6 +1544,15 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
             sess.err(&format!("requested DWARF version {} is greater than 5", dwarf_version));
         }
     }
+
+    if !sess.target.options.supported_split_debuginfo.contains(&sess.split_debuginfo())
+        && !sess.opts.unstable_opts.unstable_options
+    {
+        sess.err(&format!(
+            "`-Csplit-debuginfo={}` is unstable on this platform",
+            sess.split_debuginfo()
+        ));
+    }
 }
 
 /// Holds data on the current incremental compilation session, if there is one.