delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/02/04:37:10

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4B67F236.6020307@gmail.com>
Date: Tue, 02 Feb 2010 09:36:54 +0000
From: Andrew West <andrewwest AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: dlclose not calling destructors of static variables.
References: <4B61732F DOT 4030804 AT gmail DOT com> <4B62DDE6 DOT 5070106 AT gmail DOT com> <4B62F118 DOT 8010305 AT gmail DOT com> <20100129184514 DOT GA9550 AT ednor DOT casa DOT cgf DOT cx> <4B66BF2F DOT 4060802 AT gmail DOT com> <20100201162603 DOT GB25374 AT ednor DOT casa DOT cgf DOT cx> <4B6710CE DOT 40300 AT gmail DOT com> <20100201174611 DOT GA26080 AT ednor DOT casa DOT cgf DOT cx> <20100201175123 DOT GB26080 AT ednor DOT casa DOT cgf DOT cx> <4B672B74 DOT 4090808 AT gmail DOT com> <4B673D5F DOT 4050104 AT gmail DOT com> <4B6746A5 DOT 3090203 AT gmail DOT com>
In-Reply-To: <4B6746A5.3090203@gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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:
>
> http://cygwin.com/ml/cygwin-patches/2010-q1/msg00051.html
>
>    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.
>
>      cheers,
>        DaveK
>
>    

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.

Andy



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019