2009-06-12 Tristan Gingold <gingold@adacore.com>
[binutils.git] / bfd / cpu-powerpc.c
blobb8437bbc4eac7e3cdcf7acf84dc39d826106d105
1 /* BFD PowerPC CPU definition
2 Copyright 1994, 1995, 1996, 2000, 2001, 2002, 2003, 2007, 2008
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_powerpc_archs[1]
70 /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
71 being immediately after the 64 bit default. */
73 32, /* 32 bits in a word */
74 32, /* 32 bits in an address */
75 8, /* 8 bits in a byte */
76 bfd_arch_powerpc,
77 bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
78 "powerpc",
79 "powerpc:common",
81 FALSE,
82 powerpc_compatible,
83 bfd_default_scan,
84 &bfd_powerpc_archs[2],
86 #else
87 /* Default arch must come first. */
89 32, /* 32 bits in a word */
90 32, /* 32 bits in an address */
91 8, /* 8 bits in a byte */
92 bfd_arch_powerpc,
93 bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
94 "powerpc",
95 "powerpc:common",
97 TRUE, /* default for 32 bit target */
98 powerpc_compatible,
99 bfd_default_scan,
100 &bfd_powerpc_archs[1],
102 /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
103 being immediately after the 32 bit default. */
105 64, /* 64 bits in a word */
106 64, /* 64 bits in an address */
107 8, /* 8 bits in a byte */
108 bfd_arch_powerpc,
109 bfd_mach_ppc64,
110 "powerpc",
111 "powerpc:common64",
113 FALSE,
114 powerpc_compatible,
115 bfd_default_scan,
116 &bfd_powerpc_archs[2]
118 #endif
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",
128 FALSE, /* not the default */
129 powerpc_compatible,
130 bfd_default_scan,
131 &bfd_powerpc_archs[3]
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",
142 FALSE, /* not the default */
143 powerpc_compatible,
144 bfd_default_scan,
145 &bfd_powerpc_archs[4]
148 32, /* 32 bits in a word */
149 32, /* 32 bits in an address */
150 8, /* 8 bits in a byte */
151 bfd_arch_powerpc,
152 bfd_mach_ppc_604,
153 "powerpc",
154 "powerpc:604",
156 FALSE, /* not the default */
157 powerpc_compatible,
158 bfd_default_scan,
159 &bfd_powerpc_archs[5]
162 32, /* 32 bits in a word */
163 32, /* 32 bits in an address */
164 8, /* 8 bits in a byte */
165 bfd_arch_powerpc,
166 bfd_mach_ppc_403,
167 "powerpc",
168 "powerpc:403",
170 FALSE, /* not the default */
171 powerpc_compatible,
172 bfd_default_scan,
173 &bfd_powerpc_archs[6]
176 32, /* 32 bits in a word */
177 32, /* 32 bits in an address */
178 8, /* 8 bits in a byte */
179 bfd_arch_powerpc,
180 bfd_mach_ppc_601,
181 "powerpc",
182 "powerpc:601",
184 FALSE, /* not the default */
185 powerpc_compatible,
186 bfd_default_scan,
187 &bfd_powerpc_archs[7]
190 64, /* 64 bits in a word */
191 64, /* 64 bits in an address */
192 8, /* 8 bits in a byte */
193 bfd_arch_powerpc,
194 bfd_mach_ppc_620,
195 "powerpc",
196 "powerpc:620",
198 FALSE, /* not the default */
199 powerpc_compatible,
200 bfd_default_scan,
201 &bfd_powerpc_archs[8]
204 64, /* 64 bits in a word */
205 64, /* 64 bits in an address */
206 8, /* 8 bits in a byte */
207 bfd_arch_powerpc,
208 bfd_mach_ppc_630,
209 "powerpc",
210 "powerpc:630",
212 FALSE, /* not the default */
213 powerpc_compatible,
214 bfd_default_scan,
215 &bfd_powerpc_archs[9]
218 64, /* 64 bits in a word */
219 64, /* 64 bits in an address */
220 8, /* 8 bits in a byte */
221 bfd_arch_powerpc,
222 bfd_mach_ppc_a35,
223 "powerpc",
224 "powerpc:a35",
226 FALSE, /* not the default */
227 powerpc_compatible,
228 bfd_default_scan,
229 &bfd_powerpc_archs[10]
232 64, /* 64 bits in a word */
233 64, /* 64 bits in an address */
234 8, /* 8 bits in a byte */
235 bfd_arch_powerpc,
236 bfd_mach_ppc_rs64ii,
237 "powerpc",
238 "powerpc:rs64ii",
240 FALSE, /* not the default */
241 powerpc_compatible,
242 bfd_default_scan,
243 &bfd_powerpc_archs[11]
246 64, /* 64 bits in a word */
247 64, /* 64 bits in an address */
248 8, /* 8 bits in a byte */
249 bfd_arch_powerpc,
250 bfd_mach_ppc_rs64iii,
251 "powerpc",
252 "powerpc:rs64iii",
254 FALSE, /* not the default */
255 powerpc_compatible,
256 bfd_default_scan,
257 &bfd_powerpc_archs[12]
260 32, /* 32 bits in a word */
261 32, /* 32 bits in an address */
262 8, /* 8 bits in a byte */
263 bfd_arch_powerpc,
264 bfd_mach_ppc_7400,
265 "powerpc",
266 "powerpc:7400",
268 FALSE, /* not the default */
269 powerpc_compatible,
270 bfd_default_scan,
271 &bfd_powerpc_archs[13]
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_e500,
279 "powerpc",
280 "powerpc:e500",
282 FALSE,
283 powerpc_compatible,
284 bfd_default_scan,
285 &bfd_powerpc_archs[14]
288 32, /* 32 bits in a word */
289 32, /* 32 bits in an address */
290 8, /* 8 bits in a byte */
291 bfd_arch_powerpc,
292 bfd_mach_ppc_e500mc,
293 "powerpc",
294 "powerpc:e500mc",
296 FALSE, /* not the default */
297 powerpc_compatible,
298 bfd_default_scan,
299 &bfd_powerpc_archs[15]
302 32, /* 32 bits in a word */
303 32, /* 32 bits in an address */
304 8, /* 8 bits in a byte */
305 bfd_arch_powerpc,
306 bfd_mach_ppc_860,
307 "powerpc",
308 "powerpc:MPC8XX",
310 FALSE, /* not the default */
311 powerpc_compatible,
312 bfd_default_scan,
313 &bfd_powerpc_archs[16]
316 32, /* 32 bits in a word */
317 32, /* 32 bits in an address */
318 8, /* 8 bits in a byte */
319 bfd_arch_powerpc,
320 bfd_mach_ppc_750,
321 "powerpc",
322 "powerpc:750",
324 FALSE, /* not the default */
325 powerpc_compatible,
326 bfd_default_scan,