Add XCOFF64 support.
[external/binutils.git] / bfd / cpu-powerpc.c
1 /* BFD PowerPC CPU definition
2    Copyright (C) 1994, 1995, 1996 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
21 #include "bfd.h"
22 #include "sysdep.h"
23 #include "libbfd.h"
24
25 /* The common PowerPC architecture is compatible with the RS/6000.  */
26
27 static const bfd_arch_info_type *powerpc_compatible
28   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
29
30 static const bfd_arch_info_type *
31 powerpc_compatible (a,b)
32      const bfd_arch_info_type *a;
33      const bfd_arch_info_type *b;
34 {
35   BFD_ASSERT (a->arch == bfd_arch_powerpc);
36   switch (b->arch)
37     {
38     default:
39       return NULL;
40     case bfd_arch_powerpc:
41       return bfd_default_compatible (a, b);
42     case bfd_arch_rs6000:
43       if (a->mach == 0)
44         return a;
45       return NULL;
46     }
47   /*NOTREACHED*/
48 }
49
50 static const bfd_arch_info_type arch_info_struct[] =
51 {
52   {
53     32, /* 32 bits in a word */
54     32, /* 32 bits in an address */
55     8,  /* 8 bits in a byte */
56     bfd_arch_powerpc,
57     603, /* for the mpc603 */
58     "powerpc",
59     "powerpc:603",
60     3,
61     false, /* not the default */
62     powerpc_compatible, 
63     bfd_default_scan,
64     &arch_info_struct[1]
65   },
66   {
67     32, /* 32 bits in a word */
68     32, /* 32 bits in an address */
69     8,  /* 8 bits in a byte */
70     bfd_arch_powerpc,
71     604, /* for the mpc604 */
72     "powerpc",
73     "powerpc:604",
74     3,
75     false, /* not the default */
76     powerpc_compatible, 
77     bfd_default_scan,
78     &arch_info_struct[2]
79   },
80   {
81     32, /* 32 bits in a word */
82     32, /* 32 bits in an address */
83     8,  /* 8 bits in a byte */
84     bfd_arch_powerpc,
85     403, /* for the 403 */
86     "powerpc",
87     "powerpc:403",
88     3,
89     false, /* not the default */
90     powerpc_compatible, 
91     bfd_default_scan,
92     &arch_info_struct[3]
93   },
94   {
95     32, /* 32 bits in a word */
96     32, /* 32 bits in an address */
97     8,  /* 8 bits in a byte */
98     bfd_arch_powerpc,
99     601, /* for the mpc601 */
100     "powerpc",
101     "powerpc:601",
102     3,
103     false, /* not the default */
104     powerpc_compatible, 
105     bfd_default_scan,
106     &arch_info_struct[4]
107   },
108   { 
109     32, /* 32 bits in a word */
110     64, /* 64 bits in an address */
111     8,  /* 8 bits in a byte */
112     bfd_arch_powerpc,
113     620, /* for the mpc620 */
114     "powerpc",
115     "powerpc:620",
116     3,
117     false, /* not the default */
118     powerpc_compatible, 
119     bfd_default_scan,
120     0
121   }
122 };
123
124 const bfd_arch_info_type bfd_powerpc_arch =
125   {
126     32, /* 32 bits in a word */
127     32, /* 32 bits in an address */
128     8,  /* 8 bits in a byte */
129     bfd_arch_powerpc,
130     0, /* for the POWER/PowerPC common architecture */
131     "powerpc",
132     "powerpc:common",
133     3,
134     true, /* the default */
135     powerpc_compatible, 
136     bfd_default_scan,
137     &arch_info_struct[0]
138   };