1 /* BFD PowerPC CPU definition
2 Copyright (C) 1994-2023 Free Software Foundation, Inc.
3 Contributed by Ian Lance Taylor, Cygnus Support.
5 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
26 /* The common PowerPC architecture is compatible with the RS/6000. */
28 static const bfd_arch_info_type
*
29 powerpc_compatible (const bfd_arch_info_type
*a
,
30 const bfd_arch_info_type
*b
)
32 BFD_ASSERT (a
->arch
== bfd_arch_powerpc
);
37 case bfd_arch_powerpc
:
38 if (a
->mach
== bfd_mach_ppc_vle
&& b
->bits_per_word
== 32)
40 if (b
->mach
== bfd_mach_ppc_vle
&& a
->bits_per_word
== 32)
42 return bfd_default_compatible (a
, b
);
44 if (b
->mach
== bfd_mach_rs6k
)
51 /* Return a COUNT sized buffer filled with nops (if CODE is TRUE) or
52 zeros (if CODE is FALSE). This is the fill used between input
53 sections for alignment. It won't normally be executed. */
56 bfd_arch_ppc_nop_fill (bfd_size_type count
,
64 fill
= bfd_malloc (count
);
68 if (code
&& (count
& 3) == 0)
70 static const char nop_be
[4] = {0x60, 0, 0, 0};
71 static const char nop_le
[4] = {0, 0, 0, 0x60};
72 const char *nop
= is_bigendian
? nop_be
: nop_le
;
83 memset (fill
, 0, count
);
88 #define N(BITS, NUMBER, PRINT, DEFAULT, NEXT) \
90 BITS, /* Bits in a word. */ \
91 BITS, /* Bits in an address. */ \
92 8, /* Bits in a byte. */ \
97 3, /* Section alignment power. */ \
101 bfd_arch_ppc_nop_fill, \
103 0 /* Maximum offset of a reloc from the start of an insn. */ \
106 const bfd_arch_info_type bfd_powerpc_archs
[] =
108 #if BFD_DEFAULT_TARGET_SIZE == 64
109 /* Default for 64 bit target. */
110 N (64, bfd_mach_ppc64
, "powerpc:common64", true, bfd_powerpc_archs
+ 1),
111 /* elf32-ppc:ppc_elf_object_p relies on the default 32 bit arch
112 being immediately after the 64 bit default. */
113 N (32, bfd_mach_ppc
, "powerpc:common", false, bfd_powerpc_archs
+ 2),
115 /* Default arch must come first. */
116 N (32, bfd_mach_ppc
, "powerpc:common", true, bfd_powerpc_archs
+ 1),
117 /* elf64-ppc:ppc64_elf_object_p relies on the default 64 bit arch
118 being immediately after the 32 bit default. */
119 N (64, bfd_mach_ppc64
, "powerpc:common64", false, bfd_powerpc_archs
+ 2),
121 N (32, bfd_mach_ppc_603
, "powerpc:603", false, bfd_powerpc_archs
+ 3),
122 N (32, bfd_mach_ppc_ec603e
, "powerpc:EC603e", false, bfd_powerpc_archs
+ 4),
123 N (32, bfd_mach_ppc_604
, "powerpc:604", false, bfd_powerpc_archs
+ 5),
124 N (32, bfd_mach_ppc_403
, "powerpc:403", false, bfd_powerpc_archs
+ 6),
125 N (32, bfd_mach_ppc_601
, "powerpc:601", false, bfd_powerpc_archs
+ 7),
126 N (64, bfd_mach_ppc_620
, "powerpc:620", false, bfd_powerpc_archs
+ 8),
127 N (64, bfd_mach_ppc_630
, "powerpc:630", false, bfd_powerpc_archs
+ 9),
128 N (64, bfd_mach_ppc_a35
, "powerpc:a35", false, bfd_powerpc_archs
+ 10),
129 N (64, bfd_mach_ppc_rs64ii
, "powerpc:rs64ii", false, bfd_powerpc_archs
+ 11),
130 N (64, bfd_mach_ppc_rs64iii
, "powerpc:rs64iii", false, bfd_powerpc_archs
+ 12),
131 N (32, bfd_mach_ppc_7400
, "powerpc:7400", false, bfd_powerpc_archs
+ 13),
132 N (32, bfd_mach_ppc_e500
, "powerpc:e500", false, bfd_powerpc_archs
+ 14),
133 N (32, bfd_mach_ppc_e500mc
, "powerpc:e500mc", false, bfd_powerpc_archs
+ 15),
134 N (64, bfd_mach_ppc_e500mc64
, "powerpc:e500mc64",false, bfd_powerpc_archs
+ 16),
135 N (32, bfd_mach_ppc_860
, "powerpc:MPC8XX", false, bfd_powerpc_archs
+ 17),
136 N (32, bfd_mach_ppc_750
, "powerpc:750", false, bfd_powerpc_archs
+ 18),
137 N (32, bfd_mach_ppc_titan
, "powerpc:titan", false, bfd_powerpc_archs
+ 19),
140 16, /* Bits in a word. */
141 32, /* Bits in an address. */
142 8, /* Bits in a byte. */
148 false, /* Not the default. */
151 bfd_arch_default_fill
,
152 bfd_powerpc_archs
+ 20,
153 0 /* Maximum offset of a reloc from the start of an insn. */
156 N (64, bfd_mach_ppc_e5500
, "powerpc:e5500", false, bfd_powerpc_archs
+ 21),
157 N (64, bfd_mach_ppc_e6500
, "powerpc:e6500", false, NULL
)