diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-09-04 12:35:33 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-09-04 12:35:33 +0000 |
commit | 636392c0fed8a268c3cbb59003b255dc5462d0af (patch) | |
tree | 1b29ed890f286429359fef990a457a61831dcc56 | |
parent | fe93d6d74513d8ac898a069380f377a2c2a0f8a6 (diff) | |
download | gdb-636392c0fed8a268c3cbb59003b255dc5462d0af.tar.gz |
Ignore section symbols without a BFD section
bfd/
PR binutils/14493
* elf.c (ignore_section_sym): Also ignore section symbols without
a BFD section.
binutils/
PR binutils/14493
* readelf.c (get_symbol_index_type): Check bad section index.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf.c | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 189d52d1a65..a7165020e43 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2012-09-04 H.J. Lu <hongjiu.lu@intel.com> + + PR binutils/14493 + * elf.c (ignore_section_sym): Also ignore section symbols without + a BFD section. + 2012-09-03 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * elf32-s390.c (elf_s390_relocate_section): Handle PLTOFF for diff --git a/bfd/elf.c b/bfd/elf.c index 0208e05ec1f..b4043b12928 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -3264,13 +3264,21 @@ sym_is_global (bfd *abfd, asymbol *sym) } /* Don't output section symbols for sections that are not going to be - output, or that are duplicates. */ + output, that are duplicates or there is no BFD section. */ static bfd_boolean ignore_section_sym (bfd *abfd, asymbol *sym) { - return ((sym->flags & BSF_SECTION_SYM) != 0 - && !(sym->section->owner == abfd + elf_symbol_type *type_ptr; + + if ((sym->flags & BSF_SECTION_SYM) == 0) + return FALSE; + + type_ptr = elf_symbol_from (abfd, sym); + return ((type_ptr != NULL + && type_ptr->internal_elf_sym.st_shndx != 0 + && bfd_is_abs_section (sym->section)) + || !(sym->section->owner == abfd || (sym->section->output_section->owner == abfd && sym->section->output_offset == 0) || bfd_is_abs_section (sym->section))); |