@@ -255,7 +255,7 @@ pub struct Config {
255
255
pub rust_debuginfo_level_std : DebuginfoLevel ,
256
256
pub rust_debuginfo_level_tools : DebuginfoLevel ,
257
257
pub rust_debuginfo_level_tests : DebuginfoLevel ,
258
- pub rust_split_debuginfo : SplitDebuginfo ,
258
+ pub rust_split_debuginfo_for_build_triple : Option < SplitDebuginfo > , // FIXME: Deprecated field. Remove in Q3'24.
259
259
pub rust_rpath : bool ,
260
260
pub rust_strip : bool ,
261
261
pub rust_frame_pointers : bool ,
@@ -573,6 +573,7 @@ pub struct Target {
573
573
pub ranlib : Option < PathBuf > ,
574
574
pub default_linker : Option < PathBuf > ,
575
575
pub linker : Option < PathBuf > ,
576
+ pub split_debuginfo : Option < SplitDebuginfo > ,
576
577
pub sanitizers : Option < bool > ,
577
578
pub profiler : Option < StringOrBool > ,
578
579
pub rpath : Option < bool > ,
@@ -1131,6 +1132,7 @@ define_config! {
1131
1132
ranlib: Option <String > = "ranlib" ,
1132
1133
default_linker: Option <PathBuf > = "default-linker" ,
1133
1134
linker: Option <String > = "linker" ,
1135
+ split_debuginfo: Option <String > = "split-debuginfo" ,
1134
1136
llvm_config: Option <String > = "llvm-config" ,
1135
1137
llvm_has_rust_patches: Option <bool > = "llvm-has-rust-patches" ,
1136
1138
llvm_filecheck: Option <String > = "llvm-filecheck" ,
@@ -1624,11 +1626,18 @@ impl Config {
1624
1626
debuginfo_level_tools = debuginfo_level_tools_toml;
1625
1627
debuginfo_level_tests = debuginfo_level_tests_toml;
1626
1628
1627
- config. rust_split_debuginfo = split_debuginfo
1629
+ config. rust_split_debuginfo_for_build_triple = split_debuginfo
1628
1630
. as_deref ( )
1629
1631
. map ( SplitDebuginfo :: from_str)
1630
- . map ( |v| v. expect ( "invalid value for rust.split_debuginfo" ) )
1631
- . unwrap_or ( SplitDebuginfo :: default_for_platform ( config. build ) ) ;
1632
+ . map ( |v| v. expect ( "invalid value for rust.split-debuginfo" ) ) ;
1633
+
1634
+ if config. rust_split_debuginfo_for_build_triple . is_some ( ) {
1635
+ println ! (
1636
+ "WARNING: specifying `rust.split-debuginfo` is deprecated, use `target.{}.split-debuginfo` instead" ,
1637
+ config. build
1638
+ ) ;
1639
+ }
1640
+
1632
1641
optimize = optimize_toml;
1633
1642
omit_git_hash = omit_git_hash_toml;
1634
1643
config. rust_new_symbol_mangling = new_symbol_mangling;
@@ -1849,10 +1858,11 @@ impl Config {
1849
1858
if let Some ( ref s) = cfg. llvm_filecheck {
1850
1859
target. llvm_filecheck = Some ( config. src . join ( s) ) ;
1851
1860
}
1852
- target. llvm_libunwind = cfg
1853
- . llvm_libunwind
1854
- . as_ref ( )
1855
- . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
1861
+ target. llvm_libunwind = cfg. llvm_libunwind . as_ref ( ) . map ( |v| {
1862
+ v. parse ( ) . unwrap_or_else ( |_| {
1863
+ panic ! ( "failed to parse target.{triple}.llvm-libunwind" )
1864
+ } )
1865
+ } ) ;
1856
1866
if let Some ( s) = cfg. no_std {
1857
1867
target. no_std = s;
1858
1868
}
@@ -1889,6 +1899,12 @@ impl Config {
1889
1899
} ) . collect ( ) ) ;
1890
1900
}
1891
1901
1902
+ target. split_debuginfo = cfg. split_debuginfo . as_ref ( ) . map ( |v| {
1903
+ v. parse ( ) . unwrap_or_else ( |_| {
1904
+ panic ! ( "invalid value for target.{triple}.split-debuginfo" )
1905
+ } )
1906
+ } ) ;
1907
+
1892
1908
config. target_config . insert ( TargetSelection :: from_user ( & triple) , target) ;
1893
1909
}
1894
1910
}
@@ -2287,6 +2303,16 @@ impl Config {
2287
2303
} )
2288
2304
}
2289
2305
2306
+ pub fn split_debuginfo ( & self , target : TargetSelection ) -> SplitDebuginfo {
2307
+ self . target_config
2308
+ . get ( & target)
2309
+ . and_then ( |t| t. split_debuginfo )
2310
+ . or_else ( || {
2311
+ if self . build == target { self . rust_split_debuginfo_for_build_triple } else { None }
2312
+ } )
2313
+ . unwrap_or_else ( || SplitDebuginfo :: default_for_platform ( target) )
2314
+ }
2315
+
2290
2316
pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
2291
2317
self . submodules . unwrap_or ( rust_info. is_managed_git_subrepository ( ) )
2292
2318
}
0 commit comments