* archures (bfd_mach_ppc64): Define.
[external/binutils.git] / bfd / cpu-powerpc.c
1 /* BFD PowerPC CPU definition
2    Copyright 1994, 1995, 1996, 2000, 2001, 2002
3    Free Software Foundation, Inc.
4    Contributed by Ian Lance Taylor, Cygnus Support.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
21
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "libbfd.h"
25
26 /* The common PowerPC architecture is compatible with the RS/6000.  */
27
28 static const bfd_arch_info_type *powerpc_compatible
29   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
30
31 static const bfd_arch_info_type *
32 powerpc_compatible (a,b)
33      const bfd_arch_info_type *a;
34      const bfd_arch_info_type *b;
35 {
36   BFD_ASSERT (a->arch == bfd_arch_powerpc);
37   switch (b->arch)
38     {
39     default:
40       return NULL;
41     case bfd_arch_powerpc:
42       return bfd_default_compatible (a, b);
43     case bfd_arch_rs6000:
44       if (a->mach == 0)
45         return a;
46       return NULL;
47     }
48   /*NOTREACHED*/
49 }
50
51 const bfd_arch_info_type bfd_powerpc_archs[] =
52 {
53   {
54     32, /* 32 bits in a word */
55     32, /* 32 bits in an address */
56     8,  /* 8 bits in a byte */
57     bfd_arch_powerpc,
58     bfd_mach_ppc_603,
59     "powerpc",
60     "powerpc:603",
61     3,
62     false, /* not the default */
63     powerpc_compatible,
64     bfd_default_scan,
65     &bfd_powerpc_archs[1]
66   },
67   {
68     32, /* 32 bits in a word */
69     32, /* 32 bits in an address */
70     8,  /* 8 bits in a byte */
71     bfd_arch_powerpc,
72     bfd_mach_ppc_ec603e,
73     "powerpc",
74     "powerpc:EC603e",
75     3,
76     false, /* not the default */
77     powerpc_compatible,
78     bfd_default_scan,
79     &bfd_powerpc_archs[2]
80   },
81   {
82     32, /* 32 bits in a word */
83     32, /* 32 bits in an address */
84     8,  /* 8 bits in a byte */
85     bfd_arch_powerpc,
86     bfd_mach_ppc_604,
87     "powerpc",
88     "powerpc:604",
89     3,
90     false, /* not the default */
91     powerpc_compatible,
92     bfd_default_scan,
93     &bfd_powerpc_archs[3]
94   },
95   {
96     32, /* 32 bits in a word */
97     32, /* 32 bits in an address */
98     8,  /* 8 bits in a byte */
99     bfd_arch_powerpc,
100     bfd_mach_ppc_403,
101     "powerpc",
102     "powerpc:403",
103     3,
104     false, /* not the default */
105     powerpc_compatible,
106     bfd_default_scan,
107     &bfd_powerpc_archs[4]
108   },
109   {
110     32, /* 32 bits in a word */
111     32, /* 32 bits in an address */
112     8,  /* 8 bits in a byte */
113     bfd_arch_powerpc,
114     bfd_mach_ppc_601,
115     "powerpc",
116     "powerpc:601",
117     3,
118     false, /* not the default */
119     powerpc_compatible,
120     bfd_default_scan,
121     &bfd_powerpc_archs[5]
122   },
123   {
124     64, /* 64 bits in a word */
125     64, /* 64 bits in an address */
126     8,  /* 8 bits in a byte */
127     bfd_arch_powerpc,
128     bfd_mach_ppc_620,
129     "powerpc",
130     "powerpc:620",
131     3,
132     false, /* not the default */
133     powerpc_compatible,
134     bfd_default_scan,
135     &bfd_powerpc_archs[6]
136   },
137   {
138     64, /* 64 bits in a word */
139     64, /* 64 bits in an address */
140     8,  /* 8 bits in a byte */
141     bfd_arch_powerpc,
142     bfd_mach_ppc_630,
143     "powerpc",
144     "powerpc:630",
145     3,
146     false, /* not the default */
147     powerpc_compatible,
148     bfd_default_scan,
149     &bfd_powerpc_archs[7]
150   },
151   {
152     64, /* 64 bits in a word */
153     64, /* 64 bits in an address */
154     8,  /* 8 bits in a byte */
155     bfd_arch_powerpc,
156     bfd_mach_ppc_a35,
157     "powerpc",
158     "powerpc:a35",
159     3,
160     false, /* not the default */
161     powerpc_compatible,
162     bfd_default_scan,
163     &bfd_powerpc_archs[8]
164   },
165   {
166     64, /* 64 bits in a word */
167     64, /* 64 bits in an address */
168     8,  /* 8 bits in a byte */
169     bfd_arch_powerpc,
170     bfd_mach_ppc_rs64ii,
171     "powerpc",
172     "powerpc:rs64ii",
173     3,
174     false, /* not the default */
175     powerpc_compatible,
176     bfd_default_scan,
177     &bfd_powerpc_archs[9]
178   },
179   {
180     64, /* 64 bits in a word */
181     64, /* 64 bits in an address */
182     8,  /* 8 bits in a byte */
183     bfd_arch_powerpc,
184     bfd_mach_ppc_rs64iii,
185     "powerpc",
186     "powerpc:rs64iii",
187     3,
188     false, /* not the default */
189     powerpc_compatible,
190     bfd_default_scan,
191     &bfd_powerpc_archs[10]
192   },
193   {
194     32, /* 32 bits in a word */
195     32, /* 32 bits in an address */
196     8,  /* 8 bits in a byte */
197     bfd_arch_powerpc,
198     bfd_mach_ppc_7400,
199     "powerpc",
200     "powerpc:7400",
201     3,
202     false, /* not the default */
203     powerpc_compatible,
204     bfd_default_scan,
205     &bfd_powerpc_archs[11]
206   },
207   {
208     32,       /* 32 bits in a word */
209     32,       /* 32 bits in an address */
210     8,        /* 8 bits in a byte */
211     bfd_arch_powerpc,
212     bfd_mach_ppc_860,
213     "powerpc",
214     "powerpc:MPC8XX",
215     3,
216     false, /* not the default */
217     powerpc_compatible,
218     bfd_default_scan,
219     &bfd_powerpc_archs[12]
220   },
221   {
222     64, /* 64 bits in a word */
223     64, /* 64 bits in an address */
224     8,  /* 8 bits in a byte */
225     bfd_arch_powerpc,
226     bfd_mach_ppc64,
227     "powerpc",
228     "powerpc:common64",
229     3,
230     BFD_DEFAULT_TARGET_SIZE == 64, /* default for 64 bit target */
231     powerpc_compatible,
232     bfd_default_scan,
233     &bfd_powerpc_archs[13]
234   },
235   {
236     32, /* 32 bits in a word */
237     32, /* 32 bits in an address */
238     8,  /* 8 bits in a byte */
239     bfd_arch_powerpc,
240     bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
241     "powerpc",
242     "powerpc:common",
243     3,
244     BFD_DEFAULT_TARGET_SIZE != 64, /* default for 32 bit target */
245     powerpc_compatible,
246     bfd_default_scan,
247     0
248   }
249 };