This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: under cygwin, zsh cannot run when built against ncurses9-5.7-13


Christopher Faylor wrote:

> Your reading of the Makefile is not right.  libc.a and libm.a from
> newlib do get used in creating cygwin1.dll (obviously?).  There are
> different libc.a, libm.a, libpthread.a, libutil.a, libdl.a, and
> libresolv.a libraries which are all produced intentionally and have
> nothing to do with the creation of the dll itself.
> 
> The initial discussion of the reason for these libraries started here:
> 
> http://cygwin.com/ml/cygwin/2001-12/msg00705.html

  Ah, gottit.  The bug happens because the libraries are not quite correctly
constructed.  When you add -lm to the link line, you see this in the map file,
in the imports section:

/usr/lib/gcc/i686-pc-cygwin/4.3.2/libgcc_s.dll.a(d000104.o)

/usr/lib/gcc/i686-pc-cygwin/4.3.2/libgcc_s.dll.a(d000000.o) (cyggcc_s_1_dll_iname)
/usr/lib/libm.a(d001286.o)    math.o (pow)
/usr/lib/libm.a(d000000.o)    /usr/lib/libm.a(d001286.o) (_head_libm)
/usr/lib/libcygwin.a(dll_entry.o)
                              (_cygwin_dll_entry@12)

  There's no import name chunk for libm (_libm_dll_iname), instead the head
chunk of the import table in libm.a refers to _cygwin1_dll_iname:

DKAdmin@ubik /usr/src/zsh2/zsh-4.3.9/.build/Src/libm
$ nm ./d000000.o
00000000 i .idata$2
00000000 i .idata$4
00000000 i .idata$5
00000000 I __head_libm
         U _cygwin1_dll_iname

which means at link time it is resolved by the definition of that symbol
supplied by libcygwin.a and so the tail chunk from libm is not pulled in to
correctly 'cap off' the end of the import table.  Then all the name entries
and IAT table pointers get out of sync and we get confused and overlapping
import name tables.  Constructing import tables is tricky, and we can't
optimise away or share any of the .idata$x blocks.

  There are a number of ways to solve this, either by changing the undefined
symbol in the head and tail archive members, or maybe by using dlltool or ld
to generate a fresh import library rather than munging an existing one, but
I'm going AFK now to get a few hours sleep.

    cheers,
      DaveK



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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