summaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2011-12-19 04:36:20 +0000
committerJoel Brobecker <brobecker@gnat.com>2011-12-19 04:36:20 +0000
commit12d5fca175219f6eaf19d2d4a70795a8cc7407c1 (patch)
tree585f4988d5979893f2feaedb190f20f39a275840 /gdb/elfread.c
parentf80241eeca80e9fa48a59b5027634ea6de8d8c4e (diff)
downloadgdb-12d5fca175219f6eaf19d2d4a70795a8cc7407c1.tar.gz
try ignoring bad PLT entries in ELF symbol tables
Comment says it all: /* 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. */ 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.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 067c77f26dc..fd65ecf9159 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