@@ -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 ,
@@ -571,6 +571,7 @@ pub struct Target {
571
571
pub ranlib : Option < PathBuf > ,
572
572
pub default_linker : Option < PathBuf > ,
573
573
pub linker : Option < PathBuf > ,
574
+ pub split_debuginfo : Option < SplitDebuginfo > ,
574
575
pub sanitizers : Option < bool > ,
575
576
pub profiler : Option < StringOrBool > ,
576
577
pub rpath : Option < bool > ,
@@ -1128,6 +1129,7 @@ define_config! {
1128
1129
ranlib: Option <String > = "ranlib" ,
1129
1130
default_linker: Option <PathBuf > = "default-linker" ,
1130
1131
linker: Option <String > = "linker" ,
1132
+ split_debuginfo: Option <String > = "split-debuginfo" ,
1131
1133
llvm_config: Option <String > = "llvm-config" ,
1132
1134
llvm_has_rust_patches: Option <bool > = "llvm-has-rust-patches" ,
1133
1135
llvm_filecheck: Option <String > = "llvm-filecheck" ,
@@ -1620,11 +1622,18 @@ impl Config {
1620
1622
debuginfo_level_tools = debuginfo_level_tools_toml;
1621
1623
debuginfo_level_tests = debuginfo_level_tests_toml;
1622
1624
1623
- config. rust_split_debuginfo = split_debuginfo
1625
+ config. rust_split_debuginfo_for_build_triple = split_debuginfo
1624
1626
. as_deref ( )
1625
1627
. map ( SplitDebuginfo :: from_str)
1626
- . map ( |v| v. expect ( "invalid value for rust.split_debuginfo" ) )
1627
- . unwrap_or ( SplitDebuginfo :: default_for_platform ( config. build ) ) ;
1628
+ . map ( |v| v. expect ( "invalid value for rust.split-debuginfo" ) ) ;
1629
+
1630
+ if config. rust_split_debuginfo_for_build_triple . is_some ( ) {
1631
+ println ! (
1632
+ "WARNING: specifying `rust.split-debuginfo` is deprecated, use `target.{}.split-debuginfo` instead" ,
1633
+ config. build
1634
+ ) ;
1635
+ }
1636
+
1628
1637
optimize = optimize_toml;
1629
1638
omit_git_hash = omit_git_hash_toml;
1630
1639
config. rust_new_symbol_mangling = new_symbol_mangling;
@@ -1845,10 +1854,11 @@ impl Config {
1845
1854
if let Some ( ref s) = cfg. llvm_filecheck {
1846
1855
target. llvm_filecheck = Some ( config. src . join ( s) ) ;
1847
1856
}
1848
- target. llvm_libunwind = cfg
1849
- . llvm_libunwind
1850
- . as_ref ( )
1851
- . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
1857
+ target. llvm_libunwind = cfg. llvm_libunwind . as_ref ( ) . map ( |v| {
1858
+ v. parse ( ) . unwrap_or_else ( |_| {
1859
+ panic ! ( "failed to parse target.{triple}.llvm-libunwind" )
1860
+ } )
1861
+ } ) ;
1852
1862
if let Some ( s) = cfg. no_std {
1853
1863
target. no_std = s;
1854
1864
}
@@ -1884,6 +1894,12 @@ impl Config {
1884
1894
} ) . collect ( ) ) ;
1885
1895
}
1886
1896
1897
+ target. split_debuginfo = cfg. split_debuginfo . as_ref ( ) . map ( |v| {
1898
+ v. parse ( ) . unwrap_or_else ( |_| {
1899
+ panic ! ( "invalid value for target.{triple}.split-debuginfo" )
1900
+ } )
1901
+ } ) ;
1902
+
1887
1903
config. target_config . insert ( TargetSelection :: from_user ( & triple) , target) ;
1888
1904
}
1889
1905
}
@@ -2282,6 +2298,16 @@ impl Config {
2282
2298
} )
2283
2299
}
2284
2300
2301
+ pub fn split_debuginfo ( & self , target : TargetSelection ) -> SplitDebuginfo {
2302
+ self . target_config
2303
+ . get ( & target)
2304
+ . and_then ( |t| t. split_debuginfo )
2305
+ . or_else ( || {
2306
+ if self . build == target { self . rust_split_debuginfo_for_build_triple } else { None }
2307
+ } )
2308
+ . unwrap_or_else ( || SplitDebuginfo :: default_for_platform ( target) )
2309
+ }
2310
+
2285
2311
pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
2286
2312
self . submodules . unwrap_or ( rust_info. is_managed_git_subrepository ( ) )
2287
2313
}
0 commit comments