Fix merging strings when linking really big programs.

This commit is contained in:
Nick Clifton 2023-11-07 10:53:32 +00:00
parent de97bb3603
commit c3cd6c8351
2 changed files with 37 additions and 1 deletions

29
binutils-big-merge.patch Normal file
View File

@ -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;

View File

@ -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 <nickc@redhat.com> - 2.41-11
- Fix merging strings when linking really big programs.
* Wed Nov 01 2023 Nick Clifton <nickc@redhat.com> - 2.41-10
- Allow for x86_64 build environments that use a base ISA of x86-64-v3. (#2247296)