delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/07/07/02:09:54

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <396574C7.924FADB6@ece.gatech.edu>
Date: Fri, 07 Jul 2000 02:12:23 -0400
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
To: DJ Delorie <dj AT delorie DOT com>
CC: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: binutils-20000625 ld.exe --shared broken
References: <396547F2 DOT 333FBD51 AT ece DOT gatech DOT edu> <200007070300 DOT XAA08402 AT envy DOT delorie DOT com>

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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019