Merge from vendor branch HEIMDAL:
[dragonfly.git] / contrib / binutils / bfd / cpu-powerpc.c
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.
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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
21
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "libbfd.h"
25
26 /* The common PowerPC architecture is compatible with the RS/6000.  */
27
28 static const bfd_arch_info_type *powerpc_compatible
29   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
30
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;
35 {
36   BFD_ASSERT (a->arch == bfd_arch_powerpc);
37   switch (b->arch)
38     {
39     default:
40       return NULL;
41     case bfd_arch_powerpc:
42       return bfd_default_compatible (a, b);
43     case bfd_arch_rs6000:
44       if (a->mach == 0)
45         return a;
46       return NULL;
47     }
48   /*NOTREACHED*/
49 }
50
51 const bfd_arch_info_type bfd_powerpc_archs[] =
52 {
53 #if BFD_DEFAULT_TARGET_SIZE == 64 /* default arch must come first.  */
54   {
55     64, /* 64 bits in a word */
56     64, /* 64 bits in an address */
57     8,  /* 8 bits in a byte */
58     bfd_arch_powerpc,
59     bfd_mach_ppc64,
60     "powerpc",
61     "powerpc:common64",
62     3,
63     true, /* default for 64 bit target */
64     powerpc_compatible,
65     bfd_default_scan,
66     &bfd_powerpc_archs[1]
67   },
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_powerpc_archs[2],
81   },
82 #else
83   {
84     32, /* 32 bits in a word */
85     32, /* 32 bits in an address */
86     8,  /* 8 bits in a byte */
87     bfd_arch_powerpc,
88     bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
89     "powerpc",
90     "powerpc:common",
91     3,
92     true, /* default for 32 bit target */
93     powerpc_compatible,
94     bfd_default_scan,
95     &bfd_powerpc_archs[1],
96   },
97   {
98     64, /* 64 bits in a word */
99     64, /* 64 bits in an address */
100     8,  /* 8 bits in a byte */
101     bfd_arch_powerpc,
102     bfd_mach_ppc64,
103     "powerpc",
104     "powerpc:common64",
105     3,
106     false,
107     powerpc_compatible,
108     bfd_default_scan,
109     &bfd_powerpc_archs[2]
110   },
111 #endif
112   {
113     32, /* 32 bits in a word */
114     32, /* 32 bits in an address */
115     8,  /* 8 bits in a byte */
116     bfd_arch_powerpc,
117     bfd_mach_ppc_603,
118     "powerpc",
119     "powerpc:603",
120     3,
121     false, /* not the default */
122     powerpc_compatible,
123     bfd_default_scan,
124     &bfd_powerpc_archs[3]
125   },
126   {
127     32, /* 32 bits in a word */
128     32, /* 32 bits in an address */
129     8,  /* 8 bits in a byte */
130     bfd_arch_powerpc,
131     bfd_mach_ppc_ec603e,
132     "powerpc",
133     "powerpc:EC603e",
134     3,
135     false, /* not the default */
136     powerpc_compatible,
137     bfd_default_scan,
138     &bfd_powerpc_archs[4]
139   },
140   {
141     32, /* 32 bits in a word */
142     32, /* 32 bits in an address */
143     8,  /* 8 bits in a byte */
144     bfd_arch_powerpc,
145     bfd_mach_ppc_604,
146     "powerpc",
147     "powerpc:604",
148     3,
149     false, /* not the default */
150     powerpc_compatible,
151     bfd_default_scan,
152     &bfd_powerpc_archs[5]
153   },
154   {
155     32, /* 32 bits in a word */
156     32, /* 32 bits in an address */
157     8,  /* 8 bits in a byte */
158     bfd_arch_powerpc,
159     bfd_mach_ppc_403,
160     "powerpc",
161     "powerpc:403",
162     3,
163     false, /* not the default */
164     powerpc_compatible,
165     bfd_default_scan,
166     &bfd_powerpc_archs[6]
167   },
168   {
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_601,
174     "powerpc",
175     "powerpc:601",
176     3,
177     false, /* not the default */
178     powerpc_compatible,
179     bfd_default_scan,
180     &bfd_powerpc_archs[7]
181   },
182   {
183     64, /* 64 bits in a word */
184     64, /* 64 bits in an address */
185     8,  /* 8 bits in a byte */
186     bfd_arch_powerpc,
187     bfd_mach_ppc_620,
188     "powerpc",
189     "powerpc:620",
190     3,
191     false, /* not the default */
192     powerpc_compatible,
193     bfd_default_scan,
194     &bfd_powerpc_archs[8]
195   },
196   {
197     64, /* 64 bits in a word */
198     64, /* 64 bits in an address */
199     8,  /* 8 bits in a byte */
200     bfd_arch_powerpc,
201     bfd_mach_ppc_630,
202     "powerpc",
203     "powerpc:630",
204     3,
205     false, /* not the default */
206     powerpc_compatible,
207     bfd_default_scan,
208     &bfd_powerpc_archs[9]
209   },
210   {
211     64, /* 64 bits in a word */
212     64, /* 64 bits in an address */
213     8,  /* 8 bits in a byte */
214     bfd_arch_powerpc,
215     bfd_mach_ppc_a35,
216     "powerpc",
217     "powerpc:a35",
218     3,
219     false, /* not the default */
220     powerpc_compatible,
221     bfd_default_scan,
222     &bfd_powerpc_archs[10]
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_rs64ii,
230     "powerpc",
231     "powerpc:rs64ii",
232     3,
233     false, /* not the default */
234     powerpc_compatible,
235     bfd_default_scan,
236     &bfd_powerpc_archs[11]
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_rs64iii,
244     "powerpc",
245     "powerpc:rs64iii",
246     3,
247     false, /* not the default */
248     powerpc_compatible,
249     bfd_default_scan,
250     &bfd_powerpc_archs[12]
251   },
252   {
253     32, /* 32 bits in a word */
254     32, /* 32 bits in an address */
255     8,  /* 8 bits in a byte */
256     bfd_arch_powerpc,
257     bfd_mach_ppc_7400,
258     "powerpc",
259     "powerpc:7400",
260     3,
261     false, /* not the default */
262     powerpc_compatible,
263     bfd_default_scan,
264     &bfd_powerpc_archs[13]
265   },
266   {
267     32,       /* 32 bits in a word */
268     32,       /* 32 bits in an address */
269     8,        /* 8 bits in a byte */
270     bfd_arch_powerpc,
271     bfd_mach_ppc_860,
272     "powerpc",
273     "powerpc:MPC8XX",
274     3,
275     false, /* not the default */
276     powerpc_compatible,
277     bfd_default_scan,
278     0
279   }
280 };