diff options
author | Nick Clifton <nickc@redhat.com> | 2021-07-09 16:54:59 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-07-09 16:54:59 +0100 |
commit | 84fd26d8209e99fc3a432dd0b09b6c053de1ce65 (patch) | |
tree | 916235bf7eff727cba653bc6daa4324a06151972 | |
parent | abe2a28aaa7a2bfd0f3061c72a98eb898976b721 (diff) | |
download | gdb-84fd26d8209e99fc3a432dd0b09b6c053de1ce65.zip gdb-84fd26d8209e99fc3a432dd0b09b6c053de1ce65.tar.gz gdb-84fd26d8209e99fc3a432dd0b09b6c053de1ce65.tar.bz2 |
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.
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/elf.c | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cd6f370..0b035fb 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,15 @@ 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: 2021-03-02 Nick Clifton <nickc@redhat.com> @@ -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) |