diff mbox

[1/2] Account for padding in FreeBSD/mipsn32 NT_PRSTATUS notes.

Message ID 20170919204814.93328-2-jhb@FreeBSD.org
State New
Headers show

Commit Message

John Baldwin Sept. 19, 2017, 8:48 p.m. UTC
bfd/ChangeLog:

	* elf.c: Include "elf/mips.h".
	(elfcore_grok_freebsd_prstatus): Account for padding in MIPS N32
	NT_PRSTATUS notes.
---
 bfd/ChangeLog | 6 ++++++
 bfd/elf.c     | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4c8c12cd46..d7cd445b11 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@ 
+2017-09-19  John Baldwin  <jhb@FreeBSD.org>
+
+	* elf.c: Include "elf/mips.h".
+	(elfcore_grok_freebsd_prstatus): Account for padding in MIPS N32
+	NT_PRSTATUS notes.
+
 2017-09-19  Alan Modra  <amodra@gmail.com>
 
 	PR 21441
diff --git a/bfd/elf.c b/bfd/elf.c
index 2aa2337724..d8d29ac70b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -43,6 +43,7 @@  SECTION
 #include "libiberty.h"
 #include "safe-ctype.h"
 #include "elf-linux-core.h"
+#include "elf/mips.h"
 
 #ifdef CORE_HEADER
 #include CORE_HEADER
@@ -9955,7 +9956,9 @@  elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note)
   offset += 4;
 
   /* Padding before pr_reg.  */
-  if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64)
+  if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64
+      || (elf_elfheader (abfd)->e_machine == EM_MIPS
+	  && (elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0))
     offset += 4;
 
   /* Make sure that there is enough data remaining in the note.  */