@@ -66,7 +66,6 @@ pub struct Config {
66
66
pub rustc_error_format : Option < String > ,
67
67
pub json_output : bool ,
68
68
pub test_compare_mode : bool ,
69
- pub llvm_libunwind : LlvmLibunwind ,
70
69
pub color : Color ,
71
70
72
71
pub on_fail : Option < String > ,
@@ -145,6 +144,7 @@ pub struct Config {
145
144
pub rust_profile_generate : Option < String > ,
146
145
pub llvm_profile_use : Option < String > ,
147
146
pub llvm_profile_generate : bool ,
147
+ pub llvm_libunwind_default : Option < LlvmLibunwind > ,
148
148
149
149
pub build : TargetSelection ,
150
150
pub hosts : Vec < TargetSelection > ,
@@ -289,6 +289,7 @@ pub struct Target {
289
289
pub llvm_config : Option < PathBuf > ,
290
290
/// Some(path to FileCheck) if one was specified.
291
291
pub llvm_filecheck : Option < PathBuf > ,
292
+ pub llvm_libunwind : Option < LlvmLibunwind > ,
292
293
pub cc : Option < PathBuf > ,
293
294
pub cxx : Option < PathBuf > ,
294
295
pub ar : Option < PathBuf > ,
@@ -573,6 +574,7 @@ derive_merge! {
573
574
linker: Option <String >,
574
575
llvm_config: Option <String >,
575
576
llvm_filecheck: Option <String >,
577
+ llvm_libunwind: Option <String >,
576
578
android_ndk: Option <String >,
577
579
sanitizers: Option <bool >,
578
580
profiler: Option <bool >,
@@ -925,10 +927,6 @@ impl Config {
925
927
set ( & mut config. rust_rpath , rust. rpath ) ;
926
928
set ( & mut config. jemalloc , rust. jemalloc ) ;
927
929
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 ( ) ;
932
930
set ( & mut config. backtrace , rust. backtrace ) ;
933
931
set ( & mut config. channel , rust. channel ) ;
934
932
config. description = rust. description ;
@@ -951,6 +949,9 @@ impl Config {
951
949
config. rust_thin_lto_import_instr_limit = rust. thin_lto_import_instr_limit ;
952
950
set ( & mut config. rust_remap_debuginfo , rust. remap_debuginfo ) ;
953
951
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" ) ) ;
954
955
955
956
if let Some ( ref backends) = rust. codegen_backends {
956
957
config. rust_codegen_backends =
@@ -977,6 +978,10 @@ impl Config {
977
978
if let Some ( ref s) = cfg. llvm_filecheck {
978
979
target. llvm_filecheck = Some ( config. src . join ( s) ) ;
979
980
}
981
+ target. llvm_libunwind = cfg
982
+ . llvm_libunwind
983
+ . as_ref ( )
984
+ . map ( |v| v. parse ( ) . expect ( "failed to parse rust.llvm-libunwind" ) ) ;
980
985
if let Some ( ref s) = cfg. android_ndk {
981
986
target. ndk = Some ( config. src . join ( s) ) ;
982
987
}
@@ -1174,6 +1179,18 @@ impl Config {
1174
1179
self . rust_codegen_backends . contains ( & INTERNER . intern_str ( "llvm" ) )
1175
1180
}
1176
1181
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
+
1177
1194
pub fn submodules ( & self , rust_info : & GitInfo ) -> bool {
1178
1195
self . submodules . unwrap_or ( rust_info. is_git ( ) )
1179
1196
}
0 commit comments