@@ -66,7 +66,6 @@ pub struct Config {
6666 pub rustc_error_format : Option < String > ,
6767 pub json_output : bool ,
6868 pub test_compare_mode : bool ,
69- pub llvm_libunwind : LlvmLibunwind ,
7069 pub color : Color ,
7170
7271 pub on_fail : Option < String > ,
@@ -145,6 +144,7 @@ pub struct Config {
145144 pub rust_profile_generate : Option < String > ,
146145 pub llvm_profile_use : Option < String > ,
147146 pub llvm_profile_generate : bool ,
147+ pub llvm_libunwind_default : Option < LlvmLibunwind > ,
148148
149149 pub build : TargetSelection ,
150150 pub hosts : Vec < TargetSelection > ,
@@ -289,6 +289,7 @@ pub struct Target {
289289 pub llvm_config : Option < PathBuf > ,
290290 /// Some(path to FileCheck) if one was specified.
291291 pub llvm_filecheck : Option < PathBuf > ,
292+ pub llvm_libunwind : Option < LlvmLibunwind > ,
292293 pub cc : Option < PathBuf > ,
293294 pub cxx : Option < PathBuf > ,
294295 pub ar : Option < PathBuf > ,
@@ -573,6 +574,7 @@ derive_merge! {
573574 linker: Option <String >,
574575 llvm_config: Option <String >,
575576 llvm_filecheck: Option <String >,
577+ llvm_libunwind: Option <String >,
576578 android_ndk: Option <String >,
577579 sanitizers: Option <bool >,
578580 profiler: Option <bool >,
@@ -925,10 +927,6 @@ impl Config {
925927 set ( & mut config. rust_rpath , rust. rpath ) ;
926928 set ( & mut config. jemalloc , rust. jemalloc ) ;
927929 set ( & mut config. test_compare_mode , rust. test_compare_mode ) ;
928- config. llvm_libunwind = rust
929- . llvm_libunwind
930- . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) )
931- . unwrap_or_default ( ) ;
932930 set ( & mut config. backtrace , rust. backtrace ) ;
933931 set ( & mut config. channel , rust. channel ) ;
934932 config. description = rust. description ;
@@ -951,6 +949,9 @@ impl Config {
951949 config. rust_thin_lto_import_instr_limit = rust. thin_lto_import_instr_limit ;
952950 set ( & mut config. rust_remap_debuginfo , rust. remap_debuginfo ) ;
953951 set ( & mut config. control_flow_guard , rust. control_flow_guard ) ;
952+ config. llvm_libunwind_default = rust
953+ . llvm_libunwind
954+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
954955
955956 if let Some ( ref backends) = rust. codegen_backends {
956957 config. rust_codegen_backends =
@@ -977,6 +978,10 @@ impl Config {
977978 if let Some ( ref s) = cfg. llvm_filecheck {
978979 target. llvm_filecheck = Some ( config. src . join ( s) ) ;
979980 }
981+ target. llvm_libunwind = cfg
982+ . llvm_libunwind
983+ . as_ref ( )
984+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
980985 if let Some ( ref s) = cfg. android_ndk {
981986 target. ndk = Some ( config. src . join ( s) ) ;
982987 }
@@ -1174,6 +1179,18 @@ impl Config {
11741179 self . rust_codegen_backends . contains ( & INTERNER . intern_str ( "llvm" ) )
11751180 }
11761181
1182+ pub fn llvm_libunwind ( & self , target : TargetSelection ) -> LlvmLibunwind {
1183+ self . target_config
1184+ . get ( & target)
1185+ . and_then ( |t| t. llvm_libunwind )
1186+ . or ( self . llvm_libunwind_default )
1187+ . unwrap_or ( if target. contains ( "fuchsia" ) {
1188+ LlvmLibunwind :: InTree
1189+ } else {
1190+ LlvmLibunwind :: No
1191+ } )
1192+ }
1193+
11771194 pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
11781195 self . submodules . unwrap_or ( rust_info. is_git ( ) )
11791196 }
0 commit comments