This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PING/PATCH] Set architecture for NetBSD core files


As a result of my previous post:

   http://sources.redhat.com/ml/binutils/2004-02/msg00078.html

the NetBSD folks changed the machine IDs for amd64 and sparc64.
Here's an adjusted patch that deals with the changed reality.

OK to check this in?


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* libaout.h (enum machine_type): Add M_SPARC64_NETBSD and
	M_X86_64_NETBSD.
	* netbsd-core.c (M_SPARC64_OPENBSD): Define.
	(netbsd_core_file_p): Set architecture from machine ID for
	selected machines.

Index: libaout.h
===================================================================
RCS file: /cvs/src/src/bfd/libaout.h,v
retrieving revision 1.12
diff -u -p -r1.12 libaout.h
--- libaout.h 4 Nov 2003 10:41:51 -0000 1.12
+++ libaout.h 20 Feb 2004 19:17:30 -0000
@@ -305,6 +305,8 @@ enum machine_type {
   M_VAX4K_NETBSD = 150,	/* NetBSD/vax 4K pages binary */
   M_MIPS1 = 151,        /* MIPS R2000/R3000 binary */
   M_MIPS2 = 152,        /* MIPS R4000/R6000 binary */
+  M_SPARC64_NETBSD = 156, /* NetBSD/sparc64 binary */
+  M_X86_64_NETBSD = 157, /* NetBSD/amd64 binary */
   M_SPARCLET_2 = 163,	/* 0xa3, reserved */
   M_SPARCLET_3 = 179,	/* 0xb3, reserved */
   M_SPARCLET_4 = 195,	/* 0xc3, reserved */
Index: netbsd-core.c
===================================================================
RCS file: /cvs/src/src/bfd/netbsd-core.c,v
retrieving revision 1.8
diff -u -p -r1.8 netbsd-core.c
--- netbsd-core.c 1 Dec 2003 06:33:01 -0000 1.8
+++ netbsd-core.c 20 Feb 2004 19:17:30 -0000
@@ -1,6 +1,6 @@
 /* BFD back end for NetBSD style core files
    Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001,
-   2002
+   2002, 2003, 2004
    Free Software Foundation, Inc.
    Written by Paul Kranenburg, EUR
 
@@ -30,6 +30,10 @@ Foundation, Inc., 59 Temple Place - Suit
 #include <signal.h>
 #include <sys/core.h>
 
+/* The machine ID for OpenBSD/sparc64 and older versions of
+   NetBSD/sparc64 overlaps with M_MIPS1.  */
+#define M_SPARC64_OPENBSD	M_MIPS1
+
 /*
  * FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof (struct trapframe))
  */
@@ -158,6 +162,27 @@ netbsd_core_file_p (abfd)
 	  break;
 	}
 #endif
+    }
+
+  /* Set architecture from machine ID.  */
+  switch (CORE_GETMID (core))
+    {
+    case M_X86_64_NETBSD:
+      bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_x86_64);
+      break;
+
+    case M_386_NETBSD:
+      bfd_default_set_arch_mach (abfd, bfd_arch_i386, bfd_mach_i386_i386);
+      break;
+
+    case M_SPARC_NETBSD:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc);
+      break;
+
+    case M_SPARC64_NETBSD:
+    case M_SPARC64_OPENBSD:
+      bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc_v9);
+      break;
     }
 
   /* OK, we believe you.  You're a core file (sure, sure).  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]