From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6366 invoked by alias); 1 Dec 2011 23:14:17 -0000 Received: (qmail 6358 invoked by uid 22791); 1 Dec 2011 23:14:16 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_BJ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Dec 2011 23:14:00 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id AD9AE2BC0F0 for ; Thu, 1 Dec 2011 18:13:59 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ib1eacftViui for ; Thu, 1 Dec 2011 18:13:59 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 800F12BC0ED for ; Thu, 1 Dec 2011 18:13:59 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 6D39D145615; Thu, 1 Dec 2011 15:13:57 -0800 (PST) Date: Thu, 01 Dec 2011 23:14:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [RFA/RFC] try ignoring bad PLT entries in ELF symbol tables Message-ID: <20111201231357.GC2777@adacore.com> References: <1318983817-29454-1-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1318983817-29454-1-git-send-email-brobecker@adacore.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00026.txt.bz2 On Tue, Oct 18, 2011 at 05:23:37PM -0700, Joel Brobecker wrote: > gdb/ChangeLog: > > * elfread.c (elf_symtab_read): Ignore undefined symbols with > nonzero addresses if they do not correspond to a .plt section > when one is available in the objfile. No real comment on this except from Jan. I think the bottom line is that we're not really sure it might not have any unwanted side-effect. But on the other hand, we've had it in AdaCore's tree for a while now, with no visible side-effect, while it does catch a real problem. URL for the discussion: http://www.sourceware.org/ml/gdb-patches/2011-10/msg00517.html I suggest we check it in after the 7.4 branch is created. > diff --git a/gdb/elfread.c b/gdb/elfread.c > index a309a2c..866226d 100644 > --- a/gdb/elfread.c > +++ b/gdb/elfread.c > @@ -303,6 +303,23 @@ elf_symtab_read (struct objfile *objfile, int type, > if (!sect) > continue; > > + /* On ia64-hpux, we have discovered that the system linker > + adds undefined symbols with nonzero addresses that cannot > + be right (their address points inside the code of another > + function in the .text section). This creates problems > + when trying to determine which symbol corresponds to > + a given address. > + > + We try to detect those buggy symbols by checking which > + section we think they correspond to. Normally, PLT symbols > + are stored inside their own section, and the typical name > + for that section is ".plt". So, if there is a ".plt" > + section, and yet the section name of our symbol does not > + start with ".plt", we ignore that symbol. */ > + if (strncmp (sect->name, ".plt", 4) != 0 > + && bfd_get_section_by_name (abfd, ".plt") != NULL) > + continue; > + > symaddr += ANOFFSET (objfile->section_offsets, sect->index); > > msym = record_minimal_symbol -- Joel