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.
This commit is contained in:
Nick Clifton
2009-09-09 15:03:54 +00:00
parent ad86f1fb4d
commit cfcac11dc8
5 changed files with 130 additions and 31 deletions

View File

@ -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