This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Relocatable dll problems when generated by ld


Ton van Overbeek writes:
 > Jon,
 > 
 > Your problem with your improperly build threads.dll by ld smells like the infamous
 > problem of an improperly terminated import section.

Well, it certainly seems to be improperly terminated. I'm using b17.1
ld, is b18 ld any better?

 > Have you added the extra file fixup.c to your sources ?
 > --------------------------------- 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");
 > -------------------------------------------------------------------------
 > Without this you will get listings like you got from
 > Microsoft's VC dumpbin.

Ah. I should explain that the object files I am linking are not
produced by a C compiler. This probably explains why I have had
problems with extra _ characters, because dlltool in particular was
assuming that its results would be linked against the results of a C
compiler which prepends _ characters to all its COFF names. The
compiler I'm using doesn't do that, the names go through untouched.

 > Also your previous problem of converting a Microsoft import library (.lib)
 > file to a cygwin import library (libxxx.a) I would have done differently:
 > First produce a .def file from the .lib file. I do not know off hand if
 > the Microsoft LIB allows you to do this automatically.
 > Otherwise you would have to use nm, strip the leading underscores  and
 > manually edit it to a proper .def file. Note that dlltool does not like
 > the .def file to start with e.g. 'LIBRARY kernel32.lib'. It wants line 1
 > to be 'EXPORTS'. 

Again, the dll I'm linking against does not come from a C compiler, so
there was no need to strip leading underscores, indeed in some cases,
there were no leading underscores. Making the .def file using nm
worked fine, using a three stage pipeline of nm, grep and sed.

 > Then with the .def file produce the import library with
 > dlltool --def <name>.def --output-lib <name>.a
 > Hope this helps a bit.

I hope the fixup stuff will help.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]