From e0c880965cab990eed0a9236b677b5a7bf5d5559 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 18 Apr 2008 09:22:24 +0000 Subject: [PATCH] * 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. --- bfd/ChangeLog | 11 +++++++++++ bfd/aix5ppc-core.c | 13 ++++++++++++- bfd/rs6000-core.c | 22 +++++++++++++++++++++- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e2867e0..1ac4be9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2008-04-18 Dennis Roberts + + * 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 * config.bfd (i[3-7]86-*-dicos*, x86_64-*-dicos*): Add. diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c index 2b6fd67..7b0695a 100644 --- a/bfd/aix5ppc-core.c +++ b/bfd/aix5ppc-core.c @@ -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 #include +/* 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: diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c index eb0eb52..ad7bef9 100644 --- a/bfd/rs6000-core.c +++ b/bfd/rs6000-core.c @@ -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)) { -- 2.7.4