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