Skip to content

Conversation

dpaoliello
Copy link
Contributor

@dpaoliello dpaoliello commented Sep 4, 2025

For my purposes, contains fixes when compiling the Rust compiler for Arm64EC.

Checked the commits since 1.2.16, and I don't see anything else that may affect Rust?

find-msvc-tools was also factored out from cc to allow updating the use in rustc_codegen_ssa (finding the linker when running the Rust compiler) to be separate from the use in rustc_llvm (building LLVM as part of the Rust compiler).

@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2025

Failed to set assignee to NobodyXu: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2025

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

cc @WaffleLapkin

@jieyouxu jieyouxu self-assigned this Sep 4, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Sep 4, 2025

@bors try jobs=aarch64-msvc-1,aarch64-apple,test-various,dist-apple-various

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 4, 2025
Update cc-rs to 1.2.33

try-job: aarch64-msvc-1
try-job: aarch64-apple
try-job: test-various
try-job: dist-apple-various
@rust-bors
Copy link

rust-bors bot commented Sep 4, 2025

☀️ Try build successful (CI)
Build commit: d8ac12e (d8ac12e3b0cef5271092800d62ab852417973355, parent: a1208bf765ba783ee4ebdc4c29ab0a0c215806ef)

@jieyouxu
Copy link
Member

jieyouxu commented Sep 4, 2025

Let me know @dpaoliello if you want to try with find-msvc-tools, otherwise I'm fine with the current change as well.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot

This comment has been minimized.

@dpaoliello dpaoliello changed the title Update cc-rs to 1.2.33 Update cc-rs to 1.2.33, and switch rustc_codegen_ssa to use find-msvc-tools Sep 4, 2025
@dpaoliello
Copy link
Contributor Author

I switched to find-msvc-tools, since I was here changing things.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 4, 2025
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Sep 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2025

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

@davidtwco
Copy link
Member

@bors r=davidtwco,jieyouxu

@bors
Copy link
Collaborator

bors commented Sep 4, 2025

📌 Commit 45a0e10 has been approved by davidtwco,jieyouxu

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 4, 2025
@bors

This comment was marked as off-topic.

@jieyouxu
Copy link
Member

jieyouxu commented Sep 5, 2025

Sorry, wrong bors
@bors2 delegate=try

@rust-bors
Copy link

rust-bors bot commented Sep 5, 2025

✌️ @dpaoliello, you can now perform try builds on this pull request!

You can now post @bors2 try to start a try build.

@rustbot
Copy link
Collaborator

rustbot commented Sep 5, 2025

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.

@dpaoliello dpaoliello marked this pull request as draft September 5, 2025 18:01
@dpaoliello
Copy link
Contributor Author

@bors2 try jobs=dist-aarch64-linux

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 5, 2025
Update cc-rs to 1.2.33, and switch rustc_codegen_ssa to use find-msvc-tools

try-job: dist-aarch64-linux
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 5, 2025

💔 Test for 501f1bd failed: CI. Failed jobs:

@dpaoliello
Copy link
Contributor Author

There we go:

  configure:3111: clang -O3 -ffunction-sections -fdata-sections -fPIC --target=aarch64-unknown-linux-gnu -fprofile-generate=/tmp/tmp-multistage/opt-artifacts/rustc-pgo -flto=thin -fdebug-prefix-map=/checkout=/rustc/501f1bdbb5e1ad826d9b365e27bcefd98d951e0b -O3 -ffunction-sections -fdata-sections -fPIC --target=aarch64-unknown-linux-gnu -fprofile-generate=/tmp/tmp-multistage/opt-artifacts/rustc-pgo -flto=thin -fdebug-prefix-map=/checkout=/rustc/501f1bdbb5e1ad826d9b365e27bcefd98d951e0b -O3 -ffunction-sections -fdata-sections -fPIC --target=aarch64-unknown-linux-gnu -fprofile-generate=/tmp/tmp-multistage/opt-artifacts/rustc-pgo -flto=thin -fdebug-prefix-map=/checkout=/rustc/501f1bdbb5e1ad826d9b365e27bcefd98d951e0b conftest.c  >&5
  /usr/bin/ld: /rustroot/bin/../lib/LLVMgold.so: error loading plugin: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /rustroot/bin/../lib/LLVMgold.so)
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Now, what to do about it? I'm not a Linux dev, so I have no idea what's gone wrong...

@jieyouxu
Copy link
Member

jieyouxu commented Sep 6, 2025

Bisected the change next doors (#146226 (comment)) to cc https://github.com/rust-lang/cc-rs/releases/tag/cc-v1.2.21 and rust-lang/cc-rs#1424, but it's not immediately obvious what's the significance of that change to me.

@jieyouxu
Copy link
Member

jieyouxu commented Sep 6, 2025

🤔

gcc's -c flag is

Compile or assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file.

clang's -c flag is

Only run preprocess, compile, and assemble steps

@jieyouxu
Copy link
Member

jieyouxu commented Sep 6, 2025

Now, what to do about it? I'm not a Linux dev, so I have no idea what's gone wrong...

Let me ask other people as well

EDIT: asked in #t-compiler/help > compiler `cc` bump failure

Unfortunately I won't have time to dig into this, not until next weekend.

@dpaoliello
Copy link
Contributor Author

@bors2 try jobs=dist-aarch64-linux

rust-bors bot added a commit that referenced this pull request Sep 8, 2025
Update cc-rs to 1.2.33, and switch rustc_codegen_ssa to use find-msvc-tools

try-job: dist-aarch64-linux
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 8, 2025

💔 Test for 083d034 failed: CI. Failed jobs:

@bors
Copy link
Collaborator

bors commented Sep 9, 2025

☔ The latest upstream changes (presumably #146018) made this pull request unmergeable. Please resolve the merge conflicts.

@lambdageek
Copy link
Contributor

@dpaoliello nice cleanup. Please consider cherrypicking lambdageek@797c4b1 which should switch rust_windows_rc to use find-msvc-tools, too

@@ -117,7 +117,6 @@ pub(crate) fn get_linker<'a>(
if sess.target.is_like_msvc
&& let Some(ref tool) = msvc_tool
{
cmd.args(tool.args());
Copy link
Contributor

@lambdageek lambdageek Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this ok? It looked to me like cc::windows_registry::find_tool can have extra arguments here, while find_msvc_tools::find_tool cannot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old windows_registry::find_tool never set any args, which is why find_msvc_tools dropped it
https://github.com/rust-lang/cc-rs/blob/3c1325b09a78827fb2beb3ea9e8f1e3f84876b64/src/windows/find_tools.rs#L359-L371

@dpaoliello
Copy link
Contributor Author

Please consider cherrypicking lambdageek@797c4b1 which should switch rust_windows_rc to use find-msvc-tools, too

I have concerns with that change: I don't think we can rely on HOST being set.

I will switch rust_windows_rc to use find-msvc-tools, that seems reasonable, but I suggest that we make find-msvc-tools natively know how to find tools that ship in the Windows SDK.

@lambdageek
Copy link
Contributor

I don't think we can rely on HOST being set

From https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts

HOST — the host triple of the Rust compiler.

Is the concern that it might be set to something unexpected when bootstrapping the compiler?

@dpaoliello
Copy link
Contributor Author

... but I suggest that we make find-msvc-tools natively know how to find tools that ship in the Windows SDK.

Decided to implement this myself: rust-lang/cc-rs#1553

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants