> Not all architectures/ABIs pass the return address (RA) on the stack on > function entry, like x86-64 does due to its CALL instruction pushing > the RA onto the stack. Architectures/ABIs, such as s390, also do not > require the RA to be saved on the stack in the function prologue. In > particular, the RA may never be saved to the stack at all, such as in > leaf functions. Unwinding must therefore not assume the presence of a > RA saved on stack for the topmost frame. > > Treat a RA offset from CFA of zero as indication that the RA is not > saved (on the stack). For the topmost frame treat it as indication that > the RA is in the link/RA register, such as on arm64 and s390, and obtain > it from there. For non-topmost frames treat it as error, as the RA must > be saved. > > Additionally allow the SP to be unchanged in the topmost frame, for > architectures where SP at function entry == SP at call site, such as > arm64 and s390. > > Note that treating a RA offset from CFA of zero as indication that > the RA is not saved on the stack additionally allows for architectures, > such as s390, where the frame pointer (FP) may be saved without the RA > being saved as well. Provided that such architectures represent this > in SFrame by encoding the "missing" RA offset using a padding RA offset > with a value of zero. > > Reviewed-by: Indu Bhagat <[email protected]> > Signed-off-by: Jens Remus <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
