Linker: Do not associate allocated reloc sections with the .symtab section.
Resolves: #2166419
This commit is contained in:
parent
9fe14c4dd6
commit
d0a86e89e0
50
binutils-reloc-symtab.patch
Normal file
50
binutils-reloc-symtab.patch
Normal file
@ -0,0 +1,50 @@
|
||||
--- binutils.orig/bfd/elf.c 2023-03-30 10:01:40.824181703 +0100
|
||||
+++ binutils-2.40/bfd/elf.c 2023-03-30 10:02:23.103135337 +0100
|
||||
@@ -3877,21 +3877,23 @@ assign_section_numbers (bfd *abfd, struc
|
||||
{
|
||||
case SHT_REL:
|
||||
case SHT_RELA:
|
||||
- /* A reloc section which we are treating as a normal BFD
|
||||
- section. sh_link is the section index of the symbol
|
||||
- table. sh_info is the section index of the section to
|
||||
- which the relocation entries apply. We assume that an
|
||||
- allocated reloc section uses the dynamic symbol table
|
||||
- if there is one. Otherwise we guess the normal symbol
|
||||
- table. FIXME: How can we be sure? */
|
||||
- if (d->this_hdr.sh_link == 0 && (sec->flags & SEC_ALLOC) != 0)
|
||||
+ /* sh_link is the section index of the symbol table.
|
||||
+ sh_info is the section index of the section to which the
|
||||
+ relocation entries apply. */
|
||||
+ if (d->this_hdr.sh_link == 0)
|
||||
{
|
||||
- s = bfd_get_section_by_name (abfd, ".dynsym");
|
||||
- if (s != NULL)
|
||||
- d->this_hdr.sh_link = elf_section_data (s)->this_idx;
|
||||
+ /* FIXME maybe: If this is a reloc section which we are
|
||||
+ treating as a normal section then we likely should
|
||||
+ not be assuming its sh_link is .dynsym or .symtab. */
|
||||
+ if ((sec->flags & SEC_ALLOC) != 0)
|
||||
+ {
|
||||
+ s = bfd_get_section_by_name (abfd, ".dynsym");
|
||||
+ if (s != NULL)
|
||||
+ d->this_hdr.sh_link = elf_section_data (s)->this_idx;
|
||||
+ }
|
||||
+ else
|
||||
+ d->this_hdr.sh_link = elf_onesymtab (abfd);
|
||||
}
|
||||
- if (d->this_hdr.sh_link == 0)
|
||||
- d->this_hdr.sh_link = elf_onesymtab (abfd);
|
||||
|
||||
s = elf_get_reloc_section (sec);
|
||||
if (s != NULL)
|
||||
--- binutils.orig/binutils/objcopy.c 2023-03-30 10:01:41.063181441 +0100
|
||||
+++ binutils-2.40/binutils/objcopy.c 2023-03-30 12:25:41.439108276 +0100
|
||||
@@ -2256,7 +2256,7 @@ merge_gnu_build_notes (bfd * ab
|
||||
{
|
||||
if (pnote->note.namedata[4] == '2')
|
||||
++ version_2_seen;
|
||||
- else if (pnote->note.namedata[4] == '3')
|
||||
+ else if (pnote->note.namedata[4] == '3' || pnote->note.namedata[4] == '4')
|
||||
++ version_3_seen;
|
||||
else
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
Summary: A GNU collection of binary utilities
|
||||
Name: binutils%{?_with_debug:-debug}
|
||||
Version: 2.40
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPLv3+
|
||||
URL: https://sourceware.org/binutils
|
||||
|
||||
@ -261,10 +261,15 @@ Patch17: binutils-update-linker-manual.patch
|
||||
# Lifetime: Fixed in 2.41
|
||||
Patch18: binutils-objcopy-note-merge-speedup.patch
|
||||
|
||||
# # Purpose: Fix testsuite failures due to the patches applied here.
|
||||
# # Lifetime: Permanent, but varying with each new rebase.
|
||||
# Purpose: Fix testsuite failures due to the patches applied here.
|
||||
# Lifetime: Permanent, but varying with each new rebase.
|
||||
Patch19: binutils-testsuite-fixes.patch
|
||||
|
||||
# Purpose: Stop the linker from associating allocated reloc sections with
|
||||
# the .symtab section , which prevents it from being stripped.
|
||||
# Lifetime: Fixed in 2.41
|
||||
Patch20: binutils-reloc-symtab.patch
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
Provides: bundled(libiberty)
|
||||
@ -764,9 +769,19 @@ run_tests()
|
||||
%endif
|
||||
|
||||
pushd build-$target
|
||||
|
||||
# FIXME: I have not been able to find a way to capture a "failed" return
|
||||
# value from "make check" without having it also stop the build. So in
|
||||
# order to obtain the logs from the test runs if a check fails I have to
|
||||
# run the tests twice. Once to generate the logs and then a second time
|
||||
# to generate the correct exit code.
|
||||
|
||||
echo ================ $target == TEST RUN 1 =============================
|
||||
|
||||
# Run the tests and accumulate the logs - but ignore failures...
|
||||
|
||||
if test x$native == x1 ; then
|
||||
make -k check-gas check-binutils check-ld < /dev/null
|
||||
make -k check-gas check-binutils check-ld < /dev/null || :
|
||||
%if %{with gold}
|
||||
# The GOLD testsuite always returns an error code, even if no tests fail.
|
||||
make -k check-gold < /dev/null || :
|
||||
@ -776,8 +791,6 @@ run_tests()
|
||||
make -k check-gas check-binutils < /dev/null || :
|
||||
fi
|
||||
|
||||
echo ================ $target == TESTING BEGINS ========================
|
||||
|
||||
for f in {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
|
||||
do
|
||||
if [ -f $f ]; then
|
||||
@ -794,8 +807,6 @@ run_tests()
|
||||
fi
|
||||
%endif
|
||||
|
||||
echo ================ $target == TESTING END ===========================
|
||||
|
||||
for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
|
||||
do
|
||||
if [ -f $file ]; then
|
||||
@ -815,6 +826,18 @@ run_tests()
|
||||
fi
|
||||
%endif
|
||||
|
||||
echo ================ $target == TEST RUN 2 =============================
|
||||
|
||||
# Run the tests and this time fail if there are any errors.
|
||||
|
||||
if test x$native == x1 ; then
|
||||
make -k check-gas check-binutils check-ld < /dev/null
|
||||
# Ignore the gold tests - they always fail
|
||||
else
|
||||
# Do not try running linking tests for the cross-binutils.
|
||||
make -k check-gas check-binutils < /dev/null
|
||||
fi
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
@ -1205,6 +1228,9 @@ exit 0
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
%changelog
|
||||
* Thu Mar 30 2023 Nick Clifton <nickc@redhat.com> - 2.40-6
|
||||
- Linker: Do not associate allocated reloc sections with the .symtab section. (#2166419)
|
||||
|
||||
* Wed Mar 08 2023 Nick Clifton <nickc@redhat.com> - 2.40-5
|
||||
- Spec file: Rebuild libsframe.a with -fPIC enabled. (#2174841)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user