| 1 | /* BFD PowerPC CPU definition |
| 2 | Copyright (C) 1994-2017 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 3 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., 51 Franklin Street - Fifth Floor, Boston, |
| 20 | MA 02110-1301, USA. */ |
| 21 | |
| 22 | #include "sysdep.h" |
| 23 | #include "bfd.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 * |
| 29 | powerpc_compatible (const bfd_arch_info_type *a, |
| 30 | const bfd_arch_info_type *b) |
| 31 | { |
| 32 | BFD_ASSERT (a->arch == bfd_arch_powerpc); |
| 33 | switch (b->arch) |
| 34 | { |
| 35 | default: |
| 36 | return NULL; |
| 37 | case bfd_arch_powerpc: |
| 38 | if (a->mach == bfd_mach_ppc_vle && b->bits_per_word == 32) |
| 39 | return a; |
| 40 | if (b->mach == bfd_mach_ppc_vle && a->bits_per_word == 32) |
| 41 | return b; |
| 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; |
| 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_arch_default_fill, |
| 68 | &bfd_powerpc_archs[1] |
| 69 | }, |
| 70 | /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch |
| 71 | being immediately after the 64 bit default. */ |
| 72 | { |
| 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", |
| 80 | 3, |
| 81 | FALSE, |
| 82 | powerpc_compatible, |
| 83 | bfd_default_scan, |
| 84 | bfd_arch_default_fill, |
| 85 | &bfd_powerpc_archs[2], |
| 86 | }, |
| 87 | #else |
| 88 | /* Default arch must come first. */ |
| 89 | { |
| 90 | 32, /* 32 bits in a word */ |
| 91 | 32, /* 32 bits in an address */ |
| 92 | 8, /* 8 bits in a byte */ |
| 93 | bfd_arch_powerpc, |
| 94 | bfd_mach_ppc, /* for the POWER/PowerPC common architecture */ |
| 95 | "powerpc", |
| 96 | "powerpc:common", |
| 97 | 3, |
| 98 | TRUE, /* default for 32 bit target */ |
| 99 | powerpc_compatible, |
| 100 | bfd_default_scan, |
| 101 | bfd_arch_default_fill, |
| 102 | &bfd_powerpc_archs[1], |
| 103 | }, |
| 104 | /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch |
| 105 | being immediately after the 32 bit default. */ |
| 106 | { |
| 107 | 64, /* 64 bits in a word */ |
| 108 | 64, /* 64 bits in an address */ |
| 109 | 8, /* 8 bits in a byte */ |
| 110 | bfd_arch_powerpc, |
| 111 | bfd_mach_ppc64, |
| 112 | "powerpc", |
| 113 | "powerpc:common64", |
| 114 | 3, |
| 115 | FALSE, |
| 116 | powerpc_compatible, |
| 117 | bfd_default_scan, |
| 118 | bfd_arch_default_fill, |
| 119 | &bfd_powerpc_archs[2] |
| 120 | }, |
| 121 | #endif |
| 122 | { |
| 123 | 32, /* 32 bits in a word */ |
| 124 | 32, /* 32 bits in an address */ |
| 125 | 8, /* 8 bits in a byte */ |
| 126 | bfd_arch_powerpc, |
| 127 | bfd_mach_ppc_603, |
| 128 | "powerpc", |
| 129 | "powerpc:603", |
| 130 | 3, |
| 131 | FALSE, /* not the default */ |
| 132 | powerpc_compatible, |
| 133 | bfd_default_scan, |
| 134 | bfd_arch_default_fill, |
| 135 | &bfd_powerpc_archs[3] |
| 136 | }, |
| 137 | { |
| 138 | 32, /* 32 bits in a word */ |
| 139 | 32, /* 32 bits in an address */ |
| 140 | 8, /* 8 bits in a byte */ |
| 141 | bfd_arch_powerpc, |
| 142 | bfd_mach_ppc_ec603e, |
| 143 | "powerpc", |
| 144 | "powerpc:EC603e", |
| 145 | 3, |
| 146 | FALSE, /* not the default */ |
| 147 | powerpc_compatible, |
| 148 | bfd_default_scan, |
| 149 | bfd_arch_default_fill, |
| 150 | &bfd_powerpc_archs[4] |
| 151 | }, |
| 152 | { |
| 153 | 32, /* 32 bits in a word */ |
| 154 | 32, /* 32 bits in an address */ |
| 155 | 8, /* 8 bits in a byte */ |
| 156 | bfd_arch_powerpc, |
| 157 | bfd_mach_ppc_604, |
| 158 | "powerpc", |
| 159 | "powerpc:604", |
| 160 | 3, |
| 161 | FALSE, /* not the default */ |
| 162 | powerpc_compatible, |
| 163 | bfd_default_scan, |
| 164 | bfd_arch_default_fill, |
| 165 | &bfd_powerpc_archs[5] |
| 166 | }, |
| 167 | { |
| 168 | 32, /* 32 bits in a word */ |
| 169 | 32, /* 32 bits in an address */ |
| 170 | 8, /* 8 bits in a byte */ |
| 171 | bfd_arch_powerpc, |
| 172 | bfd_mach_ppc_403, |
| 173 | "powerpc", |
| 174 | "powerpc:403", |
| 175 | 3, |
| 176 | FALSE, /* not the default */ |
| 177 | powerpc_compatible, |
| 178 | bfd_default_scan, |
| 179 | bfd_arch_default_fill, |
| 180 | &bfd_powerpc_archs[6] |
| 181 | }, |
| 182 | { |
| 183 | 32, /* 32 bits in a word */ |
| 184 | 32, /* 32 bits in an address */ |
| 185 | 8, /* 8 bits in a byte */ |
| 186 | bfd_arch_powerpc, |
| 187 | bfd_mach_ppc_601, |
| 188 | "powerpc", |
| 189 | "powerpc:601", |
| 190 | 3, |
| 191 | FALSE, /* not the default */ |
| 192 | powerpc_compatible, |
| 193 | bfd_default_scan, |
| 194 | bfd_arch_default_fill, |
| 195 | &bfd_powerpc_archs[7] |
| 196 | }, |
| 197 | { |
| 198 | 64, /* 64 bits in a word */ |
| 199 | 64, /* 64 bits in an address */ |
| 200 | 8, /* 8 bits in a byte */ |
| 201 | bfd_arch_powerpc, |
| 202 | bfd_mach_ppc_620, |
| 203 | "powerpc", |
| 204 | "powerpc:620", |
| 205 | 3, |
| 206 | FALSE, /* not the default */ |
| 207 | powerpc_compatible, |
| 208 | bfd_default_scan, |
| 209 | bfd_arch_default_fill, |
| 210 | &bfd_powerpc_archs[8] |
| 211 | }, |
| 212 | { |
| 213 | 64, /* 64 bits in a word */ |
| 214 | 64, /* 64 bits in an address */ |
| 215 | 8, /* 8 bits in a byte */ |
| 216 | bfd_arch_powerpc, |
| 217 | bfd_mach_ppc_630, |
| 218 | "powerpc", |
| 219 | "powerpc:630", |
| 220 | 3, |
| 221 | FALSE, /* not the default */ |
| 222 | powerpc_compatible, |
| 223 | bfd_default_scan, |
| 224 | bfd_arch_default_fill, |
| 225 | &bfd_powerpc_archs[9] |
| 226 | }, |
| 227 | { |
| 228 | 64, /* 64 bits in a word */ |
| 229 | 64, /* 64 bits in an address */ |
| 230 | 8, /* 8 bits in a byte */ |
| 231 | bfd_arch_powerpc, |
| 232 | bfd_mach_ppc_a35, |
| 233 | "powerpc", |
| 234 | "powerpc:a35", |
| 235 | 3, |
| 236 | FALSE, /* not the default */ |
| 237 | powerpc_compatible, |
| 238 | bfd_default_scan, |
| 239 | bfd_arch_default_fill, |
| 240 | &bfd_powerpc_archs[10] |
| 241 | }, |
| 242 | { |
| 243 | 64, /* 64 bits in a word */ |
| 244 | 64, /* 64 bits in an address */ |
| 245 | 8, /* 8 bits in a byte */ |
| 246 | bfd_arch_powerpc, |
| 247 | bfd_mach_ppc_rs64ii, |
| 248 | "powerpc", |
| 249 | "powerpc:rs64ii", |
| 250 | 3, |
| 251 | FALSE, /* not the default */ |
| 252 | powerpc_compatible, |
| 253 | bfd_default_scan, |
| 254 | bfd_arch_default_fill, |
| 255 | &bfd_powerpc_archs[11] |
| 256 | }, |
| 257 | { |
| 258 | 64, /* 64 bits in a word */ |
| 259 | 64, /* 64 bits in an address */ |
| 260 | 8, /* 8 bits in a byte */ |
| 261 | bfd_arch_powerpc, |
| 262 | bfd_mach_ppc_rs64iii, |
| 263 | "powerpc", |
| 264 | "powerpc:rs64iii", |
| 265 | 3, |
| 266 | FALSE, /* not the default */ |
| 267 | powerpc_compatible, |
| 268 | bfd_default_scan, |
| 269 | bfd_arch_default_fill, |
| 270 | &bfd_powerpc_archs[12] |
| 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_7400, |
| 278 | "powerpc", |
| 279 | "powerpc:7400", |
| 280 | 3, |
| 281 | FALSE, /* not the default */ |
| 282 | powerpc_compatible, |
| 283 | bfd_default_scan, |
| 284 | bfd_arch_default_fill, |
| 285 | &bfd_powerpc_archs[13] |
| 286 | }, |
| 287 | { |
| 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_e500, |
| 293 | "powerpc", |
| 294 | "powerpc:e500", |
| 295 | 3, |
| 296 | FALSE, |
| 297 | powerpc_compatible, |
| 298 | bfd_default_scan, |
| 299 | bfd_arch_default_fill, |
| 300 | &bfd_powerpc_archs[14] |
| 301 | }, |
| 302 | { |
| 303 | 32, /* 32 bits in a word */ |
| 304 | 32, /* 32 bits in an address */ |
| 305 | 8, /* 8 bits in a byte */ |
| 306 | bfd_arch_powerpc, |
| 307 | bfd_mach_ppc_e500mc, |
| 308 | "powerpc", |
| 309 | "powerpc:e500mc", |
| 310 | 3, |
| 311 | FALSE, /* not the default */ |
| 312 | powerpc_compatible, |
| 313 | bfd_default_scan, |
| 314 | bfd_arch_default_fill, |
| 315 | &bfd_powerpc_archs[15] |
| 316 | }, |
| 317 | { |
| 318 | 64, /* 64 bits in a word */ |
| 319 | 64, /* 64 bits in an address */ |
| 320 | 8, /* 8 bits in a byte */ |
| 321 | bfd_arch_powerpc, |
| 322 | bfd_mach_ppc_e500mc64, |
| 323 | "powerpc", |
| 324 | "powerpc:e500mc64", |
| 325 | 3, |
| 326 | FALSE, /* not the default */ |
| 327 | powerpc_compatible, |
| 328 | bfd_default_scan, |
| 329 | bfd_arch_default_fill, |
| 330 | &bfd_powerpc_archs[16] |
| 331 | }, |
| 332 | { |
| 333 | 32, /* 32 bits in a word */ |
| 334 | 32, /* 32 bits in an address */ |
| 335 | 8, /* 8 bits in a byte */ |
| 336 | bfd_arch_powerpc, |
| 337 | bfd_mach_ppc_860, |
| 338 | "powerpc", |
| 339 | "powerpc:MPC8XX", |
| 340 | 3, |
| 341 | FALSE, /* not the default */ |
| 342 | powerpc_compatible, |
| 343 | bfd_default_scan, |
| 344 | bfd_arch_default_fill, |
| 345 | &bfd_powerpc_archs[17] |
| 346 | }, |
| 347 | { |
| 348 | 32, /* 32 bits in a word */ |
| 349 | 32, /* 32 bits in an address */ |
| 350 | 8, /* 8 bits in a byte */ |
| 351 | bfd_arch_powerpc, |
| 352 | bfd_mach_ppc_750, |
| 353 | "powerpc", |
| 354 | "powerpc:750", |
| 355 | 3, |
| 356 | FALSE, /* not the default */ |
| 357 | powerpc_compatible, |
| 358 | bfd_default_scan, |
| 359 | bfd_arch_default_fill, |
| 360 | &bfd_powerpc_archs[18] |
| 361 | }, |
| 362 | { |
| 363 | 32, /* 32 bits in a word */ |
| 364 | 32, /* 32 bits in an address */ |
| 365 | 8, /* 8 bits in a byte */ |
| 366 | bfd_arch_powerpc, |
| 367 | bfd_mach_ppc_titan, |
| 368 | "powerpc", |
| 369 | "powerpc:titan", |
| 370 | 3, |
| 371 | FALSE, /* not the default */ |
| 372 | powerpc_compatible, |
| 373 | bfd_default_scan, |
| 374 | bfd_arch_default_fill, |
| 375 | &bfd_powerpc_archs[19] |
| 376 | }, |
| 377 | { |
| 378 | 16, /* 16 or 32 bits in a word */ |
| 379 | 32, /* 32 bits in an address */ |
| 380 | 8, /* 8 bits in a byte */ |
| 381 | bfd_arch_powerpc, |
| 382 | bfd_mach_ppc_vle, |
| 383 | "powerpc", |
| 384 | "powerpc:vle", |
| 385 | 3, |
| 386 | FALSE, /* not the default */ |
| 387 | powerpc_compatible, |
| 388 | bfd_default_scan, |
| 389 | bfd_arch_default_fill, |
| 390 | &bfd_powerpc_archs[20] |
| 391 | }, |
| 392 | { |
| 393 | 64, /* 64 bits in a word */ |
| 394 | 64, /* 64 bits in an address */ |
| 395 | 8, /* 8 bits in a byte */ |
| 396 | bfd_arch_powerpc, |
| 397 | bfd_mach_ppc_e5500, |
| 398 | "powerpc", |
| 399 | "powerpc:e5500", |
| 400 | 3, |
| 401 | FALSE, /* not the default */ |
| 402 | powerpc_compatible, |
| 403 | bfd_default_scan, |
| 404 | bfd_arch_default_fill, |
| 405 | &bfd_powerpc_archs[21] |
| 406 | }, |
| 407 | { |
| 408 | 64, /* 64 bits in a word */ |
| 409 | 64, /* 64 bits in an address */ |
| 410 | 8, /* 8 bits in a byte */ |
| 411 | bfd_arch_powerpc, |
| 412 | bfd_mach_ppc_e6500, |
| 413 | "powerpc", |
| 414 | "powerpc:e6500", |
| 415 | 3, |
| 416 | FALSE, /* not the default */ |
| 417 | powerpc_compatible, |
| 418 | bfd_default_scan, |
| 419 | bfd_arch_default_fill, |
| 420 | 0 |
| 421 | } |
| 422 | }; |