Only compile #[used] as llvm.compiler.used for ELF targets

This commit is contained in:
Thom Chiovoloni 2022-02-06 13:51:11 -08:00
parent ecd44958e0
commit 54133cfcf4
No known key found for this signature in database
GPG key ID: E2EFD4309E11C8A8
2 changed files with 36 additions and 4 deletions

View file

@ -13,7 +13,9 @@ pub trait StaticMethods: BackendTypes {
/// Same as add_used_global(), but only prevent the compiler from potentially removing an
/// otherwise unused symbol. The linker is still permitted to drop it.
///
/// This corresponds to the semantics of the `#[used]` attribute.
/// This corresponds to the documented semantics of the `#[used]` attribute, although
/// on some targets (non-ELF), we may use `add_used_global` for `#[used]` statics
/// instead.
fn add_compiler_used_global(&self, global: Self::Value);
}