Blame SOURCES/binutils-gold-note-segment.patch

869a11
Only in binutils-2.30/gold: ChangeLog.orig
869a11
Only in binutils-2.30/gold: ChangeLog.rej
869a11
diff -rup binutils.orig/gold/layout.cc binutils-2.30/gold/layout.cc
869a11
--- binutils.orig/gold/layout.cc	2018-08-14 16:18:17.928466978 +0100
869a11
+++ binutils-2.30/gold/layout.cc	2018-08-14 16:23:15.811244776 +0100
869a11
@@ -474,7 +474,8 @@ Layout::Layout(int number_of_input_files
869a11
     input_section_position_(),
869a11
     input_section_glob_(),
869a11
     incremental_base_(NULL),
869a11
-    free_list_()
869a11
+    free_list_(),
869a11
+    gnu_properties_()
869a11
 {
869a11
   // Make space for more than enough segments for a typical file.
869a11
   // This is just for efficiency--it's OK if we wind up needing more.
869a11
@@ -2182,11 +2183,243 @@ Layout::layout_gnu_stack(bool seen_gnu_s
869a11
     }
869a11
 }
869a11
 
869a11
+// Read a value with given size and endianness.
869a11
+
869a11
+static inline uint64_t
869a11
+read_sized_value(size_t size, const unsigned char* buf, bool is_big_endian,
869a11
+		 const Object* object)
869a11
+{
869a11
+  uint64_t val = 0;
869a11
+  if (size == 4)
869a11
+    {
869a11
+      if (is_big_endian)
869a11
+	val = elfcpp::Swap<32, true>::readval(buf);
869a11
+      else
869a11
+	val = elfcpp::Swap<32, false>::readval(buf);
869a11
+    }
869a11
+  else if (size == 8)
869a11
+    {
869a11
+      if (is_big_endian)
869a11
+	val = elfcpp::Swap<64, true>::readval(buf);
869a11
+      else
869a11
+	val = elfcpp::Swap<64, false>::readval(buf);
869a11
+    }
869a11
+  else
869a11
+    {
869a11
+      gold_warning(_("%s: in .note.gnu.property section, "
869a11
+		     "pr_datasz must be 4 or 8"),
869a11
+		   object->name().c_str());
869a11
+    }
869a11
+  return val;
869a11
+}
869a11
+
869a11
+// Write a value with given size and endianness.
869a11
+
869a11
+static inline void
869a11
+write_sized_value(uint64_t value, size_t size, unsigned char* buf,
869a11
+		  bool is_big_endian)
869a11
+{
869a11
+  if (size == 4)
869a11
+    {
869a11
+      if (is_big_endian)
869a11
+	elfcpp::Swap<32, true>::writeval(buf, static_cast<uint32_t>(value));
869a11
+      else
869a11
+	elfcpp::Swap<32, false>::writeval(buf, static_cast<uint32_t>(value));
869a11
+    }
869a11
+  else if (size == 8)
869a11
+    {
869a11
+      if (is_big_endian)
869a11
+	elfcpp::Swap<64, true>::writeval(buf, value);
869a11
+      else
869a11
+	elfcpp::Swap<64, false>::writeval(buf, value);
869a11
+    }
869a11
+  else
869a11
+    {
869a11
+      // We will have already complained about this.
869a11
+    }
869a11
+}
869a11
+
869a11
+// Handle the .note.gnu.property section at layout time.
869a11
+
869a11
+void
869a11
+Layout::layout_gnu_property(unsigned int note_type,
869a11
+			    unsigned int pr_type,
869a11
+			    size_t pr_datasz,
869a11
+			    const unsigned char* pr_data,
869a11
+			    const Object* object)
869a11
+{
869a11
+  // We currently support only the one note type.
869a11
+  gold_assert(note_type == elfcpp::NT_GNU_PROPERTY_TYPE_0);
869a11
+
869a11
+  if (pr_type >= elfcpp::GNU_PROPERTY_LOPROC
869a11
+      && pr_type < elfcpp::GNU_PROPERTY_HIPROC)
869a11
+    {
869a11
+      // Target-dependent property value; call the target to record.
869a11
+      const int size = parameters->target().get_size();
869a11
+      const bool is_big_endian = parameters->target().is_big_endian();
869a11
+      if (size == 32)
869a11
+        {
869a11
+          if (is_big_endian)
869a11
+            {
869a11
+#ifdef HAVE_TARGET_32_BIG
869a11
+	      parameters->sized_target<32, true>()->
869a11
+		  record_gnu_property(note_type, pr_type, pr_datasz, pr_data,
869a11
+				      object);
869a11
+#else
869a11
+	      gold_unreachable();
869a11
+#endif
869a11
+            }
869a11
+          else
869a11
+            {
869a11
+#ifdef HAVE_TARGET_32_LITTLE
869a11
+	      parameters->sized_target<32, false>()->
869a11
+		  record_gnu_property(note_type, pr_type, pr_datasz, pr_data,
869a11
+				      object);
869a11
+#else
869a11
+	      gold_unreachable();
869a11
+#endif
869a11
+            }
869a11
+        }
869a11
+      else if (size == 64)
869a11
+        {
869a11
+          if (is_big_endian)
869a11
+            {
869a11
+#ifdef HAVE_TARGET_64_BIG
869a11
+	      parameters->sized_target<64, true>()->
869a11
+		  record_gnu_property(note_type, pr_type, pr_datasz, pr_data,
869a11
+				      object);
869a11
+#else
869a11
+	      gold_unreachable();
869a11
+#endif
869a11
+            }
869a11
+          else
869a11
+            {
869a11
+#ifdef HAVE_TARGET_64_LITTLE
869a11
+	      parameters->sized_target<64, false>()->
869a11
+		  record_gnu_property(note_type, pr_type, pr_datasz, pr_data,
869a11
+				      object);
869a11
+#else
869a11
+	      gold_unreachable();
869a11
+#endif
869a11
+            }
869a11
+        }
869a11
+      else
869a11
+        gold_unreachable();
869a11
+      return;
869a11
+    }
869a11
+
869a11
+  Gnu_properties::iterator pprop = this->gnu_properties_.find(pr_type);
869a11
+  if (pprop == this->gnu_properties_.end())
869a11
+    {
869a11
+      Gnu_property prop;
869a11
+      prop.pr_datasz = pr_datasz;
869a11
+      prop.pr_data = new unsigned char[pr_datasz];
869a11
+      memcpy(prop.pr_data, pr_data, pr_datasz);
869a11
+      this->gnu_properties_[pr_type] = prop;
869a11
+    }
869a11
+  else
869a11
+    {
869a11
+      const bool is_big_endian = parameters->target().is_big_endian();
869a11
+      switch (pr_type)
869a11
+	{
869a11
+	case elfcpp::GNU_PROPERTY_STACK_SIZE:
869a11
+	  // Record the maximum value seen.
869a11
+	  {
869a11
+	    uint64_t val1 = read_sized_value(pprop->second.pr_datasz,
869a11
+					     pprop->second.pr_data,
869a11
+					     is_big_endian, object);
869a11
+	    uint64_t val2 = read_sized_value(pr_datasz, pr_data,
869a11
+					     is_big_endian, object);
869a11
+	    if (val2 > val1)
869a11
+	      write_sized_value(val2, pprop->second.pr_datasz,
869a11
+				pprop->second.pr_data, is_big_endian);
869a11
+	  }
869a11
+	  break;
869a11
+	case elfcpp::GNU_PROPERTY_NO_COPY_ON_PROTECTED:
869a11
+	  // No data to merge.
869a11
+	  break;
869a11
+	default:
869a11
+	  gold_warning(_("%s: unknown program property type %d "
869a11
+			 "in .note.gnu.property section"),
869a11
+		       object->name().c_str(), pr_type);
869a11
+	}
869a11
+    }
869a11
+}
869a11
+
869a11
+// Merge per-object properties with program properties.
869a11
+// This lets the target identify objects that are missing certain
869a11
+// properties, in cases where properties must be ANDed together.
869a11
+
869a11
+void
869a11
+Layout::merge_gnu_properties(const Object* object)
869a11
+{
869a11
+  const int size = parameters->target().get_size();
869a11
+  const bool is_big_endian = parameters->target().is_big_endian();
869a11
+  if (size == 32)
869a11
+    {
869a11
+      if (is_big_endian)
869a11
+	{
869a11
+#ifdef HAVE_TARGET_32_BIG
869a11
+	  parameters->sized_target<32, true>()->merge_gnu_properties(object);
869a11
+#else
869a11
+	  gold_unreachable();
869a11
+#endif
869a11
+	}
869a11
+      else
869a11
+	{
869a11
+#ifdef HAVE_TARGET_32_LITTLE
869a11
+	  parameters->sized_target<32, false>()->merge_gnu_properties(object);
869a11
+#else
869a11
+	  gold_unreachable();
869a11
+#endif
869a11
+	}
869a11
+    }
869a11
+  else if (size == 64)
869a11
+    {
869a11
+      if (is_big_endian)
869a11
+	{
869a11
+#ifdef HAVE_TARGET_64_BIG
869a11
+	  parameters->sized_target<64, true>()->merge_gnu_properties(object);
869a11
+#else
869a11
+	  gold_unreachable();
869a11
+#endif
869a11
+	}
869a11
+      else
869a11
+	{
869a11
+#ifdef HAVE_TARGET_64_LITTLE
869a11
+	  parameters->sized_target<64, false>()->merge_gnu_properties(object);
869a11
+#else
869a11
+	  gold_unreachable();
869a11
+#endif
869a11
+	}
869a11
+    }
869a11
+  else
869a11
+    gold_unreachable();
869a11
+}
869a11
+
869a11
+// Add a target-specific property for the output .note.gnu.property section.
869a11
+
869a11
+void
869a11
+Layout::add_gnu_property(unsigned int note_type,
869a11
+			 unsigned int pr_type,
869a11
+			 size_t pr_datasz,
869a11
+			 const unsigned char* pr_data)
869a11
+{
869a11
+  gold_assert(note_type == elfcpp::NT_GNU_PROPERTY_TYPE_0);
869a11
+
869a11
+  Gnu_property prop;
869a11
+  prop.pr_datasz = pr_datasz;
869a11
+  prop.pr_data = new unsigned char[pr_datasz];
869a11
+  memcpy(prop.pr_data, pr_data, pr_datasz);
869a11
+  this->gnu_properties_[pr_type] = prop;
869a11
+}
869a11
+
869a11
 // Create automatic note sections.
869a11
 
869a11
 void
869a11
 Layout::create_notes()
869a11
 {
869a11
+  this->create_gnu_properties_note();
869a11
   this->create_gold_note();
869a11
   this->create_stack_segment();
869a11
   this->create_build_id();
869a11
@@ -3010,6 +3243,58 @@ Layout::create_note(const char* name, in
869a11
   return os;
869a11
 }
869a11
 
869a11
+// Create a .note.gnu.property section to record program properties
869a11
+// accumulated from the input files.
869a11
+
869a11
+void
869a11
+Layout::create_gnu_properties_note()
869a11
+{
869a11
+  parameters->target().finalize_gnu_properties(this);
869a11
+
869a11
+  if (this->gnu_properties_.empty())
869a11
+    return;
869a11
+
869a11
+  const unsigned int size = parameters->target().get_size();
869a11
+  const bool is_big_endian = parameters->target().is_big_endian();
869a11
+
869a11
+  // Compute the total size of the properties array.
869a11
+  size_t descsz = 0;
869a11
+  for (Gnu_properties::const_iterator prop = this->gnu_properties_.begin();
869a11
+       prop != this->gnu_properties_.end();
869a11
+       ++prop)
869a11
+    {
869a11
+      descsz = align_address(descsz + 8 + prop->second.pr_datasz, size / 8);
869a11
+    }
869a11
+
869a11
+  // Create the note section.
869a11
+  size_t trailing_padding;
869a11
+  Output_section* os = this->create_note("GNU", elfcpp::NT_GNU_PROPERTY_TYPE_0,
869a11
+					 ".note.gnu.property", descsz,
869a11
+					 true, &trailing_padding);
869a11
+  if (os == NULL)
869a11
+    return;
869a11
+  gold_assert(trailing_padding == 0);
869a11
+
869a11
+  // Allocate and fill the properties array.
869a11
+  unsigned char* desc = new unsigned char[descsz];
869a11
+  unsigned char* p = desc;
869a11
+  for (Gnu_properties::const_iterator prop = this->gnu_properties_.begin();
869a11
+       prop != this->gnu_properties_.end();
869a11
+       ++prop)
869a11
+    {
869a11
+      size_t datasz = prop->second.pr_datasz;
869a11
+      size_t aligned_datasz = align_address(prop->second.pr_datasz, size / 8);
869a11
+      write_sized_value(prop->first, 4, p, is_big_endian);
869a11
+      write_sized_value(datasz, 4, p + 4, is_big_endian);
869a11
+      memcpy(p + 8, prop->second.pr_data, datasz);
869a11
+      if (aligned_datasz > datasz)
869a11
+        memset(p + 8 + datasz, 0, aligned_datasz - datasz);
869a11
+      p += 8 + aligned_datasz;
869a11
+    }
869a11
+  Output_section_data* posd = new Output_data_const(desc, descsz, 4);
869a11
+  os->add_output_section_data(posd);
869a11
+}
869a11
+
869a11
 // For an executable or shared library, create a note to record the
869a11
 // version of gold used to create the binary.
869a11
 
869a11
Only in binutils-2.30/gold: layout.cc.orig
869a11
diff -rup binutils.orig/gold/layout.h binutils-2.30/gold/layout.h
869a11
--- binutils.orig/gold/layout.h	2018-08-14 16:18:17.926466993 +0100
869a11
+++ binutils-2.30/gold/layout.h	2018-08-14 16:23:15.811244776 +0100
869a11
@@ -680,6 +680,25 @@ class Layout
869a11
   layout_gnu_stack(bool seen_gnu_stack, uint64_t gnu_stack_flags,
869a11
 		   const Object*);
869a11
 
869a11
+  // Layout a .note.gnu.property section.
869a11
+  void
869a11
+  layout_gnu_property(unsigned int note_type,
869a11
+		      unsigned int pr_type,
869a11
+		      size_t pr_datasz,
869a11
+		      const unsigned char* pr_data,
869a11
+		      const Object* object);
869a11
+
869a11
+  // Merge per-object properties with program properties.
869a11
+  void
869a11
+  merge_gnu_properties(const Object* object);
869a11
+
869a11
+  // Add a target-specific property for the output .note.gnu.property section.
869a11
+  void
869a11
+  add_gnu_property(unsigned int note_type,
869a11
+		   unsigned int pr_type,
869a11
+		   size_t pr_datasz,
869a11
+		   const unsigned char* pr_data);
869a11
+
869a11
   // Add an Output_section_data to the layout.  This is used for
869a11
   // special sections like the GOT section.  ORDER is where the
869a11
   // section should wind up in the output segment.  IS_RELRO is true
869a11
@@ -1040,6 +1059,10 @@ class Layout
869a11
   create_note(const char* name, int note_type, const char* section_name,
869a11
 	      size_t descsz, bool allocate, size_t* trailing_padding);
869a11
 
869a11
+  // Create a note section for gnu program properties.
869a11
+  void
869a11
+  create_gnu_properties_note();
869a11
+
869a11
   // Create a note section for gold version.
869a11
   void
869a11
   create_gold_note();
869a11
@@ -1326,6 +1349,14 @@ class Layout
869a11
     std::vector<Section_info> section_infos_;
869a11
   };
869a11
 
869a11
+  // Program properties from .note.gnu.property sections.
869a11
+  struct Gnu_property
869a11
+  {
869a11
+    size_t pr_datasz;
869a11
+    unsigned char* pr_data;
869a11
+  };
869a11
+  typedef std::map<unsigned int, Gnu_property> Gnu_properties;
869a11
+
869a11
   // The number of input files, for sizing tables.
869a11
   int number_of_input_files_;
869a11
   // Information set by scripts or by command line options.
869a11
@@ -1452,6 +1483,8 @@ class Layout
869a11
   Incremental_binary* incremental_base_;
869a11
   // For incremental links, a list of free space within the file.
869a11
   Free_list free_list_;
869a11
+  // Program properties.
869a11
+  Gnu_properties gnu_properties_;
869a11
 };
