From 45b1139e413d3939436dac636991a5bbbfd7e9ad Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Tue, 24 Aug 2004 08:49:33 +0000 Subject: * crt1.c: (__mingw_CRTStartup): Change return to void. Add noreturn attribute. Align stack to 16 bytes before passing args to main. (mainCRTStartup): Change return to void. (WinMainCRTStartup): Likewise. --- winsup/mingw/ChangeLog | 9 +++++++++ winsup/mingw/crt1.c | 31 +++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'winsup/mingw') diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 56ae976..f6f5063 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,12 @@ +2004-08-24 Danny Smith + + * crt1.c: (__mingw_CRTStartup): Change return to void. Add + noreturn attribute. Align stack to 16 bytes before passing args + to main. + (mainCRTStartup): Change return to void. + (WinMainCRTStartup): Likewise. + + 2004-08-15 Danny Smith * profile/COPYING: New file. diff --git a/winsup/mingw/crt1.c b/winsup/mingw/crt1.c index 21c54d6..780b75e 100644 --- a/winsup/mingw/crt1.c +++ b/winsup/mingw/crt1.c @@ -9,10 +9,8 @@ * */ -/* Hide the declaration of _fmode with dllimport attribute in stdlib.h. - This is not necessary with Mumit Khan's patches to gcc's winnt.c, - but those patches are still unofficial. */ - +/* Hide the declaration of _fmode with dllimport attribute in stdlib.h to + avoid problems with older GCC. */ #define __IN_MINGW_RUNTIME #include #include @@ -30,7 +28,6 @@ * a-good-idea use of include. */ #include "init.c" - extern void _pei386_runtime_relocator (void); extern int main (int, char **, char **); @@ -62,7 +59,7 @@ extern int* __p__fmode(void); /* To access the dll _fmode */ extern int _CRT_fmode; static void -_mingw32_init_fmode () +_mingw32_init_fmode (void) { /* Don't set the std file mode if the user hasn't set any value for it. */ if (_CRT_fmode) @@ -96,7 +93,6 @@ _mingw32_init_fmode () #else *_imp___fmode_dll = _fmode; #endif - } /* This function will be called when a trap occurs. Thanks to Jacob @@ -164,8 +160,8 @@ _gnu_exception_handler (EXCEPTION_POINTERS * exception_data) /* * The function mainCRTStartup is the entry point for all console programs. */ -static int -__mingw_CRTStartup () +static void __attribute__((noreturn)) +__mingw_CRTStartup (void) { int nRet; @@ -194,11 +190,14 @@ __mingw_CRTStartup () * NOTE: DLLs don't do this because that would be rude! */ _mingw32_init_fmode (); - /* Adust references to dllimported data that have non-zero offsets. */ _pei386_runtime_relocator (); + /* Align the stack to 16 bytes for the sake of SSE ops in main + or in functions inlined into main. */ + asm __volatile__ ("andl $-16, %%esp" : : : "%esp"); + /* * Call the main function. If the user does not supply one * the one in the 'libmingw32.a' library will be linked in, and @@ -214,21 +213,18 @@ __mingw_CRTStartup () _cexit (); ExitProcess (nRet); - - return 0; } /* * The function mainCRTStartup is the entry point for all console programs. */ -int -mainCRTStartup () +void +mainCRTStartup (void) { #ifdef __MSVCRT__ __set_app_type (__CONSOLE_APP); #endif __mingw_CRTStartup (); - return 0; } /* @@ -236,14 +232,13 @@ mainCRTStartup () * This simply gets rid of the annoying warning about not being able * to find WinMainCRTStartup when linking GUI applications. */ -int -WinMainCRTStartup () +void +WinMainCRTStartup (void) { #ifdef __MSVCRT__ __set_app_type (__GUI_APP); #endif __mingw_CRTStartup (); -return 0; } /* -- cgit v1.1