]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Backport patch to fix a quadratic slow down in the BFD library.
authorNick Clifton <nickc@redhat.com>
Fri, 9 Jul 2021 15:54:59 +0000 (16:54 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 9 Jul 2021 15:54:59 +0000 (16:54 +0100)
PR 28058
bfd * elf.c (bfd_section_from_shdr): Set has_secondary_relocs flag.
(_bfd_elf_slurp_secondary_reloc_section): Use it for early-out.

bfd/ChangeLog
bfd/elf.c

index cd6f3706fe2f1ab499eedf1b18970960ba8518cb..0b035fbc3aea227984c2729607c3bbe4db0245d3 100644 (file)
@@ -1,3 +1,13 @@
+2021-07-09  Nick Clifton  <nickc@redhat.com>
+
+       Backport from mainline:
+
+       2021-06-08  Michael Matz  <matz@suse.de>
+
+       PR 28058
+       * elf.c (bfd_section_from_shdr): Set has_secondary_relocs flag.
+       (_bfd_elf_slurp_secondary_reloc_section): Use it for early-out.
+
 2021-07-09  Nick Clifton  <nickc@redhat.com>
 
        Backport this patch from the mainline:
index 36733e080dd9d9be28b576b246aaf5bd8c8569c7..af62aadc3d446cd5b1f0201b207c90c22e7809b1 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2454,6 +2454,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
                     "for section %pA found - ignoring"),
                   abfd, name, target_sect);
              }
+           else
+             esdt->has_secondary_relocs = TRUE;
            goto success;
          }
 
@@ -12587,6 +12589,9 @@ _bfd_elf_slurp_secondary_reloc_section (bfd *       abfd,
 #endif
     r_sym = elf32_r_sym;
   
+  if (!elf_section_data (sec)->has_secondary_relocs)
+    return TRUE;
+
   /* Discover if there are any secondary reloc sections
      associated with SEC.  */
   for (relsec = abfd->sections; relsec != NULL; relsec = relsec->next)