Align stacks for non-main entry points - that's needed with gcc 3.1 on Windows so we don't crash when trying to use SSE2

This commit is contained in:
Airy ANDRE 2014-03-24 18:08:54 +01:00
parent 97aba61b2f
commit a22301eb95
3 changed files with 9 additions and 2 deletions

View File

@ -1660,7 +1660,8 @@ const int kWindowMaxDim = 10000;
return DefWindowProcW(_handle,message,wParam,lParam);
}
static LRESULT CALLBACK windowProcedure(HWND handle,UINT message,WPARAM wParam,LPARAM lParam){
// Be sure the stack is aligned in case someone wants to do exotic things like SSE2
static LRESULT __attribute__((force_align_arg_pointer)) CALLBACK windowProcedure(HWND handle,UINT message,WPARAM wParam,LPARAM lParam){
NSAutoreleasePool *pool=[NSAutoreleasePool new];
Win32Window *self=GetProp(handle,"Win32Window");
LRESULT result;

View File

@ -71,7 +71,8 @@ static NSThread* mainThread = nil;
}
#ifdef WINDOWS
static unsigned __stdcall nsThreadStartThread(void* t)
// Be sure the stack is aligned in case the thread wants to do exotic things like SSE2
static __attribute__((force_align_arg_pointer)) unsigned __stdcall nsThreadStartThread(void* t)
#else
static void *nsThreadStartThread(void* t)
#endif

View File

@ -316,7 +316,12 @@ typedef struct pthread_start_routine_args_win32 {
void *arg;
} pthread_start_routine_args;
#ifdef WINDOWS
// Be sure the stack is aligned in case the thread wants to do exotic things like SSE2
unsigned __attribute__((force_align_arg_pointer)) __stdcall startroutine_thunk_for_win32_beginthreadex(void *arg)
#else
unsigned __stdcall startroutine_thunk_for_win32_beginthreadex(void *arg)
#endif
{
pthread_start_routine_args *threadArgs = (pthread_start_routine_args *)arg;