File tree 5 files changed +27
-1
lines changed
compiler/rustc_codegen_ssa/src/back
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 {
1037
1037
return false ;
1038
1038
}
1039
1039
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
+
1040
1047
// If we're on OSX then the equivalent of split dwarf is turned on by
1041
1048
// default. The final executable won't actually have any debug information
1042
1049
// 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 {
897
897
suite: "incremental"
898
898
} ) ;
899
899
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
+ } ) ;
901
906
902
907
host_test ! ( UiFullDeps { path: "src/test/ui-fulldeps" , mode: "ui" , suite: "ui-fulldeps" } ) ;
903
908
Original file line number Diff line number Diff line change @@ -127,6 +127,8 @@ pub enum CompareMode {
127
127
Nll ,
128
128
Polonius ,
129
129
Chalk ,
130
+ SplitDwarf ,
131
+ SplitDwarfSingle ,
130
132
}
131
133
132
134
impl CompareMode {
@@ -135,6 +137,8 @@ impl CompareMode {
135
137
CompareMode :: Nll => "nll" ,
136
138
CompareMode :: Polonius => "polonius" ,
137
139
CompareMode :: Chalk => "chalk" ,
140
+ CompareMode :: SplitDwarf => "split-dwarf" ,
141
+ CompareMode :: SplitDwarfSingle => "split-dwarf-single" ,
138
142
}
139
143
}
140
144
@@ -143,6 +147,8 @@ impl CompareMode {
143
147
"nll" => CompareMode :: Nll ,
144
148
"polonius" => CompareMode :: Polonius ,
145
149
"chalk" => CompareMode :: Chalk ,
150
+ "split-dwarf" => CompareMode :: SplitDwarf ,
151
+ "split-dwarf-single" => CompareMode :: SplitDwarfSingle ,
146
152
x => panic ! ( "unknown --compare-mode option: {}" , x) ,
147
153
}
148
154
}
Original file line number Diff line number Diff line change @@ -852,6 +852,8 @@ impl Config {
852
852
Some ( CompareMode :: Nll ) => name == "compare-mode-nll" ,
853
853
Some ( CompareMode :: Polonius ) => name == "compare-mode-polonius" ,
854
854
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" ,
855
857
None => false ,
856
858
} ||
857
859
( cfg ! ( debug_assertions) && name == "debug" ) ||
Original file line number Diff line number Diff line change @@ -2017,6 +2017,12 @@ impl<'test> TestCx<'test> {
2017
2017
Some ( CompareMode :: Chalk ) => {
2018
2018
rustc. args ( & [ "-Zchalk" ] ) ;
2019
2019
}
2020
+ Some ( CompareMode :: SplitDwarf ) => {
2021
+ rustc. args ( & [ "-Zsplit-dwarf=split" ] ) ;
2022
+ }
2023
+ Some ( CompareMode :: SplitDwarfSingle ) => {
2024
+ rustc. args ( & [ "-Zsplit-dwarf=single" ] ) ;
2025
+ }
2020
2026
None => { }
2021
2027
}
2022
2028
You can’t perform that action at this time.
0 commit comments