@@ -68,7 +68,6 @@ pub struct Config {
6868 pub rustc_error_format : Option < String > ,
6969 pub json_output : bool ,
7070 pub test_compare_mode : bool ,
71- pub llvm_libunwind : LlvmLibunwind ,
7271 pub color : Color ,
7372
7473 pub on_fail : Option < String > ,
@@ -146,6 +145,7 @@ pub struct Config {
146145 pub rust_profile_generate : Option < String > ,
147146 pub llvm_profile_use : Option < String > ,
148147 pub llvm_profile_generate : bool ,
148+ pub llvm_libunwind_default : Option < LlvmLibunwind > ,
149149
150150 pub build : TargetSelection ,
151151 pub hosts : Vec < TargetSelection > ,
@@ -290,6 +290,7 @@ pub struct Target {
290290 pub llvm_config : Option < PathBuf > ,
291291 /// Some(path to FileCheck) if one was specified.
292292 pub llvm_filecheck : Option < PathBuf > ,
293+ pub llvm_libunwind : Option < LlvmLibunwind > ,
293294 pub cc : Option < PathBuf > ,
294295 pub cxx : Option < PathBuf > ,
295296 pub ar : Option < PathBuf > ,
@@ -574,6 +575,7 @@ derive_merge! {
574575 linker: Option <String >,
575576 llvm_config: Option <String >,
576577 llvm_filecheck: Option <String >,
578+ llvm_libunwind: Option <String >,
577579 android_ndk: Option <String >,
578580 sanitizers: Option <bool >,
579581 profiler: Option <bool >,
@@ -921,10 +923,6 @@ impl Config {
921923 set ( & mut config. rust_rpath , rust. rpath ) ;
922924 set ( & mut config. jemalloc , rust. jemalloc ) ;
923925 set ( & mut config. test_compare_mode , rust. test_compare_mode ) ;
924- config. llvm_libunwind = rust
925- . llvm_libunwind
926- . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) )
927- . unwrap_or_default ( ) ;
928926 set ( & mut config. backtrace , rust. backtrace ) ;
929927 set ( & mut config. channel , rust. channel ) ;
930928 config. description = rust. description ;
@@ -947,6 +945,9 @@ impl Config {
947945 config. rust_thin_lto_import_instr_limit = rust. thin_lto_import_instr_limit ;
948946 set ( & mut config. rust_remap_debuginfo , rust. remap_debuginfo ) ;
949947 set ( & mut config. control_flow_guard , rust. control_flow_guard ) ;
948+ config. llvm_libunwind_default = rust
949+ . llvm_libunwind
950+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
950951
951952 if let Some ( ref backends) = rust. codegen_backends {
952953 config. rust_codegen_backends =
@@ -973,6 +974,10 @@ impl Config {
973974 if let Some ( ref s) = cfg. llvm_filecheck {
974975 target. llvm_filecheck = Some ( config. src . join ( s) ) ;
975976 }
977+ target. llvm_libunwind = cfg
978+ . llvm_libunwind
979+ . as_ref ( )
980+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
976981 if let Some ( ref s) = cfg. android_ndk {
977982 target. ndk = Some ( config. src . join ( s) ) ;
978983 }
@@ -1170,6 +1175,14 @@ impl Config {
11701175 self . rust_codegen_backends . contains ( & INTERNER . intern_str ( "llvm" ) )
11711176 }
11721177
1178+ pub fn llvm_libunwind ( & self , target : TargetSelection ) -> LlvmLibunwind {
1179+ self . target_config
1180+ . get ( & target)
1181+ . and_then ( |t| t. llvm_libunwind )
1182+ . or ( self . llvm_libunwind_default )
1183+ . unwrap_or ( LlvmLibunwind :: No )
1184+ }
1185+
11731186 pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
11741187 self . submodules . unwrap_or ( rust_info. is_git ( ) )
11751188 }
0 commit comments