[binutils-gdb/binutils-2_36-branch] Backport patch to fix a quadratic slow down in the BFD library.
Nick Clifton
nickc@sourceware.org
Fri Jul 9 15:55:45 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=84fd26d8209e99fc3a432dd0b09b6c053de1ce65
commit 84fd26d8209e99fc3a432dd0b09b6c053de1ce65
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Jul 9 16:54:59 2021 +0100
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:
---
bfd/ChangeLog | 10 ++++++++++
bfd/elf.c | 5 +++++
2 files changed, 15 insertions(+)
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 <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:
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)
More information about the Binutils-cvs
mailing list