[Arm64EC] Only decorate functions with #

This commit is contained in:
Daniel Paoliello
2025-04-25 16:44:58 -07:00
parent f5d3fe273b
commit 6dabf7ea3a
11 changed files with 201 additions and 54 deletions

View File

@@ -364,7 +364,12 @@ impl<'ll> CodegenCx<'ll, '_> {
if !def_id.is_local() {
let needs_dll_storage_attr = self.use_dll_storage_attrs
&& !self.tcx.is_foreign_item(def_id)
// 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)))
// Local definitions can never be imported, so we must not apply
// the DLLImport annotation.
&& !dso_local