Stop the BFD library from failing when encountering a second set of relocs for the...
authorNick Clifton <nickc@redhat.com>
Fri, 23 Aug 2019 12:22:02 +0000 (13:22 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 23 Aug 2019 12:22:02 +0000 (13:22 +0100)
PR 24456
* elf.c (bfd_section_from_shdr): Issue an informative warning
message and continue processing other sections after encountering
a reloc section for a section which already has other relocs
associated with it.

bfd/ChangeLog
bfd/elf.c

index b39acb19b21856d92017619b8a24865913b9c1cc..00afa81398d28ffe6253257b4a221d21e8ba177e 100644 (file)
@@ -1,3 +1,11 @@
+2019-08-23  Nick Clifton  <nickc@redhat.com>
+
+       PR 24456
+       * elf.c (bfd_section_from_shdr): Issue an informative warning
+       message and continue processing other sections after encountering
+       a reloc section for a section which already has other relocs
+       associated with it.
+
 2019-08-23  Alan Modra  <amodra@gmail.com>
 
        PR 24933
index 42ae1627ba7c412add0772f7657db6120433494c..5a061c91107024753e5da46dbd8a9cc440223365 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2466,9 +2466,18 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
        else
          p_hdr = &esdt->rel.hdr;
 
-       /* PR 17512: file: 0b4f81b7.  */
+       /* PR 17512: file: 0b4f81b7.
+          Also see PR 24456, for a file which deliberately has two reloc
+          sections.  */
        if (*p_hdr != NULL)
-         goto fail;
+         {
+           _bfd_error_handler
+             /* xgettext:c-format */
+             (_("%pB: warning: multiple relocation sections for section %pA \
+found - ignoring all but the first"),
+              abfd, target_sect);
+           goto success;
+         }
        hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, sizeof (*hdr2));
        if (hdr2 == NULL)
          goto fail;
This page took 0.029014 seconds and 4 git commands to generate.