[win] Ignore MSVC linker warning 4217 #140954
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 markedextern "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 asdllimport
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
asdllimport
if we know that the compiler will be generating it in the current crate.