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

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