Support -Zno-link #9019
Labels
A-linkage
Area: linker issues, dylib, cdylib, shared libraries, so
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Performance
Gotta go fast!
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Describe the problem you are trying to solve
Compilation pipelining can currently compile dependent crates as soon as the crate metadata is written in most cases. This improves cpu utilization for from-scratch builds. It is however not possible to apply pipelining on crates that need to be linked like executables and dylibs as all object files need to be available to link something.
Describe the solution you'd like
Using the
-Zno-link
option of rustc it is possible to separate the compilation and linking step. This makes it possible to pipeline the compilation and only wait for all crates to be fully compiled once we want to link the final executable. This option was introduced in rust-lang/rust#68487 and fixed in rust-lang/rust#80187 (now with a test to prevent regressions).Notes
cc rust-lang/rust#64191
To implement this rustc will first need to be invoked with
-Zno-link
as argument. This will produce all object files and a.rlink
file. Once all dependencies are compiled you need to invoke rustc a second time with-Zlink-only
as argument and the.rlink
file instead of the source file.The text was updated successfully, but these errors were encountered: