OSDN Git Service

* aix5ppc-core.c: Define macros for the default architecture and
authorNick Clifton <nickc@redhat.com>
Fri, 18 Apr 2008 09:22:24 +0000 (09:22 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 18 Apr 2008 09:22:24 +0000 (09:22 +0000)
       machine for matching core files.
       (xcoff64_core_p): Set the architecture and machine to the default
       values defined in the macros mentioned above.
       * rs6000-core.c: Define macros to determine whether or not the
       core file header uses the core_dumpxx header format.
       (rs6000coff_core_p): Don't match core files that use the
       core_dumpxx header format.

bfd/ChangeLog
bfd/aix5ppc-core.c
bfd/rs6000-core.c

index e2867e0..1ac4be9 100644 (file)
@@ -1,3 +1,14 @@
+2008-04-18  Dennis Roberts  <dennis.roberts@sunquestinfo.com>
+
+       * aix5ppc-core.c: Define macros for the default architecture and
+       machine for matching core files.
+       (xcoff64_core_p): Set the architecture and machine to the default
+       values defined in the macros mentioned above.
+       * rs6000-core.c: Define macros to determine whether or not the
+       core file header uses the core_dumpxx header format.
+       (rs6000coff_core_p): Don't match core files that use the
+       core_dumpxx header format.
+
 2008-04-16  Pedro Alves  <pedro@codesourcery.com>
 
        * config.bfd (i[3-7]86-*-dicos*, x86_64-*-dicos*): Add.
index 2b6fd67..7b0695a 100644 (file)
@@ -1,5 +1,5 @@
 /* IBM RS/6000 "XCOFF" back-end for BFD.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    Written by Tom Rix
    Contributed by Red Hat Inc.
@@ -40,6 +40,10 @@ int xcoff64_core_file_failing_signal (bfd *);
 #include <sys/ldr.h>
 #include <core.h>
 
+/* The default architecture and machine for matching core files.  */
+#define DEFAULT_ARCHITECTURE   bfd_arch_powerpc
+#define DEFAULT_MACHINE                bfd_mach_ppc_620
+
 #define        core_hdr(abfd)          ((struct core_dumpxx *) abfd->tdata.any)
 
 #define CHECK_FILE_OFFSET(s, v) \
@@ -48,6 +52,8 @@ int xcoff64_core_file_failing_signal (bfd *);
 const bfd_target *
 xcoff64_core_p (bfd *abfd)
 {
+  enum bfd_architecture arch;
+  unsigned long mach;
   struct core_dumpxx core, *new_core_hdr;
   struct stat statbuf;
   asection *sec;
@@ -218,6 +224,11 @@ xcoff64_core_p (bfd *abfd)
        }
     }
 
+  /* Set the architecture and machine.  */
+  arch = DEFAULT_ARCHITECTURE;
+  mach = DEFAULT_MACHINE;
+  bfd_default_set_arch_mach (abfd, arch, mach);
+
   return_value = (bfd_target *) abfd->xvec;    /* This is garbage for now.  */
 
  xcoff64_core_p_error:
index eb0eb52..ad7bef9 100644 (file)
@@ -1,6 +1,6 @@
 /* IBM RS/6000 "XCOFF" back-end for BFD.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-   2001, 2002, 2004, 2006, 2007
+   2001, 2002, 2004, 2006, 2007, 2008
    Free Software Foundation, Inc.
    Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore.
    Archive support from Damon A. Permezel.
@@ -136,6 +136,19 @@ typedef union {
 # define CORE_NEW(c)   0
 #endif
 
+/* Return whether CoreHdr C usese core_dumpxx structure.
+
+   FIXME: the core file format version number used here definitely indicates
+   that struct core_dumpxx should be used to represent the core file header,
+   but that may not be the only such format version number.  */
+
+#ifdef AIX_5_CORE
+# define CORE_DUMPXX_VERSION   267312562
+# define CNEW_IS_CORE_DUMPXX(c) ((c).new.c_version == CORE_DUMPXX_VERSION)
+#else
+# define CNEW_IS_CORE_DUMPXX(c) 0
+#endif
+
 /* Return the c_stackorg field from struct core_dumpx C.  */
 
 #ifdef AIX_CORE_DUMPX_CORE
@@ -329,6 +342,13 @@ rs6000coff_core_p (bfd *abfd)
       return NULL;
     }
 
+  /* This isn't the right handler for 64-bit core files on AIX 5.x.  */
+  if (CORE_NEW (core) && CNEW_IS_CORE_DUMPXX (core))
+    {
+      bfd_set_error (bfd_error_wrong_format);
+      return NULL;
+    }
+
   /* Copy fields from new or old core structure.  */
   if (CORE_NEW (core))
     {