@@ -254,7 +254,7 @@ pub struct Config {
254
254
pub rust_debuginfo_level_std : DebuginfoLevel ,
255
255
pub rust_debuginfo_level_tools : DebuginfoLevel ,
256
256
pub rust_debuginfo_level_tests : DebuginfoLevel ,
257
- pub rust_split_debuginfo : SplitDebuginfo ,
257
+ pub rust_split_debuginfo_for_build_triple : Option < SplitDebuginfo > , // FIXME: Deprecated field. Remove in Q3'24.
258
258
pub rust_rpath : bool ,
259
259
pub rust_strip : bool ,
260
260
pub rust_frame_pointers : bool ,
@@ -570,6 +570,7 @@ pub struct Target {
570
570
pub ranlib : Option < PathBuf > ,
571
571
pub default_linker : Option < PathBuf > ,
572
572
pub linker : Option < PathBuf > ,
573
+ pub split_debuginfo : Option < SplitDebuginfo > ,
573
574
pub sanitizers : Option < bool > ,
574
575
pub profiler : Option < StringOrBool > ,
575
576
pub rpath : Option < bool > ,
@@ -1126,6 +1127,7 @@ define_config! {
1126
1127
ranlib: Option <String > = "ranlib" ,
1127
1128
default_linker: Option <PathBuf > = "default-linker" ,
1128
1129
linker: Option <String > = "linker" ,
1130
+ split_debuginfo: Option <String > = "split-debuginfo" ,
1129
1131
llvm_config: Option <String > = "llvm-config" ,
1130
1132
llvm_has_rust_patches: Option <bool > = "llvm-has-rust-patches" ,
1131
1133
llvm_filecheck: Option <String > = "llvm-filecheck" ,
@@ -1616,11 +1618,18 @@ impl Config {
1616
1618
debuginfo_level_tools = debuginfo_level_tools_toml;
1617
1619
debuginfo_level_tests = debuginfo_level_tests_toml;
1618
1620
1619
- config. rust_split_debuginfo = split_debuginfo
1621
+ config. rust_split_debuginfo_for_build_triple = split_debuginfo
1620
1622
. as_deref ( )
1621
1623
. map ( SplitDebuginfo :: from_str)
1622
- . map ( |v| v. expect ( "invalid value for rust.split_debuginfo" ) )
1623
- . unwrap_or ( SplitDebuginfo :: default_for_platform ( config. build ) ) ;
1624
+ . map ( |v| v. expect ( "invalid value for rust.split-debuginfo" ) ) ;
1625
+
1626
+ if config. rust_split_debuginfo_for_build_triple . is_some ( ) {
1627
+ println ! (
1628
+ "WARNING: specifying `rust.split-debuginfo` is deprecated, use `target.{}.split-debuginfo` instead" ,
1629
+ config. build
1630
+ ) ;
1631
+ }
1632
+
1624
1633
optimize = optimize_toml;
1625
1634
omit_git_hash = omit_git_hash_toml;
1626
1635
config. rust_new_symbol_mangling = new_symbol_mangling;
@@ -1841,10 +1850,11 @@ impl Config {
1841
1850
if let Some ( ref s) = cfg. llvm_filecheck {
1842
1851
target. llvm_filecheck = Some ( config. src . join ( s) ) ;
1843
1852
}
1844
- target. llvm_libunwind = cfg
1845
- . llvm_libunwind
1846
- . as_ref ( )
1847
- . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
1853
+ target. llvm_libunwind = cfg. llvm_libunwind . as_ref ( ) . map ( |v| {
1854
+ v. parse ( ) . unwrap_or_else ( |_| {
1855
+ panic ! ( "failed to parse target.{triple}.llvm-libunwind" )
1856
+ } )
1857
+ } ) ;
1848
1858
if let Some ( s) = cfg. no_std {
1849
1859
target. no_std = s;
1850
1860
}
@@ -1880,6 +1890,12 @@ impl Config {
1880
1890
} ) . collect ( ) ) ;
1881
1891
}
1882
1892
1893
+ target. split_debuginfo = cfg. split_debuginfo . as_ref ( ) . map ( |v| {
1894
+ v. parse ( ) . unwrap_or_else ( |_| {
1895
+ panic ! ( "invalid value for target.{triple}.split_debuginfo" )
1896
+ } )
1897
+ } ) ;
1898
+
1883
1899
config. target_config . insert ( TargetSelection :: from_user ( & triple) , target) ;
1884
1900
}
1885
1901
}
@@ -2278,6 +2294,16 @@ impl Config {
2278
2294
} )
2279
2295
}
2280
2296
2297
+ pub fn split_debuginfo ( & self , target : TargetSelection ) -> SplitDebuginfo {
2298
+ self . target_config
2299
+ . get ( & target)
2300
+ . and_then ( |t| t. split_debuginfo )
2301
+ . or_else ( || {
2302
+ if self . build == target { self . rust_split_debuginfo_for_build_triple } else { None }
2303
+ } )
2304
+ . unwrap_or_else ( || SplitDebuginfo :: default_for_platform ( target) )
2305
+ }
2306
+
2281
2307
pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
2282
2308
self . submodules . unwrap_or ( rust_info. is_managed_git_subrepository ( ) )
2283
2309
}
0 commit comments