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

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