869a11
 
869a11
 // This task handles writing out data in output sections which is not
869a11
Only in binutils-2.30/gold: layout.h.orig
869a11
diff -rup binutils.orig/gold/object.cc binutils-2.30/gold/object.cc
869a11
--- binutils.orig/gold/object.cc	2018-08-14 16:18:17.929466971 +0100
869a11
+++ binutils-2.30/gold/object.cc	2018-08-14 16:23:15.812244769 +0100
869a11
@@ -1313,6 +1313,102 @@ Sized_relobj_file<size, big_endian>::lay
869a11
     this->set_relocs_must_follow_section_writes();
869a11
 }
869a11
 
869a11
+// Layout an input .note.gnu.property section.
869a11
+
869a11
+// This note section has an *extremely* non-standard layout.
869a11
+// The gABI spec says that ELF-64 files should have 8-byte fields and
869a11
+// 8-byte alignment in the note section, but the Gnu tools generally
869a11
+// use 4-byte fields and 4-byte alignment (see the comment for
869a11
+// Layout::create_note).  This section uses 4-byte fields (i.e.,
869a11
+// namesz, descsz, and type are always 4 bytes), the name field is
869a11
+// padded to a multiple of 4 bytes, but the desc field is padded
869a11
+// to a multiple of 4 or 8 bytes, depending on the ELF class.
869a11
+// The individual properties within the desc field always use
869a11
+// 4-byte pr_type and pr_datasz fields, but pr_data is padded to
869a11
+// a multiple of 4 or 8 bytes, depending on the ELF class.
869a11
+
869a11
+template<int size, bool big_endian>
869a11
+void
869a11
+Sized_relobj_file<size, big_endian>::layout_gnu_property_section(
869a11
+    Layout* layout,
869a11
+    unsigned int shndx)
869a11
+{
869a11
+  section_size_type contents_len;
869a11
+  const unsigned char* pcontents = this->section_contents(shndx,
869a11
+							  &contents_len,
869a11
+							  false);
869a11
+  const unsigned char* pcontents_end = pcontents + contents_len;
869a11
+
869a11
+  // Loop over all the notes in this section.
869a11
+  while (pcontents < pcontents_end)
869a11
+    {
869a11
+      if (pcontents + 16 > pcontents_end)
869a11
+	{
869a11
+	  gold_warning(_("%s: corrupt .note.gnu.property section "
869a11
+			 "(note too short)"),
869a11
+		       this->name().c_str());
869a11
+	  return;
869a11
+	}
869a11
+
869a11
+      size_t namesz = elfcpp::Swap<32, big_endian>::readval(pcontents);
869a11
+      size_t descsz = elfcpp::Swap<32, big_endian>::readval(pcontents + 4);
869a11
+      unsigned int ntype = elfcpp::Swap<32, big_endian>::readval(pcontents + 8);
869a11
+      const unsigned char* pname = pcontents + 12;
869a11
+
869a11
+      if (namesz != 4 || strcmp(reinterpret_cast<const char*>(pname), "GNU") != 0)
869a11
+	{
869a11
+	  gold_warning(_("%s: corrupt .note.gnu.property section "
869a11
+			 "(name is not 'GNU')"),
869a11
+		       this->name().c_str());
869a11
+	  return;
869a11
+	}
869a11
+
869a11
+      if (ntype != elfcpp::NT_GNU_PROPERTY_TYPE_0)
869a11
+	{
869a11
+	  gold_warning(_("%s: unsupported note type %d "
869a11
+			 "in .note.gnu.property section"),
869a11
+		       this->name().c_str(), ntype);
869a11
+	  return;
869a11
+	}
869a11
+
869a11
+      size_t aligned_namesz = align_address(namesz, 4);
869a11
+      const unsigned char* pdesc = pname + aligned_namesz;
869a11
+
869a11
+      if (pdesc + descsz > pcontents + contents_len)
869a11
+	{
869a11
+	  gold_warning(_("%s: corrupt .note.gnu.property section"),
869a11
+		       this->name().c_str());
869a11
+	  return;
869a11
+	}
869a11
+
869a11
+      const unsigned char* pprop = pdesc;
869a11
+
869a11
+      // Loop over the program properties in this note.
869a11
+      while (pprop < pdesc + descsz)
869a11
+	{
869a11
+	  if (pprop + 8 > pdesc + descsz)
869a11
+	    {
869a11
+	      gold_warning(_("%s: corrupt .note.gnu.property section"),
869a11
+			   this->name().c_str());
869a11
+	      return;
869a11
+	    }
869a11
+	  unsigned int pr_type = elfcpp::Swap<32, big_endian>::readval(pprop);
869a11
+	  size_t pr_datasz = elfcpp::Swap<32, big_endian>::readval(pprop + 4);
869a11
+	  pprop += 8;
869a11
+	  if (pprop + pr_datasz > pdesc + descsz)
869a11
+	    {
869a11
+	      gold_warning(_("%s: corrupt .note.gnu.property section"),
869a11
+			   this->name().c_str());
869a11
+	      return;
869a11
+	    }
869a11
+	  layout->layout_gnu_property(ntype, pr_type, pr_datasz, pprop, this);
869a11
+	  pprop += align_address(pr_datasz, size / 8);
869a11
+	}
869a11
+
869a11
+      pcontents = pdesc + align_address(descsz, size / 8);
869a11
+    }
869a11
+}
869a11
+
869a11
 // Lay out the input sections.  We walk through the sections and check
