-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
Detailed design
When -Zsplit-metadata is passed to rustc, it will put the metadata normally inside a rlib or dylib in a separate rmeta file. The rlib/dylib will contain the SVH to prevent accidentally mixing the rmeta and rlib/dylib of different compilations.
Advantages
This would make the increase in size of #56987 easily fixable by deleting the rlib files, while keeping the rmeta files. Those are not necessary anyway, because rustc_driver.so already contains the code.
This will decrease staticlib, dylib and cdylib compilation time, because there is no need to copy all object files to a new archive to remove the rust.metadata.bin file from the rlib.
rust/src/librustc_codegen_llvm/back/link.rs
Lines 1340 to 1342 in 6d9640b
| if f.ends_with(RLIB_BYTECODE_EXTENSION) || f == METADATA_FILENAME { | |
| archive.remove_file(&f); | |
| continue |
Disadvantages
Rustc and cargo get a bit more complex.