[PATCH 5/8] Cygwin: Fix bfd target for parsing PE files on x86_64 in dumper

Jon Turney jon.turney@dronecode.org.uk
Wed Jul 1 21:25:26 GMT 2020


---
 winsup/utils/parse_pe.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/parse_pe.cc b/winsup/utils/parse_pe.cc
index 90b5c0b0d..d2a510a81 100644
--- a/winsup/utils/parse_pe.cc
+++ b/winsup/utils/parse_pe.cc
@@ -91,7 +91,14 @@ parse_pe (const char *file_name, exclusion * excl_list)
   if (file_name == NULL || excl_list == NULL)
     return 0;
 
-  bfd *abfd = bfd_openr (file_name, "pei-i386");
+#ifdef __x86_64__
+  const char *target = "pei-x86-64";
+#else
+  const char *target = "pei-i386";
+#endif
+
+  bfd *abfd = bfd_openr (file_name, target);
+
   if (abfd == NULL)
     {
       bfd_perror ("failed to open file");
-- 
2.27.0



More information about the Cygwin-patches mailing list