Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Sun, 26 Aug 2001 02:13:56 -0400 Message-Id: <200108260613.CAA28557@envy.delorie.com> X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f From: DJ Delorie To: cwilson AT ece DOT gatech DOT edu CC: binutils AT sources DOT redhat DOT com, cygwin AT cygwin DOT com In-reply-to: <3B888D76.6090102@ece.gatech.edu> (message from Charles Wilson on Sun, 26 Aug 2001 01:47:34 -0400) 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> <3B888D76 DOT 6090102 AT ece DOT gatech DOT edu> > 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. Ok, a couple of things: In make_import_fixup in ld/emultempl/pe.em, it uses rel->addend without also checking for the inline offset. For formats that use an inline addend, rel->addend may be zero. Addends are very tricky in PE. There's lots of comments about adding, subtracting, adding, subtracting, etc, in various places in the code. I don't think an import library *can* specify an offset to be added at runtime. From my understanding of the dll import/export system, windows simply places the address of the thing being imported in the location indicated. -- 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/