Skip to content

Commit 4ccf8ca

Browse files
authored
Rollup merge of #145884 - clubby789:test-mcount, r=Mark-Simulacrum
Test `instrument-mcount` codegen Closes #92109 by testing that a call to `mcount` is actually emitted
2 parents 4b0933a + f9c765e commit 4ccf8ca

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/assembly-llvm/x86_64-mcount.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//@ assembly-output: emit-asm
2+
//@ compile-flags: -Zinstrument-mcount=y -Cllvm-args=-x86-asm-syntax=intel
3+
4+
//@ revisions: x86_64-linux
5+
//@[x86_64-linux] compile-flags: --target=x86_64-unknown-linux-gnu
6+
//@[x86_64-linux] needs-llvm-components: x86
7+
//@[x86_64-linux] only-x86_64-unknown-linux-gnu
8+
9+
//@ revisions: x86_64-darwin
10+
//@[x86_64-darwin] compile-flags: --target=x86_64-apple-darwin
11+
//@[x86_64-darwin] needs-llvm-components: x86
12+
//@[x86_64-darwin] only-x86_64-apple-darwin
13+
14+
#![crate_type = "lib"]
15+
16+
// CHECK-LABEL: mcount_func:
17+
#[no_mangle]
18+
pub fn mcount_func() {
19+
// CHECK: call mcount
20+
21+
std::hint::black_box(());
22+
23+
// CHECK: ret
24+
}

0 commit comments

Comments
 (0)