1 use super::BackendTypes; 2 use rustc_hir::def_id::DefId; 3 use rustc_target::abi::Align; 4 5 pub trait StaticMethods: BackendTypes { static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value6 fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value; codegen_static(&self, def_id: DefId, is_mutable: bool)7 fn codegen_static(&self, def_id: DefId, is_mutable: bool); 8 9 /// Mark the given global value as "used", to prevent the compiler and linker from potentially 10 /// removing a static variable that may otherwise appear unused. add_used_global(&self, global: Self::Value)11 fn add_used_global(&self, global: Self::Value); 12 13 /// Same as add_used_global(), but only prevent the compiler from potentially removing an 14 /// otherwise unused symbol. The linker is still permitted to drop it. 15 /// 16 /// This corresponds to the documented semantics of the `#[used]` attribute, although 17 /// on some targets (non-ELF), we may use `add_used_global` for `#[used]` statics 18 /// instead. add_compiler_used_global(&self, global: Self::Value)19 fn add_compiler_used_global(&self, global: Self::Value); 20 } 21 22 pub trait StaticBuilderMethods: BackendTypes { get_static(&mut self, def_id: DefId) -> Self::Value23 fn get_static(&mut self, def_id: DefId) -> Self::Value; 24 } 25