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