184865Sobrien/* BFD back-end for rs6000 support
2218822Sdim   Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003, 2007
3130561Sobrien   Free Software Foundation, Inc.
4218822Sdim   Written by Mimi Phuong-Thao Vo of IBM
584865Sobrien   and John Gilmore of Cygnus Support.
684865Sobrien
784865SobrienThis file is part of BFD, the Binary File Descriptor library.
884865Sobrien
984865SobrienThis program is free software; you can redistribute it and/or modify
1084865Sobrienit under the terms of the GNU General Public License as published by
1184865Sobrienthe Free Software Foundation; either version 2 of the License, or
1284865Sobrien(at your option) any later version.
1384865Sobrien
1484865SobrienThis program is distributed in the hope that it will be useful,
1584865Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1684865SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1784865SobrienGNU General Public License for more details.
1884865Sobrien
1984865SobrienYou should have received a copy of the GNU General Public License
2084865Sobrienalong with this program; if not, write to the Free Software
21218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2284865Sobrien
23218822Sdim#include "sysdep.h"
2484865Sobrien#include "bfd.h"
2584865Sobrien#include "libbfd.h"
2684865Sobrien
2784865Sobrien/* The RS/6000 architecture is compatible with the PowerPC common
2884865Sobrien   architecture.  */
2984865Sobrien
3084865Sobrienstatic const bfd_arch_info_type *rs6000_compatible
3184865Sobrien  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
3284865Sobrien
3384865Sobrienstatic const bfd_arch_info_type *
3484865Sobrienrs6000_compatible (a,b)
3584865Sobrien     const bfd_arch_info_type *a;
3684865Sobrien     const bfd_arch_info_type *b;
3784865Sobrien{
3884865Sobrien  BFD_ASSERT (a->arch == bfd_arch_rs6000);
3984865Sobrien  switch (b->arch)
4084865Sobrien    {
4184865Sobrien    default:
4284865Sobrien      return NULL;
4384865Sobrien    case bfd_arch_rs6000:
4484865Sobrien      return bfd_default_compatible (a, b);
4584865Sobrien    case bfd_arch_powerpc:
46130561Sobrien      if (a->mach == bfd_mach_rs6k)
4784865Sobrien	return b;
4884865Sobrien      return NULL;
4984865Sobrien    }
5084865Sobrien  /*NOTREACHED*/
5184865Sobrien}
5284865Sobrien
5384865Sobrienstatic const bfd_arch_info_type arch_info_struct[] =
5484865Sobrien{
5584865Sobrien  {
5684865Sobrien    32,	/* 32 bits in a word */
5784865Sobrien    32,	/* 32 bits in an address */
5884865Sobrien    8,	/* 8 bits in a byte */
5984865Sobrien    bfd_arch_rs6000,
6084865Sobrien    bfd_mach_rs6k_rs1,
6184865Sobrien    "rs6000",
6284865Sobrien    "rs6000:rs1",
6384865Sobrien    3,
64130561Sobrien    FALSE, /* not the default */
6584865Sobrien    rs6000_compatible,
6684865Sobrien    bfd_default_scan,
6784865Sobrien    &arch_info_struct[1]
6884865Sobrien  },
6984865Sobrien  {
7084865Sobrien    32,	/* 32 bits in a word */
7184865Sobrien    32,	/* 32 bits in an address */
7284865Sobrien    8,	/* 8 bits in a byte */
7384865Sobrien    bfd_arch_rs6000,
7484865Sobrien    bfd_mach_rs6k_rsc,
7584865Sobrien    "rs6000",
7684865Sobrien    "rs6000:rsc",
7784865Sobrien    3,
78130561Sobrien    FALSE, /* not the default */
7984865Sobrien    rs6000_compatible,
8084865Sobrien    bfd_default_scan,
8184865Sobrien    &arch_info_struct[2]
8284865Sobrien  },
8384865Sobrien  {
8484865Sobrien    32,	/* 32 bits in a word */
8584865Sobrien    32,	/* 32 bits in an address */
8684865Sobrien    8,	/* 8 bits in a byte */
8784865Sobrien    bfd_arch_rs6000,
8884865Sobrien    bfd_mach_rs6k_rs2,
8984865Sobrien    "rs6000",
9084865Sobrien    "rs6000:rs2",
9184865Sobrien    3,
92130561Sobrien    FALSE, /* not the default */
9384865Sobrien    rs6000_compatible,
9484865Sobrien    bfd_default_scan,
9584865Sobrien    0
9684865Sobrien  }
9784865Sobrien};
9884865Sobrien
9984865Sobrienconst bfd_arch_info_type bfd_rs6000_arch =
10084865Sobrien  {
10184865Sobrien    32,	/* 32 bits in a word */
10284865Sobrien    32,	/* 32 bits in an address */
10384865Sobrien    8,	/* 8 bits in a byte */
10484865Sobrien    bfd_arch_rs6000,
10584865Sobrien    bfd_mach_rs6k,	/* POWER common architecture */
10684865Sobrien    "rs6000",
10784865Sobrien    "rs6000:6000",
10884865Sobrien    3,
109130561Sobrien    TRUE, /* the default */
11084865Sobrien    rs6000_compatible,
11184865Sobrien    bfd_default_scan,
11284865Sobrien    &arch_info_struct[0]
11384865Sobrien  };
114