On 5/8/24 11:32 AM, Palmer Dabbelt 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.

Signed-off-by: Yanzhang Wang <yanzhang.w...@intel.com>
(cherry picked from commit 39663298b5934831a0125e12f113ebd83248c3be)
---
I haven't tested this (just an all-gcc build), but I figured I'd just
send it now as it's kind of a grey area for backports: the flag itself
is a new feature, but it also fixes a compatibility issue with the psABI
-- which itself is a grey area, as the psABI change was a retrofit and is
marked as optional.  I'd test it before pushing it, but this is one of
those things where I'm not really sure what the backporting rules
indicate we should do.

There's more discussion on this LKML thread:
https://lore.kernel.org/linux-riscv/527dd4d8-f1e5-4581-b1e3-aa315fea8...@sifive.com/T/#mf15ccc659b7b8b838b88959fbea460210875eb9c

That also has a much smaller fix, but having the whole argument seems
like a nicer user interface to me -- then users who really want
compatibility with the psABI's section on frame records can just ask for
it directly (via the odd spelling `-fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer`, but too late to change that).

Thoughts on this for 13?
Given its target specific, I think we have a lot more leeway here.

I think there was a followup in the space.  defa8681d951



We'd probably also want it all the way back to 11, but I assume that's
going to be the same discussion.
Yea.

You might explicitly run it by Jakub. But I'm certainly OK with this being backported.

jeff

Reply via email to