This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Core dump on 32-bit Cygwin if program calls dlopen


Hi JonY,

On Jul 15 16:39, Corinna Vinschen wrote:
> On Jul 15 21:55, JonY wrote:
> > On 7/15/2014 21:08, Corinna Vinschen wrote:
> > >>
> > >> FWIW, the problem disappears if I revert gcc-core and libgcc1 to 4.8.2-2.
> > > 
> > > JonY, do you have a chance to have a look into this issue?
> > > 
> > 
> > Sorry, I have been busy these few weeks, but I am well aware that there
> > is a problem with one of the libgcc changes, but has yet to investigate it.
> > 
> > I believe Jon Turney has looked into it somewhat.
> 
> Sounds good.  Thanks in advance.

Yesterday I asked my collegues to take a stab at the issue and one of
them, DJ Delorie, came up with a libgcc patch already.  It hasn't been
sent upstream yet.  Can we give it a try, perhaps by creating a new
libgcc DLL, please?

Thanks,
Corinna


Index: libgcc/config/i386/cygming-crtbegin.c
===================================================================
--- libgcc/config/i386/cygming-crtbegin.c	(revision 212546)
+++ libgcc/config/i386/cygming-crtbegin.c	(working copy)
@@ -99,12 +99,13 @@ static EH_FRAME_SECTION_CONST char __EH_
   = { };
 
 static struct object obj;
 
 /* Handle of libgcc's DLL reference.  */
 HANDLE hmod_libgcc;
+static void *  (*deregister_frame_fn) (const void *) = NULL;
 #endif
 
 #if TARGET_USE_JCR_SECTION
 static void *__JCR_LIST__[]
   __attribute__ ((used, section(JCR_SECTION_NAME), aligned(4)))
   = { };
@@ -130,15 +131,20 @@ __gcc_register_frame (void)
   if (h)
     {
       /* Increasing the load-count of LIBGCC_SONAME DLL.  */
       hmod_libgcc = LoadLibrary (LIBGCC_SONAME);
       register_frame_fn = (void (*) (const void *, struct object *))
 			  GetProcAddress (h, "__register_frame_info");
+      deregister_frame_fn = (void* (*) (const void *))
+	                    GetProcAddress (h, "__deregister_frame_info");
+    }
+  else
+    {
+      register_frame_fn = __register_frame_info;
+      deregister_frame_fn = __deregister_frame_info;
     }
-  else 
-    register_frame_fn = __register_frame_info;
   if (register_frame_fn)
      register_frame_fn (__EH_FRAME_BEGIN__, &obj);
 #endif
 
 #if TARGET_USE_JCR_SECTION 
   if (__JCR_LIST__[0])
@@ -158,19 +164,12 @@ __gcc_register_frame (void)
 }
 
 void
 __gcc_deregister_frame (void)
 {
 #if DWARF2_UNWIND_INFO
-  void *  (*deregister_frame_fn) (const void *);
-  HANDLE h = GetModuleHandle (LIBGCC_SONAME);
-  if (h)
-    deregister_frame_fn = (void* (*) (const void *))
-			  GetProcAddress (h, "__deregister_frame_info");
-  else 
-    deregister_frame_fn = __deregister_frame_info;
   if (deregister_frame_fn)
      deregister_frame_fn (__EH_FRAME_BEGIN__);
   if (hmod_libgcc)
     FreeLibrary (hmod_libgcc);
 #endif
 }

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpTZvT00sH17.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]