Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a test that #[used] makes it through to the linker on macos
  • Loading branch information
thomcc committed May 11, 2022
commit 16c2b39e1c5029913daf7b780c2cbea7477e077c
11 changes: 11 additions & 0 deletions src/test/run-make-fulldeps/used-cdylib-macos/Makefile
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/test/run-make-fulldeps/used-cdylib-macos/dylib_used.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![crate_type = "cdylib"]

#[used]
static VERY_IMPORTANT_SYMBOL: u32 = 12345;