https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119279

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Call instructions are normally valid anywhere in the function, including
prologue and epilogue, even with frame pointers.
E.g. for
void bar (char *);
void
foo (void)
{
  char a[1024];
  bar (a);
  bar (a);
}
with -O2 -fno-omit-frame-pointer -mfentry -p there is
foo:
1:      call    __fentry__
        pushq   %rbp
        movq    %rsp, %rbp
        subq    $1024, %rsp
        leaq    -1024(%rbp), %rdi
        call    bar
        leaq    -1024(%rbp), %rdi
        call    bar
        leave
        ret
Sure, the function then needs to have special calling convention, but guess
that is the case when you call functions from inline asm as well unless the
inline asm properly describes all clobbered registers and other details (and
ideally for GCC 15 has "redzone" clobber as well).
So if calls before setup of the frame pointer aren't considered kosher in the
kernel, I think it must be some kernel imposed limitation.  If it is to make
sure that the otherwise leaf or innermost function is visible in the backtrace,
then don't tail calls have the same problem (the caller of the tail call is
also not visible in the backtrace unless DWARF proves it must be virtually
there)?

Reply via email to