Skip to content

Commit c186ad4

Browse files
committed
add ignore-cross-compile to run-make test
1 parent 41afd5f commit c186ad4

2 files changed

Lines changed: 32 additions & 5 deletions

File tree

tests/run-make/naked-dead-code-elimination/main.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ extern "C" fn used() {
77
naked_asm!("ret")
88
}
99

10+
#[unsafe(no_mangle)]
11+
extern "C" fn used_clothed() -> i32 {
12+
41
13+
}
14+
15+
pub fn main() {
16+
std::hint::black_box(used());
17+
std::hint::black_box(used_clothed());
18+
}
19+
1020
#[unsafe(no_mangle)]
1121
extern "C" fn unused_clothed() -> i32 {
1222
42
@@ -36,7 +46,3 @@ extern "C" fn unused_link_section() {
3646
extern "C" fn unused_link_section_clothed() -> i32 {
3747
43
3848
}
39-
40-
fn main() {
41-
used();
42-
}

tests/run-make/naked-dead-code-elimination/rmake.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
1+
//@ ignore-cross-compile
12
//@ needs-asm-support
23

34
use run_make_support::symbols::object_contains_any_symbol;
45
use run_make_support::{bin_name, rustc};
56

67
fn main() {
8+
let bin = bin_name("main");
9+
10+
rustc().input("main.rs").opt().function_sections(false).run();
11+
12+
assert!(object_contains_any_symbol(&bin, &["used"]));
13+
14+
// Check that the naked symbol is eliminated when the "clothed" one is.
15+
16+
assert_eq!(
17+
object_contains_any_symbol(&bin, &["unused_clothed"]),
18+
object_contains_any_symbol(&bin, &["unused"])
19+
);
20+
21+
assert_eq!(
22+
object_contains_any_symbol(&bin, &["unused_link_section_clothed"]),
23+
object_contains_any_symbol(&bin, &["unused_link_section"])
24+
);
25+
26+
// ---
27+
728
rustc().input("main.rs").opt().function_sections(true).run();
829

9-
let bin = bin_name("main");
30+
assert!(object_contains_any_symbol(&bin, &["used"]));
1031

1132
// Check that the naked symbol is eliminated when the "clothed" one is.
1233

0 commit comments

Comments
 (0)