On Sun, Apr 18, 2010 at 04:28:54PM -0600, Charles Davis wrote:
On 4/18/10 4:17 PM, Marcus Meissner wrote:
Hi,
The Win32 ABI has its stack arguments aligned at 4 (2^2) bytes. For MMX/SSE operations we however need to have the stack aligned to 16 (2^4).
So specify this explicitly.
(This should probably be even part of attribute((stdcall)) perhaps in gcc. Not sure though.)
From windef.h:
# ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */ # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__)) # else # define __stdcall __attribute__((__stdcall__)) # endif
Maybe then it's time we got rid of the #ifdef __APPLE__ block, then, and used the OS X definition everywhere? Or, we could use your switch, and that would obviate the need for __force_align_arg_pointer__ with gcc (but not clang, because it doesn't implement that switch yet).
Hmm. Sounds like an idea. I will test and send a patch.
Ciao, Marcus