Skip to content

Commit adfcb74

Browse files
authored
Rollup merge of #98886 - michaelwoerister:tracked-split-dwarf-kind, r=davidtwco
incr.comp.: Make split-dwarf commandline options [TRACKED]. This commandline options have an influence on the contents of object files (and .dwo files), so they need to be `[TRACKED]`. r? `@davidtwco`
2 parents accb41e + 822957f commit adfcb74

File tree

3 files changed

+38
-4
lines changed

3 files changed

+38
-4
lines changed

compiler/rustc_session/src/config.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2724,8 +2724,8 @@ pub(crate) mod dep_tracking {
27242724
use super::{
27252725
BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, ErrorOutputType,
27262726
InstrumentCoverage, LdImpl, LinkerPluginLto, LocationDetail, LtoCli, OomStrategy, OptLevel,
2727-
OutputType, OutputTypes, Passes, SourceFileHashAlgorithm, SwitchWithOptPath,
2728-
SymbolManglingVersion, TrimmedDefPaths,
2727+
OutputType, OutputTypes, Passes, SourceFileHashAlgorithm, SplitDwarfKind,
2728+
SwitchWithOptPath, SymbolManglingVersion, TrimmedDefPaths,
27292729
};
27302730
use crate::lint;
27312731
use crate::options::WasiExecModel;
@@ -2812,6 +2812,7 @@ pub(crate) mod dep_tracking {
28122812
Edition,
28132813
LinkerPluginLto,
28142814
SplitDebuginfo,
2815+
SplitDwarfKind,
28152816
StackProtector,
28162817
SwitchWithOptPath,
28172818
SymbolManglingVersion,

compiler/rustc_session/src/options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1496,15 +1496,15 @@ options! {
14961496
"control if mem::uninitialized and mem::zeroed panic on more UB"),
14971497
strip: Strip = (Strip::None, parse_strip, [UNTRACKED],
14981498
"tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)"),
1499-
split_dwarf_kind: SplitDwarfKind = (SplitDwarfKind::Split, parse_split_dwarf_kind, [UNTRACKED],
1499+
split_dwarf_kind: SplitDwarfKind = (SplitDwarfKind::Split, parse_split_dwarf_kind, [TRACKED],
15001500
"split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform)
15011501
(default: `split`)
15021502
15031503
`split`: sections which do not require relocation are written into a DWARF object (`.dwo`)
15041504
file which is ignored by the linker
15051505
`single`: sections which do not require relocation are written into object file but ignored
15061506
by the linker"),
1507-
split_dwarf_inlining: bool = (true, parse_bool, [UNTRACKED],
1507+
split_dwarf_inlining: bool = (true, parse_bool, [TRACKED],
15081508
"provide minimal debug info in the object/executable to facilitate online \
15091509
symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF"),
15101510
symbol_mangling_version: Option<SymbolManglingVersion> = (None,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This test case makes sure that changing split-debuginfo commandline options triggers a full re-compilation.
2+
// We only test on x86_64-unknown-linux-gnu because there all combinations split-debuginfo settings are valid
3+
// and the test is platform-independent otherwise.
4+
5+
// ignore-tidy-linelength
6+
// only-x86_64-unknown-linux-gnu
7+
// revisions:rpass1 rpass2 rpass3 rpass4
8+
9+
// [rpass1]compile-flags: -Zquery-dep-graph -Zunstable-options -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on
10+
// [rpass2]compile-flags: -Zquery-dep-graph -Zunstable-options -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single -Zsplit-dwarf-inlining=on
11+
// [rpass3]compile-flags: -Zquery-dep-graph -Zunstable-options -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split -Zsplit-dwarf-inlining=on
12+
// [rpass4]compile-flags: -Zquery-dep-graph -Zunstable-options -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split -Zsplit-dwarf-inlining=off
13+
14+
#![feature(rustc_attrs)]
15+
// For rpass2 we change -Csplit-debuginfo and thus expect every CGU to be recompiled
16+
#![rustc_partition_codegened(module = "split_debuginfo_mode", cfg = "rpass2")]
17+
#![rustc_partition_codegened(module = "split_debuginfo_mode-another_module", cfg = "rpass2")]
18+
// For rpass3 we change -Zsplit-dwarf-kind and thus also expect every CGU to be recompiled
19+
#![rustc_partition_codegened(module = "split_debuginfo_mode", cfg = "rpass3")]
20+
#![rustc_partition_codegened(module = "split_debuginfo_mode-another_module", cfg = "rpass3")]
21+
// For rpass4 we change -Zsplit-dwarf-inlining and thus also expect every CGU to be recompiled
22+
#![rustc_partition_codegened(module = "split_debuginfo_mode", cfg = "rpass4")]
23+
#![rustc_partition_codegened(module = "split_debuginfo_mode-another_module", cfg = "rpass4")]
24+
25+
mod another_module {
26+
pub fn foo() -> &'static str {
27+
"hello world"
28+
}
29+
}
30+
31+
pub fn main() {
32+
println!("{}", another_module::foo());
33+
}

0 commit comments

Comments
 (0)