This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Don't match PE/EFI target with EFI/PE file


Alan Modra wrote:
On Mon, Jun 18, 2007 at 05:10:14PM +0100, Nick Clifton wrote:
2007-06-09 H.J. Lu <hongjiu.lu@intel.com>

	* libpei.h (_bfd_XXi_final_link_postscript): Remove
	duplication.
	(bfd_target_pei_p): New.
	(bfd_target_pei_arch): New
	(bfd_target_efi_p): Likewise.
	(bfd_target_efi_arch): New
	(bfd_pe_executable_p): Use bfd_target_pei_p and
	bfd_target_efi_p.

	* peicode.h (arch_type): New enum.
	(pe_arch): New function.
	(pe_bfd_object_p): Don't match PE/EFI target with EFI/PE file
	if there is an EFI/PE target.
Approved - please apply.

I believe this patch is responsible for multiple testsuite failures on non-x86 pe targets. eg. arm-wince-pe and mcore-pe. HJ would you please look into it?


I was just looking at it, as it also breaks gdb.


This is what I have now.  Minimally tested on arm-wince.  It should also
fix epoc, but I haven't tested it yet.  (Posted to minimize work
duplication with HJ - be my guest to pick it up.)

Cheers,
Pedro Alves

2007-07-05  Pedro Alves  <pedro_alves@portugalmail.pt>

	* libpei.h (bfd_target_pei_p): Handle "epoc-pei".
	(bfd_target_pei_arch): Likewise.
	* peicode.h (arch_type): Add arch_type_arm_little and
	arch_type_arm_big.
	(pe_arch): Handle arm-wince-little, arm-little, arm-wince-big
	and arm-big.

---
 libpei.h  |    7 +++++--
 peicode.h |   12 +++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

Index: bfd/libpei.h
===================================================================
--- bfd.orig/libpei.h	2007-07-03 21:12:54.000000000 +0100
+++ bfd/libpei.h	2007-07-05 00:56:46.000000000 +0100
@@ -303,11 +303,14 @@
 
 /* Returns true if the target is a PE executable target.  */
 #define bfd_target_pei_p(xvec)				\
-  (CONST_STRNEQ ((xvec)->name, "pei-"))
+  (CONST_STRNEQ ((xvec)->name, "pei-") 			\
+    || CONST_STRNEQ ((xvec)->name, "epoc-pei-"))
 
 /* Return the arch string of a PE executable target.  */
 #define bfd_target_pei_arch(xvec)				\
-  ((xvec)->name + sizeof ("pei-") - 1)
+  (CONST_STRNEQ ((xvec)->name, "pei-") 				\
+    ? ((xvec)->name + sizeof ("pei-") - 1) 			\
+    : ((xvec)->name + sizeof ("epoc-pei-") - 1)) 		\
 
 /* Returns true if the target is an EFI target.  */
 #define bfd_target_efi_p(xvec)				\
Index: bfd/peicode.h
===================================================================
--- bfd.orig/peicode.h	2007-07-03 21:13:16.000000000 +0100
+++ bfd/peicode.h	2007-07-05 01:03:30.000000000 +0100
@@ -1240,7 +1240,9 @@ enum arch_type
 {
   arch_type_unknown,
   arch_type_i386,
-  arch_type_x86_64
+  arch_type_x86_64,
+  arch_type_arm_little,
+  arch_type_arm_big
 };
 
 static enum arch_type
@@ -1252,6 +1254,14 @@ pe_arch (const char *arch)
   if (strcmp (arch, "x86_64") == 0 || strcmp (arch, "x86-64") == 0)
     return arch_type_x86_64;
 
+  if (strcmp (arch, "arm-wince-little") == 0
+      || strcmp (arch, "arm-little") == 0)
+    return arch_type_arm_little;
+
+  if (strcmp (arch, "arm-wince-big") == 0
+      || strcmp (arch, "arm-big") == 0)
+    return arch_type_arm_big;
+
   return arch_type_unknown;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]