Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update to ar_archive_writer 0.5 #145721

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

Merged
bors merged 2 commits into rust-lang:master from dpaoliello:ar050
Sep 1, 2025
Merged

Update to ar_archive_writer 0.5 #145721

bors merged 2 commits into rust-lang:master from dpaoliello:ar050
Sep 1, 2025

Conversation

Copy link
Contributor

@dpaoliello dpaoliello commented Aug 21, 2025
edited
Loading

This updates ar_archive_writer to 0.5, which in turn was updated to match LLVM 20.1.8: rust-lang/ar_archive_writer#24

As part of this, I refactored part of SymbolWrapper.cpp to pull common code that I was about to duplicate again into a new function.

NOTE: ar_archive_writer does include a breaking change where it no longer supports mangling C++ mangled names for Arm64EC. Since we don't need the mangled name (it's not the "exported name" which we're trying to load from the external dll), I'm setting the import_name when building for Arm64EC to prevent error when failing to mangle.

r? @bjorn3

@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 Aug 21, 2025
Copy link
Collaborator

rustbot commented Aug 21, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

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.

This comment has been minimized.

Copy link
Member

bjorn3 commented Aug 22, 2025

For the Rust project, this means that anyone using the raw-dylib feature will need to provide the Arm64EC mangled name for any C++ function when targeting Arm64EC

How would that actually work? If you just do #[link_name = "..."] it would be provided to both LLVM (which mangles it) and ar_archive_writer (which doesn't mangle it) To disable the name mangling on the LLVM side you have to use \x01, but ar_archive_writer doesn't handle that and it is an LLVM implementation detail that may not work with other backends anyway.

Copy link
Contributor Author

For the Rust project, this means that anyone using the raw-dylib feature will need to provide the Arm64EC mangled name for any C++ function when targeting Arm64EC

How would that actually work? If you just do #[link_name = "..."] it would be provided to both LLVM (which mangles it) and ar_archive_writer (which doesn't mangle it) To disable the name mangling on the LLVM side you have to use \x01, but ar_archive_writer doesn't handle that and it is an LLVM implementation detail that may not work with other backends anyway.

Let's take the example from the LLVM bug I posted above: int Wrapper<X>::GetValue(void) const

For most arches this is mangled as ?GetValue@?$Wrapper@UA@@@@QEBAHXZ
But, for Arm64EC it is mangled as ?GetValue@?$Wrapper@UA@@@@$$hQEBAHXZ

So, with ar_archive_writer 0.4.2 writing #[link_name = "?GetValue@?$Wrapper@UA@@@@QEBAHXZ"] would generate an incorrect Arm64EC mangled name and so linking would fail. With 0.5.0, ar_archive_writer recognizes that it is not an Arm64EC mangled name and so raises an error.

There are cases where 0.4.2 got the Arm64EC mangling correct, and those will now raise an error.

Copy link
Member

bjorn3 commented Aug 22, 2025

If you do #[link_name = "?GetValue@?$Wrapper@UA@@@@$$hQEBAHXZ"] as already mangled name, then LLVM would mangle it again when it codegens a call to this function, right? Or actually it turns out LLVM literally crashes when you try that currently: https://rust.godbolt.org/z/Y6aj635qc

Copy link
Contributor Author

But if you use a simpler name where the old 0.4.2 algorithm happened to be correct, then it compiles correctly: https://rust.godbolt.org/z/dnhn64sqM but with 0.5.0 this will now raise an error.

Copy link
Member

bjorn3 commented Aug 22, 2025

So basically before this PR there were cases where the name mangling was wrong for C++ on arm64ec when using raw-dylib and in those cases there was no workaround. And with this PR you simply can't correctly use C++ symbols with raw-dylib at all.

Copy link
Contributor Author

Actually, the example that you provided works fine if you use raw-dylib: https://rust.godbolt.org/z/fofzhfs5G

I did some experiments with 0.4.2, and it did work correctly even with the incorrect Arm64EC mangling: turns out that we don't need the mangled name since the EXPORT_AS gets set to the unmangled name anyway. I'm going to make a slight change to ar_archive_writer that will allow us to avoid this error and continue to link against C++ mangled names.

Copy link
Contributor Author

Ok, workaround in ar_archive_writer: rust-lang/ar_archive_writer#26

Copy link
Collaborator

bors commented Aug 27, 2025

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

Copy link
Collaborator

rustbot commented Aug 29, 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 changed the title (削除) Update to ar_archive_writer 0.5.0 (削除ここまで) (追記) Update to ar_archive_writer 0.5 (追記ここまで) Aug 29, 2025
Copy link
Contributor Author

@bjorn3 I've updated with the workaround I added in ar_archive_writer, and verified via our internal build pipeline that the workaround works.

Copy link
Member

bjorn3 commented Sep 1, 2025

@bors r+

Copy link
Collaborator

bors commented Sep 1, 2025

📌 Commit 4daae65 has been approved by bjorn3

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 1, 2025
Copy link
Collaborator

bors commented Sep 1, 2025

⌛ Testing commit 4daae65 with merge 7aef4be...

Copy link
Collaborator

bors commented Sep 1, 2025

☀️ Test successful - checks-actions
Approved by: bjorn3
Pushing 7aef4be to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 1, 2025
@bors bors merged commit 7aef4be into rust-lang:master Sep 1, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 1, 2025
Copy link
Contributor

github-actions bot commented Sep 1, 2025

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 154037f (parent) -> 7aef4be (this PR)

Test differences

Show 2 test diffs

2 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 7aef4bec4bec16cb6204d51eb633873e23b18771 --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

  1. dist-x86_64-apple: 5796.5s -> 7384.2s (27.4%)
  2. aarch64-apple: 5868.5s -> 7320.6s (24.7%)
  3. dist-arm-linux-gnueabi: 4930.1s -> 5505.5s (11.7%)
  4. dist-i586-gnu-i586-i686-musl: 5882.8s -> 5344.6s (-9.1%)
  5. x86_64-gnu-stable: 7490.7s -> 6980.0s (-6.8%)
  6. x86_64-gnu-llvm-19-1: 3595.9s -> 3365.6s (-6.4%)
  7. dist-aarch64-msvc: 6022.0s -> 5668.6s (-5.9%)
  8. dist-various-2: 2173.7s -> 2055.1s (-5.5%)
  9. x86_64-gnu-llvm-20-1: 3485.4s -> 3309.7s (-5.0%)
  10. aarch64-gnu: 7284.9s -> 6925.5s (-4.9%)
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.

Copy link
Collaborator

Finished benchmarking commit (7aef4be): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -3.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.5% [-3.5%, -3.5%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.5% [-3.5%, -3.5%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 467.56s -> 469.026s (0.31%)
Artifact size: 388.51 MiB -> 388.37 MiB (-0.04%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Milestone
1.91.0
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /