From: jont AT harlequin DOT co DOT uk (Jon Thackray) Subject: Re: Relocatable dll problems when generated by ld 11 Jul 1997 06:38:21 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199707111307.OAA09931.cygnus.gnu-win32@zaphod.long.harlequin.co.uk> References: <199707101528 DOT QAA27954 AT zaphod DOT long DOT harlequin DOT co DOT uk> <33C42161 DOT B3820489 AT smva DOT com> Original-To: gnu-win32 AT cygnus DOT com In-Reply-To: <33C42161.B3820489@smva.com> Original-Sender: owner-gnu-win32 AT cygnus DOT com 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 AT cygnus DOT com" with one line of text: "help".