@@ -905,34 +905,6 @@ impl Step for Rustc {
905
905
) ) ;
906
906
}
907
907
908
- // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
909
- // and may just be a time sink.
910
- if compiler. stage != 0 {
911
- match builder. config . rust_lto {
912
- RustcLto :: Thin | RustcLto :: Fat => {
913
- // Since using LTO for optimizing dylibs is currently experimental,
914
- // we need to pass -Zdylib-lto.
915
- cargo. rustflag ( "-Zdylib-lto" ) ;
916
- // Cargo by default passes `-Cembed-bitcode=no` and doesn't pass `-Clto` when
917
- // compiling dylibs (and their dependencies), even when LTO is enabled for the
918
- // crate. Therefore, we need to override `-Clto` and `-Cembed-bitcode` here.
919
- let lto_type = match builder. config . rust_lto {
920
- RustcLto :: Thin => "thin" ,
921
- RustcLto :: Fat => "fat" ,
922
- _ => unreachable ! ( ) ,
923
- } ;
924
- cargo. rustflag ( & format ! ( "-Clto={lto_type}" ) ) ;
925
- cargo. rustflag ( "-Cembed-bitcode=yes" ) ;
926
- }
927
- RustcLto :: ThinLocal => { /* Do nothing, this is the default */ }
928
- RustcLto :: Off => {
929
- cargo. rustflag ( "-Clto=off" ) ;
930
- }
931
- }
932
- } else if builder. config . rust_lto == RustcLto :: Off {
933
- cargo. rustflag ( "-Clto=off" ) ;
934
- }
935
-
936
908
for krate in & * self . crates {
937
909
cargo. arg ( "-p" ) . arg ( krate) ;
938
910
}
@@ -989,6 +961,34 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec
989
961
990
962
cargo. rustdocflag ( "-Zcrate-attr=warn(rust_2018_idioms)" ) ;
991
963
964
+ // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
965
+ // and may just be a time sink.
966
+ if stage != 0 {
967
+ match builder. config . rust_lto {
968
+ RustcLto :: Thin | RustcLto :: Fat => {
969
+ // Since using LTO for optimizing dylibs is currently experimental,
970
+ // we need to pass -Zdylib-lto.
971
+ cargo. rustflag ( "-Zdylib-lto" ) ;
972
+ // Cargo by default passes `-Cembed-bitcode=no` and doesn't pass `-Clto` when
973
+ // compiling dylibs (and their dependencies), even when LTO is enabled for the
974
+ // crate. Therefore, we need to override `-Clto` and `-Cembed-bitcode` here.
975
+ let lto_type = match builder. config . rust_lto {
976
+ RustcLto :: Thin => "thin" ,
977
+ RustcLto :: Fat => "fat" ,
978
+ _ => unreachable ! ( ) ,
979
+ } ;
980
+ cargo. rustflag ( & format ! ( "-Clto={lto_type}" ) ) ;
981
+ cargo. rustflag ( "-Cembed-bitcode=yes" ) ;
982
+ }
983
+ RustcLto :: ThinLocal => { /* Do nothing, this is the default */ }
984
+ RustcLto :: Off => {
985
+ cargo. rustflag ( "-Clto=off" ) ;
986
+ }
987
+ }
988
+ } else if builder. config . rust_lto == RustcLto :: Off {
989
+ cargo. rustflag ( "-Clto=off" ) ;
990
+ }
991
+
992
992
rustc_cargo_env ( builder, cargo, target, stage) ;
993
993
}
994
994
0 commit comments