@@ -158,6 +158,7 @@ pub struct Config {
158
158
pub rust_new_symbol_mangling : Option < bool > ,
159
159
pub rust_profile_use : Option < String > ,
160
160
pub rust_profile_generate : Option < String > ,
161
+ pub rust_lto : RustcLto ,
161
162
pub llvm_profile_use : Option < String > ,
162
163
pub llvm_profile_generate : bool ,
163
164
pub llvm_libunwind_default : Option < LlvmLibunwind > ,
@@ -319,6 +320,28 @@ impl SplitDebuginfo {
319
320
}
320
321
}
321
322
323
+ /// LTO mode used for compiling rustc itself.
324
+ #[ derive( Default ) ]
325
+ pub enum RustcLto {
326
+ #[ default]
327
+ ThinLocal ,
328
+ Thin ,
329
+ Fat
330
+ }
331
+
332
+ impl std:: str:: FromStr for RustcLto {
333
+ type Err = String ;
334
+
335
+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
336
+ match s {
337
+ "thin-local" => Ok ( RustcLto :: ThinLocal ) ,
338
+ "thin" => Ok ( RustcLto :: Thin ) ,
339
+ "fat" => Ok ( RustcLto :: Fat ) ,
340
+ _ => Err ( format ! ( "Invalid value for rustc LTO: {}" , s) ) ,
341
+ }
342
+ }
343
+ }
344
+
322
345
#[ derive( Copy , Clone , Default , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
323
346
pub struct TargetSelection {
324
347
pub triple : Interned < String > ,
@@ -726,6 +749,7 @@ define_config! {
726
749
profile_use: Option <String > = "profile-use" ,
727
750
// ignored; this is set from an env var set by bootstrap.py
728
751
download_rustc: Option <StringOrBool > = "download-rustc" ,
752
+ lto: Option <String > = "lto" ,
729
753
}
730
754
}
731
755
@@ -1173,6 +1197,13 @@ impl Config {
1173
1197
config. rust_profile_use = flags. rust_profile_use . or ( rust. profile_use ) ;
1174
1198
config. rust_profile_generate = flags. rust_profile_generate . or ( rust. profile_generate ) ;
1175
1199
config. download_rustc_commit = download_ci_rustc_commit ( & config, rust. download_rustc ) ;
1200
+
1201
+ config. rust_lto = rust
1202
+ . lto
1203
+ . as_deref ( )
1204
+ . map ( RustcLto :: from_str)
1205
+ . map ( |v| v. expect ( "invalid value for rust.lto" ) )
1206
+ . unwrap_or_default ( ) ;
1176
1207
} else {
1177
1208
config. rust_profile_use = flags. rust_profile_use ;
1178
1209
config. rust_profile_generate = flags. rust_profile_generate ;
0 commit comments