From d6fee2389787a709737b22c628a1d15db01d76f8 Mon Sep 17 00:00:00 2001
From: Fred Fish <fnf@specifix.com>
Date: Tue, 12 Nov 1991 03:06:05 +0000
Subject: [PATCH] Add support for ELF note sections, which are used in ELF core
 files to hold copies of various /proc structures at the time of the core
 dump.

---
 include/elf-common.h   | 6 ++++++
 include/elf-external.h | 9 +++++++++
 include/elf-internal.h | 9 +++++++++
 3 files changed, 24 insertions(+)

diff --git a/include/elf-common.h b/include/elf-common.h
index 4544debbd77..a2cb39806aa 100755
--- a/include/elf-common.h
+++ b/include/elf-common.h
@@ -126,3 +126,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define SHF_ALLOC	(1 << 1)	/* Occupies memory during execution */
 #define SHF_EXECINSTR	(1 << 2)	/* Executable machine instructions */
 #define SHF_MASKPROC	0xF0000000	/* Processor-specific semantics */
+
+/* Values of note segment descriptor types for core files. */
+
+#define NT_PRSTATUS	1		/* Contains copy of prstatus struct */
+#define NT_FPREGSET	2		/* Contains copy of fpregset struct */
+#define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
diff --git a/include/elf-external.h b/include/elf-external.h
index 2a95f26cd8b..0cc8eebe142 100755
--- a/include/elf-external.h
+++ b/include/elf-external.h
@@ -85,3 +85,12 @@ typedef struct {
   unsigned char	st_other[1];		/* No defined meaning, 0 */
   unsigned char	st_shndx[2];		/* Associated section index */
 } Elf_External_Sym;
+
+/* Note segments */
+
+typedef struct {
+  unsigned char	namesz[4];		/* Size of entry's owner string */
+  unsigned char	descsz[4];		/* Size of the note descriptor */
+  unsigned char	type[4];		/* Interpretation of the descriptor */
+  char		name[1];		/* Start of the name+desc data */
+} Elf_External_Note;
diff --git a/include/elf-internal.h b/include/elf-internal.h
index bf5133902bc..40193737ea0 100755
--- a/include/elf-internal.h
+++ b/include/elf-internal.h
@@ -96,3 +96,12 @@ typedef struct {
   Elf_Char	st_other;		/* No defined meaning, 0 */
   Elf_Half	st_shndx;		/* Associated section index */
 } Elf_Internal_Sym;
+
+/* Note segments */
+
+typedef struct {
+  Elf_Word	namesz;			/* Size of entry's owner string */
+  Elf_Word	descsz;			/* Size of the note descriptor */
+  Elf_Word	type;			/* Interpretation of the descriptor */
+  char		name[1];		/* Start of the name+desc data */
+} Elf_Internal_Note;