Hi Jeff, Yes, there's a requirement to support backtrace based on the fp+ra. And the unwind/cfa is not acceptable because it will add additional sections to the binary. Currently, -fno-omit-frame-pointer can not save the ra for the leaf function. So we need to add another option like ARM/X86 to support consistent fp+ra stack layout for the leaf and non-leaf functions.
Thanks, Yanzhang ________________________________ From: Jeff Law <jeffreya...@gmail.com> Sent: Saturday, June 3, 2023 10:43 AM To: Wang, Yanzhang <yanzhang.w...@intel.com>; gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org> Cc: juzhe.zh...@rivai.ai <juzhe.zh...@rivai.ai>; kito.ch...@sifive.com <kito.ch...@sifive.com>; Li, Pan2 <pan2...@intel.com> Subject: Re: [PATCH] RISCV: Add -m(no)-omit-leaf-frame-pointer support. On 6/2/23 01:07, yanzhang.wang--- via Gcc-patches wrote: > From: Yanzhang Wang <yanzhang.w...@intel.com> > > gcc/ChangeLog: > > * config/riscv/riscv.cc (riscv_save_reg_p): Save ra for leaf > when enabling -mno-omit-leaf-frame-pointer > (riscv_option_override): Override omit-frame-pointer. > (riscv_frame_pointer_required): Save s0 for non-leaf function > (TARGET_FRAME_POINTER_REQUIRED): Override defination > * config/riscv/riscv.opt: Add option support. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/omit-frame-pointer-1.c: New test. > * gcc.target/riscv/omit-frame-pointer-2.c: New test. > * gcc.target/riscv/omit-frame-pointer-3.c: New test. > * gcc.target/riscv/omit-frame-pointer-4.c: New test. > * gcc.target/riscv/omit-frame-pointer-test.c: New test. Not ACKing or NAKing at this time. Why do you want this feature? jeff