Module Name:    src
Committed By:   matt
Date:           Wed Sep 11 18:53:54 UTC 2013

Modified Files:
        src/external/gpl3/binutils/dist/binutils: readelf.c
        src/external/gpl3/binutils/dist/include/elf: common.h

Log Message:
Teach readelf how to interpet netbsd notes.

Notes at offset 0x00000128 with length 0x00000018:
  Owner         Data size       Description
  NetBSD        0x00000004      IDENT 699002300 (6.99.23)

Notes at offset 0x00000154 with length 0x00000020:
  Owner         Data size       Description
  NetBSD        0x00000009      MARCH <earmv7hf>


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/binutils/dist/binutils/readelf.c
cvs rdiff -u -r1.1.1.2 -r1.2 \
    src/external/gpl3/binutils/dist/include/elf/common.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/binutils/readelf.c
diff -u src/external/gpl3/binutils/dist/binutils/readelf.c:1.5 src/external/gpl3/binutils/dist/binutils/readelf.c:1.6
--- src/external/gpl3/binutils/dist/binutils/readelf.c:1.5	Mon Oct 31 19:12:48 2011
+++ src/external/gpl3/binutils/dist/binutils/readelf.c	Wed Sep 11 18:53:54 2013
@@ -11890,6 +11890,38 @@ get_gnu_elf_note_type (unsigned e_type)
   return buff;
 }
 
+static int 
+process_netbsd_elf_note (Elf_Internal_Note * pnote)
+{
+  unsigned int version;
+
+  switch (pnote->type)
+    {
+    case NT_NETBSD_IDENT:
+      version = byte_get((unsigned char *)pnote->descdata, sizeof(version));
+      if ((version / 10000) % 100)
+        printf ("  NetBSD\t0x%08lx\tIDENT %u (%u.%u%s%c)\n", pnote->descsz,
+		version, version / 100000000, (version / 1000000) % 100,
+		(version / 10000) % 100 > 26 ? "Z" : "",
+		'A' + (version / 10000) % 26); 
+      else
+	printf ("  NetBSD\t0x%08lx\tIDENT %u (%u.%u.%u)\n", pnote->descsz,
+	        version, version / 100000000, (version / 1000000) % 100,
+		(version / 100) % 100); 
+      return 1;
+    case NT_NETBSD_MARCH:
+      printf ("  NetBSD\t0x%08lx\tMARCH <%s>\n", pnote->descsz,
+	      pnote->descdata);
+      return 1;
+    default:
+      break;
+    }
+
+  printf ("  NetBSD\t0x%08lx\tUnknown note type: (0x%08lx)\n", pnote->descsz,
+	  pnote->type);
+  return 1;
+}
+
 static const char *
 get_netbsd_elfcore_note_type (unsigned e_type)
 {
@@ -11989,6 +12021,10 @@ process_note (Elf_Internal_Note * pnote)
     /* GNU-specific object file notes.  */
     nt = get_gnu_elf_note_type (pnote->type);
 
+  else if (const_strneq (pnote->namedata, "NetBSD"))
+    /* NetBSD-specific core file notes.  */
+    return process_netbsd_elf_note (pnote);
+
   else if (const_strneq (pnote->namedata, "NetBSD-CORE"))
     /* NetBSD-specific core file notes.  */
     nt = get_netbsd_elfcore_note_type (pnote->type);

Index: src/external/gpl3/binutils/dist/include/elf/common.h
diff -u src/external/gpl3/binutils/dist/include/elf/common.h:1.1.1.2 src/external/gpl3/binutils/dist/include/elf/common.h:1.2
--- src/external/gpl3/binutils/dist/include/elf/common.h:1.1.1.2	Sat Sep 24 22:23:02 2011
+++ src/external/gpl3/binutils/dist/include/elf/common.h	Wed Sep 11 18:53:54 2013
@@ -594,6 +594,7 @@
 /* Values for NetBSD .note.netbsd.ident notes.  Note name is "NetBSD".  */
 
 #define NT_NETBSD_IDENT		1
+#define NT_NETBSD_MARCH		5
 
 /* Values for OpenBSD .note.openbsd.ident notes.  Note name is "OpenBSD".  */
 

Reply via email to