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: binutils-20000625 ld.exe --shared broken


DJ Delorie wrote:
> 
> Try searching for BFD_IN_MEMORY.  It's notoriously buggy, and used to
> build the import libraries.

I'm not sure, but I think I've *located* the problem, but not solved it:

Here's the stack trace:

#0  _bfd_write_archive_contents (arch=0xa17f970) at archive.c:1689
#1  0xa04d830 in ?? ()
#2  0x434c9d in bfd_close (abfd=0xa17f970) at opncls.c:413
#3  0x42bce4 in pe_dll_generate_implib (def=0xa04c010,
impfilename=0xa042190 "libz.dll.a") at pe-dll.c:1606
#4  0x424f51 in gld_i386pe_finish () at ei386pe.c:1093
#5  0x41f19c in ldemul_finish () at ldemul.c:91
#6  0x4172f8 in lang_process () at ldlang.c:4122
#7  0x41a334 in main (argc=32, argv=0xa041b90) at ./ldmain.c:346
#8  0x61002385 in _size_of_stack_reserve__ ()
#9  0x610027d5 in _size_of_stack_reserve__ ()
#10 0x4771c7 in cygwin_crt0 (f=0x419ccc <main>) at
/cygnus/netrel/src/cygwin-1.1.2/winsup/cygwin/libccrt0.cc:84

Basically, when pe_dll_generate_implib is ready to write the implib to
disk, it calls bfd_close on the implib bfd pointer. This in turn calls 
"BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))" (e.g.
_bfd_write_archive_contents). 

_bfd_write_archive_contents cycles through the bfd's of the members of
the implib. One the very first one ('archive_head')

(bfd/archive.c)
        1685      for (current = arch->archive_head; current; current =
current->next)
 	1686	    {
	1687	      if (bfd_write_p (current))
 	1688		{
-	1689		  bfd_set_error (bfd_error_invalid_operation);
-	1690		  return false;
 	1691            }

The clause in 1687 is triggered. Now, bfd_write_p(current) is #defined
so that it expands to 

((current)->direction == write_direction || (current)->direction ==
both_direction))

Checking 'current->direction' in the watch window shows that it is,
indeed, equal to 'write_direction'.

And so it dies.

However, it seems to me that the members of the output archive SHOULD be
writeable. Basically, I can't tell if current->direction is set
incorrectly, or if the test in line 1687 of archive.c is incorrect (or
even necessary).

Any ideas?

--Chuck

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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