Proposal
I've been working on fixing support for -Zno-link/-Zlink-only, which is supposed to also allow for build pipelining for linked crates (rust-lang/rust#141706). It is currently broken because the dependency_formats are calculated too early during the -Zno-link invocation, which forces all dependencies to be already available as fully compiled artifacts during the -Zno-link invocation rather than only during the -Zlink-only invocation. One of the reasons this is done is because LTO, which needs fully compiled artifacts, currently runs during the -Zno-link invocation. As such fixing -Zno-link/-Zlink-only requires moving LTO to the -Zlink-only invocation. In the process I also discovered that -Zdylib-lto is currently broken when combined with -Cprefer-dynamic and --crate-type staticlib,dylib as in that case both crate types disagree about whether or not LTO has to statically link (and include in LTO) or dynamically link (and exclude from LTO) the standard library. Fixing that requires doing LTO once for each crate type (if the dependency_formats are different between crate types at least), which is easier to do when running LTO inside link_binary.
Implementation steps
Questions
Mentors or Reviewers
If you have a reviewer or mentor in mind for this work, mention them here. You can put your own name here if you are planning to mentor the work.
Process
The main points of the Major Change Process are as follows:
You can read more about Major Change Proposals on forge.
Proposal
I've been working on fixing support for
-Zno-link/-Zlink-only, which is supposed to also allow for build pipelining for linked crates (rust-lang/rust#141706). It is currently broken because thedependency_formatsare calculated too early during the-Zno-linkinvocation, which forces all dependencies to be already available as fully compiled artifacts during the-Zno-linkinvocation rather than only during the-Zlink-onlyinvocation. One of the reasons this is done is because LTO, which needs fully compiled artifacts, currently runs during the-Zno-linkinvocation. As such fixing-Zno-link/-Zlink-onlyrequires moving LTO to the-Zlink-onlyinvocation. In the process I also discovered that-Zdylib-ltois currently broken when combined with-Cprefer-dynamicand--crate-type staticlib,dylibas in that case both crate types disagree about whether or not LTO has to statically link (and include in LTO) or dynamically link (and exclude from LTO) the standard library. Fixing that requires doing LTO once for each crate type (if thedependency_formatsare different between crate types at least), which is easier to do when running LTO inside link_binary.Implementation steps
--crate-type staticlib,dylib -Cprefer-dynamicfor the non-LTO case)link_binaryand handle serialization of modules to bitcode when using-Zno-link/-Zlink-only.Make the allocator shim participate in LTO again to fix the aforementioned performance regression.dependency_formatsare mismatched to fix-Zdylib-ltowith multiple crate types.Questions
dependency_formatsare mismatched between crate types, I think it is unavoidable.Mentors or Reviewers
If you have a reviewer or mentor in mind for this work, mention them here. You can put your own name here if you are planning to mentor the work.
Process
The main points of the Major Change Process are as follows:
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.You can read more about Major Change Proposals on forge.