This is the mail archive of the cygwin-apps@cygwin.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]

.def files, ordinals, and dlls


So here's a strange thing.  The XEmacs binary for cygwin from xemacs.org
was built against tiff-3.5.5-3.  However, xemacs.exe broke when
tiff-3.5.6beta-1 was installed, because the entry point "TIFFClientOpen"
could not be found (in the new dll). 

However, BOTH dlls, tiff-3.5.5-3 and tiff-3.5.6beta-1 contained that
symbol, just at different ordinal positions.  Both versions used the
same .def file, and did NOT specify "NONAME" -- so presumably, all
symbols were exported by name and ordinal, and xemacs *supposedly* was
linked "by name" -- the "supposed" default for ld.

There are actually two problems here:

1) why did XEmacs break -- obviously it's a link-by-ordinal problem
since both DLL's contained exactly the same symbol exports, just with
different ordinals.  But if ld "links-by-name" by default, then why did
this problem occur?

2) why did the two tiff packages, which both used the same .def file,
assign variant ordinals to the exports?  In some cases, the actual
ordinals in the dll's were DIFFERENT than those specified in the .def
file -- but 3.5.5-3 differed from the def file "differently" than
3.5.6beta-1 differed from the def file. (Got that?)  One possible clue:
there are 100 __declspec'ed exports, but the .def file specified only 75
of them.  Both dll's contained all 100 exports -- but not only were the
"extra" 25 exports differently assigned, but also the 75 .def'ed exports
were not assigned the same ordinals in the two dlls (which in some
cases, ALSO differed from the ordinal numbers EXPLICITLY given in the
.def file!!)

I worked around the problem by using objdump on the 3.5.5-3 dll, and
recreating a new .def file that specified all 100 exports.  I used this
new .def file in 3.5.6beta-2, and ended up with a dll that used the same
ordinals as 3.5.5-3 for all 100 exports.

Who was it that said ld's export behavior was deterministic? Was that
you, Robert? :-)

--Chuck


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