[4/21] Fix o_cputype for 64-bit XCOFF objects
Tue Mar 10 14:05:00 GMT 2009
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.
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:
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?
* coff64-rs6000.c (xcoff64_write_object_contents): Set the cputype
to 2 for bfd_mach_ppc_620.
--- 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)
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;
internal_a.o_cputype = 1;
More information about the Binutils