@@ -67,7 +67,6 @@ pub struct Config {
67
67
pub rustc_error_format : Option < String > ,
68
68
pub json_output : bool ,
69
69
pub test_compare_mode : bool ,
70
- pub llvm_libunwind : LlvmLibunwind ,
71
70
pub color : Color ,
72
71
pub patch_binaries_for_nix : bool ,
73
72
@@ -151,6 +150,7 @@ pub struct Config {
151
150
pub rust_profile_generate : Option < String > ,
152
151
pub llvm_profile_use : Option < String > ,
153
152
pub llvm_profile_generate : bool ,
153
+ pub llvm_libunwind_default : Option < LlvmLibunwind > ,
154
154
155
155
pub build : TargetSelection ,
156
156
pub hosts : Vec < TargetSelection > ,
@@ -342,6 +342,7 @@ pub struct Target {
342
342
pub llvm_config : Option < PathBuf > ,
343
343
/// Some(path to FileCheck) if one was specified.
344
344
pub llvm_filecheck : Option < PathBuf > ,
345
+ pub llvm_libunwind : Option < LlvmLibunwind > ,
345
346
pub cc : Option < PathBuf > ,
346
347
pub cxx : Option < PathBuf > ,
347
348
pub ar : Option < PathBuf > ,
@@ -680,6 +681,7 @@ define_config! {
680
681
linker: Option <String > = "linker" ,
681
682
llvm_config: Option <String > = "llvm-config" ,
682
683
llvm_filecheck: Option <String > = "llvm-filecheck" ,
684
+ llvm_libunwind: Option <String > = "llvm-libunwind" ,
683
685
android_ndk: Option <String > = "android-ndk" ,
684
686
sanitizers: Option <bool > = "sanitizers" ,
685
687
profiler: Option <bool > = "profiler" ,
@@ -1043,10 +1045,6 @@ impl Config {
1043
1045
set ( & mut config. rust_rpath , rust. rpath ) ;
1044
1046
set ( & mut config. jemalloc , rust. jemalloc ) ;
1045
1047
set ( & mut config. test_compare_mode , rust. test_compare_mode ) ;
1046
- config. llvm_libunwind = rust
1047
- . llvm_libunwind
1048
- . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) )
1049
- . unwrap_or_default ( ) ;
1050
1048
set ( & mut config. backtrace , rust. backtrace ) ;
1051
1049
set ( & mut config. channel , rust. channel ) ;
1052
1050
config. description = rust. description ;
@@ -1069,6 +1067,9 @@ impl Config {
1069
1067
config. rust_thin_lto_import_instr_limit = rust. thin_lto_import_instr_limit ;
1070
1068
set ( & mut config. rust_remap_debuginfo , rust. remap_debuginfo ) ;
1071
1069
set ( & mut config. control_flow_guard , rust. control_flow_guard ) ;
1070
+ config. llvm_libunwind_default = rust
1071
+ . llvm_libunwind
1072
+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
1072
1073
1073
1074
if let Some ( ref backends) = rust. codegen_backends {
1074
1075
config. rust_codegen_backends =
@@ -1095,6 +1096,10 @@ impl Config {
1095
1096
if let Some ( ref s) = cfg. llvm_filecheck {
1096
1097
target. llvm_filecheck = Some ( config. src . join ( s) ) ;
1097
1098
}
1099
+ target. llvm_libunwind = cfg
1100
+ . llvm_libunwind
1101
+ . as_ref ( )
1102
+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
1098
1103
if let Some ( ref s) = cfg. android_ndk {
1099
1104
target. ndk = Some ( config. src . join ( s) ) ;
1100
1105
}
@@ -1328,6 +1333,14 @@ impl Config {
1328
1333
self . rust_codegen_backends . contains ( & INTERNER . intern_str ( "llvm" ) )
1329
1334
}
1330
1335
1336
+ pub fn llvm_libunwind ( & self , target : TargetSelection ) -> LlvmLibunwind {
1337
+ self . target_config
1338
+ . get ( & target)
1339
+ . and_then ( |t| t. llvm_libunwind )
1340
+ . or ( self . llvm_libunwind_default )
1341
+ . unwrap_or ( LlvmLibunwind :: No )
1342
+ }
1343
+
1331
1344
pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
1332
1345
self . submodules . unwrap_or ( rust_info. is_git ( ) )
1333
1346
}
0 commit comments