Skip to content

Commit 16c2b39

Browse files
committed
Add a test that #[used] makes it through to the linker on macos
1 parent 54133cf commit 16c2b39

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-include ../tools.mk
2+
3+
# only-macos
4+
#
5+
# This checks that `#[used]` passes through to the linker on
6+
# darwin. This is subject to change in the future, see
7+
# https://github.com/rust-lang/rust/pull/93718 for discussion
8+
9+
all:
10+
$(RUSTC) -Copt-level=3 dylib_used.rs
11+
nm $(TMPDIR)/libdylib_used.dylib | $(CGREP) VERY_IMPORTANT_SYMBOL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![crate_type = "cdylib"]
2+
3+
#[used]
4+
static VERY_IMPORTANT_SYMBOL: u32 = 12345;

0 commit comments

Comments
 (0)