869a11
 // whether they should be included in the link.  If they should, we
869a11
 // pass them to the Layout object, which will return an output section
869a11
@@ -1565,6 +1661,14 @@ Sized_relobj_file<size, big_endian>::do_
869a11
 	      omit[i] = true;
869a11
 	    }
869a11
 
869a11
+	  // Handle .note.gnu.property sections.
869a11
+	  if (sh_type == elfcpp::SHT_NOTE
869a11
+	      && strcmp(name, ".note.gnu.property") == 0)
869a11
+	    {
869a11
+	      this->layout_gnu_property_section(layout, i);
869a11
+	      omit[i] = true;
869a11
+	    }
869a11
+
869a11
 	  bool discard = omit[i];
869a11
 	  if (!discard)
869a11
 	    {
869a11
@@ -1781,7 +1885,10 @@ Sized_relobj_file<size, big_endian>::do_
869a11
     }
869a11
 
869a11
   if (!is_pass_two)
869a11
-    layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags, this);
869a11
+    {
869a11
+      layout->merge_gnu_properties(this);
869a11
+      layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags, this);
869a11
+    }
869a11
 
869a11
   // Handle the .eh_frame sections after the other sections.
869a11
   gold_assert(!is_pass_one || eh_frame_sections.empty());
