libtcl8.5.dll collides with Cygwin DLL by default

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Wed Mar 7 23:57:00 GMT 2012


On 2012-03-07 04:42, Corinna Vinschen wrote:
> the default base address of libtcl8.5.dll collides with the address
> space of the Cygwin DLL.  Sure, we can't quite avoid DLL collisions,
> but this kind of collision results with high probability in a crash,
> rather than a collision detection message from Cygwin.

Tcl does not use any special linker options, so this is a result of 
--enable-auto-image-base, which gcc has been using by default for some 
time.  See ld/emultempl/pe.em:

static unsigned long
compute_dll_image_base (const char *ofile)
{
   unsigned long hash = strhash (ofile);
   return 0x61300000 + ((hash << 16) & 0x0FFC0000);
}

This would be based on an assumption that cygwin1.dll's ImageBase is 
0x6100000 and its SizeOfImage 0x00300000.  That was correct through 
1.7.7, but since then:

1.7.8:   00350000
1.7.9:   00450000
1.7.10:  00470000
1.7.11:  00480000

I'm not sure what is causing this continuous change, but the 
now-incorrect assumption is the real problem: any DLL with a strhash() 
within a certain range will have the same issue.  So unless there is a 
way to get our SizeOfImage back down to 0x00300000, the correct fix 
needs to be there (keeping in mind future growth).

> Do you think it's ok if you create a new tcl package with another
> default base address for libtcl8.5.dll?

With a patched binutils, I suppose.  But this begs the question, how 
many other DLLs are affected?


Yaakov



More information about the Cygwin-apps mailing list