https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98482
--- Comment #7 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to H.J. Lu from comment #6) > A patch is posted at > > https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563033.html Yes, %r10 is pushed before __fentry__ cat test.c void func(int (*param)(int)); void outer(int x) { int nested(int y) { // If x is not used somewhere in here, // then the function will be "lifted" into // a normal, non-nested function. return x + y; } func(nested); } with -O2 -pg -mfentry got nested.0: .LFB1: .cfi_startproc pushq %r10 1: call __fentry__ popq %r10 movl (%r10), %eax addl %edi, %eax ret .cfi_endproc .LFE1: .size nested.0, .-nested.0 .p2align 4 .globl outer .type outer, @function outer: .LFB0: .cfi_startproc 1: call __fentry__ subq $56, %rsp .cfi_def_cfa_offset 64 leaq 64(%rsp), %rax movq %rax, 32(%rsp) movl $-17599, %eax movl %edi, (%rsp) movw %ax, 4(%rsp) movl $-17847, %edx movl $nested.0, %eax leaq 4(%rsp), %rdi movl %eax, 6(%rsp) movw %dx, 10(%rsp) movq %rsp, 12(%rsp) movl $-1864106167, 20(%rsp) call func addq $56, %rsp .cfi_def_cfa_offset 8