diff options
author | Nick Clifton <nickc@redhat.com> | 2009-03-13 11:34:43 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-03-13 11:34:43 +0000 |
commit | ce98a316e9018523f263417f3948fed63a1ba1db (patch) | |
tree | 328e6f758f98e96ba4d3df6b1434c3d082ca98f2 /bfd/elf-bfd.h | |
parent | f7c60c5e2b07932c2b73b687083b254cbe0dd5de (diff) | |
download | gdb-ce98a316e9018523f263417f3948fed63a1ba1db.zip gdb-ce98a316e9018523f263417f3948fed63a1ba1db.tar.gz gdb-ce98a316e9018523f263417f3948fed63a1ba1db.tar.bz2 |
PR 9934
* elf-bfd.h (NUM_SHDR_ENTRIES): Cope with an empty section.
* elflink.c (elf_link_read_relocs_from_section): Use
NUM_SHDR_ENTRIES. Gracefully handle the case where there are
relocs but no symbol table.
* elf32-arm.c (elf32_arm_check_relocs): Likewise.
Diffstat (limited to 'bfd/elf-bfd.h')
-rw-r--r-- | bfd/elf-bfd.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 7b8fa69..865388c 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -31,8 +31,11 @@ /* The number of entries in a section is its size divided by the size of a single entry. This is normally only applicable to reloc and - symbol table sections. */ -#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize) + symbol table sections. + PR 9934: It is possible to have relocations that do not refer to + symbols, thus it is also possible to have a relocation section in + an object file, but no symbol table. */ +#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_entsize > 0 ? (shdr)->sh_size / (shdr)->sh_entsize : 0) /* If size isn't specified as 64 or 32, NAME macro should fail. */ #ifndef NAME |