Commit: Fix merging empty ppc64le notes

Message ID 87v9apsist.fsf@redhat.com
State New
Headers show
Series
  • Commit: Fix merging empty ppc64le notes
Related show

Commit Message

Nick Clifton via Binutils Feb. 18, 2021, 11:43 a.m.
Hi Guys,

  I am applying the patch below to fix a problem merging empty PowerPC
  annobin notes, which can have a start address higher than the end
  address.

Cheers
  Nick

binutils/ChangeLog
2021-02-18  Nick Clifton  <nickc@redhat.com>

	* objcopy.c (merge_gnu_build_notes): Handle notes with a start
	address that is higher than the end address.

Patch

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 0e1047e748..54a59430f1 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2275,6 +2275,11 @@  merge_gnu_build_notes (bfd *          abfd,
 	  goto done;
 	}
 
+      if (start > end)
+	/* This can happen with PPC64LE binaries where empty notes are
+	   encoded as start = end + 4.  */
+	start = end;
+
       if (is_open_note (pnote))
 	{
 	  if (start)