Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 3 Apr 2016 13:26:31 -0400
From: Rich Felker <>
Subject: Re: [PATCH 2/2] add powerpc64 port

On Sun, Apr 03, 2016 at 12:10:44PM -0500, Bobby Bingham wrote:
> > > r2 is call-saved when calling to the local entry point, so setjmp needs
> > > to save it.
> >
> > OK, I see how this works for local calls to setjmp. But how does the
> > linker PLT magic work for setjmp?
> >
> > After the first return, the caller's stack slot where r2 was saved
> > belongs to the caller, and the compiler can clobber it. Upon the
> The ABI is very prescriptive about the layout of a stack frame.  Each
> stack frame has several slots where callees are allowed to use part of
> their caller's frame.  For example, the link register is saved to the
> caller's frame, not the callee's.
> For several of these slots, the ABI explicitly documents that they may
> be used as temporary storage which should be considered call-clobbered.
> For the slot used for saving the toc pointer (r2), the ABI makes no
> mention of it being available for temporary storage.  It would be nice
> if it were more explicit here, but I believe the intent is that the
> compiler may not use this slot for any other purpose.

My concern was not that the function itself could clobber it (although
I think it would be entitled to if it's no longer live, i.e. if no
code paths remain that reference its value) but that future function
calls might clobber it. However I think they all necessarily either
don't write to this slot at all, or write the same value that was
already there, so it's probably safe without longjmp having to restore


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.