869a11
Only in binutils-2.30/gold: object.cc.orig
869a11
diff -rup binutils.orig/gold/object.h binutils-2.30/gold/object.h
869a11
--- binutils.orig/gold/object.h	2018-08-14 16:18:17.926466993 +0100
869a11
+++ binutils-2.30/gold/object.h	2018-08-14 16:18:47.793244187 +0100
869a11
@@ -2647,6 +2647,10 @@ class Sized_relobj_file : public Sized_r
869a11
 			  unsigned int shndx, const typename This::Shdr&,
869a11
 			  unsigned int reloc_shndx, unsigned int reloc_type);
869a11
 
869a11
+  // Layout an input .note.gnu.property section.
869a11
+  void
869a11
+  layout_gnu_property_section(Layout* layout, unsigned int shndx);
869a11
+
869a11
   // Write section data to the output file.  Record the views and
869a11
   // sizes in VIEWS for use when relocating.
869a11
   void
869a11
Only in binutils-2.30/gold: object.h.orig
869a11
diff -rup binutils.orig/gold/target.h binutils-2.30/gold/target.h
869a11
--- binutils.orig/gold/target.h	2018-08-14 16:18:17.928466978 +0100
869a11
+++ binutils-2.30/gold/target.h	2018-08-14 16:23:15.812244769 +0100
869a11
@@ -504,6 +504,11 @@ class Target
869a11
   should_include_section(elfcpp::Elf_Word sh_type) const
869a11
   { return this->do_should_include_section(sh_type); }
869a11
 
869a11
+  // Finalize the target-specific properties in the .note.gnu.property section.
869a11
+  void
869a11
+  finalize_gnu_properties(Layout* layout) const
869a11
+  { this->do_finalize_gnu_properties(layout); }
869a11
+
869a11
  protected:
869a11
   // This struct holds the constant information for a child class.  We
869a11
   // use a struct to avoid the overhead of virtual function calls for
869a11
@@ -807,6 +812,11 @@ class Target
869a11
   do_should_include_section(elfcpp::Elf_Word) const
869a11
   { return true; }
869a11
 
869a11
+  // Finalize the target-specific properties in the .note.gnu.property section.
869a11
+  virtual void
869a11
+  do_finalize_gnu_properties(Layout*) const
869a11
+  { }
869a11
+
869a11
  private:
869a11
   // The implementations of the four do_make_elf_object virtual functions are
869a11
   // almost identical except for their sizes and endianness.  We use a template.
869a11
@@ -1126,6 +1136,17 @@ class Sized_target : public Target
869a11
     return elfcpp::elf_r_sym<size>(rel.get_r_info());
869a11
   }
869a11
 
869a11
+  // Record a target-specific program property in the .note.gnu.property
869a11
+  // section.
869a11
+  virtual void
869a11
+  record_gnu_property(int, int, size_t, const unsigned char*, const Object*)
869a11
+  { }
869a11
+
869a11
+  // Merge the target-specific program properties from the current object.
869a11
+  virtual void
869a11
+  merge_gnu_properties(const Object*)
869a11
+  { }
869a11
+
869a11
  protected:
869a11
   Sized_target(const Target::Target_info* pti)
869a11
     : Target(pti)
