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]

[4/21] Fix o_cputype for 64-bit XCOFF objects


coff_set_arch_mach_hook associates an o_cputype of 2 (TCPU_PP64)
with bfd_mach_ppc_620, but there is no corresponding case in
xcoff64_write_object_contents.  This means that bfd_mach_ppc_620
objects are incorrectly marked with cputype 1 (TCPU_PPC) instead.

According to:

http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.files/doc/aixfiles/XCOFF.htm

the o_cputype field is still "reserved, set to 0", and the native
AIX tools do seem to set it to 0.  However, the native aouthdr.h file
nevertheless defines various TCPU_* values, and:

http://sourceware.org/ml/binutils/2000-05/msg00228.html

implies that GDB _does_ indirectly care about the cputype,
because it can be used to set the bfd_arch when reading the
object back in.  Even if that's no longer true of modern GDBs,
I'm a bit reluctant to break older, working things.  I've therefore
just added the missing case instead.

AIX seems happy with this.  It understandably refuses to load our
pre-patch 64-bit objects (marked as TCPU_PPC), but it seems just
as happy with TCPU_PPC64 as it is with 0.

OK to install?

Richard


bfd/
	* coff64-rs6000.c (xcoff64_write_object_contents): Set the cputype
	to 2 for bfd_mach_ppc_620.

Index: bfd/coff64-rs6000.c
===================================================================
--- bfd/coff64-rs6000.c	2009-03-10 13:38:53.000000000 +0000
+++ bfd/coff64-rs6000.c	2009-03-10 13:43:22.000000000 +0000
@@ -1048,6 +1048,8 @@ xcoff64_write_object_contents (abfd)
 	    case bfd_arch_powerpc:
 	      if (bfd_get_mach (abfd) == bfd_mach_ppc)
 		internal_a.o_cputype = 3;
+	      else if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
+		internal_a.o_cputype = 2;
 	      else
 		internal_a.o_cputype = 1;
 	      break;


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