Files
rust/tests/assembly-llvm/fentry.rs
Paul Murphy 6ce0650633 Add -Zinstrument-mcount=fentry to -Zinstrument-mcount
fentry is essentially a simpler version of mcount where the
counting function is called before any other function prologue
actions happen.

fentry is still used by the linux x86-64 kernel. It's unclear if
or when patchable-function-entry will replace it. It is also used
by clang for some x86-64 mingw toolchains.

This is only supported on some x86, x86-64, and s390x targets.
2026-06-17 13:09:33 -05:00

26 lines
640 B
Rust

//@ assembly-output: emit-asm
//@ compile-flags: -Zinstrument-mcount=fentry
//@ add-minicore
//@ revisions: X86 S390X
//@[X86] compile-flags: --target=x86_64-unknown-linux-gnu -Cllvm-args=-x86-asm-syntax=intel
//@[X86] needs-llvm-components: x86
//@[S390X] compile-flags: --target=s390x-unknown-linux-gnu
//@[S390X] needs-llvm-components: systemz
#![crate_type = "lib"]
#![feature(no_core)]
#![no_core]
extern crate minicore;
// CHECK-LABEL: mcount_func:
#[no_mangle]
pub fn mcount_func(a: isize, b: isize) -> isize {
// X86: call __fentry__
// S390X: brasl %r0, __fentry__@PLT
a + b
// X86: ret
// S390X: br %r14
}