This is the mail archive of the
mailing list for the GDB project.
Re: [RFA/RFC] try ignoring bad PLT entries in ELF symbol tables
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 1 Dec 2011 15:13:57 -0800
- Subject: Re: [RFA/RFC] try ignoring bad PLT entries in ELF symbol tables
- References: <email@example.com>
On Tue, Oct 18, 2011 at 05:23:37PM -0700, Joel Brobecker wrote:
> * 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:
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)
> + /* 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