From c6c79eaa2c2530ae28f6041b3bcf5deb277d763b Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Jun 24 2019 14:11:32 +0000 Subject: Stop gold from aborting when it encounters input sections with the same name and different flags. Relates: #1722715 --- diff --git a/binutils-gold-mismatched-section-flags.patch b/binutils-gold-mismatched-section-flags.patch new file mode 100644 index 0000000..4125801 --- /dev/null +++ b/binutils-gold-mismatched-section-flags.patch @@ -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::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) + { diff --git a/binutils.spec b/binutils.spec index 2e1c504..5ebda79 100644 --- a/binutils.spec +++ b/binutils.spec @@ -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 - 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 - 2.32-14 - Import fix for PR 23870 in order to help building Go binaries.