Relocatable dll problems when generated by ld

Jon Thackray jont@harlequin.co.uk
Fri Jul 11 06:11:00 GMT 1997


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
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list