public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Charles Wilson <cwilson@ece.gatech.edu>
To: DJ Delorie <dj@delorie.com>
Cc: binutils@sources.redhat.com, cygwin@cygwin.com
Subject: Re: [aida_s@mx12.freecom.ne.jp: A serious bug of "ld --enable-auto-import"]
Date: Sat, 25 Aug 2001 22:47:00 -0000	[thread overview]
Message-ID: <3B888D76.6090102@ece.gatech.edu> (raw)
In-Reply-To: <200108260530.BAA28221@envy.delorie.com>

DJ Delorie wrote:

>>pe_find_data_imports:_hwstr1
>>->__head_cyghwstr_dll
>>arelent: _hwstr1@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

  reply	other threads:[~2001-08-25 22:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-25 22:11 Charles S. Wilson
2001-08-25 22:30 ` DJ Delorie
2001-08-25 22:47   ` Charles Wilson [this message]
2001-08-25 23:14     ` DJ Delorie
2001-08-26  8:10       ` Charles Wilson
2001-08-26  8:43         ` DJ Delorie
2001-08-26  9:04           ` Charles Wilson
2001-08-26  9:43             ` DJ Delorie
2001-08-26 15:35               ` Charles Wilson
2001-08-26 12:27             ` Kurt Roeckx
  -- strict thread matches above, loose matches on Subject: below --
2001-08-25 10:50 Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B888D76.6090102@ece.gatech.edu \
    --to=cwilson@ece.gatech.edu \
    --cc=binutils@sources.redhat.com \
    --cc=cygwin@cygwin.com \
    --cc=dj@delorie.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).