1/* BFD back-end for rs6000 support
2   Copyright 1990, 1991, 1993, 1995, 2000, 2002, 2003
3   Free Software Foundation, Inc.
4   FIXME: Can someone provide a transliteration of this name into ASCII?
5   Using the following chars caused a compiler warning on HIUX (so I replaced
6   them with octal escapes), and isn't useful without an understanding of what
7   character set it is.
8   Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
9   and John Gilmore of Cygnus Support.
10
11This file is part of BFD, the Binary File Descriptor library.
12
13This program is free software; you can redistribute it and/or modify
14it under the terms of the GNU General Public License as published by
15the Free Software Foundation; either version 2 of the License, or
16(at your option) any later version.
17
18This program is distributed in the hope that it will be useful,
19but WITHOUT ANY WARRANTY; without even the implied warranty of
20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21GNU General Public License for more details.
22
23You should have received a copy of the GNU General Public License
24along with this program; if not, write to the Free Software
25Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
26
27#include "bfd.h"
28#include "sysdep.h"
29#include "libbfd.h"
30
31/* The RS/6000 architecture is compatible with the PowerPC common
32   architecture.  */
33
34static const bfd_arch_info_type *rs6000_compatible
35  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
36
37static const bfd_arch_info_type *
38rs6000_compatible (a,b)
39     const bfd_arch_info_type *a;
40     const bfd_arch_info_type *b;
41{
42  BFD_ASSERT (a->arch == bfd_arch_rs6000);
43  switch (b->arch)
44    {
45    default:
46      return NULL;
47    case bfd_arch_rs6000:
48      return bfd_default_compatible (a, b);
49    case bfd_arch_powerpc:
50      if (a->mach == bfd_mach_rs6k)
51	return b;
52      return NULL;
53    }
54  /*NOTREACHED*/
55}
56
57static const bfd_arch_info_type arch_info_struct[] =
58{
59  {
60    32,	/* 32 bits in a word */
61    32,	/* 32 bits in an address */
62    8,	/* 8 bits in a byte */
63    bfd_arch_rs6000,
64    bfd_mach_rs6k_rs1,
65    "rs6000",
66    "rs6000:rs1",
67    3,
68    FALSE, /* not the default */
69    rs6000_compatible,
70    bfd_default_scan,
71    &arch_info_struct[1]
72  },
73  {
74    32,	/* 32 bits in a word */
75    32,	/* 32 bits in an address */
76    8,	/* 8 bits in a byte */
77    bfd_arch_rs6000,
78    bfd_mach_rs6k_rsc,
79    "rs6000",
80    "rs6000:rsc",
81    3,
82    FALSE, /* not the default */
83    rs6000_compatible,
84    bfd_default_scan,
85    &arch_info_struct[2]
86  },
87  {
88    32,	/* 32 bits in a word */
89    32,	/* 32 bits in an address */
90    8,	/* 8 bits in a byte */
91    bfd_arch_rs6000,
92    bfd_mach_rs6k_rs2,
93    "rs6000",
94    "rs6000:rs2",
95    3,
96    FALSE, /* not the default */
97    rs6000_compatible,
98    bfd_default_scan,
99    0
100  }
101};
102
103const bfd_arch_info_type bfd_rs6000_arch =
104  {
105    32,	/* 32 bits in a word */
106    32,	/* 32 bits in an address */
107    8,	/* 8 bits in a byte */
108    bfd_arch_rs6000,
109    bfd_mach_rs6k,	/* POWER common architecture */
110    "rs6000",
111    "rs6000:6000",
112    3,
113    TRUE, /* the default */
114    rs6000_compatible,
115    bfd_default_scan,
116    &arch_info_struct[0]
117  };
118