869a11
Only in binutils-2.30/gold: target.h.orig
869a11
Only in binutils-2.30/gold/testsuite: gnu_property_a.S
869a11
Only in binutils-2.30/gold/testsuite: gnu_property_b.S
869a11
Only in binutils-2.30/gold/testsuite: gnu_property_c.S
869a11
Only in binutils-2.30/gold/testsuite: gnu_property_main.c
869a11
Only in binutils-2.30/gold/testsuite: gnu_property_test.sh
869a11
diff -rup binutils.orig/gold/testsuite/Makefile.am binutils-2.30/gold/testsuite/Makefile.am
869a11
--- binutils.orig/gold/testsuite/Makefile.am	2018-08-14 16:18:17.930466963 +0100
869a11
+++ binutils-2.30/gold/testsuite/Makefile.am	2018-08-14 16:23:15.812244769 +0100
869a11
@@ -3121,6 +3121,23 @@ exception_x86_64_bnd_2.o: exception_test
869a11
 	$(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
869a11
 endif DEFAULT_TARGET_X86_64
869a11
 
869a11
+if DEFAULT_TARGET_X86_64
869a11
+check_SCRIPTS += gnu_property_test.sh
869a11
+check_DATA += gnu_property_test.stdout
869a11
+gnu_property_test.stdout: gnu_property_test
869a11
+	$(TEST_READELF) -n $< >$@
869a11
+gnu_property_test: gcctestdir/ld gnu_property_a.o gnu_property_b.o gnu_property_c.o
869a11
+	gcctestdir/ld -o $@ gnu_property_a.o gnu_property_b.o gnu_property_c.o
869a11
+gnu_property_main.o: gnu_property_main.c
869a11
+	$(COMPILE) -c -o $@ $<
869a11
+gnu_property_a.o: gnu_property_a.S
869a11
+	$(COMPILE) -c -o $@ $<
869a11
+gnu_property_b.o: gnu_property_b.S
869a11
+	$(COMPILE) -c -o $@ $<
869a11
+gnu_property_c.o: gnu_property_c.S
869a11
+	$(COMPILE) -c -o $@ $<
869a11
+endif DEFAULT_TARGET_X86_64
869a11
+
869a11
 check_PROGRAMS += pr22266
869a11
 pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld
869a11
 	$(LINK) -Bgcctestdir/ pr22266_main.o pr22266_ar.o
869a11
Only in binutils-2.30/gold/testsuite: Makefile.am.orig
869a11
diff -rup binutils.orig/gold/testsuite/Makefile.in binutils-2.30/gold/testsuite/Makefile.in
869a11
--- binutils.orig/gold/testsuite/Makefile.in	2018-08-14 16:18:17.939466896 +0100
869a11
+++ binutils-2.30/gold/testsuite/Makefile.in	2018-08-14 16:23:15.813244761 +0100
869a11
@@ -814,28 +814,30 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	two_file_test_tmp_4.o \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	two_file_test_5.a \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	two_file_test_6.a
869a11
-@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_84 = pr22266
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_84 = gnu_property_test.sh
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_85 = gnu_property_test.stdout
869a11
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_86 = pr22266
869a11
 
869a11
 # These tests work with native and cross linkers.
869a11
 
869a11
 # Test script section order.
869a11
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_85 = script_test_10.sh
869a11
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_86 = script_test_10.stdout
869a11
-@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = script_test_10
869a11
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_87 = script_test_10.sh
869a11
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = script_test_10.stdout
869a11
+@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = script_test_10
869a11
 
869a11
 # These tests work with cross linkers only.
869a11
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_88 = split_i386.sh
869a11
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_89 = split_i386_1.stdout split_i386_2.stdout \
869a11
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_i386.sh
869a11
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_i386_1.stdout split_i386_2.stdout \
869a11
 @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
869a11
 
869a11
-@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_90 = split_i386_1 split_i386_2 split_i386_3 \
869a11
+@DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_i386_1 split_i386_2 split_i386_3 \
869a11
 @DEFAULT_TARGET_I386_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_i386_4 split_i386_r
869a11
 
869a11
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_91 = split_x86_64.sh \
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_x86_64.sh \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	bnd_plt_1.sh \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	bnd_ifunc_1.sh \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	bnd_ifunc_2.sh
869a11
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_92 = split_x86_64_1.stdout \
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x86_64_1.stdout \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_x86_64_2.stdout \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_x86_64_3.stdout \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_x86_64_4.stdout \
869a11
@@ -843,14 +845,14 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	bnd_plt_1.stdout \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	bnd_ifunc_1.stdout \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	bnd_ifunc_2.stdout
869a11
-@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_93 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x86_64_1 split_x86_64_2 split_x86_64_3 \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_x86_64_4 split_x86_64_r
869a11
 
869a11
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_94 = split_x32.sh
869a11
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_95 = split_x32_1.stdout split_x32_2.stdout \
869a11
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = split_x32.sh
869a11
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = split_x32_1.stdout split_x32_2.stdout \
869a11
 @DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
869a11
 
869a11
-@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_96 = split_x32_1 split_x32_2 split_x32_3 \
869a11
+@DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = split_x32_1 split_x32_2 split_x32_3 \
869a11
 @DEFAULT_TARGET_X32_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_x32_4 split_x32_r
869a11
 
869a11
 
869a11
@@ -871,7 +873,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 # Check Thumb to ARM farcall veneers
869a11
 
869a11
 # Check handling of --target1-abs, --target1-rel and --target2 options
869a11
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_97 = arm_abs_global.sh \
869a11
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = arm_abs_global.sh \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_branch_in_range.sh \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_branch_out_of_range.sh \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_fix_v4bx.sh \
869a11
@@ -894,7 +896,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_target2_got_rel.sh
869a11
 
869a11
 # The test demonstrates why the constructor of a target object should not access options.
869a11
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_98 = arm_abs_global.stdout \
869a11
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = arm_abs_global.stdout \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_bl_in_range.stdout \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_bl_out_of_range.stdout \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	thumb_bl_in_range.stdout \
869a11
@@ -947,7 +949,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_target2_abs.stdout \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_target2_got_rel.stdout \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_target_lazy_init
869a11
-@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_99 = arm_abs_global \
869a11
+@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = arm_abs_global \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_bl_in_range \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_bl_out_of_range \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	thumb_bl_in_range \
869a11
@@ -998,20 +1000,20 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_target2_abs \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_target2_got_rel \
869a11
 @DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	arm_target_lazy_init
869a11
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_100 = aarch64_reloc_none.sh \
869a11
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = aarch64_reloc_none.sh \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	aarch64_relocs.sh \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	pr21430.sh \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	aarch64_tlsdesc.sh
869a11
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_101 = aarch64_reloc_none.stdout \
869a11
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = aarch64_reloc_none.stdout \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	aarch64_relocs.stdout \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	pr21430.stdout \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	aarch64_tlsdesc.stdout
869a11
-@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_102 = aarch64_reloc_none \
869a11
+@DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = aarch64_reloc_none \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	aarch64_relocs \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	pr21430 \
869a11
 @DEFAULT_TARGET_AARCH64_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	aarch64_tlsdesc
869a11
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_103 = split_s390.sh
869a11
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_104 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
869a11
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_105 = split_s390.sh
869a11
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_106 = split_s390_z1.stdout split_s390_z2.stdout split_s390_z3.stdout \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390_z4.stdout split_s390_n1.stdout split_s390_n2.stdout \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390_a1.stdout split_s390_a2.stdout split_s390_z1_ns.stdout \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390_z2_ns.stdout split_s390_z3_ns.stdout split_s390_z4_ns.stdout \
869a11
@@ -1023,7 +1025,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390x_z4_ns.stdout split_s390x_n1_ns.stdout \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390x_n2_ns.stdout split_s390x_r.stdout
869a11
 
869a11
-@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_105 = split_s390_z1 split_s390_z2 split_s390_z3 \
869a11
+@DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@am__append_107 = split_s390_z1 split_s390_z2 split_s390_z3 \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390_z4 split_s390_n1 split_s390_n2 split_s390_a1 \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390_a2 split_s390_z1_ns split_s390_z2_ns split_s390_z3_ns \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390_z4_ns split_s390_n1_ns split_s390_n2_ns split_s390_r \
869a11
@@ -1032,10 +1034,10 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__E
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390x_z1_ns split_s390x_z2_ns split_s390x_z3_ns \
869a11
 @DEFAULT_TARGET_S390_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@	split_s390x_z4_ns split_s390x_n1_ns split_s390x_n2_ns split_s390x_r
869a11
 
869a11
-@DEFAULT_TARGET_X86_64_TRUE@am__append_106 = *.dwo *.dwp
869a11
-@DEFAULT_TARGET_X86_64_TRUE@am__append_107 = dwp_test_1.sh \
869a11
+@DEFAULT_TARGET_X86_64_TRUE@am__append_108 = *.dwo *.dwp
869a11
+@DEFAULT_TARGET_X86_64_TRUE@am__append_109 = dwp_test_1.sh \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@	dwp_test_2.sh
869a11
-@DEFAULT_TARGET_X86_64_TRUE@am__append_108 = dwp_test_1.stdout \
869a11
+@DEFAULT_TARGET_X86_64_TRUE@am__append_110 = dwp_test_1.stdout \
869a11
 @DEFAULT_TARGET_X86_64_TRUE@	dwp_test_2.stdout
869a11
 subdir = testsuite
869a11
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
869a11
@@ -2828,9 +2830,9 @@ MOSTLYCLEANFILES = *.so *.syms *.stdout
869a11
 	$(am__append_34) $(am__append_37) $(am__append_41) \
869a11
 	$(am__append_47) $(am__append_51) $(am__append_52) \
869a11
 	$(am__append_58) $(am__append_78) $(am__append_81) \
869a11
-	$(am__append_83) $(am__append_87) $(am__append_90) \
869a11
-	$(am__append_93) $(am__append_96) $(am__append_99) \
869a11
-	$(am__append_102) $(am__append_105) $(am__append_106)
869a11
+	$(am__append_83) $(am__append_89) $(am__append_92) \
869a11
+	$(am__append_95) $(am__append_98) $(am__append_101) \
869a11
+	$(am__append_104) $(am__append_107) $(am__append_108)
869a11
 
869a11
 # We will add to these later, for each individual test.  Note
869a11
 # that we add each test under check_SCRIPTS or check_PROGRAMS;
869a11
@@ -2839,18 +2841,18 @@ check_SCRIPTS = $(am__append_2) $(am__ap
869a11
 	$(am__append_29) $(am__append_35) $(am__append_42) \
869a11
 	$(am__append_45) $(am__append_49) $(am__append_53) \
869a11
 	$(am__append_56) $(am__append_62) $(am__append_73) \
869a11
-	$(am__append_76) $(am__append_79) $(am__append_85) \
869a11
-	$(am__append_88) $(am__append_91) $(am__append_94) \
869a11
-	$(am__append_97) $(am__append_100) $(am__append_103) \
869a11
-	$(am__append_107)
869a11
+	$(am__append_76) $(am__append_79) $(am__append_84) \
869a11
+	$(am__append_87) $(am__append_90) $(am__append_93) \
869a11
+	$(am__append_96) $(am__append_99) $(am__append_102) \
869a11
+	$(am__append_105) $(am__append_109)
869a11
 check_DATA = $(am__append_3) $(am__append_20) $(am__append_24) \
869a11
 	$(am__append_30) $(am__append_36) $(am__append_43) \
869a11
 	$(am__append_46) $(am__append_50) $(am__append_54) \
869a11
 	$(am__append_57) $(am__append_63) $(am__append_74) \
869a11
-	$(am__append_77) $(am__append_80) $(am__append_86) \
869a11
-	$(am__append_89) $(am__append_92) $(am__append_95) \
869a11
-	$(am__append_98) $(am__append_101) $(am__append_104) \
869a11
-	$(am__append_108)
869a11
+	$(am__append_77) $(am__append_80) $(am__append_85) \
869a11
+	$(am__append_88) $(am__append_91) $(am__append_94) \
869a11
+	$(am__append_97) $(am__append_100) $(am__append_103) \
869a11
+	$(am__append_106) $(am__append_110)
869a11
 BUILT_SOURCES = $(am__append_40)
869a11
 TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
869a11
 
869a11
@@ -5737,6 +5739,8 @@ exception_x86_64_bnd_test.log: exception
869a11
 	@p='exception_x86_64_bnd_test$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
869a11
 pr22266.log: pr22266$(EXEEXT)
869a11
 	@p='pr22266$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
869a11
+gnu_property_test.sh.log: gnu_property_test.sh
869a11
+	@p='gnu_property_test.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
869a11
 .test.log:
869a11
 	@p='$<'; $(am__check_pre) $(TEST_LOG_COMPILE) "$$tst" $(am__check_post)
869a11
 @am__EXEEXT_TRUE@.test$(EXEEXT).log:
869a11
@@ -7394,6 +7403,18 @@ uninstall-am:
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
869a11
 @DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_test.stdout: gnu_property_test
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(TEST_READELF) -n $< >$@
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_test: gcctestdir/ld gnu_property_a.o gnu_property_b.o gnu_property_c.o
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	gcctestdir/ld -o $@ gnu_property_a.o gnu_property_b.o gnu_property_c.o
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_main.o: gnu_property_main.c
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(COMPILE) -c -o $@ $<
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_a.o: gnu_property_a.S
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(COMPILE) -c -o $@ $<
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_b.o: gnu_property_b.S
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(COMPILE) -c -o $@ $<
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@gnu_property_c.o: gnu_property_c.S
869a11
+@DEFAULT_TARGET_X86_64_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@	$(COMPILE) -c -o $@ $<
869a11
 @GCC_TRUE@@NATIVE_LINKER_TRUE@pr22266: pr22266_main.o pr22266_ar.o gcctestdir/ld
869a11
 @GCC_TRUE@@NATIVE_LINKER_TRUE@	$(LINK) -Bgcctestdir/ pr22266_main.o pr22266_ar.o
869a11
 @GCC_TRUE@@NATIVE_LINKER_TRUE@pr22266_ar.o: pr22266_a.o gcctestdir/ld
869a11
Only in binutils-2.30/gold/testsuite: Makefile.in.orig
869a11
Only in binutils-2.30/gold/testsuite: Makefile.in.rej
869a11
diff -rup binutils.orig/gold/x86_64.cc binutils-2.30/gold/x86_64.cc
869a11
--- binutils.orig/gold/x86_64.cc	2018-08-14 16:18:17.926466993 +0100
869a11
+++ binutils-2.30/gold/x86_64.cc	2018-08-14 16:23:26.758163112 +0100
869a11
@@ -590,7 +590,8 @@ class Target_x86_64 : public Sized_targe
869a11
       got_tlsdesc_(NULL), global_offset_table_(NULL), rela_dyn_(NULL),
869a11
       rela_irelative_(NULL), copy_relocs_(elfcpp::R_X86_64_COPY),
869a11
       got_mod_index_offset_(-1U), tlsdesc_reloc_info_(),
869a11
-      tls_base_symbol_defined_(false)
869a11
+      tls_base_symbol_defined_(false), isa_1_used_(0), isa_1_needed_(0),
869a11
+      feature_1_(0), object_feature_1_(0), seen_first_object_(false)
869a11
   { }
869a11
 
869a11
   // Hook for a new output section.
869a11
@@ -1188,6 +1189,20 @@ class Target_x86_64 : public Sized_targe
869a11
 				  this->rela_dyn_section(layout));
869a11
   }
