i think it's about 5 month between preceeding one.
missing WINAPI(__stdcall) which should had been added for function pointer type is now cause of SIGSEGV. hence it is added. this changes applies to winsup/cygwin/environ,autoload.cc winsup/utils/mkpasswd,mkgroup.c,loadlib.h,cygpath.cc and in autoload.cc, ebp+4 maybe not frame pointer, but we can make sure it replaces return address by using __builtin_frame_address.
this change applies to winsup/cygwin/autoload.cc

patch,changelog modified are attached as you can see.
please review it.

Regards.

Index: winsup/cygwin/autoload.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/autoload.cc,v
retrieving revision 1.207
diff -u -r1.207 autoload.cc
--- winsup/cygwin/autoload.cc   28 May 2011 18:17:07 -0000      1.207
+++ winsup/cygwin/autoload.cc   12 Jul 2011 19:08:34 -0000
@@ -290,9 +290,9 @@
   InterlockedDecrement (&dll->here);
 
   /* Kludge alert.  Redirects the return address to dll_chain. */
-  __asm__ __volatile__ ("              \n\
-       movl    $dll_chain,4(%ebp)      \n\
-  ");
+  extern int dllchain asm("$dll_chain");
+  *(((int*)__builtin_frame_address(0))+1)=dllchain;
+
 
   return ret.ll;
 }
@@ -337,9 +337,8 @@
     }
 
   /* Kludge alert.  Redirects the return address to dll_chain. */
-  __asm__ __volatile__ ("              \n\
-       movl    $dll_chain,4(%ebp)      \n\
-  ");
+  extern int dllchain asm("$dll_chain");
+  *(((int*)__builtin_frame_address(0))+1)=dllchain;
 
   InterlockedDecrement (&here);
 
Index: winsup/cygwin/environ.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/environ.cc,v
retrieving revision 1.194
diff -u -r1.194 environ.cc
--- winsup/cygwin/environ.cc    4 Jul 2011 18:14:31 -0000       1.194
+++ winsup/cygwin/environ.cc    12 Jul 2011 19:08:34 -0000
@@ -392,7 +392,7 @@
   free (src);
   MALLOC_CHECK;
 }
-
+typedef char* (__stdcall *pfnenv)(const char*,int*);
 /* Returns pointer to value associated with name, if any, else NULL.
   Sets offset to be the offset of the name/value combination in the
   environment array, for use by setenv(3) and unsetenv(3).
@@ -448,7 +448,7 @@
   return NULL;
 }
 
-static char * (*findenv_func)(const char *, int *) = (char * (*)(const char *, 
int *)) getearly;
+static pfnenv findenv_func = &getearly;
 
 /* Returns ptr to value associated with name, if any, else NULL.  */
 
@@ -806,7 +806,7 @@
   FreeEnvironmentStringsW (rawenv);
 
 out:
-  findenv_func = (char * (*)(const char*, int*)) my_findenv;
+  findenv_func = my_findenv;
   __cygwin_environ = envp;
   update_envptrs ();
   if (envp_passed_in)
Index: winsup/utils/mkpasswd.c
===================================================================
RCS file: /cvs/src/src/winsup/utils/mkpasswd.c,v
retrieving revision 1.55
diff -u -r1.55 mkpasswd.c
--- winsup/utils/mkpasswd.c     28 Aug 2010 11:22:37 -0000      1.55
+++ winsup/utils/mkpasswd.c     12 Jul 2011 19:08:34 -0000
@@ -77,7 +77,7 @@
   HANDLE h = LoadLibrary ("netapi32.dll");
 
   if (h)
-    dsgetdcname = (void *) GetProcAddress (h, "DsGetDcNameW");
+    dsgetdcname = (WINAPI void *) GetProcAddress (h, "DsGetDcNameW");
 }
 
 static PWCHAR
Index: winsup/utils/mkgroup.c
===================================================================
RCS file: /cvs/src/src/winsup/utils/mkgroup.c,v
retrieving revision 1.48
diff -u -r1.48 mkgroup.c
--- winsup/utils/mkgroup.c      28 Aug 2010 11:22:37 -0000      1.48
+++ winsup/utils/mkgroup.c      12 Jul 2011 19:08:34 -0000
@@ -76,7 +76,7 @@
 {
   HANDLE h = LoadLibrary ("netapi32.dll");
   if (h)
-    dsgetdcname = (void *) GetProcAddress (h, "DsGetDcNameW");
+    dsgetdcname = (WINAPI void *) GetProcAddress (h, "DsGetDcNameW");
 }
 
 static PWCHAR
