@@ -691,23 +691,27 @@ impl Step for Rustc {
691
691
) ) ;
692
692
}
693
693
694
- match builder. config . rust_lto {
695
- RustcLto :: Thin | RustcLto :: Fat => {
696
- // Since using LTO for optimizing dylibs is currently experimental,
697
- // we need to pass -Zdylib-lto.
698
- cargo. rustflag ( "-Zdylib-lto" ) ;
699
- // Cargo by default passes `-Cembed-bitcode=no` and doesn't pass `-Clto` when
700
- // compiling dylibs (and their dependencies), even when LTO is enabled for the
701
- // crate. Therefore, we need to override `-Clto` and `-Cembed-bitcode` here.
702
- let lto_type = match builder. config . rust_lto {
703
- RustcLto :: Thin => "thin" ,
704
- RustcLto :: Fat => "fat" ,
705
- _ => unreachable ! ( ) ,
706
- } ;
707
- cargo. rustflag ( & format ! ( "-Clto={}" , lto_type) ) ;
708
- cargo. rustflag ( "-Cembed-bitcode=yes" ) ;
694
+ // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
695
+ // and may just be a time sink.
696
+ if compiler. stage != 0 {
697
+ match builder. config . rust_lto {
698
+ RustcLto :: Thin | RustcLto :: Fat => {
699
+ // Since using LTO for optimizing dylibs is currently experimental,
700
+ // we need to pass -Zdylib-lto.
701
+ cargo. rustflag ( "-Zdylib-lto" ) ;
702
+ // Cargo by default passes `-Cembed-bitcode=no` and doesn't pass `-Clto` when
703
+ // compiling dylibs (and their dependencies), even when LTO is enabled for the
704
+ // crate. Therefore, we need to override `-Clto` and `-Cembed-bitcode` here.
705
+ let lto_type = match builder. config . rust_lto {
706
+ RustcLto :: Thin => "thin" ,
707
+ RustcLto :: Fat => "fat" ,
708
+ _ => unreachable ! ( ) ,
709
+ } ;
710
+ cargo. rustflag ( & format ! ( "-Clto={}" , lto_type) ) ;
711
+ cargo. rustflag ( "-Cembed-bitcode=yes" ) ;
712
+ }
713
+ RustcLto :: ThinLocal => { /* Do nothing, this is the default */ }
709
714
}
710
- RustcLto :: ThinLocal => { /* Do nothing, this is the default */ }
711
715
}
712
716
713
717
builder. info ( & format ! (
0 commit comments