From c3cd6c8351f26092fe529b9665737ac746de6bd2 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 7 Nov 2023 10:53:32 +0000 Subject: [PATCH] Fix merging strings when linking really big programs. --- binutils-big-merge.patch | 29 +++++++++++++++++++++++++++++ binutils.spec | 9 ++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 binutils-big-merge.patch diff --git a/binutils-big-merge.patch b/binutils-big-merge.patch new file mode 100644 index 0000000..b177a3e --- /dev/null +++ b/binutils-big-merge.patch @@ -0,0 +1,29 @@ +--- binutils.orig/bfd/merge.c 2023-11-07 09:49:56.923358543 +0000 ++++ binutils-2.41/bfd/merge.c 2023-11-07 09:51:47.031552039 +0000 +@@ -167,7 +167,7 @@ static bool + sec_merge_maybe_resize (struct sec_merge_hash *table, unsigned added) + { + struct bfd_hash_table *bfdtab = &table->table; +- if (bfdtab->count + added > table->nbuckets * 2 / 3) ++ if (bfdtab->count + added > table->nbuckets / 3 * 2) + { + unsigned i; + unsigned long newnb = table->nbuckets * 2; +@@ -175,7 +175,7 @@ sec_merge_maybe_resize (struct sec_merge + uint64_t *newl; + unsigned long alloc; + +- while (bfdtab->count + added > newnb * 2 / 3) ++ while (bfdtab->count + added > newnb / 3 * 2) + { + newnb *= 2; + if (!newnb) +@@ -240,7 +240,7 @@ sec_merge_hash_insert (struct sec_merge_ + hashp->u.suffix = NULL; + hashp->next = NULL; + // We must not need resizing, otherwise _index is wrong +- BFD_ASSERT (bfdtab->count + 1 <= table->nbuckets * 2 / 3); ++ BFD_ASSERT (bfdtab->count + 1 <= table->nbuckets / 3 * 2); + bfdtab->count++; + table->key_lens[_index] = (hash << 32) | (uint32_t)len; + table->values[_index] = hashp; diff --git a/binutils.spec b/binutils.spec index 65c2067..f8f8ae3 100644 --- a/binutils.spec +++ b/binutils.spec @@ -2,7 +2,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.41 -Release: 10%{?dist} +Release: 11%{?dist} License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later LGPL-2.1-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/binutils @@ -278,6 +278,10 @@ Patch21: binutils-BPF-reloc-4.patch # Lifetime: Fixed in 2.42 Patch22: binutils-x86-64-v3.patch +# Purpose: Fix mergeing strings in really big programs. +# Lifetime: Fixed in 2.42 +Patch23: binutils-big-merge.patch + #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -1283,6 +1287,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Tue Nov 07 2023 Nick Clifton - 2.41-11 +- Fix merging strings when linking really big programs. + * Wed Nov 01 2023 Nick Clifton - 2.41-10 - Allow for x86_64 build environments that use a base ISA of x86-64-v3. (#2247296)