about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-29 12:54:11 +1000
committerGitHub <noreply@github.com>2025-08-29 12:54:11 +1000
commit4ccf8ca7202d731cfb8fcea437a4413cf8e29af5 (patch)
tree59103ec6c53a49d2f37120728145d716b959a2d9
parent4b0933a0a567079fab35b4b860f61781360364bd (diff)
parentf9c765ed76bcaa9aa2ccc902e61e3de91ec96837 (diff)
downloadrust-4ccf8ca7202d731cfb8fcea437a4413cf8e29af5.tar.gz
rust-4ccf8ca7202d731cfb8fcea437a4413cf8e29af5.zip
Rollup merge of #145884 - clubby789:test-mcount, r=Mark-Simulacrum
Test `instrument-mcount` codegen

Closes rust-lang/rust#92109 by testing that a call to `mcount` is actually emitted
-rw-r--r--tests/assembly-llvm/x86_64-mcount.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/assembly-llvm/x86_64-mcount.rs b/tests/assembly-llvm/x86_64-mcount.rs
new file mode 100644
index 00000000000..0428272cfc5
--- /dev/null
+++ b/tests/assembly-llvm/x86_64-mcount.rs
@@ -0,0 +1,24 @@
+//@ assembly-output: emit-asm
+//@ compile-flags: -Zinstrument-mcount=y -Cllvm-args=-x86-asm-syntax=intel
+
+//@ revisions: x86_64-linux
+//@[x86_64-linux] compile-flags: --target=x86_64-unknown-linux-gnu
+//@[x86_64-linux] needs-llvm-components: x86
+//@[x86_64-linux] only-x86_64-unknown-linux-gnu
+
+//@ revisions: x86_64-darwin
+//@[x86_64-darwin] compile-flags: --target=x86_64-apple-darwin
+//@[x86_64-darwin] needs-llvm-components: x86
+//@[x86_64-darwin] only-x86_64-apple-darwin
+
+#![crate_type = "lib"]
+
+// CHECK-LABEL: mcount_func:
+#[no_mangle]
+pub fn mcount_func() {
+    // CHECK: call mcount
+
+    std::hint::black_box(());
+
+    // CHECK: ret
+}