-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce -Zsplit-metadata option #120855
base: master
Are you sure you want to change the base?
Conversation
rlibs.insert(loc_canon, PathKind::ExternFlag); | ||
} else if loc.file_name().unwrap().to_str().unwrap().ends_with(".rmeta") { | ||
rmetas.insert(loc_canon, PathKind::ExternFlag); | ||
} else { | ||
rmetas.insert(loc_canon.with_extension("rmeta"), PathKind::ExternFlag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack. It should probably be replaced with proper lookup in the library search path, or with cargo passing --extern
twice for both the rlib/dylib and the rmeta file.
if extension == "so" || extension == "dylib" { | ||
// FIXME workaround for the fact that cargo doesn't understand `-Zsplit-metadata` | ||
toplevel.push((file_stem.clone(), "rmeta".to_owned(), None)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This together with the rustc wrapper passing --emit metadata
is a big hack working around the fact that cargo doesn't support -Zsplit-metadata
and as such doesn't cause a .rmeta
file to be emitted and also doesn't track it in the compiler-artifact json message. This also causes issues with recompilations as the loop below may copy outdated rmeta files into the sysroot, which would then result in compiler errors.
tests/ui/duplicate_entry_error.rs
Outdated
@@ -1,4 +1,4 @@ | |||
// normalize-stderr-test "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib" | |||
// normalize-stderr-test "loaded from .*libstd-.*.rmeta" -> "loaded from SYSROOT/libstd-*.rmeta" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .rmeta
file is now considered the canonical one as the .rlib
doesn't contain any crate metadata beyond the header.
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Introduce -Zsplit-metadata option This will split the crate metadata out of library files. Instead only the svh and a bit of extra metadata is preserved to allow for loading the right rmeta file. This significantly reduces library size. In addition it allows for cheaper checks if different library files are the same crate. A fair amount of the complexity in this PR is to work around the fact that cargo doesn't directly support this option yet. Fixes rust-lang#23366 Fixes rust-lang#57076 Revives rust-lang#93945
What would be the best way to handle the necessary cargo changes? We can't use them until the bootstrap compiler includes the cargo changes, but cargo would depend on |
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (8fb65ac): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 666.509s -> 669.311s (0.42%) |
This should save about 4MB on the download size of a toolchain without any extra targets other than the host:
For Bevy the size of the target dir shrinks a lot:
|
☔ The latest upstream changes (presumably #120486) made this pull request unmergeable. Please resolve the merge conflicts. |
@bjorn3
(I'll be able to review the first two PRs quickly.) |
9c5667a
to
a713ebc
Compare
This comment has been minimized.
This comment has been minimized.
…trochenkov Remove a workaround for a bug I don't think it is necessary anymore. As I understand it from issue 39504 the original problem was that rustbuild changed a hardlink in the cargo build dir to point to copy in the sysroot while cargo may have hardlinked it to the original first. I don't think this happens anymore and as such this workaround is no longer necessary. Split out of rust-lang#120855
…trochenkov Remove a workaround for a bug I don't think it is necessary anymore. As I understand it from issue 39504 the original problem was that rustbuild changed a hardlink in the cargo build dir to point to copy in the sysroot while cargo may have hardlinked it to the original first. I don't think this happens anymore and as such this workaround is no longer necessary. Split out of rust-lang#120855
…, r=petrochenkov Move metadata header and version checks together This will make it easier to report rustc versions for older metadata formats. Split out of rust-lang#120855
…, r=petrochenkov Move metadata header and version checks together This will make it easier to report rustc versions for older metadata formats. Split out of rust-lang#120855
Rollup merge of rust-lang#122187 - bjorn3:merge_header_version_checks, r=petrochenkov Move metadata header and version checks together This will make it easier to report rustc versions for older metadata formats. Split out of rust-lang#120855
☔ The latest upstream changes (presumably #122241) made this pull request unmergeable. Please resolve the merge conflicts. |
…chenkov Move metadata header and version checks together This will make it easier to report rustc versions for older metadata formats. Split out of rust-lang/rust#120855
…ochenkov Remove a workaround for a bug I don't think it is necessary anymore. As I understand it from issue 39504 the original problem was that rustbuild changed a hardlink in the cargo build dir to point to copy in the sysroot while cargo may have hardlinked it to the original first. I don't think this happens anymore and as such this workaround is no longer necessary. Split out of rust-lang#120855
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a82c40c
to
fe45297
Compare
☔ The latest upstream changes (presumably #126777) made this pull request unmergeable. Please resolve the merge conflicts. |
fe45297
to
a5c9a9c
Compare
☔ The latest upstream changes (presumably #131869) made this pull request unmergeable. Please resolve the merge conflicts. |
This will split the crate metadata out of library files. Instead only the svh is preserved to allow for loading the right rmeta file. This significicantly reduces library size. In addition it allows for cheaper checks if different library files are the same crate.
a5c9a9c
to
f912043
Compare
This comment has been minimized.
This comment has been minimized.
f912043
to
d093c9d
Compare
This will split the crate metadata out of library files. Instead only the svh and a bit of extra metadata is preserved to allow for loading the right rmeta file. This significantly reduces library size. In addition it allows for cheaper checks if different library files are the same crate.
A fair amount of the complexity in this PR is to work around the fact that cargo doesn't directly support this option yet.
Fixes #23366
Closes #29511
Fixes #57076
Revives #93945