* configure: Regenerate.
[external/binutils.git] / bfd / cpu-powerpc.c
1 /* BFD PowerPC CPU definition
2    Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2005, 2007, 2008,
3    2010, 2012 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
21    MA 02110-1301, USA.  */
22
23 #include "sysdep.h"
24 #include "bfd.h"
25 #include "libbfd.h"
26
27 /* The common PowerPC architecture is compatible with the RS/6000.  */
28
29 static const bfd_arch_info_type *
30 powerpc_compatible (const bfd_arch_info_type *a,
31                     const bfd_arch_info_type *b)
32 {
33   BFD_ASSERT (a->arch == bfd_arch_powerpc);
34   switch (b->arch)
35     {
36     default:
37       return NULL;
38     case bfd_arch_powerpc:
39       return bfd_default_compatible (a, b);
40     case bfd_arch_rs6000:
41       if (b->mach == bfd_mach_rs6k)
42         return a;
43       return NULL;
44     }
45   /*NOTREACHED*/
46 }
47
48 const bfd_arch_info_type bfd_powerpc_archs[] =
49 {
50 #if BFD_DEFAULT_TARGET_SIZE == 64
51   /* Default arch must come first.  */
52   {
53     64, /* 64 bits in a word */
54     64, /* 64 bits in an address */
55     8,  /* 8 bits in a byte */
56     bfd_arch_powerpc,
57     bfd_mach_ppc64,
58     "powerpc",
59     "powerpc:common64",
60     3,
61     TRUE, /* default for 64 bit target */
62     powerpc_compatible,
63     bfd_default_scan,
64     bfd_arch_default_fill,
65     &bfd_powerpc_archs[1]
66   },
67   /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
68      being immediately after the 64 bit default.  */
69   {
70     32, /* 32 bits in a word */
71     32, /* 32 bits in an address */
72     8,  /* 8 bits in a byte */
73     bfd_arch_powerpc,
74     bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
75     "powerpc",
76     "powerpc:common",
77     3,
78     FALSE,
79     powerpc_compatible,
80     bfd_default_scan,
81     bfd_arch_default_fill,
82     &bfd_powerpc_archs[2],
83   },
84 #else
85   /* Default arch must come first.  */
86   {
87     32, /* 32 bits in a word */
88     32, /* 32 bits in an address */
89     8,  /* 8 bits in a byte */
90     bfd_arch_powerpc,
91     bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
92     "powerpc",
93     "powerpc:common",
94     3,
95     TRUE, /* default for 32 bit target */
96     powerpc_compatible,
97     bfd_default_scan,
98     bfd_arch_default_fill,
99     &bfd_powerpc_archs[1],
100   },
101   /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
102      being immediately after the 32 bit default.  */
103   {
104     64, /* 64 bits in a word */
105     64, /* 64 bits in an address */
106     8,  /* 8 bits in a byte */
107     bfd_arch_powerpc,
108     bfd_mach_ppc64,
109     "powerpc",
110     "powerpc:common64",
111     3,
112     FALSE,
113     powerpc_compatible,
114     bfd_default_scan,
115     bfd_arch_default_fill,
116     &bfd_powerpc_archs[2]
117   },
118 #endif
119   {
120     32, /* 32 bits in a word */
121     32, /* 32 bits in an address */
122     8,  /* 8 bits in a byte */
123     bfd_arch_powerpc,
124     bfd_mach_ppc_603,
125     "powerpc",
126     "powerpc:603",
127     3,
128     FALSE, /* not the default */
129     powerpc_compatible,
130     bfd_default_scan,
131     bfd_arch_default_fill,
132     &bfd_powerpc_archs[3]
133   },
134   {
135     32, /* 32 bits in a word */
136     32, /* 32 bits in an address */
137     8,  /* 8 bits in a byte */
138     bfd_arch_powerpc,
139     bfd_mach_ppc_ec603e,
140     "powerpc",
141     "powerpc:EC603e",
142     3,
143     FALSE, /* not the default */
144     powerpc_compatible,
145     bfd_default_scan,
146     bfd_arch_default_fill,
147     &bfd_powerpc_archs[4]
148   },
149   {
150     32, /* 32 bits in a word */
151     32, /* 32 bits in an address */
152     8,  /* 8 bits in a byte */
153     bfd_arch_powerpc,
154     bfd_mach_ppc_604,
155     "powerpc",
156     "powerpc:604",
157     3,
158     FALSE, /* not the default */
159     powerpc_compatible,
160     bfd_default_scan,
161     bfd_arch_default_fill,
162     &bfd_powerpc_archs[5]
163   },
164   {
165     32, /* 32 bits in a word */
166     32, /* 32 bits in an address */
167     8,  /* 8 bits in a byte */
168     bfd_arch_powerpc,
169     bfd_mach_ppc_403,
170     "powerpc",
171     "powerpc:403",
172     3,
173     FALSE, /* not the default */
174     powerpc_compatible,
175     bfd_default_scan,
176     bfd_arch_default_fill,
177     &bfd_powerpc_archs[6]
178   },
179   {
180     32, /* 32 bits in a word */
181     32, /* 32 bits in an address */
182     8,  /* 8 bits in a byte */
183     bfd_arch_powerpc,
184     bfd_mach_ppc_601,
185     "powerpc",
186     "powerpc:601",
187     3,
188     FALSE, /* not the default */
189     powerpc_compatible,
190     bfd_default_scan,
191     bfd_arch_default_fill,
192     &bfd_powerpc_archs[7]
193   },
194   {
195     64, /* 64 bits in a word */
196     64, /* 64 bits in an address */
197     8,  /* 8 bits in a byte */
198     bfd_arch_powerpc,
199     bfd_mach_ppc_620,
200     "powerpc",
201     "powerpc:620",
202     3,
203     FALSE, /* not the default */
204     powerpc_compatible,
205     bfd_default_scan,
206     bfd_arch_default_fill,
207     &bfd_powerpc_archs[8]
208   },
209   {
210     64, /* 64 bits in a word */
211     64, /* 64 bits in an address */
212     8,  /* 8 bits in a byte */
213     bfd_arch_powerpc,
214     bfd_mach_ppc_630,
215     "powerpc",
216     "powerpc:630",
217     3,
218     FALSE, /* not the default */
219     powerpc_compatible,
220     bfd_default_scan,
221     bfd_arch_default_fill,
222     &bfd_powerpc_archs[9]
223   },
224   {
225     64, /* 64 bits in a word */
226     64, /* 64 bits in an address */
227     8,  /* 8 bits in a byte */
228     bfd_arch_powerpc,
229     bfd_mach_ppc_a35,
230     "powerpc",
231     "powerpc:a35",
232     3,
233     FALSE, /* not the default */
234     powerpc_compatible,
235     bfd_default_scan,
236     bfd_arch_default_fill,
237     &bfd_powerpc_archs[10]
238   },
239   {
240     64, /* 64 bits in a word */
241     64, /* 64 bits in an address */
242     8,  /* 8 bits in a byte */
243     bfd_arch_powerpc,
244     bfd_mach_ppc_rs64ii,
245     "powerpc",
246     "powerpc:rs64ii",
247     3,
248     FALSE, /* not the default */
249     powerpc_compatible,
250     bfd_default_scan,
251     bfd_arch_default_fill,
252     &bfd_powerpc_archs[11]
253   },
254   {
255     64, /* 64 bits in a word */
256     64, /* 64 bits in an address */
257     8,  /* 8 bits in a byte */
258     bfd_arch_powerpc,
259     bfd_mach_ppc_rs64iii,
260     "powerpc",
261     "powerpc:rs64iii",
262     3,
263     FALSE, /* not the default */
264     powerpc_compatible,
265     bfd_default_scan,
266     bfd_arch_default_fill,
267     &bfd_powerpc_archs[12]
268   },
269   {
270     32, /* 32 bits in a word */
271     32, /* 32 bits in an address */
272     8,  /* 8 bits in a byte */
273     bfd_arch_powerpc,
274     bfd_mach_ppc_7400,
275     "powerpc",
276     "powerpc:7400",
277     3,
278     FALSE, /* not the default */
279     powerpc_compatible,
280     bfd_default_scan,
281     bfd_arch_default_fill,
282     &bfd_powerpc_archs[13]
283   },
284   {
285     32, /* 32 bits in a word */
286     32, /* 32 bits in an address */
287     8,  /* 8 bits in a byte */
288     bfd_arch_powerpc,
289     bfd_mach_ppc_e500,
290     "powerpc",
291     "powerpc:e500",
292     3,
293     FALSE,
294     powerpc_compatible,
295     bfd_default_scan,
296     bfd_arch_default_fill,
297     &bfd_powerpc_archs[14]
298   },
299   {
300     32,        /* 32 bits in a word */
301     32,        /* 32 bits in an address */
302     8, /* 8 bits in a byte */
303     bfd_arch_powerpc,
304     bfd_mach_ppc_e500mc,
305     "powerpc",
306     "powerpc:e500mc",
307     3,
308     FALSE, /* not the default */
309     powerpc_compatible,
310     bfd_default_scan,
311     bfd_arch_default_fill,
312     &bfd_powerpc_archs[15]
313   },
314   {
315     64, /* 64 bits in a word */
316     64, /* 64 bits in an address */
317     8,  /* 8 bits in a byte */
318     bfd_arch_powerpc,
319     bfd_mach_ppc_e500mc64,
320     "powerpc",
321     "powerpc:e500mc64",
322     3,
323     FALSE, /* not the default */
324     powerpc_compatible,
325     bfd_default_scan,
326     bfd_arch_default_fill,
327     &bfd_powerpc_archs[16]
328   },
329   {
330     32,       /* 32 bits in a word */
331     32,       /* 32 bits in an address */
332     8,        /* 8 bits in a byte */
333     bfd_arch_powerpc,
334     bfd_mach_ppc_860,
335     "powerpc",
336     "powerpc:MPC8XX",
337     3,
338     FALSE, /* not the default */
339     powerpc_compatible,
340     bfd_default_scan,
341     bfd_arch_default_fill,
342     &bfd_powerpc_archs[17]
343   },
344   {
345     32, /* 32 bits in a word */
346     32, /* 32 bits in an address */
347     8,  /* 8 bits in a byte */
348     bfd_arch_powerpc,
349     bfd_mach_ppc_750,
350     "powerpc",
351     "powerpc:750",
352     3,
353     FALSE, /* not the default */
354     powerpc_compatible,
355     bfd_default_scan,
356     bfd_arch_default_fill,
357     &bfd_powerpc_archs[18]
358   },
359   {
360     32, /* 32 bits in a word */
361     32, /* 32 bits in an address */
362     8,  /* 8 bits in a byte */
363     bfd_arch_powerpc,
364     bfd_mach_ppc_titan,
365     "powerpc",
366     "powerpc:titan",
367     3,
368     FALSE, /* not the default */
369     powerpc_compatible,
370     bfd_default_scan,
371     bfd_arch_default_fill,
372     &bfd_powerpc_archs[19]
373   },
374   {
375     16, /* 16 or 32 bits in a word */
376     32, /* 32 bits in an address */
377     8,  /* 8 bits in a byte */
378     bfd_arch_powerpc,
379     bfd_mach_ppc_vle,
380     "powerpc",
381     "powerpc:vle",
382     3,
383     FALSE, /* not the default */
384     powerpc_compatible,
385     bfd_default_scan,
386     bfd_arch_default_fill,
387     &bfd_powerpc_archs[20]
388   },
389   {
390     64, /* 64 bits in a word */
391     64, /* 64 bits in an address */
392     8,  /* 8 bits in a byte */
393     bfd_arch_powerpc,
394     bfd_mach_ppc_e5500,
395     "powerpc",
396     "powerpc:e5500",
397     3,
398     FALSE, /* not the default */
399     powerpc_compatible,
400     bfd_default_scan,
401     bfd_arch_default_fill,
402     &bfd_powerpc_archs[21]
403   },
404   {
405     64, /* 64 bits in a word */
406     64, /* 64 bits in an address */
407     8,  /* 8 bits in a byte */
408     bfd_arch_powerpc,
409     bfd_mach_ppc_e6500,
410     "powerpc",
411     "powerpc:e6500",
412     3,
413     FALSE, /* not the default */
414     powerpc_compatible,
415     bfd_default_scan,
416     bfd_arch_default_fill,
417     0
418   }
419 };