On Thu Dec 15, 2022 at 10:17 AM AEST, Segher Boessenkool wrote: > On Wed, Dec 14, 2022 at 09:39:25PM +1000, Nicholas Piggin wrote: > > What about just copying x86's implementation including using > > __builtin_frame_address(1/2)? Are those builtins reliable for all > > our targets and compiler versions? > > __builtin_frame_address(n) with n > 0 is specifically not supported, not > on any architecture; it does not work in all situations on *any* arch, > and not in *any* situation on some archs.
No, but the particular case of powerpc where we have frame pointers and calling from a function where we know we have at least n + 1 frames on the stack, it would be okay, right? The code is not really different than using r1 directly and dereferencing that. Thanks, Nick