-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Link std statically in rustc_driver
#122362
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
Changes from 1 commit
3ee4325
736a249
486864f
56beb1d
dd3f757
b22253c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
std from rustc deps
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1838,17 +1838,13 @@ impl Step for Assemble { | |
| for f in builder.read_dir(&src_libdir) { | ||
| let filename = f.file_name().into_string().unwrap(); | ||
|
|
||
| // For the later stages which gets distributed only copy over the | ||
| // `rustc_driver` library so we don't end up with an extra copy of `std`. | ||
| // If we're not statically linking `std` into `rustc_driver`, just copy every library | ||
| // to ensure `std` is included. | ||
| // For the later stages which gets distributed avoid copying `std` if we're | ||
| // statically linking `std` into `rustc_driver`. | ||
| // We still need `std` for the initial stage as the bootstrap compiler may not | ||
| // have the new `rustc_private` linking behavior. | ||
| let can_be_rustc_dep = filename.starts_with("rustc_driver-") | ||
| || filename.starts_with("librustc_driver-") | ||
| || build_compiler.stage == 0 | ||
| || !link_std_into_rustc_driver; | ||
|
|
||
| let is_std = filename.starts_with("std-") || filename.starts_with("libstd-"); | ||
| let can_be_rustc_dep = | ||
| !is_std || !link_std_into_rustc_driver || build_compiler.stage == 0; // cfg(bootstrap) | ||
| if can_be_rustc_dep | ||
| && (is_dylib(&filename) || is_debug_info(&filename)) | ||
| && !proc_macros.contains(&filename) | ||
|
||
|
|
||
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.
What is this extra logic needed for?
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.
That's to prevent the
stddynamic library from also being included with the compiler, as it's no longer needed.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.
That sounds like it'd be worth a comment in the code. (That's probably true most times a reviewer had a question that was answered by a clarification without code change.)