What does the FreeBSD/i386 ABI say about stack alignment?
Ryan Stone
rysto32 at gmail.com
Fri Jan 14 13:53:13 UTC 2011
On Fri, Jan 14, 2011 at 7:52 AM, Peter Blok <peter.blok at bsd4all.org> wrote:
> Hi Ryan,
>
> Well I think gcc should not generate movdqa if it cannot guarantee the area
> it is working on is aligned. If the stack is not aligned, it should generate
> – probably less efficient – code that works.
Well that's the trouble, in Linux at least it *can* guarantee that the
area is aligned. And it seems that according to kib, FreeBSD also
intended to guarantee that alignment, but due to a bug always produced
an unaligned stack(which explains why the hack I tried to fix the
alignment didn't work -- the bug happened after we got to userland).
> What is this area, if it is not a local variable allocated somewhere? Is it
> some sort of stack probing? Is alloca used? Are variable length arrays used?
To be honest I'm really not sure. It was dying somewhere in the
constructor of a C++ class. Unfortunately due to a lot of inlining
and gdb being a total piece of garbage, I wasn't able to suss out
exactly what C++ code the instruction corresponded to, and once I
understood the problem with movdqa I stopped digging in the C++ code.
More information about the freebsd-hackers
mailing list