-
Notifications
You must be signed in to change notification settings - Fork 13.7k
compiler: Add Windows resources to rustc-main and rustc_driver #146018
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
Conversation
These commits modify the Cargo.lock
file. Unintentional changes to Cargo.lock
can be introduced when switching branches and rebasing PRs.
If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.
Some changes occurred in compiler/rustc_codegen_ssa
This comment was marked as outdated.
This comment was marked as outdated.
Why is the rustc version included in the product name? At most including the release channel would make sense to me (given that nightly genuinely behaves differently from stable by allowing unstable features), but the exaxt version is duplicated with the product version field.
This comment has been minimized.
This comment has been minimized.
Why is the rustc version included in the product name?
I don't have a good justification for the first iteration of this PR. Happy to update the names/descriptions to whatever makes the most sense
92170d4
to
6886e5b
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.
Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.
4cdb255
to
a21db62
Compare
Updated the Product Description to be just "Rust Compiler" or "Rust Compiler (channel)" for non-stable
This comment has been minimized.
This comment has been minimized.
This needs someone who actually have some clues about windows resources to review... I'll ask about a reviewer
This comment has been minimized.
This comment has been minimized.
Adds Windows resources with the rust version information to rustc-main.exe and rustc_driver.dll
I'm not familiar with Windows resources. But can you say more on the motivation for this change?
EDIT: okay I found #t-compiler/windows > version resources on rustc.exe and rustc_driver.dll, but it's still not super obvious to me the motivation for the change.
In many ways this is a cosmetic change: as you can see in the screenshot in the comment above, Windows shows the version info in the file explorer when you right click on the .exe or .dll and look at the details
However this info is also used by some other tools on Windows such as debuggers or crash reporters when collecting diagnostic information.
For our internal builds of Rust at Microsoft having version info available would allow us to collect better automated crash reports from our users.
I could just add this only in our internal builds, but it seemed like it would be useful to upstream it.
Ok thanks for the clarification, that makes sense. I'll ask internally for another reviewer who has at least slightly more clues about this than I do.
Updated screenshot (after addressing #146018 (comment)) , this what the properites look like now:
Screenshot 2025年09月02日 at 11 12 05add the support for windows-gnu (I'm not sure if this one is going to work) and windows-gnullvm
@mati865 you would need to use the windres
resource compiler from the GNU toolchain. the .rc
file format is the same. If you specify the output format as -O coff
I think you should be able to just pass the result to the gnu linker (ie, I don't think the stuff in rustc_driver
and rustc_main
build scripts would need to change much).
I moved the .rc creation into a separate function from the .res
generation, so hopefully it's easier to just add the code to invoke the GNU resource compiler.
Since you have way more clues on Windows Resources than I do,
r? @wesleywiser (as discussed :D)
wesleywiser
is currently at their maximum review capacity.
They may take a while to respond.
add the support for windows-gnu (I'm not sure if this one is going to work) and windows-gnullvm
@mati865 you would need to use the
windres
resource compiler from the GNU toolchain. the.rc
file format is the same. If you specify the output format as-O coff
I think you should be able to just pass the result to the gnu linker (ie, I don't think the stuff inrustc_driver
andrustc_main
build scripts would need to change much).
I know, it's just not a priority for me.
With LD there might be a clash with default-manifest.o
that is provided by default. Unlike LLVM tools, LD still cannot properly handle multiple resource files.
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.
lgtm can you squash your commits together and force push?
Adds Windows resources with the rust version information to rustc-main.exe and rustc_driver.dll Sets the product description to "Rust Compiler" or "Rust Compiler (channel)" for non-stable channels
5e579f4
to
095fa86
Compare
@wesleywiser done
@bors r+
...esleywiser compiler: Add Windows resources to rustc-main and rustc_driver Adds Windows resources with the rust version information to rustc-main.exe and rustc_driver.dll Invokes `rc.exe` directly, rather than using one of the crates from the ecosystem to avoid adding dependencies. A new internal `rustc_windows_rc` crate has the common build script machinery for locating `rc.exe` and constructing the resource script
Rollup of 11 pull requests Successful merges: - #145177 (std: move `thread` into `sys`) - #146018 (compiler: Add Windows resources to rustc-main and rustc_driver) - #146025 (compiler: Include span of too huge array with `-Cdebuginfo=2`) - #146184 (In the rustc_llvm build script, don't consider arm64* to be 32-bit) - #146195 (fix partial urlencoded link support) - #146300 (Implement `Sum` and `Product` for `f16` and `f128`.) - #146314 (mark `format_args_nl!` as `#[doc(hidden)]`) - #146324 (const-eval: disable pointer fragment support) - #146326 (simplify the declaration of the legacy integer modules (`std::u32` etc.)) - #146339 (Update books) - #146343 (Weakly export `platform_version` symbols) r? `@ghost` `@rustbot` modify labels: rollup
☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing fefce3c to master...
What is this?
This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing e9b6085 (parent) -> fefce3c (this PR)
Test differences
Show 4 test diffs
4 doctest diffs were found. These are ignored, as they are noisy.
Test dashboard
Run
cargo run --manifest-path src/ci/citool/Cargo.toml -- \ test-dashboard fefce3cecd63cebf2d7c9aa3dd90a84379fcfa1a --output-dir test-dashboard
And then open test-dashboard/index.html
in your browser to see an overview of all executed tests.
Job duration changes
- dist-apple-various: 3117.2s -> 5295.3s (69.9%)
- dist-x86_64-apple: 5617.0s -> 9013.2s (60.5%)
- pr-check-1: 1732.5s -> 1359.0s (-21.6%)
- dist-various-1: 3738.0s -> 4319.2s (15.6%)
- aarch64-gnu-llvm-19-1: 3894.5s -> 3340.1s (-14.2%)
- i686-gnu-2: 6412.3s -> 5517.5s (-14.0%)
- aarch64-gnu-llvm-19-2: 2591.1s -> 2245.5s (-13.3%)
- x86_64-gnu-llvm-19-1: 3626.7s -> 3232.3s (-10.9%)
- x86_64-gnu-miri: 4931.9s -> 4410.0s (-10.6%)
- i686-gnu-1: 8272.1s -> 7423.4s (-10.3%)
How to interpret the job duration changes?
Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.
Finished benchmarking commit (fefce3c): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (secondary 0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 466.867s -> 467.971s (0.24%) |
Adds Windows resources with the rust version information to rustc-main.exe and rustc_driver.dll
Invokes
rc.exe
directly, rather than using one of the crates from the ecosystem to avoid adding dependencies.A new internal
rustc_windows_rc
crate has the common build script machinery for locatingrc.exe
and constructing the resource script