Enable vector register visibility in core file for AIX binutils
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Mon, 13 Mar 2023 12:32:57 +0000 (07:32 -0500)
committerAlan Modra <amodra@gmail.com>
Sun, 19 Mar 2023 13:05:18 +0000 (23:35 +1030)
This patch will enable vector register visibility when AIX FOLKS do
core file analysis.

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

index 0a338ac391b56d272d21ef77cd9dcf8058f2afe3..fae8bb6cb1a15a246f65d7430d34be4e767f0890 100644 (file)
@@ -142,6 +142,27 @@ xcoff64_core_p (bfd *abfd)
   sec->filepos = 0;
   sec->contents = (bfd_byte *)&new_core_hdr->c_flt.r64;
 
+  if (core.c_extctx)
+    {
+      /* vmx section.  */
+      flags = SEC_HAS_CONTENTS;
+      sec = bfd_make_section_anyway_with_flags (abfd, ".aix-vmx", flags);
+      if (sec == NULL)
+       return NULL;
+      sec->size = 560;
+      sec->vma = 0;
+      sec->filepos = core.c_extctx;
+
+      /* vmx section.  */
+      flags = SEC_HAS_CONTENTS;
+      sec = bfd_make_section_anyway_with_flags (abfd, ".aix-vsx", flags);
+      if (sec == NULL)
+       return NULL;
+      sec->size = 256;
+      sec->vma = 0;
+      sec->filepos = core.c_extctx + 584;
+    }
+
   /* .ldinfo section.
      To actually find out how long this section is in this particular
      core dump would require going down the whole list of struct
index eb096098256d221a3b3f9f297c5ba3d903bf4e2f..e8efeef5951f8bf0726e0ce247fbbb45c1f3120c 100644 (file)
@@ -342,7 +342,7 @@ rs6000coff_core_p (bfd *abfd)
   /* Values from new and old core structures.  */
   int c_flag;
   file_ptr c_stack, c_regoff, c_loader;
-  bfd_size_type c_size, c_regsize, c_lsize;
+  bfd_size_type c_size, c_regsize, c_lsize, c_extoff;
   bfd_vma c_stackend;
   void *c_regptr;
   int proc64;
@@ -370,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);
+      c_extoff = core.new_dump.c_extctx;
 #ifndef BFD64
       proc64 = CNEW_PROC64 (core.new_dump);
     }
@@ -517,6 +518,19 @@ rs6000coff_core_p (bfd *abfd)
                          c_regsize, (bfd_vma) 0, c_regoff))
     goto fail;
 
+  if (c_extoff)
+    {
+      if (!make_bfd_asection (abfd, ".aix-vmx",
+                             SEC_HAS_CONTENTS,
+                             560, (bfd_vma) 0, c_extoff))
+       goto fail;
+
+      if (!make_bfd_asection (abfd, ".aix-vsx",
+                             SEC_HAS_CONTENTS,
+                             256, (bfd_vma) 0, c_extoff + 584))
+       goto fail;
+    }
+
   /* .ldinfo section.
      To actually find out how long this section is in this particular
      core dump would require going down the whole list of struct ld_info's.