aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfcode.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2006-04-18 09:41:36 +0000
committerNick Clifton <nickc@redhat.com>2006-04-18 09:41:36 +0000
commit0b49d371230ed1a85925a509755c87a750e0447c (patch)
tree3e68e4aad2473befcc3a92cd6d8f3965b3152633 /bfd/elfcode.h
parent0275de4ee1b6996c19d19704fc3fe3b19d26e64f (diff)
downloadgdb-0b49d371230ed1a85925a509755c87a750e0447c.zip
gdb-0b49d371230ed1a85925a509755c87a750e0447c.tar.gz
gdb-0b49d371230ed1a85925a509755c87a750e0447c.tar.bz2
PR 2257
* elfcode.h (elf_object_p): Allow files with corrupt e_shstrndx fields to still be handled as ELF files. * readelf.c (SECTION_NAME): Cope with a missing string table. (process_file_header): Cope with a corrupt e_shstrndx field. (process_section_headers): Correctly handle an e_shstrndx value of SHF_UNDEF.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r--bfd/elfcode.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index f7f85ba..9bb66e1 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -742,9 +742,18 @@ elf_object_p (bfd *abfd)
if (i_ehdrp->e_shstrndx >= elf_numsections (abfd)
|| (i_ehdrp->e_shstrndx >= SHN_LORESERVE
&& i_ehdrp->e_shstrndx <= SHN_HIRESERVE))
- goto got_wrong_format_error;
+ {
+ /* PR 2257:
+ We used to just goto got_wrong_format_error here
+ but there are binaries in existance for which this test
+ will prevent the binutils from working with them at all.
+ So we are kind, and reset the string index value to 0
+ so that at least some processing can be done. */
+ i_ehdrp->e_shstrndx = SHN_UNDEF;
+ _bfd_error_handler (_("warning: %s has a corrupt string table index - ignoring"), abfd->filename);
+ }
}
- else if (i_ehdrp->e_shstrndx != 0)
+ else if (i_ehdrp->e_shstrndx != SHN_UNDEF)
goto got_wrong_format_error;
/* Read in the program headers. */