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: dlclose not calling destructors of static variables.

On 01/02/2010 21:24, Dave Korn wrote:
On 01/02/2010 20:45, Andrew wrote:

I'm not looking to submit a patch to fix this, I'll leave that up to the
professionals who have a better idea about the whole picture. It's just
I've hit a brick wall with my code with this bug so I'm looking for some
work arounds for myself.
   No, really, you've been a ton of help, thanks a million.  Try the patch I
just posted to the cygwin-patches list, on top of current CVS:

That should get you going with your current DLLs.

   Next step is to add the cxx abi functions.  I found an old patch lying
around, seems I started looking at this back in August and then lost track of
it somehow (probably in the rush approaching the end of gcc stage 1, I guess),
so I owe you apologies for the inconvenience.


O.k. I've changed remove_dll_atexit to;

remove_dll_atexit (const dll *d)

   unsigned char *dll_beg = (unsigned char *) d->handle + 0x1000;
   unsigned char *dll_end = (unsigned char *) d->p.data_start;

That should cover the entire .text section for the dll. Offset the handle by 0x1000
to skip the file header and section alignment, and data_start to get the end of the
.text section. I noticed in patch you linked that you also tested against bss_end.
Doesn't bss_end always come after data_end so if the first if statement matches the
second will as well? And is it possible to have atexit functions within the data
( non executable code ) section?

I tested my changes against my simple test case and against my full program and they
both seems to work fine.


Problem reports:
Unsubscribe info:

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