From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27540 invoked by alias); 20 Sep 2006 05:20:19 -0000 Received: (qmail 27526 invoked by uid 22791); 20 Sep 2006 05:20:18 -0000 X-Spam-Check-By: sourceware.org Received: from smtp107.sbc.mail.mud.yahoo.com (HELO smtp107.sbc.mail.mud.yahoo.com) (68.142.198.206) by sourceware.org (qpsmtpd/0.31) with SMTP; Wed, 20 Sep 2006 05:20:13 +0000 Received: (qmail 64723 invoked from network); 20 Sep 2006 05:20:11 -0000 Received: from unknown (HELO lucon.org) (hjjean@sbcglobal.net@71.146.100.252 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; 20 Sep 2006 05:20:11 -0000 Received: by lucon.org (Postfix, from userid 500) id 60055105B5; Tue, 19 Sep 2006 22:20:10 -0700 (PDT) Date: Wed, 20 Sep 2006 11:40:00 -0000 From: "H. J. Lu" To: binutils@sources.redhat.com Subject: Re: PATCH: PR ld/3191: Linker failed to handle DW_FORM_ref_addr properly Message-ID: <20060920052010.GA22345@lucon.org> References: <20060920043701.GA24160@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060920043701.GA24160@lucon.org> User-Agent: Mutt/1.4.2.1i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00190.txt.bz2 On Tue, Sep 19, 2006 at 09:37:02PM -0700, H. J. Lu wrote: > DW_FORM_ref_addr is offset_size according to DWARF3 and gcc follows > DWARF3. This patch fixes > > http://sourceware.org/bugzilla/show_bug.cgi?id=3191 > > > H.J. > -- > 2006-09-19 H.J. Lu > > PR ld/3191 > * dwarf2.c (read_attribute_value): Properly handle > DW_FORM_ref_addr. > > --- bfd/dwarf2.c.ref_addr 2006-05-02 03:01:56.000000000 -0700 > +++ bfd/dwarf2.c 2006-09-19 21:26:37.000000000 -0700 > @@ -562,11 +562,16 @@ read_attribute_value (struct attribute * > switch (form) > { > case DW_FORM_addr: > - /* FIXME: DWARF3 draft says DW_FORM_ref_addr is offset_size. */ > - case DW_FORM_ref_addr: > attr->u.val = read_address (unit, info_ptr); > info_ptr += unit->addr_size; > break; > + case DW_FORM_ref_addr: > + if (unit->offset_size == 4) > + attr->u.val = read_4_bytes (abfd, info_ptr); > + else > + attr->u.val = read_8_bytes (abfd, info_ptr); > + info_ptr += unit->offset_size; > + break; > case DW_FORM_block2: > amt = sizeof (struct dwarf_block); > blk = bfd_alloc (abfd, amt); We should only do it for DWARF3. But gcc generates DWARF3 info in a DWARF2 file. H.J.