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/elf.c | |
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/elf.c')
-rw-r--r-- | bfd/elf.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -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; |