diff --git a/src/constant.rs b/src/constant.rs index e0d3a873f7c1..1f0a39540d14 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -356,7 +356,12 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut Module, cx: &mu // Don't push a `TodoItem::Static` here, as it will cause statics used by // multiple crates to be duplicated between them. It isn't necessary anyway, // as it will get pushed by `codegen_static` when necessary. - data_id_for_static(tcx, module, def_id, Linkage::Import) + data_id_for_static( + tcx, + module, + def_id, + crate::linkage::get_static_ref_linkage(tcx, def_id), + ) } };