This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: libffi doesn't keep the stack aligned to 16 bytes
- From: Neil Roberts <neil at linux dot intel dot com>
- To: libffi-discuss at sources dot redhat dot com
- Date: Mon, 09 Aug 2010 11:29:35 +0100
- Subject: Re: libffi doesn't keep the stack aligned to 16 bytes
- References: <874ogj14cl.fsf@neilpc.example.org>
Hi
Neil Roberts <neil@linux.intel.com> wrote:
> GCC appears to assume by default that the stack is always aligned to 16
> bytes when entering a function. Presumably this is to make it easier to
> use the aligned access instructions to load data into SSE
> registers. This means that if you have a variable with the aligned(16)
> attribute then GCC knows that it doesn't have to add an extra
> instruction to align the stack pointer because it will already be
> aligned.
>
> However, libffi doesn't appear to respect this. When it calls a function
> it allocates space on the stack by decrementing the stack pointer
> according to the amount of space required. This means the depending on
> the number of arguments the stack may or may not be aligned.
I wasn't subscribed to this list so I didn't see the replies to my
email. Sorry about that. It looks like the patch has now been applied
which is great, thanks. Just a small complaint however that I think a
lot of contributors would appreciate it if you could retain the commit
message and authorship when merging patches to git master instead of
combining them all into one commit.
Regards,
- Neil