1
Fork 0

Add a test that #[used] makes it through to the linker on macos

This commit is contained in:
Thom Chiovoloni 2022-02-06 17:16:47 -08:00
parent 54133cfcf4
commit 16c2b39e1c
No known key found for this signature in database
GPG key ID: E2EFD4309E11C8A8
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,11 @@
-include ../tools.mk
# only-macos
#
# This checks that `#[used]` passes through to the linker on
# darwin. This is subject to change in the future, see
# https://github.com/rust-lang/rust/pull/93718 for discussion
all:
$(RUSTC) -Copt-level=3 dylib_used.rs
nm $(TMPDIR)/libdylib_used.dylib | $(CGREP) VERY_IMPORTANT_SYMBOL

View file

@ -0,0 +1,4 @@
#![crate_type = "cdylib"]
#[used]
static VERY_IMPORTANT_SYMBOL: u32 = 12345;