869a11
 
869a11
+  // Record a target-specific program property in the .note.gnu.property
869a11
+  // section.
869a11
+  void
869a11
+  record_gnu_property(int, int, size_t, const unsigned char*, const Object*);
869a11
+
869a11
+  // Merge the target-specific program properties from the current object.
869a11
+  void
869a11
+  merge_gnu_properties(const Object*);
869a11
+
869a11
+  // Finalize the target-specific program properties and add them back to
869a11
+  // the layout.
869a11
+  void
869a11
+  do_finalize_gnu_properties(Layout*) const;
869a11
+
869a11
   // Information about this specific target which we pass to the
869a11
   // general Target structure.
869a11
   static const Target::Target_info x86_64_info;
869a11
@@ -1245,6 +1260,17 @@ class Target_x86_64 : public Sized_targe
869a11
   std::vector<Tlsdesc_info> tlsdesc_reloc_info_;
869a11
   // True if the _TLS_MODULE_BASE_ symbol has been defined.
869a11
   bool tls_base_symbol_defined_;
869a11
+  // Target-specific program properties, from .note.gnu.property section.
869a11
+  // Each bit represents a specific feature.
869a11
+  uint32_t isa_1_used_;
869a11
+  uint32_t isa_1_needed_;
869a11
+  uint32_t feature_1_;
869a11
+  // Target-specific properties from the current object.
869a11
+  // These bits get ANDed into FEATURE_1_ after all properties for the object
869a11
+  // have been processed.
869a11
+  uint32_t object_feature_1_;
869a11
+  // Whether we have seen our first object, for use in initializing FEATURE_1_.
869a11
+  bool seen_first_object_;
869a11
 };
869a11
 
869a11
 template<>
869a11
@@ -1431,6 +1457,93 @@ Target_x86_64<size>::rela_irelative_sect
869a11
   return this->rela_irelative_;
869a11
 }
869a11
 
