* elf.c (bfd_section_from_shdr): Treat invalid reloc sections as
authorAlan Modra <amodra@gmail.com>
Tue, 27 Dec 2005 03:45:30 +0000 (03:45 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 27 Dec 2005 03:45:30 +0000 (03:45 +0000)
normal sections rather than returning false.

bfd/ChangeLog
bfd/elf.c

index 97db8cd0879e5594175290e8ded2e25ce67b26d2..fc1390125a6392863fe5f0c97670282bc8eb9e88 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-27  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf.c (bfd_section_from_shdr): Treat invalid reloc sections as
+       normal sections rather than returning false.
+
 2005-12-27  Alan Modra  <amodra@bigpond.net.au>
 
        * coff-h8300.c (h8300_reloc16_extra_cases): Use input section
index 019f72a030e571445a5cf79135be315a0c5f6d60..ff433d35068939aadbedfb3bcbcf5dbb94b81a42 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2045,15 +2045,16 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
           represent such a section, so at least for now, we don't
           try.  We just present it as a normal section.  We also
           can't use it as a reloc section if it points to the null
-          section.  */
-       if (hdr->sh_link != elf_onesymtab (abfd) || hdr->sh_info == SHN_UNDEF)
+          section, an invalid section, or another reloc section.  */
+       if (hdr->sh_link != elf_onesymtab (abfd)
+           || hdr->sh_info == SHN_UNDEF
+           || (hdr->sh_info >= SHN_LORESERVE && hdr->sh_info <= SHN_HIRESERVE)
+           || hdr->sh_info >= num_sec
+           || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL
+           || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA)
          return _bfd_elf_make_section_from_shdr (abfd, hdr, name,
                                                  shindex);
 
-       /* Prevent endless recursion on broken objects.  */
-       if (elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL
-           || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA)
-         return FALSE;
        if (! bfd_section_from_shdr (abfd, hdr->sh_info))
          return FALSE;
        target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info);
This page took 0.034284 seconds and 4 git commands to generate.