On Tue, 24 Jan 2012 21:01:49 +0100 Martin Husemann <mar...@duskware.de> wrote:
> On Tue, Jan 24, 2012 at 08:21:42PM +0100, Paul Fleischer wrote: > > Is the usage of STACKALIGN indeed incorrect in this situation, or am I > > missing the big picture? > > I stumbled across this when revamping execve1 for posix_spawn recently. > > The intention seems to be to align the stack on a 8 byte boundary > (where arm usualy only requires 4 byte alignment). I did not dig in the > ARM ABI docs deep enough to see why this would be needed. > > However, the current implementation seems to be broken - the macro works > on the stack pointer but not on a length variable, as you noted. > > Can anyone explain why arm would need 8 byte alignment? Do some architectures (i.e. x86) have better performance if the stack is 16-bytes aligned? If so, perhaps that this could be MI, satisfying both 8-bytes (or 4-bytes) alignment, by aligning stacks at 16-bytes? Would this be considered wasteful? Of course, x86-64 MD code could also be used... There is also a related PR but which is for threads stack alignment: lib/39465 Thanks, -- Matt