Index: winsup/utils/loadlib.h
===================================================================
RCS file: /cvs/src/src/winsup/utils/loadlib.h,v
retrieving revision 1.2
diff -u -r1.2 loadlib.h
--- winsup/utils/loadlib.h      29 Mar 2011 11:02:58 -0000      1.2
+++ winsup/utils/loadlib.h      12 Jul 2011 19:08:34 -0000
@@ -23,7 +23,7 @@
 static HMODULE
 _load_sys_library (const wchar_t *dll)
 {
-  static BOOL (*set_dll_directory)(LPCWSTR);
+  static BOOL (WINAPI *set_dll_directory)(LPCWSTR);
   static WCHAR sysdir[MAX_PATH];
   static UINT sysdir_len;
 
@@ -39,10 +39,10 @@
     {
       HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
       if (k32)
-       set_dll_directory = (BOOL (*)(LPCWSTR))
+       set_dll_directory = (BOOL (WINAPI *)(LPCWSTR))
                     GetProcAddress (k32, "SetDllDirectoryW");
       if (!set_dll_directory)
-       set_dll_directory = (BOOL (*)(LPCWSTR)) -1;
+       set_dll_directory = (BOOL (WINAPI *)(LPCWSTR)) -1;
       else
        set_dll_directory (L"");
     }
Index: winsup/utils/cygpath.cc
===================================================================
RCS file: /cvs/src/src/winsup/utils/cygpath.cc,v
retrieving revision 1.65
diff -u -r1.65 cygpath.cc
--- winsup/utils/cygpath.cc     6 Dec 2010 13:40:24 -0000       1.65
+++ winsup/utils/cygpath.cc     12 Jul 2011 19:08:34 -0000
@@ -623,7 +623,7 @@
   DWORD len = MAX_PATH;
   WIN32_FIND_DATAW w32_fd;
   HINSTANCE k32;
-  BOOL (*GetProfilesDirectoryAPtrW) (LPWSTR, LPDWORD) = 0;
+  BOOL (WINAPI *GetProfilesDirectoryAPtrW) (LPWSTR, LPDWORD) = 0;
 
   buf = buf1;
   buf[0] = 0;
@@ -661,7 +661,7 @@
     case 'H':
       k32 = LoadLibrary ("userenv.dll");
       if (k32)
-       GetProfilesDirectoryAPtrW = (BOOL (*) (LPWSTR, LPDWORD))
+       GetProfilesDirectoryAPtrW = (BOOL (WINAPI *) (LPWSTR, LPDWORD))
          GetProcAddress (k32, "GetProfilesDirectoryW");
       if (GetProfilesDirectoryAPtrW)
        (*GetProfilesDirectoryAPtrW) (wbuf, &len);
Index: winsup/cygwin/ChangeLog
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/ChangeLog,v
retrieving revision 1.5442
diff -u -r1.5442 ChangeLog
--- winsup/cygwin/ChangeLog     11 Jul 2011 00:03:54 -0000      1.5442
+++ winsup/cygwin/ChangeLog     12 Jul 2011 19:11:43 -0000
@@ -1,3 +1,8 @@
+2011-07-13  Jinwoo Ye  <[email protected]>
+
+       * environ.cc (findenv_func): (findenv_func) Define new pfn.
+       * autoload.cc (std_dll_init,wsock_init): Use __builtin_frame_address to 
replace return address
+
 2011-07-10  Christopher Faylor  <[email protected]>
 
        * fhandler_tty.cc (fhandler_pty_slave::ioctl): Remove erroneous support
Index: winsup/utils/ChangeLog
===================================================================
RCS file: /cvs/src/src/winsup/utils/ChangeLog,v
retrieving revision 1.556
diff -u -r1.556 ChangeLog
--- winsup/utils/ChangeLog      14 Jun 2011 15:04:04 -0000      1.556
+++ winsup/utils/ChangeLog      12 Jul 2011 19:11:43 -0000
@@ -1,3 +1,10 @@
+2011-07-13  Jinwoo Ye  <[email protected]>
+
+       * mkpasswd.c: Ditto.
+       * mkgroup.c (load_dsgetdcname): Ditto.
+       * loadlib.h (_load_sys_library): Ditto.
+       * cygpath.cc (do_sysfolders): Add WINAPI to function pointer.
+
 2011-06-14  Christopher Faylor  <[email protected]>
 
        * mingw: Force use of bash.

Reply via email to