File tree Expand file tree Collapse file tree 5 files changed +27
-1
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 5 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -1037,6 +1037,13 @@ fn preserve_objects_for_their_debuginfo(sess: &Session) -> bool {
10371037 return false ;
10381038 }
10391039
1040+ // Single mode keeps debuginfo in the same object file, but in such a way that it it skipped
1041+ // by the linker - so it's expected that when codegen units are linked together that this
1042+ // debuginfo would be lost without keeping around the temps.
1043+ if sess. opts . debugging_opts . split_dwarf == config:: SplitDwarfKind :: Single {
1044+ return true ;
1045+ }
1046+
10401047 // If we're on OSX then the equivalent of split dwarf is turned on by
10411048 // default. The final executable won't actually have any debug information
10421049 // except it'll have pointers to elsewhere. Historically we've always run
Original file line number Diff line number Diff line change @@ -897,7 +897,12 @@ default_test!(Incremental {
897897 suite: "incremental"
898898} ) ;
899899
900- default_test ! ( Debuginfo { path: "src/test/debuginfo" , mode: "debuginfo" , suite: "debuginfo" } ) ;
900+ default_test_with_compare_mode ! ( Debuginfo {
901+ path: "src/test/debuginfo" ,
902+ mode: "debuginfo" ,
903+ suite: "debuginfo" ,
904+ compare_mode: "split-dwarf"
905+ } ) ;
901906
902907host_test ! ( UiFullDeps { path: "src/test/ui-fulldeps" , mode: "ui" , suite: "ui-fulldeps" } ) ;
903908
Original file line number Diff line number Diff line change @@ -127,6 +127,8 @@ pub enum CompareMode {
127127 Nll ,
128128 Polonius ,
129129 Chalk ,
130+ SplitDwarf ,
131+ SplitDwarfSingle ,
130132}
131133
132134impl CompareMode {
@@ -135,6 +137,8 @@ impl CompareMode {
135137 CompareMode :: Nll => "nll" ,
136138 CompareMode :: Polonius => "polonius" ,
137139 CompareMode :: Chalk => "chalk" ,
140+ CompareMode :: SplitDwarf => "split-dwarf" ,
141+ CompareMode :: SplitDwarfSingle => "split-dwarf-single" ,
138142 }
139143 }
140144
@@ -143,6 +147,8 @@ impl CompareMode {
143147 "nll" => CompareMode :: Nll ,
144148 "polonius" => CompareMode :: Polonius ,
145149 "chalk" => CompareMode :: Chalk ,
150+ "split-dwarf" => CompareMode :: SplitDwarf ,
151+ "split-dwarf-single" => CompareMode :: SplitDwarfSingle ,
146152 x => panic ! ( "unknown --compare-mode option: {}" , x) ,
147153 }
148154 }
Original file line number Diff line number Diff line change @@ -852,6 +852,8 @@ impl Config {
852852 Some ( CompareMode :: Nll ) => name == "compare-mode-nll" ,
853853 Some ( CompareMode :: Polonius ) => name == "compare-mode-polonius" ,
854854 Some ( CompareMode :: Chalk ) => name == "compare-mode-chalk" ,
855+ Some ( CompareMode :: SplitDwarf ) => name == "compare-mode-split-dwarf" ,
856+ Some ( CompareMode :: SplitDwarfSingle ) => name == "compare-mode-split-dwarf-single" ,
855857 None => false ,
856858 } ||
857859 ( cfg ! ( debug_assertions) && name == "debug" ) ||
Original file line number Diff line number Diff line change @@ -2017,6 +2017,12 @@ impl<'test> TestCx<'test> {
20172017 Some ( CompareMode :: Chalk ) => {
20182018 rustc. args ( & [ "-Zchalk" ] ) ;
20192019 }
2020+ Some ( CompareMode :: SplitDwarf ) => {
2021+ rustc. args ( & [ "-Zsplit-dwarf=split" ] ) ;
2022+ }
2023+ Some ( CompareMode :: SplitDwarfSingle ) => {
2024+ rustc. args ( & [ "-Zsplit-dwarf=single" ] ) ;
2025+ }
20202026 None => { }
20212027 }
20222028
You can’t perform that action at this time.
0 commit comments