@@ -130,7 +130,7 @@ pub struct Config {
130
130
pub rust_debuginfo_level_std : u32 ,
131
131
pub rust_debuginfo_level_tools : u32 ,
132
132
pub rust_debuginfo_level_tests : u32 ,
133
- pub rust_run_dsymutil : bool ,
133
+ pub rust_split_debuginfo : SplitDebuginfo ,
134
134
pub rust_rpath : bool ,
135
135
pub rustc_parallel : bool ,
136
136
pub rustc_default_linker : Option < String > ,
@@ -221,6 +221,46 @@ impl FromStr for LlvmLibunwind {
221
221
}
222
222
}
223
223
224
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
225
+ pub enum SplitDebuginfo {
226
+ Packed ,
227
+ Unpacked ,
228
+ Off ,
229
+ }
230
+
231
+ impl Default for SplitDebuginfo {
232
+ fn default ( ) -> Self {
233
+ SplitDebuginfo :: Off
234
+ }
235
+ }
236
+
237
+ impl std:: str:: FromStr for SplitDebuginfo {
238
+ type Err = ( ) ;
239
+
240
+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
241
+ match s {
242
+ "packed" => Ok ( SplitDebuginfo :: Packed ) ,
243
+ "unpacked" => Ok ( SplitDebuginfo :: Unpacked ) ,
244
+ "off" => Ok ( SplitDebuginfo :: Off ) ,
245
+ _ => Err ( ( ) ) ,
246
+ }
247
+ }
248
+ }
249
+
250
+ impl SplitDebuginfo {
251
+ /// Returns the default `-Csplit-debuginfo` value for the current target. See the comment for
252
+ /// `rust.split-debuginfo` in `config.toml.example`.
253
+ fn default_for_platform ( target : & str ) -> Self {
254
+ if target. contains ( "apple" ) {
255
+ SplitDebuginfo :: Unpacked
256
+ } else if target. contains ( "windows" ) {
257
+ SplitDebuginfo :: Packed
258
+ } else {
259
+ SplitDebuginfo :: Unpacked
260
+ }
261
+ }
262
+ }
263
+
224
264
#[ derive( Copy , Clone , Default , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
225
265
pub struct TargetSelection {
226
266
pub triple : Interned < String > ,
@@ -586,6 +626,7 @@ define_config! {
586
626
debuginfo_level_std: Option <u32 > = "debuginfo-level-std" ,
587
627
debuginfo_level_tools: Option <u32 > = "debuginfo-level-tools" ,
588
628
debuginfo_level_tests: Option <u32 > = "debuginfo-level-tests" ,
629
+ split_debuginfo: Option <String > = "split-debuginfo" ,
589
630
run_dsymutil: Option <bool > = "run-dsymutil" ,
590
631
backtrace: Option <bool > = "backtrace" ,
591
632
incremental: Option <bool > = "incremental" ,
@@ -992,7 +1033,12 @@ impl Config {
992
1033
debuginfo_level_std = rust. debuginfo_level_std ;
993
1034
debuginfo_level_tools = rust. debuginfo_level_tools ;
994
1035
debuginfo_level_tests = rust. debuginfo_level_tests ;
995
- config. rust_run_dsymutil = rust. run_dsymutil . unwrap_or ( false ) ;
1036
+ config. rust_split_debuginfo = rust
1037
+ . split_debuginfo
1038
+ . as_deref ( )
1039
+ . map ( SplitDebuginfo :: from_str)
1040
+ . map ( |v| v. expect ( "invalid value for rust.split_debuginfo" ) )
1041
+ . unwrap_or ( SplitDebuginfo :: default_for_platform ( & config. build . triple ) ) ;
996
1042
optimize = rust. optimize ;
997
1043
ignore_git = rust. ignore_git ;
998
1044
config. rust_new_symbol_mangling = rust. new_symbol_mangling ;
0 commit comments