Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFA/RFC] try ignoring bad PLT entries in ELF symbol tables
Date: Thu, 01 Dec 2011 23:14:00 -0000	[thread overview]
Message-ID: <20111201231357.GC2777@adacore.com> (raw)
In-Reply-To: <1318983817-29454-1-git-send-email-brobecker@adacore.com>

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


  parent reply	other threads:[~2011-12-01 23:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19  0:30 Joel Brobecker
2011-10-20 20:00 ` Jan Kratochvil
2011-10-21 17:40   ` Joel Brobecker
2011-10-21 17:56     ` Jan Kratochvil
2011-12-01 23:14 ` Joel Brobecker [this message]
2011-12-19  4:59 ` Joel Brobecker

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=20111201231357.GC2777@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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