[4/6] Create a psuedo section for the ELF AUXV core dump note on FreeBSD.

Message ID 20160616060202.63470-5-jhb@FreeBSD.org
State New, archived
Headers

Commit Message

John Baldwin June 16, 2016, 6:02 a.m. UTC
  The procstat AUXV core dump note in FreeBSD consists of 32-bit integer
followed by an array of auxiliary vector entries.

bfd/ChangeLog:

	* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PROCSTAT_AUXV
	notes.
---
 bfd/ChangeLog |  5 +++++
 bfd/elf.c     | 14 ++++++++++++++
 2 files changed, 19 insertions(+)
  

Comments

Nick Clifton June 17, 2016, 8:28 a.m. UTC | #1
Hi John,

> bfd/ChangeLog:
> 
> 	* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PROCSTAT_AUXV
> 	notes.
 
Approved - please apply.

Cheers
  Nick
  
Pedro Alves June 20, 2016, 11:45 p.m. UTC | #2
"pseudo" :-)

Thanks,
Pedro Alves
  

Patch

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 881ce6d..7afc44e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@ 
 2016-06-15  John Baldwin  <jhb@FreeBSD.org>
 
+	* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PROCSTAT_AUXV
+	notes.
+
+2016-06-15  John Baldwin  <jhb@FreeBSD.org>
+
 	* elf.c (elfcore_grok_note): Remove handling of NT_X86_XSTATE for
 	FreeBSD.  Remove case for NT_FREEBSD_THRMISC.
 	(elfcore_grok_freebsd_psinfo): New function.
diff --git a/bfd/elf.c b/bfd/elf.c
index 2d8f621..d947cf3 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9663,6 +9663,20 @@  elfcore_grok_freebsd_note (bfd *abfd, Elf_Internal_Note *note)
       else
 	return TRUE;
 
+    case NT_FREEBSD_PROCSTAT_AUXV:
+      {
+	asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
+							     SEC_HAS_CONTENTS);
+
+	if (sect == NULL)
+	  return FALSE;
+	sect->size = note->descsz - 4;
+	sect->filepos = note->descpos + 4;
+	sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
+
+	return TRUE;
+      }
+      
     case NT_X86_XSTATE:
       if (note->namesz == 8)
 	return elfcore_grok_xstatereg (abfd, note);