Blame SOURCES/binutils-gold-mismatched-section-flags.patch

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