1
Fork 0

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>
This commit is contained in:
David Wood 2022-06-13 11:40:28 +01:00
parent 8556e6620e
commit cf2c492ef8
14 changed files with 183 additions and 59 deletions

View file

@ -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.