aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-11-05 10:14:57 -0800
committerH.J. Lu <hjl.tools@gmail.com>2017-11-26 09:38:09 -0800
commit0860f6373e0df2b8dcece04dd874f95c3f09e3df (patch)
treebefaa35eef79309344391470ce2ecbe28449d50c /binutils
parent8e2495f2f75120baae14f9dac9d29b043c539b2b (diff)
downloadgdb-users/hjl/pr12639.zip
gdb-users/hjl/pr12639.tar.gz
gdb-users/hjl/pr12639.tar.bz2
Check corrupted symbol tableusers/hjl/pr12639
bfd/ PR binutils/12639 * elfcode.h (elf_slurp_symbol_table): Check corrupted global symbols. binutils/ PR binutils/12639 * readelf.c (process_symbol_table): Detect corrupted symbol table.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/readelf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 739367d..a9972dc 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -11571,6 +11571,12 @@ process_symbol_table (Filedata * filedata)
&& filedata->section_headers != NULL)
{
unsigned int i;
+ /* Irix 5 and 6 are broken. Object file symbol tables are not
+ always sorted correctly such that local symbols precede global
+ symbols, and the sh_info field in the symbol table is not
+ always right. */
+ bfd_boolean check_corrupt_symtab
+ = filedata->file_header.e_ident[EI_OSABI] != ELFOSABI_IRIX;
for (i = 0, section = filedata->section_headers;
i < filedata->file_header.e_shnum;
@@ -11640,7 +11646,12 @@ process_symbol_table (Filedata * filedata)
putchar (' ');
print_vma (psym->st_size, DEC_5);
printf (" %-7s", get_symbol_type (filedata, ELF_ST_TYPE (psym->st_info)));
- printf (" %-6s", get_symbol_binding (filedata, ELF_ST_BIND (psym->st_info)));
+ if (check_corrupt_symtab
+ && si < section->sh_info
+ && ELF_ST_BIND (psym->st_info) != STB_LOCAL)
+ printf (" %-6s", "<corrupt>");
+ else
+ printf (" %-6s", get_symbol_binding (filedata, ELF_ST_BIND (psym->st_info)));
if (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
printf (" %-7s", get_solaris_symbol_visibility (psym->st_other));
else