diff options
author | Nick Clifton <nickc@redhat.com> | 2009-09-09 15:03:54 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-09-09 15:03:54 +0000 |
commit | cfcac11dc826f830a5ca9a7265ad5e2ecd14e92f (patch) | |
tree | 61359fd7d4d1adacb8558d014145b96165b70922 /bfd | |
parent | ad86f1fb4da4f0b049bfd5f9fb05dcd52124ad33 (diff) | |
download | gdb-cfcac11dc826f830a5ca9a7265ad5e2ecd14e92f.zip gdb-cfcac11dc826f830a5ca9a7265ad5e2ecd14e92f.tar.gz gdb-cfcac11dc826f830a5ca9a7265ad5e2ecd14e92f.tar.bz2 |
PR 10478:
* elf.c (bfd_section_from_shdr): Do not reject sparc binaries with
section headers containing sh_link values of SHN_BEFORE or
SHN_AFTER.
* elfcode.h (elf_object_p): Likewise.
readelf.c (get_elf_section_flags): Add support for SHF_EXCLUDE and
SHF_ORDERED.
(process_section_headers): Warn about out of range sh_link
values. When displaying detailed section header information
annote the SHN_BEFORE and SHN_AFTER values.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elf.c | 20 | ||||
-rw-r--r-- | bfd/elfcode.h | 18 |
3 files changed, 42 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 39ee6fd..82a663b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2009-09-09 Nick Clifton <nickc@redhat.com> + + PR 10478: + * elf.c (bfd_section_from_shdr): Do not reject sparc binaries with + section headers containing sh_link values of SHN_BEFORE or + SHN_AFTER. + * elfcode.h (elf_object_p): Likewise. + 2009-09-09 Tristan Gingold <gingold@adacore.com> Handle DYLD_INFO introduced by Darwin10. @@ -12,7 +20,6 @@ (bfd_mach_o_load_command_name): AddB FD_MACH_O_LC_DYLD_INFO. (bfd_mach_o_print_dyld_info): New function. - 2009-09-09 M R Swami Reddy <MR.Swami.Reddy@nsc.com> * elf32-cr16.c (elf32_cr16_relocate_section): Add code to discard the @@ -1514,10 +1514,24 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) case SHT_DYNAMIC: /* Dynamic linking information. */ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; - if (hdr->sh_link > elf_numsections (abfd) - || elf_elfsections (abfd)[hdr->sh_link] == NULL) + if (hdr->sh_link > elf_numsections (abfd)) + { + /* PR 10478: Accept sparc binaries with a sh_link + field set to SHN_BEFORE or SHN_AFTER. */ + switch (bfd_get_arch (abfd)) + { + case bfd_arch_sparc: + if (hdr->sh_link == (SHN_LORESERVE & 0xffff) /* SHN_BEFORE */ + || hdr->sh_link == ((SHN_LORESERVE + 1) & 0xffff) /* SHN_AFTER */) + break; + /* Otherwise fall through. */ + default: + return FALSE; + } + } + else if (elf_elfsections (abfd)[hdr->sh_link] == NULL) return FALSE; - if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB) + else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB) { Elf_Internal_Shdr *dynsymhdr; diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 10aa131..889d25a 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -760,7 +760,23 @@ elf_object_p (bfd *abfd) /* Sanity check sh_link and sh_info. */ if (i_shdrp[shindex].sh_link >= num_sec) - goto got_wrong_format_error; + { + /* PR 10478: Accept sparc binaries with a sh_link + field set to SHN_BEFORE or SHN_AFTER. */ + switch (ebd->elf_machine_code) + { + case EM_OLD_SPARCV9: + case EM_SPARC32PLUS: + case EM_SPARCV9: + case EM_SPARC: + if (i_shdrp[shindex].sh_link == (SHN_LORESERVE & 0xffff) /* SHN_BEFORE */ + || i_shdrp[shindex].sh_link == ((SHN_LORESERVE + 1) & 0xffff) /* SHN_AFTER */) + break; + /* Otherwise fall through. */ + default: + goto got_wrong_format_error; + } + } if (((i_shdrp[shindex].sh_flags & SHF_INFO_LINK) || i_shdrp[shindex].sh_type == SHT_RELA |