Re: [PATCH] riscv: eliminate unreliable __builtin_frame_address(1)

From: Jessica Clarke
Date: Wed Jan 19 2022 - 15:48:53 EST


On 19 Jan 2022, at 20:44, Andreas Schwab <schwab@xxxxxxxxxxxxxx> wrote:
>
> On Jan 19 2022, Jessica Clarke wrote:
>
>> Leaf functions by definition don’t have callees that are trying to read
>> their frame pointer so aren’t relevant here.
>
> ??? __builtin_frame_address(1) is about the caller, not the callee.

My point is that the only thing that can possibly read the incoming
frame pointer of a leaf function is the leaf function itself, and since
it knows where it’s putting it then there is no ABI issue, it just
remembers where it put it and loads it from there. The issue of whether
it’s part of the ABI or not only arises when you’re trying to read the
incoming frame pointer from a caller, which by definition is not a leaf
function.

Jess