--- bfd/configure_orig 2015-10-16 10:03:17.000000000 -0500 +++ bfd/configure 2015-10-16 10:12:51.000000000 -0500 @@ -14056,7 +14056,7 @@ if test "${target}" = "${host}"; then rs6000-*-lynx*) COREFILE=lynx-core.lo ;; - rs6000-*-aix[5-9].* | powerpc-*-aix[5-9].*) + rs6000-*-aix[5-9].* | powerpc-*-aix[5-9].* | powerpc64-*-aix[5-9].*) COREFILE=rs6000-core.lo COREFLAG="$COREFLAG -DAIX_5_CORE -DAIX_CORE_DUMPX_CORE" ;; @@ -14094,6 +14094,7 @@ rm -f core conftest.err conftest.$ac_obj rs6000-*-*) COREFILE=rs6000-core.lo ;; powerpc-*-aix4*) COREFILE=rs6000-core.lo ;; powerpc-*-aix*) COREFILE=rs6000-core.lo ;; + powerpc64-*-aix*) COREFILE=rs6000-core.lo ;; powerpc-*-beos*) ;; powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu) COREFILE='' ;; --- bfd/rs6000-core.c_orig 2015-10-16 13:07:20.000000000 -0500 +++ bfd/rs6000-core.c 2015-10-19 04:23:26.000000000 -0500 @@ -92,7 +92,7 @@ typedef unsigned long ptr_to_uint; /* Union of 32-bit and 64-bit versions of ld_info. */ typedef union { -#ifdef __ld_info32 +#if defined (__ld_info32) || defined (__ld_info64) struct __ld_info32 l32; struct __ld_info64 l64; #else @@ -109,8 +109,10 @@ typedef union { #else struct core_dump new_dump; /* for simpler coding */ #endif +#ifndef BFD64 /* use old only if gdb is 32-bit */ struct core_dump old; /* old AIX 4.2- core dump, still used on 4.3+ with appropriate SMIT config */ +#endif } CoreHdr; /* Union of old and new vm_info structures. */ @@ -122,14 +124,20 @@ typedef union { #else struct vm_info new_dump; #endif +#ifndef BFD64 struct vm_info old; +#endif } VmInfo; #endif /* Return whether CoreHdr C is in new or old format. */ #ifdef AIX_CORE_DUMPX_CORE -# define CORE_NEW(c) (!(c).old.c_entries) + #ifndef BFD64 + # define CORE_NEW(c) (!(c).old.c_entries) + #else + # define CORE_NEW(c) (!(c).new_dump.c_entries) + #endif #else # define CORE_NEW(c) 0 #endif @@ -258,9 +266,13 @@ typedef union { /* Size of the leading portion that old and new core dump structures have in common. */ -#define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \ - + sizeof (((struct core_dump *) 0)->c_entries)) - +#ifdef AIX_CORE_DUMPX_CORE +#define CORE_COMMONSZ ((long) &((struct core_dumpx *) 0)->c_entries \ + + sizeof (((struct core_dumpx *) 0)->c_entries)) +#else +#define CORE_COMMONSZ ((int) &((struct core_dump *) 0)->c_entries \ + + sizeof (((struct core_dump *) 0)->c_entries) +#endif /* Define prototypes for certain functions, to avoid a compiler warning saying that they are missing. */ @@ -290,8 +302,10 @@ read_hdr (bfd *abfd, CoreHdr *core) /* Read the trailing portion of the structure. */ if (CORE_NEW (*core)) size = sizeof (core->new_dump); + #ifndef BFD64 else size = sizeof (core->old); + #endif size -= CORE_COMMONSZ; return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) == size; } @@ -356,6 +370,7 @@ rs6000coff_core_p (bfd *abfd) c_stackend = CNEW_STACKORG (core.new_dump) + c_size; c_lsize = CNEW_LSIZE (core.new_dump); c_loader = CNEW_LOADER (core.new_dump); + #ifndef BFD64 proc64 = CNEW_PROC64 (core.new_dump); } else @@ -366,6 +381,7 @@ rs6000coff_core_p (bfd *abfd) c_stackend = COLD_STACKEND; c_lsize = 0x7ffffff; c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old); + #endif proc64 = 0; } @@ -379,11 +395,13 @@ rs6000coff_core_p (bfd *abfd) c_regsize = sizeof (CNEW_MSTSAVE (core.new_dump)); c_regptr = &CNEW_MSTSAVE (core.new_dump); } + #ifndef BFD64 else { c_regsize = sizeof (COLD_MSTSAVE (core.old)); c_regptr = &COLD_MSTSAVE (core.old); } + #endif c_regoff = (char *) c_regptr - (char *) &core; if (bfd_stat (abfd, &statbuf) < 0) @@ -433,7 +451,11 @@ rs6000coff_core_p (bfd *abfd) } /* Sanity check on the c_tab field. */ + #ifndef BFD64 if (!CORE_NEW (core) && (c_loader < (file_ptr) sizeof core.old || + #else + if (!CORE_NEW (core) && (c_loader < (file_ptr) sizeof core.new_dump || + #endif c_loader >= statbuf.st_size || c_loader >= c_stack)) { @@ -447,7 +469,11 @@ rs6000coff_core_p (bfd *abfd) bfd_get_filename (abfd)); /* Allocate core file header. */ + #ifndef BFD64 size = CORE_NEW (core) ? sizeof (core.new_dump) : sizeof (core.old); + #else + size = sizeof (core.new_dump); + #endif tmpptr = (char *) bfd_zalloc (abfd, (bfd_size_type) size); if (!tmpptr) return NULL; @@ -540,6 +566,7 @@ rs6000coff_core_p (bfd *abfd) c_vmregions = core.new_dump.c_vmregions; c_vmm = (file_ptr) core.new_dump.c_vmm; } + #ifndef BFD64 else { c_datasize = core.old.c_datasize; @@ -547,6 +574,7 @@ rs6000coff_core_p (bfd *abfd) c_vmregions = core.old.c_vmregions; c_vmm = (file_ptr) (ptr_to_uint) core.old.c_vmm; } + #endif /* .data section from executable. */ if (c_datasize) @@ -613,7 +641,11 @@ rs6000coff_core_p (bfd *abfd) file_ptr vminfo_offset; bfd_vma vminfo_addr; + #ifndef BFD64 size = CORE_NEW (core) ? sizeof (vminfo.new_dump) : sizeof (vminfo.old); + #else + size = sizeof (vminfo.new_dump); + #endif if (bfd_bread (&vminfo, size, abfd) != size) goto fail; @@ -623,12 +655,14 @@ rs6000coff_core_p (bfd *abfd) vminfo_size = vminfo.new_dump.vminfo_size; vminfo_offset = vminfo.new_dump.vminfo_offset; } + #ifndef BFD64 else { vminfo_addr = (bfd_vma) (ptr_to_uint) vminfo.old.vminfo_addr; vminfo_size = vminfo.old.vminfo_size; vminfo_offset = vminfo.old.vminfo_offset; } + #endif if (vminfo_offset) if (!make_bfd_asection (abfd, ".vmdata", @@ -668,8 +702,10 @@ rs6000coff_core_file_matches_executable_ if (CORE_NEW (core)) c_loader = CNEW_LOADER (core.new_dump); + #ifndef BFD64 else c_loader = (file_ptr) (ptr_to_uint) COLD_LOADER (core.old); + #endif if (CORE_NEW (core) && CNEW_PROC64 (core.new_dump)) size = (int) ((LdInfo *) 0)->l64.ldinfo_filename; @@ -732,8 +768,12 @@ char * rs6000coff_core_file_failing_command (bfd *abfd) { CoreHdr *core = core_hdr (abfd); + #ifndef BFD64 char *com = CORE_NEW (*core) ? CNEW_COMM (core->new_dump) : COLD_COMM (core->old); + #else + char *com = CNEW_COMM (core->new_dump); + #endif if (*com) return com; @@ -745,7 +785,11 @@ int rs6000coff_core_file_failing_signal (bfd *abfd) { CoreHdr *core = core_hdr (abfd); + #ifndef BFD64 return CORE_NEW (*core) ? core->new_dump.c_signo : core->old.c_signo; + #else + return core->new_dump.c_signo; + #endif } #endif /* AIX_CORE */