Skip to content

[win] Ignore MSVC linker warning 4217 #140954

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dpaoliello
Copy link
Contributor

Fixes a regression from #140176

As part of fixing linking statics for Arm64EC, we needed to correctly mark statics with the DATA attribute in the generated def file.

A side-effect of this is that statics that need to be imported must be marked with dllimport.

This then caused issues with __rust_no_alloc_shim_is_unstable as it is marked extern "Rust" in the static library (indicating that it is a foreign item, thus it is linked into the binary), but the definition is generated by the compiler (in some crates). MSVC's linker would raise warning 4286 to complain about marking a symbol as dllimport that is defined in an obj file, but LLD is raising warning 4217 to complain that the symbol is declared in one obj but imported by another (it's possible the difference is due to the number of codegen-units and where the definition/declarations happen to land across the objs).

The fix here is to suppress warning 4217 as well.

Long term, it would be ideal to avoid marking __rust_no_alloc_shim_is_unstable as dllimport if we know that the compiler will be generating it in the current crate.

@rustbot
Copy link
Collaborator

rustbot commented May 12, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented May 12, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added 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 May 12, 2025
@dpaoliello
Copy link
Contributor Author

cc @zmodem

@jieyouxu
Copy link
Member

r? @bjorn3

@rustbot rustbot assigned bjorn3 and unassigned oli-obk May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants