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

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