This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/RFC] try ignoring bad PLT entries in ELF symbol tables


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]