Stop gold from aborting when it encounters input sections with the same name and different flags.

Relates: #1722715
This commit is contained in:
Nick Clifton 2019-06-24 15:11:32 +01:00
parent 6ba705ff04
commit c6c79eaa2c
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,36 @@
diff -rup binutils.orig/gold/layout.cc binutils-2.32/gold/layout.cc
--- binutils.orig/gold/layout.cc 2019-06-24 14:37:36.013086899 +0100
+++ binutils-2.32/gold/layout.cc 2019-06-24 14:41:40.054517479 +0100
@@ -868,6 +868,7 @@ Layout::get_output_section(const char* n
&& (same_name->flags() & elfcpp::SHF_TLS) == 0)
os = same_name;
}
+#if 0 /* BZ 1722715, PR 17556. */
else if ((flags & elfcpp::SHF_TLS) == 0)
{
elfcpp::Elf_Xword zero_flags = 0;
@@ -878,6 +879,7 @@ Layout::get_output_section(const char* n
if (p != this->section_name_map_.end())
os = p->second;
}
+#endif
}
if (os == NULL)
diff -rup binutils.orig/gold/object.cc binutils-2.32/gold/object.cc
--- binutils.orig/gold/object.cc 2019-06-24 14:37:36.012086906 +0100
+++ binutils-2.32/gold/object.cc 2019-06-24 14:39:59.287165501 +0100
@@ -1644,6 +1644,13 @@ Sized_relobj_file<size, big_endian>::do_
omit[i] = true;
}
+ // Skip empty sections without flags.
+ if (!(shdr.get_sh_flags() & ~elfcpp::SHF_GROUP)
+ && !shdr.get_sh_size())
+ {
+ omit[i] = true;
+ }
+
bool discard = omit[i];
if (!discard)
{

View File

@ -85,7 +85,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.32
Release: 14%{?dist}
Release: 15%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
@ -211,6 +211,11 @@ Patch19: binutils-CVE-2019-9071.patch
# Lifetime: Fixed in 2.33
Patch20: binutils-aarch64-gold-PLT-for-MOVW_ABS.patch
# Purpose: Stop gold from aborting when input sections with the same name
# have different flags.
# Lifetime: 2.33 (probably)
Patch21: binutils-gold-mismatched-section-flags.patch
#----------------------------------------------------------------------------
Provides: bundled(libiberty)
@ -357,6 +362,7 @@ Conflicts: gcc-c++ < 4.0.0
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
# FIXME - this is no longer true. Maybe try reinstating autotool use ?
@ -753,6 +759,9 @@ exit 0
#----------------------------------------------------------------------------
%changelog
* Mon Jun 24 2019 Nick Clifton <nickc@redhat.com> - 2.32-15
- Stop gold from aborting when it encounters input sections with the same name and different flags. (#1722715)
* Tue May 21 2019 Nick Clifton <nickc@redhat.com> - 2.32-14
- Import fix for PR 23870 in order to help building Go binaries.