From: Nick Clifton Date: Fri, 9 Jul 2021 15:54:59 +0000 (+0100) Subject: Backport patch to fix a quadratic slow down in the BFD library. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=84fd26d8209e99fc3a432dd0b09b6c053de1ce65;p=thirdparty%2Fbinutils-gdb.git Backport patch to fix a quadratic slow down in the BFD library. 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cd6f3706fe2..0b035fbc3ae 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2021-07-09 Nick Clifton + + Backport from mainline: + + 2021-06-08 Michael Matz + + 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 Backport this patch from the mainline: diff --git a/bfd/elf.c b/bfd/elf.c index 36733e080dd..af62aadc3d4 100644 --- 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)