[newlib-cygwin/main] Cygwin: dumper: add Aarch64 support

Jon Turney via Cygwin-cvs <[email protected]> Thu, 16 Jul 2026 13:15:00 +0000 (GMT)
Newsgroups gmane.os.cygwin.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D5634b574d53=
f7e0c773d15930de1e8979e3ceda3

commit 5634b574d53f7e0c773d15930de1e8979e3ceda3
Author: Chandru Kumaresan <chandru.kumaresan-ftNtnR/FhrXEC4y91aVriVaTQe2KTcn/@public.gmane.org>
Date:   Mon Jul 6 17:31:15 2026 +0530

    Cygwin: dumper: add Aarch64 support
   =20
    Use the correct BFD target vector name for AArch64,
    "elf64-littleaarch64", matching the aarch64_elf64_le_vec
    vector registered by BFD, instead of the previously
    used "elf64-aarch64", which is not a valid BFD target
    name and caused bfd_openw() to fail with "invalid bfd target".
   =20
    Set the BFD architecture/machine appropriately for
    AArch64 (bfd_arch_aarch64 / bfd_mach_aarch64) rather
    than unconditionally using bfd_arch_i386, which only
    applies to the x86_64 build.
   =20
    Signed-off-by: Chandru Kumaresan <chandru.kumaresan-ftNtnR/FhrXEC4y91aVridAWLNoT+7d/@public.gmane.org=
m>
    Signed-off-by: Aswin Kalies <aswin.kalies-ftNtnR/FhrXEC4y91aVriVaTQe2KTcn/@public.gmane.org>

Diff:
---
 winsup/utils/dumper.cc | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc
index b3151e66d..d8c4a530e 100644
--- a/winsup/utils/dumper.cc
+++ b/winsup/utils/dumper.cc
@@ -703,7 +703,7 @@ dumper::init_core_dump ()
 #if defined(__x86_64__)
   const char *target =3D "elf64-x86-64";
 #elif defined(__aarch64__)
-  const char *target =3D "elf64-aarch64";
+  const char *target =3D "elf64-littleaarch64";
 #else
 #error unimplemented for this target
 #endif
@@ -721,11 +721,21 @@ dumper::init_core_dump ()
       goto failed;
     }
=20
-  if (!bfd_set_arch_mach (core_bfd, bfd_arch_i386, 0 /* =3D default */))
-    {
-      bfd_perror ("setting bfd architecture");
-      goto failed;
-    }
+#if defined(__x86_64__)
+  if (!bfd_set_arch_mach(core_bfd, bfd_arch_i386, 0 /* =3D default */))
+  {
+	  bfd_perror("setting bfd architecture");
+	  goto failed;
+  }
+#elif defined(__aarch64__)
+  if (!bfd_set_arch_mach(core_bfd, bfd_arch_aarch64, bfd_mach_aarch64))
+  {
+	  bfd_perror("setting bfd architecture");
+	  goto failed;
+  }
+#else
+#error unimplemented for this target
+#endif
=20
   return 1;