@@ -67,7 +67,6 @@ pub struct Config {
6767 pub rustc_error_format : Option < String > ,
6868 pub json_output : bool ,
6969 pub test_compare_mode : bool ,
70- pub llvm_libunwind : LlvmLibunwind ,
7170 pub color : Color ,
7271 pub patch_binaries_for_nix : bool ,
7372
@@ -151,6 +150,7 @@ pub struct Config {
151150 pub rust_profile_generate : Option < String > ,
152151 pub llvm_profile_use : Option < String > ,
153152 pub llvm_profile_generate : bool ,
153+ pub llvm_libunwind_default : Option < LlvmLibunwind > ,
154154
155155 pub build : TargetSelection ,
156156 pub hosts : Vec < TargetSelection > ,
@@ -342,6 +342,7 @@ pub struct Target {
342342 pub llvm_config : Option < PathBuf > ,
343343 /// Some(path to FileCheck) if one was specified.
344344 pub llvm_filecheck : Option < PathBuf > ,
345+ pub llvm_libunwind : Option < LlvmLibunwind > ,
345346 pub cc : Option < PathBuf > ,
346347 pub cxx : Option < PathBuf > ,
347348 pub ar : Option < PathBuf > ,
@@ -680,6 +681,7 @@ define_config! {
680681 linker: Option <String > = "linker" ,
681682 llvm_config: Option <String > = "llvm-config" ,
682683 llvm_filecheck: Option <String > = "llvm-filecheck" ,
684+ llvm_libunwind: Option <String > = "llvm-libunwind" ,
683685 android_ndk: Option <String > = "android-ndk" ,
684686 sanitizers: Option <bool > = "sanitizers" ,
685687 profiler: Option <bool > = "profiler" ,
@@ -1043,10 +1045,6 @@ impl Config {
10431045 set ( & mut config. rust_rpath , rust. rpath ) ;
10441046 set ( & mut config. jemalloc , rust. jemalloc ) ;
10451047 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 ( ) ;
10501048 set ( & mut config. backtrace , rust. backtrace ) ;
10511049 set ( & mut config. channel , rust. channel ) ;
10521050 config. description = rust. description ;
@@ -1069,6 +1067,9 @@ impl Config {
10691067 config. rust_thin_lto_import_instr_limit = rust. thin_lto_import_instr_limit ;
10701068 set ( & mut config. rust_remap_debuginfo , rust. remap_debuginfo ) ;
10711069 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" ) ) ;
10721073
10731074 if let Some ( ref backends) = rust. codegen_backends {
10741075 config. rust_codegen_backends =
@@ -1095,6 +1096,10 @@ impl Config {
10951096 if let Some ( ref s) = cfg. llvm_filecheck {
10961097 target. llvm_filecheck = Some ( config. src . join ( s) ) ;
10971098 }
1099+ target. llvm_libunwind = cfg
1100+ . llvm_libunwind
1101+ . as_ref ( )
1102+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
10981103 if let Some ( ref s) = cfg. android_ndk {
10991104 target. ndk = Some ( config. src . join ( s) ) ;
11001105 }
@@ -1328,6 +1333,14 @@ impl Config {
13281333 self . rust_codegen_backends . contains ( & INTERNER . intern_str ( "llvm" ) )
13291334 }
13301335
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+
13311344 pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
13321345 self . submodules . unwrap_or ( rust_info. is_git ( ) )
13331346 }
0 commit comments