Fix the GOLD linker's handling of 32-bit PowerPC binaries. (#2234396)

This commit is contained in:
Nick Clifton 2023-08-25 14:41:23 +01:00
parent 13a8e71fad
commit 88b4953e8b
2 changed files with 79 additions and 1 deletions

View File

@ -0,0 +1,71 @@
diff -rup binutils.orig/gold/powerpc.cc binutils-2.41/gold/powerpc.cc
--- binutils.orig/gold/powerpc.cc 2023-08-25 11:21:08.882071604 +0100
+++ binutils-2.41/gold/powerpc.cc 2023-08-25 11:21:26.050081034 +0100
@@ -3714,12 +3714,7 @@ Target_powerpc<size, big_endian>::do_rel
unsigned int prev_brlt_size = 0;
if (pass == 1)
{
- bool thread_safe
- = this->abiversion() < 2 && parameters->options().plt_thread_safe();
- if (size == 64
- && this->abiversion() < 2
- && !thread_safe
- && !parameters->options().user_set_plt_thread_safe())
+ if (size == 64 && this->abiversion() < 2)
{
static const char* const thread_starter[] =
{
@@ -3747,29 +3742,37 @@ Target_powerpc<size, big_endian>::do_rel
/* libgo */
"__go_go",
};
+ bool thread_safe = parameters->options().plt_thread_safe();
- if (parameters->options().shared())
- thread_safe = true;
- else
+ if (!thread_safe
+ && !parameters->options().user_set_plt_thread_safe())
{
- for (unsigned int i = 0;
- i < sizeof(thread_starter) / sizeof(thread_starter[0]);
- i++)
+ if (parameters->options().shared())
+ thread_safe = true;
+ else
{
- Symbol* sym = symtab->lookup(thread_starter[i], NULL);
- thread_safe = (sym != NULL
- && sym->in_reg()
- && sym->in_real_elf());
- if (thread_safe)
- break;
+ for (unsigned int i = 0;
+ i < sizeof(thread_starter) / sizeof(thread_starter[0]);
+ i++)
+ {
+ Symbol* sym = symtab->lookup(thread_starter[i], NULL);
+ thread_safe = (sym != NULL
+ && sym->in_reg()
+ && sym->in_real_elf());
+ if (thread_safe)
+ break;
+ }
}
}
+ this->plt_thread_safe_ = thread_safe;
}
- this->plt_thread_safe_ = thread_safe;
- if (parameters->options().output_is_position_independent())
- this->rela_dyn_size_
- = this->rela_dyn_section(layout)->current_data_size();
+ if (size == 64
+ && parameters->options().output_is_position_independent())
+ {
+ gold_assert (this->rela_dyn_);
+ this->rela_dyn_size_ = this->rela_dyn_->current_data_size();
+ }
this->stub_group_size_ = parameters->options().stub_group_size();
bool no_size_errors = true;

View File

@ -2,7 +2,7 @@
Summary: A GNU collection of binary utilities Summary: A GNU collection of binary utilities
Name: binutils%{?_with_debug:-debug} Name: binutils%{?_with_debug:-debug}
Version: 2.41 Version: 2.41
Release: 4%{?dist} Release: 5%{?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 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 URL: https://sourceware.org/binutils
@ -252,6 +252,10 @@ Patch16: binutils-testsuite-fixes.patch
# Lifetime: Permanent, but varies with each rebase. # Lifetime: Permanent, but varies with each rebase.
Patch17: binutils-riscv-testsuite-fixes.patch Patch17: binutils-riscv-testsuite-fixes.patch
# Purpose: Fix the GOLD linker's handling of 32-bit PowerPC binaries.
# Lifetime: Fixed in 2.42
Patch18: binutils-gold-powerpc.patch
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
Provides: bundled(libiberty) Provides: bundled(libiberty)
@ -1251,6 +1255,9 @@ exit 0
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%changelog %changelog
* Fri Aug 25 2023 Nick Clifton <nickc@redhat.com> - 2.41-5
- Fix the GOLD linker's handling of 32-bit PowerPC binaries. (#2234396)
* Wed Aug 23 2023 Nick Clifton <nickc@redhat.com> - 2.41-4 * Wed Aug 23 2023 Nick Clifton <nickc@redhat.com> - 2.41-4
- Add fixes for linker testsuite failures for the RISCV-64 target. - Add fixes for linker testsuite failures for the RISCV-64 target.