[v1] Add support to recognise 32 bit core file formats in AIX 7.3
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
From: Aditya Kamath <Aditya.Kamath1@ibm.com>
In AIX 7.3 when we take core dump and analyse we get,
gdb/gdb /tmp/crash32 -c /tmp/core
GNU gdb (GDB) 18.0.50.20260728-git
Copyright (C) 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-ibm-aix7.2.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
+------------------------------------------------------------------------------+
| Find the GDB manual online at: |
| http://www.gnu.org/software/gdb/documentation/. |
| For help, type "help". |
| Type "apropos word" to search for commands related to "word". |
+------------------------------------------------------------------------------+
Reading symbols from /tmp/crash32...
"/tmp/core" is not a core dump: file format not recognized
The reason being BFD is not able to recognise the same. This patch is a fix for the same.
After applying the patch we get,
GNU gdb (GDB) 18.0.50.20260728-git
Copyright (C) 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-ibm-aix7.2.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
+------------------------------------------------------------------------------+
| Find the GDB manual online at: |
| http://www.gnu.org/software/gdb/documentation/. |
| For help, type "help". |
| Type "apropos word" to search for commands related to "word". |
+------------------------------------------------------------------------------+
Reading symbols from /tmp/crash32...
Core was generated by `crash32g'.
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) bt
/0 0x10000628 in main ()
/1 0x100002d4 in .__start ()
---
bfd/rs6000-core.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
Comments
On Tue, Jul 28, 2026 at 03:06:33PM +0530, Aditya Vidyadhar Kamath wrote:
> diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
> index 0635960eaee..7edf639fc9a 100644
> --- a/bfd/rs6000-core.c
> +++ b/bfd/rs6000-core.c
This should likely be approved by one of the listed ppc binutils
maintainers. I'm not an aix expert by any means. That said the patch
looks OK to me with one small nit tidied.
> @@ -151,7 +151,9 @@ typedef union
>
> #ifdef AIX_5_CORE
> # define CORE_DUMPXX_VERSION 267312562
> -# define CNEW_IS_CORE_DUMPXX(c) ((c).new_dump.c_version == CORE_DUMPXX_VERSION)
> +# define CORE_DUMPXX_VERSION_AIX73 267312561
> +# define CNEW_IS_CORE_DUMPXX(c) ((c).new_dump.c_version == CORE_DUMPXX_VERSION || \
> + (c).new_dump.c_version == CORE_DUMPXX_VERSION_AIX73)
Overlong lines, and trailing ||. Rewrite as
# define CNEW_IS_CORE_DUMPXX(c) \
((c).new_dump.c_version == CORE_DUMPXX_VERSION \
|| (c).new_dump.c_version == CORE_DUMPXX_VERSION_AIX73)
Hi Alan,
Thank you for the feedback. I have sent a v2 of this patch with the correction.
Hope to get approval and someone can commit this for us.
Thanks and regards,
Aditya.
From: Alan Modra <amodra@gmail.com>
Date: Thursday, 30 July 2026 at 5:07 AM
To: Aditya Vidyadhar Kamath <akamath996@gmail.com>
Cc: binutils@sourceware.org <binutils@sourceware.org>; Aditya Kamath <Aditya.Kamath1@ibm.com>; SANGAMESH MALLAYYA <sangamesh.swamy@in.ibm.com>
Subject: [EXTERNAL] Re: [PATCH v1] Add support to recognise 32 bit core file formats in AIX 7.3
On Tue, Jul 28, 2026 at 03:06:33PM +0530, Aditya Vidyadhar Kamath wrote:
> diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
> index 0635960eaee..7edf639fc9a 100644
> --- a/bfd/rs6000-core.c
> +++ b/bfd/rs6000-core.c
This should likely be approved by one of the listed ppc binutils
maintainers. I'm not an aix expert by any means. That said the patch
looks OK to me with one small nit tidied.
> @@ -151,7 +151,9 @@ typedef union
>
> #ifdef AIX_5_CORE
> # define CORE_DUMPXX_VERSION 267312562
> -# define CNEW_IS_CORE_DUMPXX(c) ((c).new_dump.c_version == CORE_DUMPXX_VERSION)
> +# define CORE_DUMPXX_VERSION_AIX73 267312561
> +# define CNEW_IS_CORE_DUMPXX(c) ((c).new_dump.c_version == CORE_DUMPXX_VERSION || \
> + (c).new_dump.c_version == CORE_DUMPXX_VERSION_AIX73)
Overlong lines, and trailing ||. Rewrite as
# define CNEW_IS_CORE_DUMPXX(c) \
((c).new_dump.c_version == CORE_DUMPXX_VERSION \
|| (c).new_dump.c_version == CORE_DUMPXX_VERSION_AIX73)
--
Alan Modra
@@ -151,7 +151,9 @@ typedef union
#ifdef AIX_5_CORE
# define CORE_DUMPXX_VERSION 267312562
-# define CNEW_IS_CORE_DUMPXX(c) ((c).new_dump.c_version == CORE_DUMPXX_VERSION)
+# define CORE_DUMPXX_VERSION_AIX73 267312561
+# define CNEW_IS_CORE_DUMPXX(c) ((c).new_dump.c_version == CORE_DUMPXX_VERSION || \
+ (c).new_dump.c_version == CORE_DUMPXX_VERSION_AIX73)
#else
# define CNEW_IS_CORE_DUMPXX(c) 0
#endif
@@ -354,11 +356,19 @@ rs6000coff_core_p (bfd *abfd)
return NULL;
}
- /* This isn't the right handler for 64-bit core files on AIX 5.x. */
+ /* This isn't the right handler for 64-bit core files on AIX 5.x.
+ However, 32-bit processes on AIX 7.x can produce core_dumpxx format
+ cores with version 0xfeeddb1, which we need to handle here.
+ The aix5ppc-core.c handler will catch 64-bit cores. */
if (CORE_NEW (core) && CNEW_IS_CORE_DUMPXX (core))
{
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
+ /* Check if this is a 64-bit process core. */
+ if (CNEW_PROC64 (core.new_dump))
+ {
+ /* Let aix5ppc-core.c handle 64-bit cores. */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
}
/* Copy fields from new or old core structure. */
@@ -371,9 +381,9 @@ rs6000coff_core_p (bfd *abfd)
c_lsize = CNEW_LSIZE (core.new_dump);
c_loader = CNEW_LOADER (core.new_dump);
c_extoff = core.new_dump.c_extctx;
-#ifndef BFD64
proc64 = CNEW_PROC64 (core.new_dump);
}
+#ifndef BFD64
else
{
c_flag = core.old.c_flag;
@@ -382,9 +392,9 @@ 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;
}
+#endif
if (proc64)
{
@@ -440,8 +450,11 @@ rs6000coff_core_p (bfd *abfd)
}
/* Don't check the core file size for a full core, AIX 4.1 includes
- additional shared library sections in a full core. */
- if (!(c_flag & (FULL_CORE | CORE_TRUNC)))
+ additional shared library sections in a full core.
+ Also skip the check for AIX 7.3 32-bit cores in core_dumpxx format,
+ as they may have additional sections beyond c_stack + c_size. */
+ if (!(c_flag & (FULL_CORE | CORE_TRUNC))
+ && !(CORE_NEW (core) && CNEW_IS_CORE_DUMPXX (core) && !proc64))
{
/* If the size is wrong, it means we're misinterpreting something. */
if (c_stack + (file_ptr) c_size != statbuf.st_size)