Subject: Re: Relocatable dll problems when generated by ld
From: [email-masked] (Jon Thackray)

11 Jul 1997 06:38:21 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
	<[email-masked]>
Original-To: [email-masked]
In-Reply-To: <[email-masked]>
Original-Sender: [email-masked]

William Greathouse writes:
 > Jon Thackray wrote:
 > > 
 > > It appears that relocatable dlls as produced by ld aren't quite right,
 > > at least in some cases. Here is what dumpbin had to say about one I
 > > produced.
 > 
 > ... details removed ... 
 >  
 > > Apart from the problem of some funny names, and a pointer going
 > > outside the file, there is a problem with the names Init_dylan_ and
 > > dylan_init_thread_local both of which have an extra _ as produced by
 > > ld. Given that these names do not appear anywhere in the input to link
 > > or ld without the spare _, I can only assume that ld is doing some
 > > mangling of the COFF symbol names when producing its import and export
 > > tables, and that ld is not emulating this behaviour.
 > 
 > Try running my "peclean" utility on the DLL.  It should correct the 
 > pointer going outside the file.  If it does not, would it be possible
 > for you to send me a copy of the offending DLL to examine?

Where do I get peclean from? The pointer going outside the file has
been corrected by the use of fixup.c as follows:-

--------------------------------- fixup.c -------------------------------
/* This is needed to terminate the list of inport stuff */
/* Copied from winsup/dcrt0.cc in the cygwin32 source distribution. */
	asm(".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0");
-------------------------------------------------------------------------

I can probably send you a copy of the dll if you still want to see it.
It would be nice if ld could be fixed so as not to produce this
problem in future.

I have now, after modifying dlltool, and using fixup.c, and a couple
of edits of the dll itself, managed to make it work. The dlltool
modifications stop the output of extra underscores, and remove at most
one underscore from every name in the export table (as this seem to be
what link does), fixup gets rid of the corrupt dll problem and the
binary edit removes leading underscores from the import table. Apart
from these requirements, everything is fine:-)
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".