delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/06/10/12:08:31

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Sun, 10 Jun 2001 12:08:46 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Re: dll base address
Message-ID: <20010610120846.B5292@redhat.com>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
References: <001f01c0f0e6$72b8ec80$0200a8c0 AT lifelesswks> <20010610004015 DOT D29231 AT redhat DOT com> <23114413578 DOT 20010610185633 AT logos-m DOT ru>
Mime-Version: 1.0
User-Agent: Mutt/1.3.11i
In-Reply-To: <23114413578.20010610185633@logos-m.ru>; from deo@logos-m.ru on Sun, Jun 10, 2001 at 06:56:33PM +0400

On Sun, Jun 10, 2001 at 06:56:33PM +0400, egor duda wrote:
>Sunday, 10 June, 2001 Christopher Faylor cgf AT redhat DOT com wrote:
>>>As you can see, cygwin1.dll has been loaded at 02561000. It seems to me
>>>that if __cygwin_user_data is a non-relocatble variable, that we should
>>>mark cygwin1.dll as non-relocatable.
>>>
>>>Thoughts?
>
>CF> It's possible that this is just an artifact of faulty handling by gdb.
>CF> I'm not aware of any reason for cygwin1.dll to be unrelocatable.
>
>i believe it isn't. when fhandlers are passed between processes,
>they're just copied as array of bytes. this includes their vtables. as
>long as cygwin1.dll is loaded at equal base addresses, everything's
>fine -- all vtables remain valid after copying. but if cygwin1.dll is
>relocated in exec()ed process, first call to virtual method in
>fhandler cause referencing invalid memory.
>
>i hadn't found a way to access vtable in gcc, so i don't know an
>elegant way to fix this.

Um, yes.  cygwin1.dll has always assumed that it will be loaded in the
same location in the parent and the child.  I guess you could interpret
that as indicating that it is not relocatable but that is not strictly
true.  It is just relying on (undocumented) deterministic behavior of
static DLL loading.  Unfortunately, LoadLibrary does not provide
deterministic behavior.

Cygwin goes to great lengths to ensure that cygwin-aware DLLs are loaded
in the same location in parent and child but there is obviously no way
that it can ensure the same thing for itself.

So, the DLL should be relocatable as long as it is consistently being
relocated to the same location.

There is a lot more than just vtables that would need to be addressed
if we were to fix this.

cgf

- Raw text -


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