869a11
+// Record a target-specific program property from the .note.gnu.property
869a11
+// section.
869a11
+template<int size>
869a11
+void
869a11
+Target_x86_64<size>::record_gnu_property(
869a11
+    int, int pr_type,
869a11
+    size_t pr_datasz, const unsigned char* pr_data,
869a11
+    const Object* object)
869a11
+{
869a11
+  uint32_t val = 0;
869a11
+
869a11
+  switch (pr_type)
869a11
+    {
869a11
+    case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
869a11
+    case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
869a11
+    case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
869a11
+      if (pr_datasz != 4)
869a11
+	{
869a11
+	  gold_warning(_("%s: corrupt .note.gnu.property section "
869a11
+			 "(pr_datasz for property %d is not 4)"),
869a11
+		       object->name().c_str(), pr_type);
869a11
+	  return;
869a11
+	}
869a11
+      val = elfcpp::Swap<32, false>::readval(pr_data);
869a11
+      break;
869a11
+    default:
869a11
+      gold_warning(_("%s: unknown program property type 0x%x "
869a11
+		     "in .note.gnu.property section"),
869a11
+		   object->name().c_str(), pr_type);
869a11
+      break;
869a11
+    }
869a11
+
869a11
+  switch (pr_type)
869a11
+    {
869a11
+    case elfcpp::GNU_PROPERTY_X86_ISA_1_USED:
869a11
+      this->isa_1_used_ |= val;
869a11
+      break;
869a11
+    case elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED:
869a11
+      this->isa_1_needed_ |= val;
869a11
+      break;
869a11
+    case elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND:
869a11
+      // If we see multiple feature props in one object, OR them together.
869a11
+      this->object_feature_1_ |= val;
869a11
+      break;
869a11
+    }
869a11
+}
869a11
+
869a11
+// Merge the target-specific program properties from the current object.
869a11
+template<int size>
869a11
+void
869a11
+Target_x86_64<size>::merge_gnu_properties(const Object*)
869a11
+{
869a11
+  if (this->seen_first_object_)
869a11
+    this->feature_1_ &= this->object_feature_1_;
869a11
+  else
869a11
+    {
869a11
+      this->feature_1_ = this->object_feature_1_;
869a11
+      this->seen_first_object_ = true;
869a11
+    }
869a11
+  this->object_feature_1_ = 0;
869a11
+}
869a11
+
869a11
+static inline void
869a11
+add_property(Layout* layout, unsigned int pr_type, uint32_t val)
869a11
+{
869a11
+  unsigned char buf[4];
869a11
+  elfcpp::Swap<32, false>::writeval(buf, val);
869a11
+  layout->add_gnu_property(elfcpp::NT_GNU_PROPERTY_TYPE_0, pr_type, 4, buf);
869a11
+}
869a11
+
869a11
+// Finalize the target-specific program properties and add them back to
869a11
+// the layout.
869a11
+template<int size>
869a11
+void
869a11
+Target_x86_64<size>::do_finalize_gnu_properties(Layout* layout) const
869a11
+{
869a11
+  if (this->isa_1_used_ != 0)
869a11
+    add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_USED,
869a11
+		 this->isa_1_used_);
869a11
+  if (this->isa_1_needed_ != 0)
869a11
+    add_property(layout, elfcpp::GNU_PROPERTY_X86_ISA_1_NEEDED,
869a11
+		 this->isa_1_needed_);
869a11
+  if (this->feature_1_ != 0)
869a11
+    add_property(layout, elfcpp::GNU_PROPERTY_X86_FEATURE_1_AND,
869a11
+		 this->feature_1_);
869a11
+}
869a11
+
869a11
 // Write the first three reserved words of the .got.plt section.
869a11
 // The remainder of the section is written while writing the PLT
869a11
 // in Output_data_plt_i386::do_write.
869a11
Only in binutils-2.30/gold: x86_64.cc.orig
869a11
--- /dev/null	2018-08-14 08:11:42.835432884 +0100
869a11
+++ binutils-2.30/gold/testsuite/gnu_property_a.S	2018-08-14 16:23:15.813244761 +0100
869a11
@@ -0,0 +1,46 @@
869a11
+#define NT_GNU_PROPERTY_TYPE_0 5
869a11
+
869a11
+#define GNU_PROPERTY_STACK_SIZE 1
869a11
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
869a11
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
869a11
+#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
869a11
+
869a11
+#if __SIZEOF_PTRDIFF_T__  == 8
869a11
+# define ALIGN 3
869a11
+#elif __SIZEOF_PTRDIFF_T__  == 4
869a11
+# define ALIGN 2
869a11
+#endif
869a11
+
869a11
+	.text
869a11
+	.globl _start
869a11
+_start:
869a11
+	ret
869a11
+
869a11
+        .section ".note.gnu.property", "a"
869a11
+        .p2align ALIGN
869a11
+
869a11
+        .long 1f - 0f           /* name length */
869a11
+        .long 5f - 2f           /* data length */
869a11
+        .long NT_GNU_PROPERTY_TYPE_0    /* note type */
869a11
+0:      .asciz "GNU"            /* vendor name */
869a11
+1:
869a11
+        .p2align ALIGN
869a11
+2:      .long GNU_PROPERTY_STACK_SIZE   /* pr_type.  */
869a11
+        .long 4f - 3f   /* pr_datasz.  */
869a11
+3:
869a11
+        .dc.a 0x800     /* Stack size.  */
869a11
+4:
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_ISA_1_USED
869a11
+	.long 4
869a11
+	.byte 0x01,0x10,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_ISA_1_NEEDED
869a11
+	.long 4
869a11
+	.byte 0x01,0x10,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_FEATURE_1_AND
869a11
+	.long 4
869a11
+	.byte 0x01,0x00,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+5:
869a11
--- /dev/null	2018-08-14 08:11:42.835432884 +0100
869a11
+++ binutils-2.30/gold/testsuite/gnu_property_b.S	2018-08-14 16:18:47.795244173 +0100
869a11
@@ -0,0 +1,38 @@
869a11
+#define NT_GNU_PROPERTY_TYPE_0 5
869a11
+
869a11
+#define GNU_PROPERTY_STACK_SIZE 1
869a11
+#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
869a11
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
869a11
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
869a11
+#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
869a11
+
869a11
+#if __SIZEOF_PTRDIFF_T__  == 8
869a11
+# define ALIGN 3
869a11
+#elif __SIZEOF_PTRDIFF_T__  == 4
869a11
+# define ALIGN 2
869a11
+#endif
869a11
+
869a11
+        .section ".note.gnu.property", "a"
869a11
+        .p2align ALIGN
869a11
+        .long 1f - 0f           /* name length */
869a11
+        .long 3f - 2f           /* data length */
869a11
+        .long NT_GNU_PROPERTY_TYPE_0    /* note type */
869a11
+0:      .asciz "GNU"            /* vendor name */
869a11
+1:
869a11
+        .p2align ALIGN
869a11
+2:      .long GNU_PROPERTY_NO_COPY_ON_PROTECTED /* pr_type.  */
869a11
+        .long 0 /* pr_datasz.  */
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_ISA_1_USED
869a11
+	.long 4
869a11
+	.byte 0x01,0x11,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_ISA_1_NEEDED
869a11
+	.long 4
869a11
+	.byte 0x01,0x11,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_FEATURE_1_AND
869a11
+	.long 4
869a11
+	.byte 0x03,0x00,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+3:
869a11
--- /dev/null	2018-08-14 08:11:42.835432884 +0100
869a11
+++ binutils-2.30/gold/testsuite/gnu_property_c.S	2018-08-14 16:18:47.795244173 +0100
869a11
@@ -0,0 +1,44 @@
869a11
+#define NT_GNU_PROPERTY_TYPE_0 5
869a11
+
869a11
+#define GNU_PROPERTY_STACK_SIZE 1
869a11
+#define GNU_PROPERTY_NO_COPY_ON_PROTECTED 2
869a11
+#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
869a11
+#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
869a11
+#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
869a11
+
869a11
+#if __SIZEOF_PTRDIFF_T__  == 8
869a11
+# define ALIGN 3
869a11
+#elif __SIZEOF_PTRDIFF_T__  == 4
869a11
+# define ALIGN 2
869a11
+#endif
869a11
+
869a11
+        .section ".note.gnu.property", "a"
869a11
+        .p2align ALIGN
869a11
+        .long 1f - 0f           /* name length */
869a11
+        .long 5f - 2f           /* data length */
869a11
+        .long NT_GNU_PROPERTY_TYPE_0    /* note type */
869a11
+0:      .asciz "GNU"            /* vendor name */
869a11
+1:
869a11
+        .p2align ALIGN
869a11
+2:      .long GNU_PROPERTY_STACK_SIZE   /* pr_type.  */
869a11
+        .long 4f - 3f   /* pr_datasz.  */
869a11
+3:
869a11
+        .dc.a 0x111100  /* Stack size.  */
869a11
+4:
869a11
+        .p2align ALIGN
869a11
+        .long GNU_PROPERTY_NO_COPY_ON_PROTECTED /* pr_type.  */
869a11
+        .long 0 /* pr_datasz.  */
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_ISA_1_USED
869a11
+	.long 4
869a11
+	.byte 0x11,0x10,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_ISA_1_NEEDED
869a11
+	.long 4
869a11
+	.byte 0x11,0x10,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+	.long GNU_PROPERTY_X86_FEATURE_1_AND
869a11
+	.long 4
869a11
+	.byte 0x01,0x00,0x00,0x00
869a11
+        .p2align ALIGN
869a11
+5:
869a11
--- /dev/null	2018-08-14 08:11:42.835432884 +0100
869a11
+++ binutils-2.30/gold/testsuite/gnu_property_main.c	2018-08-14 16:18:47.795244173 +0100
869a11
@@ -0,0 +1,5 @@
869a11
+int
869a11
+main(void)
869a11
+{
869a11
+  return 0;
869a11
+}
869a11
--- /dev/null	2018-08-14 08:11:42.835432884 +0100
869a11
+++ binutils-2.30/gold/testsuite/gnu_property_test.sh	2018-08-14 16:18:47.795244173 +0100
869a11
@@ -0,0 +1,64 @@
869a11
+#!/bin/sh
869a11
+
869a11
+# gnu_property_test.sh -- test .note.gnu.property section.
869a11
+
869a11
+# Copyright (C) 2018 Free Software Foundation, Inc.
869a11
+# Written by Cary Coutant <ccoutant@gmail.com>.
869a11
+
869a11
+# This file is part of gold.
869a11
+
869a11
+# This program is free software; you can redistribute it and/or modify
869a11
+# it under the terms of the GNU General Public License as published by
869a11
+# the Free Software Foundation; either version 3 of the License, or
869a11
+# (at your option) any later version.
869a11
+
869a11
+# This program is distributed in the hope that it will be useful,
869a11
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
869a11
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
869a11
+# GNU General Public License for more details.
869a11
+
869a11
+# You should have received a copy of the GNU General Public License
869a11
+# along with this program; if not, write to the Free Software
869a11
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
869a11
+# MA 02110-1301, USA.
869a11
+
869a11
+# This script checks that after linking the three object files
869a11
+# gnu_property_[abc].S, each of which contains a .note.gnu.property
869a11
+# section, the resulting output has only a single such note section,
869a11
+# and that the properties have been correctly combined.
869a11
+
869a11
+check()
869a11
+{
869a11
+    if ! grep -q "$2" "$1"
869a11
+    then
869a11
+	echo "Did not find expected output in $1:"
869a11
+	echo "   $2"
869a11
+	echo ""
869a11
+	echo "Actual output below:"
869a11
+	cat "$1"
869a11
+	exit 1
869a11
+    fi
869a11
+}
869a11
+
869a11
+check_count()
869a11
+{
869a11
+    if test "`grep -c "$2" "$1"`" != "$3"
869a11
+    then
869a11
+	echo "Did not find correct number of note sections in $1:"
869a11
+	echo "   $2"
869a11
+	echo ""
869a11
+	echo "Actual output below:"
869a11
+	cat "$1"
869a11
+	exit 1
869a11
+    fi
869a11
+}
869a11
+
869a11
+check_count gnu_property_test.stdout "GNU\s*0x[0-9a-f]*\s*NT_GNU_PROPERTY_TYPE_0" 1
869a11
+
869a11
+check gnu_property_test.stdout "stack size: 0x111100"
869a11
+check gnu_property_test.stdout "no copy on protected"
869a11
+check gnu_property_test.stdout "x86 ISA used: i486, SSE2, SSE4_2, AVX512CD"
869a11
+check gnu_property_test.stdout "x86 ISA needed: i486, SSE2, SSE4_2, AVX512CD"
869a11
+check gnu_property_test.stdout "x86 feature: IBT"
869a11
+
869a11
+exit 0
869a11
--- binutils.orig/elfcpp/elfcpp.h	2018-08-14 16:18:18.007466389 +0100
869a11
+++ binutils-2.30/elfcpp/elfcpp.h	2018-08-14 16:36:27.151339505 +0100
869a11
@@ -984,7 +984,9 @@ enum
869a11
   NT_GNU_BUILD_ID = 3,
