* elf32-spu.c (build_stub): Fix malloc under-allocation.
[binutils.git] / bfd / cpu-powerpc.c
blob6a652b2bb26d2b33e4aabc4f12c26ba219831806
1 /* BFD PowerPC CPU definition
2 Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2010
3 Free Software Foundation, Inc.
4 Contributed by Ian Lance Taylor, Cygnus Support.
6 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
23 #include "sysdep.h"
24 #include "bfd.h"
25 #include "libbfd.h"
27 /* The common PowerPC architecture is compatible with the RS/6000. */
29 static const bfd_arch_info_type *powerpc_compatible
30 PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
32 static const bfd_arch_info_type *
33 powerpc_compatible (a,b)
34 const bfd_arch_info_type *a;
35 const bfd_arch_info_type *b;
37 BFD_ASSERT (a->arch == bfd_arch_powerpc);
38 switch (b->arch)
40 default:
41 return NULL;
42 case bfd_arch_powerpc:
43 return bfd_default_compatible (a, b);
44 case bfd_arch_rs6000:
45 if (b->mach == bfd_mach_rs6k)
46 return a;
47 return NULL;
49 /*NOTREACHED*/
52 const bfd_arch_info_type bfd_powerpc_archs[] =
54 #if BFD_DEFAULT_TARGET_SIZE == 64
55 /* Default arch must come first. */
57 64, /* 64 bits in a word */
58 64, /* 64 bits in an address */
59 8, /* 8 bits in a byte */
60 bfd_arch_powerpc,
61 bfd_mach_ppc64,
62 "powerpc",
63 "powerpc:common64",
65 TRUE, /* default for 64 bit target */
66 powerpc_compatible,
67 bfd_default_scan,
68 bfd_arch_default_fill,
69 &bfd_powerpc_archs[1]
71 /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
72 being immediately after the 64 bit default. */
74 32, /* 32 bits in a word */
75 32, /* 32 bits in an address */
76 8, /* 8 bits in a byte */
77 bfd_arch_powerpc,
78 bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
79 "powerpc",
80 "powerpc:common",
82 FALSE,
83 powerpc_compatible,
84 bfd_default_scan,
85 bfd_arch_default_fill,
86 &bfd_powerpc_archs[2],
88 #else
89 /* Default arch must come first. */
91 32, /* 32 bits in a word */
92 32, /* 32 bits in an address */
93 8, /* 8 bits in a byte */
94 bfd_arch_powerpc,
95 bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
96 "powerpc",
97 "powerpc:common",
99 TRUE, /* default for 32 bit target */
100 powerpc_compatible,
101 bfd_default_scan,
102 bfd_arch_default_fill,
103 &bfd_powerpc_archs[1],
105 /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
106 being immediately after the 32 bit default. */
108 64, /* 64 bits in a word */
109 64, /* 64 bits in an address */
110 8, /* 8 bits in a byte */
111 bfd_arch_powerpc,
112 bfd_mach_ppc64,
113 "powerpc",
114 "powerpc:common64",
116 FALSE,
117 powerpc_compatible,
118 bfd_default_scan,
119 bfd_arch_default_fill,
120 &bfd_powerpc_archs[2]
122 #endif
124 32, /* 32 bits in a word */
125 32, /* 32 bits in an address */
126 8, /* 8 bits in a byte */
127 bfd_arch_powerpc,
128 bfd_mach_ppc_603,
129 "powerpc",
130 "powerpc:603",
132 FALSE, /* not the default */
133 powerpc_compatible,
134 bfd_default_scan,
135 bfd_arch_default_fill,
136 &bfd_powerpc_archs[3]
139 32, /* 32 bits in a word */
140 32, /* 32 bits in an address */
141 8, /* 8 bits in a byte */
142 bfd_arch_powerpc,
143 bfd_mach_ppc_ec603e,
144 "powerpc",
145 "powerpc:EC603e",
147 FALSE, /* not the default */
148 powerpc_compatible,
149 bfd_default_scan,
150 bfd_arch_default_fill,
151 &bfd_powerpc_archs[4]
154 32, /* 32 bits in a word */
155 32, /* 32 bits in an address */
156 8, /* 8 bits in a byte */
157 bfd_arch_powerpc,
158 bfd_mach_ppc_604,
159 "powerpc",
160 "powerpc:604",
162 FALSE, /* not the default */
163 powerpc_compatible,
164 bfd_default_scan,
165 bfd_arch_default_fill,
166 &bfd_powerpc_archs[5]
169 32, /* 32 bits in a word */
170 32, /* 32 bits in an address */
171 8, /* 8 bits in a byte */
172 bfd_arch_powerpc,
173 bfd_mach_ppc_403,
174 "powerpc",
175 "powerpc:403",
177 FALSE, /* not the default */
178 powerpc_compatible,
179 bfd_default_scan,
180 bfd_arch_default_fill,
181 &bfd_powerpc_archs[6]
184 32, /* 32 bits in a word */
185 32, /* 32 bits in an address */
186 8, /* 8 bits in a byte */
187 bfd_arch_powerpc,
188 bfd_mach_ppc_601,
189 "powerpc",
190 "powerpc:601",
192 FALSE, /* not the default */
193 powerpc_compatible,
194 bfd_default_scan,
195 bfd_arch_default_fill,
196 &bfd_powerpc_archs[7]
199 64, /* 64 bits in a word */
200 64, /* 64 bits in an address */
201 8, /* 8 bits in a byte */
202 bfd_arch_powerpc,
203 bfd_mach_ppc_620,
204 "powerpc",
205 "powerpc:620",
207 FALSE, /* not the default */
208 powerpc_compatible,
209 bfd_default_scan,
210 bfd_arch_default_fill,
211 &bfd_powerpc_archs[8]
214 64, /* 64 bits in a word */
215 64, /* 64 bits in an address */
216 8, /* 8 bits in a byte */
217 bfd_arch_powerpc,
218 bfd_mach_ppc_630,
219 "powerpc",
220 "powerpc:630",
222 FALSE, /* not the default */
223 powerpc_compatible,
224 bfd_default_scan,
225 bfd_arch_default_fill,
226 &bfd_powerpc_archs[9]
229 64, /* 64 bits in a word */
230 64, /* 64 bits in an address */
231 8, /* 8 bits in a byte */
232 bfd_arch_powerpc,
233 bfd_mach_ppc_a35,
234 "powerpc",
235 "powerpc:a35",
237 FALSE, /* not the default */
238 powerpc_compatible,
239 bfd_default_scan,
240 bfd_arch_default_fill,
241 &bfd_powerpc_archs[10]
244 64, /* 64 bits in a word */
245 64, /* 64 bits in an address */
246 8, /* 8 bits in a byte */
247 bfd_arch_powerpc,
248 bfd_mach_ppc_rs64ii,
249 "powerpc",
250 "powerpc:rs64ii",
252 FALSE, /* not the default */
253 powerpc_compatible,
254 bfd_default_scan,
255 bfd_arch_default_fill,
256 &bfd_powerpc_archs[11]
259 64, /* 64 bits in a word */
260 64, /* 64 bits in an address */
261 8, /* 8 bits in a byte */
262 bfd_arch_powerpc,
263 bfd_mach_ppc_rs64iii,
264 "powerpc",
265 "powerpc:rs64iii",
267 FALSE, /* not the default */
268 powerpc_compatible,
269 bfd_default_scan,
270 bfd_arch_default_fill,
271 &bfd_powerpc_archs[12]
274 32, /* 32 bits in a word */
275 32, /* 32 bits in an address */
276 8, /* 8 bits in a byte */
277 bfd_arch_powerpc,
278 bfd_mach_ppc_7400,
279 "powerpc",
280 "powerpc:7400",
282 FALSE, /* not the default */
283 powerpc_compatible,
284 bfd_default_scan,
285 bfd_arch_default_fill,
286 &bfd_powerpc_archs[13]
289 32, /* 32 bits in a word */
290 32, /* 32 bits in an address */
291 8, /* 8 bits in a byte */
292 bfd_arch_powerpc,
293 bfd_mach_ppc_e500,
294 "powerpc",
295 "powerpc:e500",
297 FALSE,
298 powerpc_compatible,
299 bfd_default_scan,
300 bfd_arch_default_fill,
301 &bfd_powerpc_archs[14]
304 32, /* 32 bits in a word */
305 32, /* 32 bits in an address */
306 8, /* 8 bits in a byte */
307 bfd_arch_powerpc,
308 bfd_mach_ppc_e500mc,
309 "powerpc",
310 "powerpc:e500mc",
312 FALSE, /* not the default */
313 powerpc_compatible,
314 bfd_default_scan,
315 bfd_arch_default_fill,
316 &bfd_powerpc_archs[15]
319 64, /* 64 bits in a word */
320 64, /* 64 bits in an address */
321 8, /* 8 bits in a byte */
322 bfd_arch_powerpc,
323 bfd_mach_ppc_e500mc64,
324 "powerpc",
325 "powerpc:e500mc64",
327 FALSE, /* not the default */
328 powerpc_compatible,
329 bfd_default_scan,
330 bfd_arch_default_fill,
331 &bfd_powerpc_archs[16]
334 32, /* 32 bits in a word */
335 32, /* 32 bits in an address */
336 8, /* 8 bits in a byte */
337 bfd_arch_powerpc,
338 bfd_mach_ppc_860,
339 "powerpc",
340 "powerpc:MPC8XX",
342 FALSE, /* not the default */
343 powerpc_compatible,
344 bfd_default_scan,
345 bfd_arch_default_fill,
346 &bfd_powerpc_archs[17]
349 32, /* 32 bits in a word */
350 32, /* 32 bits in an address */
351 8, /* 8 bits in a byte */
352 bfd_arch_powerpc,
353 bfd_mach_ppc_750,
354 "powerpc",
355 "powerpc:750",
357 FALSE, /* not the default */
358 powerpc_compatible,
359 bfd_default_scan,
360 bfd_arch_default_fill,
361 &bfd_powerpc_archs[18]
364 32, /* 32 bits in a word */
365 32, /* 32 bits in an address */
366 8, /* 8 bits in a byte */
367 bfd_arch_powerpc,
368 bfd_mach_ppc_titan,
369 "powerpc",
370 "powerpc:titan",
372 FALSE, /* not the default */
373 powerpc_compatible,
374 bfd_default_scan,
375 bfd_arch_default_fill,