-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Do not store LLVM bitcode in RLIBs by default #66961
Copy link
Copy link
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
@nnethercote asked me to write up a more detailed plan for getting rid of LLVM bitcode in RLIBs, so here goes:
Current situation
rustccanperform cross-crate LTO.
than necessary too (because then machine code is duplicated)
especially obvious because then we have two basically identical LLVM bitcode
files for each module (modulo compression).
bigger because we have to keep object files and bitcode files in the cache.
Proposed Solution
The proposed solution is to follow Clang's model: When compiling for cross-crate
LTO, no machine code is generated and the
.ofile is actually LLVM bitcode.There are special "fat" object files that contain regular machine code and
additionally, in a special section, uncompressed LLVM bitcode. These fat objects
would mainly be used for the standard library.
The consequences of this approach are:
libstd) would only be eithermachine code or LLVM bitcode.
rustcneeds to know if it is intended to be used forLTO or not. Thus Cargo needs to invoke
rustcdifferently.libstdcan partakein LTO steps performed by the LLVM linker plugin.
Open questions
Steps to get there
That actually depends on how we resolve the open questions above.
cc #66598