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

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