(elf_link_add_object_symbols): Set the error code to bfd_error_wrong_format when
[binutils.git] / bfd / cpu-powerpc.c
bloba4e72d5bf3064af57db8d4228b22d9711c93933e
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.
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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "libbfd.h"
26 /* The common PowerPC architecture is compatible with the RS/6000. */
28 static const bfd_arch_info_type *powerpc_compatible
29 PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
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;
36 BFD_ASSERT (a->arch == bfd_arch_powerpc);
37 switch (b->arch)
39 default:
40 return NULL;
41 case bfd_arch_powerpc:
42 return bfd_default_compatible (a, b);
43 case bfd_arch_rs6000:
44 if (b->mach == bfd_mach_rs6k)
45 return a;
46 return NULL;
48 /*NOTREACHED*/
51 const bfd_arch_info_type bfd_powerpc_archs[] =
53 #if BFD_DEFAULT_TARGET_SIZE == 64
54 /* Default arch must come first. */
56 64, /* 64 bits in a word */
57 64, /* 64 bits in an address */
58 8, /* 8 bits in a byte */
59 bfd_arch_powerpc,
60 bfd_mach_ppc64,
61 "powerpc",
62 "powerpc:common64",
64 TRUE, /* default for 64 bit target */
65 powerpc_compatible,
66 bfd_default_scan,
67 &bfd_powerpc_archs[1]
69 /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
70 being immediately after the 64 bit default. */
72 32, /* 32 bits in a word */
73 32, /* 32 bits in an address */
74 8, /* 8 bits in a byte */
75 bfd_arch_powerpc,
76 bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
77 "powerpc",
78 "powerpc:common",
80 FALSE,
81 powerpc_compatible,
82 bfd_default_scan,
83 &bfd_powerpc_archs[2],
85 #else
86 /* Default arch must come first. */
88 32, /* 32 bits in a word */
89 32, /* 32 bits in an address */
90 8, /* 8 bits in a byte */
91 bfd_arch_powerpc,
92 bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
93 "powerpc",
94 "powerpc:common",
96 TRUE, /* default for 32 bit target */
97 powerpc_compatible,
98 bfd_default_scan,
99 &bfd_powerpc_archs[1],
101 /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
102 being immediately after the 32 bit default. */
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",
112 FALSE,
113 powerpc_compatible,
114 bfd_default_scan,
115 &bfd_powerpc_archs[2]
117 #endif
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",
127 FALSE, /* not the default */
128 powerpc_compatible,
129 bfd_default_scan,
130 &bfd_powerpc_archs[3]
133 32, /* 32 bits in a word */
134 32, /* 32 bits in an address */
135 8, /* 8 bits in a byte */
136 bfd_arch_powerpc,
137 bfd_mach_ppc_ec603e,
138 "powerpc",
139 "powerpc:EC603e",
141 FALSE, /* not the default */
142 powerpc_compatible,
143 bfd_default_scan,
144 &bfd_powerpc_archs[4]
147 32, /* 32 bits in a word */
148 32, /* 32 bits in an address */
149 8, /* 8 bits in a byte */
150 bfd_arch_powerpc,
151 bfd_mach_ppc_604,
152 "powerpc",
153 "powerpc:604",
155 FALSE, /* not the default */
156 powerpc_compatible,
157 bfd_default_scan,
158 &bfd_powerpc_archs[5]
161 32, /* 32 bits in a word */
162 32, /* 32 bits in an address */
163 8, /* 8 bits in a byte */
164 bfd_arch_powerpc,
165 bfd_mach_ppc_403,
166 "powerpc",
167 "powerpc:403",
169 FALSE, /* not the default */
170 powerpc_compatible,
171 bfd_default_scan,
172 &bfd_powerpc_archs[6]
175 32, /* 32 bits in a word */
176 32, /* 32 bits in an address */
177 8, /* 8 bits in a byte */
178 bfd_arch_powerpc,
179 bfd_mach_ppc_601,
180 "powerpc",
181 "powerpc:601",
183 FALSE, /* not the default */
184 powerpc_compatible,
185 bfd_default_scan,
186 &bfd_powerpc_archs[7]
189 64, /* 64 bits in a word */
190 64, /* 64 bits in an address */
191 8, /* 8 bits in a byte */
192 bfd_arch_powerpc,
193 bfd_mach_ppc_620,
194 "powerpc",
195 "powerpc:620",
197 FALSE, /* not the default */
198 powerpc_compatible,
199 bfd_default_scan,
200 &bfd_powerpc_archs[8]
203 64, /* 64 bits in a word */
204 64, /* 64 bits in an address */
205 8, /* 8 bits in a byte */
206 bfd_arch_powerpc,
207 bfd_mach_ppc_630,
208 "powerpc",
209 "powerpc:630",
211 FALSE, /* not the default */
212 powerpc_compatible,
213 bfd_default_scan,
214 &bfd_powerpc_archs[9]
217 64, /* 64 bits in a word */
218 64, /* 64 bits in an address */
219 8, /* 8 bits in a byte */
220 bfd_arch_powerpc,
221 bfd_mach_ppc_a35,
222 "powerpc",
223 "powerpc:a35",
225 FALSE, /* not the default */
226 powerpc_compatible,
227 bfd_default_scan,
228 &bfd_powerpc_archs[10]
231 64, /* 64 bits in a word */
232 64, /* 64 bits in an address */
233 8, /* 8 bits in a byte */
234 bfd_arch_powerpc,
235 bfd_mach_ppc_rs64ii,
236 "powerpc",
237 "powerpc:rs64ii",
239 FALSE, /* not the default */
240 powerpc_compatible,
241 bfd_default_scan,
242 &bfd_powerpc_archs[11]
245 64, /* 64 bits in a word */
246 64, /* 64 bits in an address */
247 8, /* 8 bits in a byte */
248 bfd_arch_powerpc,
249 bfd_mach_ppc_rs64iii,
250 "powerpc",
251 "powerpc:rs64iii",
253 FALSE, /* not the default */
254 powerpc_compatible,
255 bfd_default_scan,
256 &bfd_powerpc_archs[12]
259 32, /* 32 bits in a word */
260 32, /* 32 bits in an address */
261 8, /* 8 bits in a byte */
262 bfd_arch_powerpc,
263 bfd_mach_ppc_7400,
264 "powerpc",
265 "powerpc:7400",
267 FALSE, /* not the default */
268 powerpc_compatible,
269 bfd_default_scan,
270 &bfd_powerpc_archs[13]
273 32, /* 32 bits in a word */
274 32, /* 32 bits in an address */
275 8, /* 8 bits in a byte */
276 bfd_arch_powerpc,
277 bfd_mach_ppc_e500,
278 "powerpc",
279 "powerpc:e500",
281 FALSE,
282 powerpc_compatible,
283 bfd_default_scan,
284 &bfd_powerpc_archs[14]
287 32, /* 32 bits in a word */
288 32, /* 32 bits in an address */
289 8, /* 8 bits in a byte */
290 bfd_arch_powerpc,
291 bfd_mach_ppc_860,
292 "powerpc",
293 "powerpc:MPC8XX",
295 FALSE, /* not the default */
296 powerpc_compatible,
297 bfd_default_scan,