Revert "Fix linking statics on Arm64EC #140176"

Unfortunately, multiple people are reporting linker warnings related to
`__rust_no_alloc_shim_is_unstable` after this change. The solution isn't
quite clear yet, let's revert to green for now, and try a reland with a
determined solution for `__rust_no_alloc_shim_is_unstable`.

This reverts commit c8b7f32434, reversing
changes made to 667247db71.
This commit is contained in:
Jieyou Xu
2025-05-15 16:51:32 +08:00
parent 414482f6a0
commit 734a5b1aa7
11 changed files with 54 additions and 201 deletions

View File

@@ -364,12 +364,7 @@ impl<'ll> CodegenCx<'ll, '_> {
if !def_id.is_local() {
let needs_dll_storage_attr = self.use_dll_storage_attrs
// If the symbol is a foreign item, then don't automatically apply DLLImport, as
// we'll rely on the #[link] attribute instead. BUT, if this is an internal symbol
// then it may be generated by the compiler in some crate, so we do need to apply
// DLLImport when linking with the MSVC linker.
&& (!self.tcx.is_foreign_item(def_id)
|| (self.sess().target.is_like_msvc && fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)))
&& !self.tcx.is_foreign_item(def_id)
// Local definitions can never be imported, so we must not apply
// the DLLImport annotation.
&& !dso_local