Skip to content

Commit 2db9de3

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

2 files changed

Lines changed: 29 additions & 6 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: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
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() {
7-
rustc().input("main.rs").opt().function_sections(true).run();
8-
98
let bin = bin_name("main");
109

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

1330
assert_eq!(

0 commit comments

Comments
 (0)