We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 446da17 commit 77de006Copy full SHA for 77de006
2 files changed
tests/run-make/naked-dead-code-elimination/main.rs
@@ -0,0 +1,24 @@
1
+use std::arch::naked_asm;
2
+
3
+#[unsafe(naked)]
4
+#[no_mangle]
5
+extern "C" fn used() {
6
+ naked_asm!("ret")
7
+}
8
9
10
11
+extern "C" fn unused() {
12
13
14
15
16
+#[link_section = "foobar"]
17
18
+extern "C" fn unused_link_section() {
19
20
21
22
+fn main() {
23
+ used();
24
tests/run-make/naked-dead-code-elimination/rmake.rs
@@ -0,0 +1,10 @@
+//@ needs-asm-support
+use run_make_support::symbols::object_contains_any_symbol;
+use run_make_support::{bin_name, rustc};
+ rustc().input("main.rs").opt().run();
+ let mut unused = vec!["unused", "unused_link_section"];
+ assert!(!object_contains_any_symbol(bin_name("main"), &unused));
0 commit comments