Blame SOURCES/binutils-gas-build-note-relocs.patch

0c74e2
--- binutils.orig/gas/write.c	2019-07-01 16:23:28.133707500 +0100
0c74e2
+++ binutils-2.32/gas/write.c	2019-07-01 16:24:50.699130611 +0100
0c74e2
@@ -1891,7 +1891,8 @@ create_obj_attrs_section (void)
0c74e2
 static void
0c74e2
 create_note_reloc (segT           sec,
0c74e2
 		   symbolS *      sym,
0c74e2
-		   bfd_size_type  offset,
0c74e2
+		   bfd_size_type  note_offset,
0c74e2
+		   bfd_size_type  desc2_offset,
0c74e2
 		   int            reloc_type,
0c74e2
 		   bfd_vma        addend,
0c74e2
 		   char *         note)
0c74e2
@@ -1901,10 +1902,10 @@ create_note_reloc (segT           sec,
0c74e2
   reloc = XNEW (struct reloc_list);
0c74e2
 
0c74e2
   /* We create a .b type reloc as resolve_reloc_expr_symbols() has already been called.  */
0c74e2
-  reloc->u.b.sec   = sec;
0c74e2
-  reloc->u.b.s     = symbol_get_bfdsym (sym);
0c74e2
+  reloc->u.b.sec           = sec;
0c74e2
+  reloc->u.b.s             = symbol_get_bfdsym (sym);
0c74e2
   reloc->u.b.r.sym_ptr_ptr = & reloc->u.b.s;
0c74e2
-  reloc->u.b.r.address     = offset;
0c74e2
+  reloc->u.b.r.address     = note_offset + desc2_offset;
0c74e2
   reloc->u.b.r.addend      = addend;
0c74e2
   reloc->u.b.r.howto       = bfd_reloc_type_lookup (stdoutput, reloc_type);
0c74e2
 
0c74e2
@@ -1929,12 +1930,12 @@ create_note_reloc (segT           sec,
0c74e2
       if (target_big_endian)
0c74e2
 	{
0c74e2
 	  if (bfd_arch_bits_per_address (stdoutput) <= 32)
0c74e2
-	    note[offset + 3] = addend;
0c74e2
+	    note[desc2_offset + 3] = addend;
0c74e2
 	  else
0c74e2
-	    note[offset + 7] = addend;
0c74e2
+	    note[desc2_offset + 7] = addend;
0c74e2
 	}
0c74e2
       else
0c74e2
-	note[offset] = addend;
0c74e2
+	note[desc2_offset] = addend;
0c74e2
     }
0c74e2
 }
0c74e2
 
0c74e2
@@ -2037,10 +2038,10 @@ maybe_generate_build_notes (void)
0c74e2
 	memcpy (note + 12, "GA$?3a1", 8);
0c74e2
 
0c74e2
 	/* Create a relocation to install the start address of the note...  */
0c74e2
-	create_note_reloc (sec, sym, total_size + 20, desc_reloc, 0, note);
0c74e2
+	create_note_reloc (sec, sym, total_size, 20, desc_reloc, 0, note);
0c74e2
 
0c74e2
 	/* ...and another one to install the end address.  */
0c74e2
-	create_note_reloc (sec, sym, total_size + desc2_offset, desc_reloc,
0c74e2
+	create_note_reloc (sec, sym, total_size, desc2_offset, desc_reloc,
0c74e2
 			   bfd_get_section_size (bsym->section),
0c74e2
 			   note);
0c74e2