Blame SOURCES/binutils-objcopy-version-note.patch

eeb5bc
--- binutils.orig/binutils/objcopy.c	2019-08-06 09:42:51.065854915 +0100
eeb5bc
+++ binutils-2.30/binutils/objcopy.c	2019-08-06 09:47:36.293974283 +0100
eeb5bc
@@ -2161,12 +2161,10 @@ merge_gnu_build_notes (bfd * abfd, asect
eeb5bc
   attribute_type_byte = version_1_seen ? 1 : 3;
eeb5bc
   val_start = attribute_type_byte + 1;
eeb5bc
 
eeb5bc
-  /* The first note should be the first version note.  */
eeb5bc
-  if (pnotes[0].note.namedata[attribute_type_byte] != GNU_BUILD_ATTRIBUTE_VERSION)
eeb5bc
-    {
eeb5bc
-      err = _("bad GNU build attribute notes: first note not version note");
eeb5bc
-      goto done;
eeb5bc
-    }
eeb5bc
+  /* We used to require that the first note be a version note,
eeb5bc
+     but this is no longer enforced.  Due to the problems with
eeb5bc
+     linking sections with the same name (eg .gnu.build.note.hot)
eeb5bc
+     we cannot guarantee that the first note will be a version note.  */
eeb5bc
 
eeb5bc
   /* Now merge the notes.  The rules are:
eeb5bc
      1. Preserve the ordering of the notes.
eeb5bc
@@ -2184,7 +2182,7 @@ merge_gnu_build_notes (bfd * abfd, asect
eeb5bc
 	description field of the note must be changed to contain the starting
eeb5bc
 	address to which it refers.
eeb5bc
      6. Notes with the same start and end address can be deleted.  */
eeb5bc
-  for (pnote = pnotes + 1; pnote < pnotes_end; pnote ++)
eeb5bc
+  for (pnote = pnotes; pnote < pnotes_end; pnote ++)
eeb5bc
     {
eeb5bc
       int                      note_type;
eeb5bc
       objcopy_internal_note *  back;