delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/08/26/01:48:06

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://sources.redhat.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://sources.redhat.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: <3B888D76.6090102@ece.gatech.edu>
Date: Sun, 26 Aug 2001 01:47:34 -0400
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010713
X-Accept-Language: en-us
MIME-Version: 1.0
To: DJ Delorie <dj AT delorie DOT com>
CC: binutils AT sources DOT redhat DOT com, cygwin AT cygwin DOT com
Subject: Re: [aida_s AT mx12 DOT freecom DOT ne DOT jp: A serious bug of "ld --enable-auto-import"]
References: <3B8884F6 DOT 80708 AT ece DOT gatech DOT edu> <200108260530 DOT BAA28221 AT envy DOT delorie DOT com>

DJ Delorie wrote:

>>pe_find_data_imports:_hwstr1
>>->__head_cyghwstr_dll
>>arelent: _hwstr1 AT 0xd: add=0  <<<< this should be "add=12", right?
>>
> 
> Not always.  Sometimes the addend is in the relent, and sometimes the
> addend is in the data stream.  It depends on the target format.
> 


Well, in *this* case we're talking about pe-386....

> 
>>Unfortunately, that's as far as I can go.  I don't know where the 
>>arelent structure gets filled with the approprate data from the .o, so I 
>>can't track down WHY the "12" isn't going into (arelent)->addend.
>>
> 
> Gas puts it there.  Probably in src/gas/config/tc-i386.c's
> tc_gen_reloc, but other places convert it from a bfd reloc to an
> i386-specific reloc.


Hmm...but the original bug report said (and I verified) that it works 
fine if you add the appropriate __declspec(dll??port) modifiers. 
Somehow, this is tied to the autoimport additions -- but none of that 
touched gas.

Anyway, I'm confused.  The .o file already contains the "12" (actually, 
0c 00 00 00 in on-disk byte order), so gas has already done its work -- 
properly.  The problem occurs during the linking step -- ld is ignoring 
the offset stored within the opcode and is blindly stuffing in the 
relocation address without adding the offset.

That doesn't involve gas at all, does it?--gas is done, at this point. 
As *ld* runs, it has to fill arelent structures in order to actually 
*perform* the relocation, right?  *That's* the part that is not 
happening correctly.

--Chuck


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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