@@ -21,7 +21,7 @@ use serde::Deserialize;
2121use crate :: builder:: Cargo ;
2222use crate :: builder:: { Builder , Kind , RunConfig , ShouldRun , Step } ;
2323use crate :: cache:: { Interned , INTERNER } ;
24- use crate :: config:: { LlvmLibunwind , RustcLto , TargetSelection } ;
24+ use crate :: config:: { LlvmLibunwind , TargetSelection } ;
2525use crate :: dist;
2626use crate :: native;
2727use crate :: tool:: SourceType ;
@@ -702,7 +702,7 @@ impl Step for Rustc {
702702 }
703703
704704 // cfg(bootstrap): remove if condition once the bootstrap compiler supports dylib LTO
705- if compiler. stage != 0 {
705+ /* if compiler.stage != 0 {
706706 match builder.config.rust_lto {
707707 RustcLto::Thin | RustcLto::Fat => {
708708 // Since using LTO for optimizing dylibs is currently experimental,
@@ -721,6 +721,22 @@ impl Step for Rustc {
721721 }
722722 RustcLto::ThinLocal => { /* Do nothing, this is the default */ }
723723 }
724+ }*/
725+
726+ if compiler. stage == 1 {
727+ // let build_bin = builder.llvm_out(builder.config.build).join("build").join("bin");
728+ // let clang = build_bin.join("clang");
729+ // let clang = PathBuf::from("/projects/personal/llvm-project/build/install/bin/clang");
730+ cargo. rustflag ( "-Clinker-plugin-lto" ) ;
731+ // cargo.rustflag(&format!("-Clinker={}", clang.display()));
732+ // cargo.rustflag("-Clink-arg=-fuse-ld=lld");
733+
734+ // let path = builder.ensure(CrtBeginEnd {
735+ // target
736+ // });
737+ // cargo.rustflag(&format!("-Clink-args=-L{}", path.display()));
738+ // cargo.rustflag(&format!("-Clink-args=-B{}", path.display()));
739+ // cargo.rustflag(&format!("-Clink-args=--gcc-toolchain={}", path.display()));
724740 }
725741
726742 builder. info ( & format ! (
0 commit comments