Merge pull request #129900 from nh2/binutils-patch-strip-performance-regression

binutils: Patch `strip` performance regression
This commit is contained in:
Sandro 2021-07-14 03:38:06 +02:00 committed by GitHub
commit e929db9629
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,26 @@
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff_plain;f=bfd%2Felf.c;h=af62aadc3d446cd5b1f0201b207c90c22e7809b1;hp=36733e080dd9d9be28b576b246aaf5bd8c8569c7;hb=84fd26d8209e99fc3a432dd0b09b6c053de1ce65;hpb=abe2a28aaa7a2bfd0f3061c72a98eb898976b721
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)

View file

@ -61,6 +61,15 @@ stdenv.mkDerivation {
# cross-compiling.
./always-search-rpath.patch
# Fix quadratic slowdown in `strip` performance.
# See #129467 and https://sourceware.org/bugzilla/show_bug.cgi?id=28058
# Remove when we're on binutils > 2.36.1.
# The patch is downloaded from
# https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff_plain;f=bfd/elf.c;h=af62aadc3d446cd5b1f0201b207c90c22e7809b1;hp=36733e080dd9d9be28b576b246aaf5bd8c8569c7;hb=84fd26d8209e99fc3a432dd0b09b6c053de1ce65;hpb=abe2a28aaa7a2bfd0f3061c72a98eb898976b721
# which is the 2.36 backport (using `TRUE` instead of `true` of binutils master commit:
# https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=956ea65cd707707c0f725930214cbc781367a831
./bfd-elf-Dont-read-non-existing-secondary-relocs.patch
./CVE-2020-35448.patch
] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch
++ # This patch was suggested by Nick Clifton to fix