| 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 == bfd_mach_ppc) | 
|---|
| 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 | 
|---|
| 54 | /* Default arch must come first.  */ | 
|---|
| 55 | { | 
|---|
| 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", | 
|---|
| 63 | 3, | 
|---|
| 64 | TRUE, /* default for 64 bit target */ | 
|---|
| 65 | powerpc_compatible, | 
|---|
| 66 | bfd_default_scan, | 
|---|
| 67 | &bfd_powerpc_archs[1] | 
|---|
| 68 | }, | 
|---|
| 69 | /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch | 
|---|
| 70 | being immediately after the 64 bit default.  */ | 
|---|
| 71 | { | 
|---|
| 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", | 
|---|
| 79 | 3, | 
|---|
| 80 | FALSE, | 
|---|
| 81 | powerpc_compatible, | 
|---|
| 82 | bfd_default_scan, | 
|---|
| 83 | &bfd_powerpc_archs[2], | 
|---|
| 84 | }, | 
|---|
| 85 | #else | 
|---|
| 86 | /* Default arch must come first.  */ | 
|---|
| 87 | { | 
|---|
| 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", | 
|---|
| 95 | 3, | 
|---|
| 96 | TRUE, /* default for 32 bit target */ | 
|---|
| 97 | powerpc_compatible, | 
|---|
| 98 | bfd_default_scan, | 
|---|
| 99 | &bfd_powerpc_archs[1], | 
|---|
| 100 | }, | 
|---|
| 101 | /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch | 
|---|
| 102 | being immediately after the 32 bit default.  */ | 
|---|
| 103 | { | 
|---|
| 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", | 
|---|
| 111 | 3, | 
|---|
| 112 | FALSE, | 
|---|
| 113 | powerpc_compatible, | 
|---|
| 114 | bfd_default_scan, | 
|---|
| 115 | &bfd_powerpc_archs[2] | 
|---|
| 116 | }, | 
|---|
| 117 | #endif | 
|---|
| 118 | { | 
|---|
| 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", | 
|---|
| 126 | 3, | 
|---|
| 127 | FALSE, /* not the default */ | 
|---|
| 128 | powerpc_compatible, | 
|---|
| 129 | bfd_default_scan, | 
|---|
| 130 | &bfd_powerpc_archs[3] | 
|---|
| 131 | }, | 
|---|
| 132 | { | 
|---|
| 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", | 
|---|
| 140 | 3, | 
|---|
| 141 | FALSE, /* not the default */ | 
|---|
| 142 | powerpc_compatible, | 
|---|
| 143 | bfd_default_scan, | 
|---|
| 144 | &bfd_powerpc_archs[4] | 
|---|
| 145 | }, | 
|---|
| 146 | { | 
|---|
| 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", | 
|---|
| 154 | 3, | 
|---|
| 155 | FALSE, /* not the default */ | 
|---|
| 156 | powerpc_compatible, | 
|---|
| 157 | bfd_default_scan, | 
|---|
| 158 | &bfd_powerpc_archs[5] | 
|---|
| 159 | }, | 
|---|
| 160 | { | 
|---|
| 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", | 
|---|
| 168 | 3, | 
|---|
| 169 | FALSE, /* not the default */ | 
|---|
| 170 | powerpc_compatible, | 
|---|
| 171 | bfd_default_scan, | 
|---|
| 172 | &bfd_powerpc_archs[6] | 
|---|
| 173 | }, | 
|---|
| 174 | { | 
|---|
| 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", | 
|---|
| 182 | 3, | 
|---|
| 183 | FALSE, /* not the default */ | 
|---|
| 184 | powerpc_compatible, | 
|---|
| 185 | bfd_default_scan, | 
|---|
| 186 | &bfd_powerpc_archs[7] | 
|---|
| 187 | }, | 
|---|
| 188 | { | 
|---|
| 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", | 
|---|
| 196 | 3, | 
|---|
| 197 | FALSE, /* not the default */ | 
|---|
| 198 | powerpc_compatible, | 
|---|
| 199 | bfd_default_scan, | 
|---|
| 200 | &bfd_powerpc_archs[8] | 
|---|
| 201 | }, | 
|---|
| 202 | { | 
|---|
| 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", | 
|---|
| 210 | 3, | 
|---|
| 211 | FALSE, /* not the default */ | 
|---|
| 212 | powerpc_compatible, | 
|---|
| 213 | bfd_default_scan, | 
|---|
| 214 | &bfd_powerpc_archs[9] | 
|---|
| 215 | }, | 
|---|
| 216 | { | 
|---|
| 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", | 
|---|
| 224 | 3, | 
|---|
| 225 | FALSE, /* not the default */ | 
|---|
| 226 | powerpc_compatible, | 
|---|
| 227 | bfd_default_scan, | 
|---|
| 228 | &bfd_powerpc_archs[10] | 
|---|
| 229 | }, | 
|---|
| 230 | { | 
|---|
| 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", | 
|---|
| 238 | 3, | 
|---|
| 239 | FALSE, /* not the default */ | 
|---|
| 240 | powerpc_compatible, | 
|---|
| 241 | bfd_default_scan, | 
|---|
| 242 | &bfd_powerpc_archs[11] | 
|---|
| 243 | }, | 
|---|
| 244 | { | 
|---|
| 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", | 
|---|
| 252 | 3, | 
|---|
| 253 | FALSE, /* not the default */ | 
|---|
| 254 | powerpc_compatible, | 
|---|
| 255 | bfd_default_scan, | 
|---|
| 256 | &bfd_powerpc_archs[12] | 
|---|
| 257 | }, | 
|---|
| 258 | { | 
|---|
| 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", | 
|---|
| 266 | 3, | 
|---|
| 267 | FALSE, /* not the default */ | 
|---|
| 268 | powerpc_compatible, | 
|---|
| 269 | bfd_default_scan, | 
|---|
| 270 | &bfd_powerpc_archs[13] | 
|---|
| 271 | }, | 
|---|
| 272 | { | 
|---|
| 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", | 
|---|
| 280 | 3, | 
|---|
| 281 | FALSE, | 
|---|
| 282 | powerpc_compatible, | 
|---|
| 283 | bfd_default_scan, | 
|---|
| 284 | &bfd_powerpc_archs[14] | 
|---|
| 285 | }, | 
|---|
| 286 | { | 
|---|
| 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", | 
|---|
| 294 | 3, | 
|---|
| 295 | FALSE, /* not the default */ | 
|---|
| 296 | powerpc_compatible, | 
|---|
| 297 | bfd_default_scan, | 
|---|
| 298 | 0 | 
|---|
| 299 | } | 
|---|
| 300 | }; | 
|---|