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

Clément Léger <cleger at rivosinc dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cleger at rivosinc dot com

--- Comment #5 from Clément Léger <cleger at rivosinc dot com> ---
(In reply to Andrew Pinski from comment #1)
> I don't see where in any of the spec mentioned that storing of ra is needed
> at all. That is it does not read ambigous to me at all. It just mentions for
> a frame pointer, the frame pointer needs to be saved and nothing about ra.
> 
> This is totally different from the power ABI.

I also stumbled on this problem and looking at the spec, it seems specified
what needs to be stored in a frame record:

"A frame record consists of two XLEN values on the stack; the return address
and the link to the next frame record. The frame pointer register will point to
the innermost frame, thereby starting the linked list. By convention, the
lowest XLEN value shall point to the previous frame, while the next XLEN value
shall be the return address."

So storing ra is actually specified unless you refer to an older version of
this spec but this clarification was added in a (somehow) not so recent commit:
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/e353f995d0645078e4ce5cb1acd355d37cb3e9c2

Regarding frame pointer generation wrt to leaf functions, either GCC should not
generate the frame record or generate a non bogus one. The current one is
unusable since it is malformed. But this behavior should probably depends on
-f(no)omit-frame-leaf-pointer.

Reply via email to