File tree 5 files changed +12
-2
lines changed
5 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 235
235
# compiler.
236
236
#codegen-units = 1
237
237
238
+ # Whether to enable ThinLTO (and increase the codegen units to either a default
239
+ # or the configured value). On by default. If we want the fastest possible
240
+ # compiler, we should disable this.
241
+ #thinlto = true
242
+
238
243
# Whether or not debug assertions are enabled for the compiler and standard
239
244
# library. Also enables compilation of debug! and trace! logging macros.
240
245
#debug-assertions = false
Original file line number Diff line number Diff line change @@ -686,8 +686,8 @@ impl<'a> Builder<'a> {
686
686
}
687
687
688
688
if self . config . rust_codegen_units . is_none ( ) &&
689
- self . build . is_rust_llvm ( compiler. host )
690
- {
689
+ self . build . is_rust_llvm ( compiler. host ) &&
690
+ self . config . rust_thinlto {
691
691
cargo. env ( "RUSTC_THINLTO" , "1" ) ;
692
692
}
693
693
}
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ pub struct Config {
81
81
// rust codegen options
82
82
pub rust_optimize : bool ,
83
83
pub rust_codegen_units : Option < u32 > ,
84
+ pub rust_thinlto : bool ,
84
85
pub rust_debug_assertions : bool ,
85
86
pub rust_debuginfo : bool ,
86
87
pub rust_debuginfo_lines : bool ,
@@ -261,6 +262,7 @@ impl Default for StringOrBool {
261
262
struct Rust {
262
263
optimize : Option < bool > ,
263
264
codegen_units : Option < u32 > ,
265
+ thinlto : Option < bool > ,
264
266
debug_assertions : Option < bool > ,
265
267
debuginfo : Option < bool > ,
266
268
debuginfo_lines : Option < bool > ,
@@ -466,6 +468,7 @@ impl Config {
466
468
set ( & mut config. quiet_tests , rust. quiet_tests ) ;
467
469
set ( & mut config. test_miri , rust. test_miri ) ;
468
470
set ( & mut config. wasm_syscall , rust. wasm_syscall ) ;
471
+ config. rust_thinlto = rust. thinlto . unwrap_or ( true ) ;
469
472
config. rustc_parallel_queries = rust. experimental_parallel_queries . unwrap_or ( false ) ;
470
473
config. rustc_default_linker = rust. default_linker . clone ( ) ;
471
474
config. musl_root = rust. musl_root . clone ( ) . map ( PathBuf :: from) ;
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ def v(*args):
70
70
# Optimization and debugging options. These may be overridden by the release
71
71
# channel, etc.
72
72
o ("optimize" , "rust.optimize" , "build optimized rust code" )
73
+ o ("thinlto" , "rust.thinlto" , "build Rust with ThinLTO enabled" )
73
74
o ("optimize-llvm" , "llvm.optimize" , "build optimized LLVM" )
74
75
o ("llvm-assertions" , "llvm.assertions" , "build LLVM with assertions" )
75
76
o ("debug-assertions" , "rust.debug-assertions" , "build with debugging assertions" )
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ export RUST_RELEASE_CHANNEL=nightly
46
46
if [ " $DEPLOY$DEPLOY_ALT " != " " ]; then
47
47
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL "
48
48
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
49
+ RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --disable-thinlto"
49
50
50
51
if [ " $NO_LLVM_ASSERTIONS " = " 1" ]; then
51
52
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --disable-llvm-assertions"
You can’t perform that action at this time.
0 commit comments