869a11
   // The version of gold used to link.  Th descriptor is just a
869a11
   // string.
869a11
-  NT_GNU_GOLD_VERSION = 4
869a11
+  NT_GNU_GOLD_VERSION = 4,
869a11
+  // Program property note, as described in "Linux Extensions to the gABI".
869a11
+  NT_GNU_PROPERTY_TYPE_0 = 5
869a11
 };
869a11
 
869a11
 // The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note.
869a11
@@ -999,6 +1001,21 @@ enum
869a11
   ELF_NOTE_OS_SYLLABLE = 5
869a11
 };
869a11
 
869a11
+// Program property types for NT_GNU_PROPERTY_TYPE_0.
869a11
+
869a11
+enum
869a11
+{
869a11
+  GNU_PROPERTY_STACK_SIZE = 1,
869a11
+  GNU_PROPERTY_NO_COPY_ON_PROTECTED = 2,
869a11
+  GNU_PROPERTY_LOPROC = 0xc0000000,
869a11
+  GNU_PROPERTY_X86_ISA_1_USED = 0xc0000000,
869a11
+  GNU_PROPERTY_X86_ISA_1_NEEDED = 0xc0000001,
869a11
+  GNU_PROPERTY_X86_FEATURE_1_AND = 0xc0000002,
869a11
+  GNU_PROPERTY_HIPROC = 0xdfffffff,
869a11
+  GNU_PROPERTY_LOUSER = 0xe0000000,
869a11
+  GNU_PROPERTY_HIUSER = 0xffffffff
869a11
+};
869a11
+
869a11
 } // End namespace elfcpp.
869a11
 
869a11
 // Include internal details after defining the types.
869a11
--- binutils.orig/elfcpp/x86_64.h	2018-08-14 16:18:18.006466396 +0100
869a11
+++ binutils-2.30/elfcpp/x86_64.h	2018-08-14 16:36:55.838125405 +0100
869a11
@@ -103,6 +103,12 @@ enum
869a11
   R_X86_64_GNU_VTENTRY = 251
869a11
 };
869a11
 
869a11
+// The bit values that can appear in the GNU_PROPERTY_X86_FEATURE_1_AND
869a11
+// program property.
869a11
+
869a11
+const uint64_t GNU_PROPERTY_X86_FEATURE_1_IBT = 1ULL << 0;
869a11
+const uint64_t GNU_PROPERTY_X86_FEATURE_1_SHSTK = 1ULL << 1;
869a11
+
869a11
 } // End namespace elfcpp.
869a11
 
869a11
 #endif // !defined(ELFCPP_X86_64_H)
869a11
--- binutils.orig/gold/object.cc	2018-08-14 16:43:20.553254144 +0100
869a11
+++ binutils-2.30/gold/object.cc	2018-08-14 16:43:35.275144269 +0100
869a11
@@ -1618,6 +1618,7 @@ Sized_relobj_file<size, big_endian>::do_
869a11
   for (unsigned int i = 1; i < shnum; ++i, pshdrs += This::shdr_size)
869a11
     {
869a11
       typename This::Shdr shdr(pshdrs);
869a11
+      unsigned int sh_type = shdr.get_sh_type();
869a11
 
869a11
       if (shdr.get_sh_name() >= section_names_size)
869a11
 	{