2 BFD keeps one atom in a BFD describing the
3 architecture of the data attached to the BFD: a pointer to a
4 @code{bfd_arch_info_type}.
6 Pointers to structures can be requested independently of a BFD
7 so that an architecture's information can be interrogated
8 without access to an open BFD.
10 The architecture information is provided by each architecture package.
11 The set of default architectures is selected by the macro
12 @code{SELECT_ARCHITECTURES}. This is normally set up in the
13 @file{config/@var{target}.mt} file of your choice. If the name is not
14 defined, then all the architectures supported are included.
16 When BFD starts up, all the architectures are called with an
17 initialize method. It is up to the architecture back end to
18 insert as many items into the list of architectures as it wants to;
19 generally this would be one for each machine and one for the
20 default case (an item with a machine field of 0).
22 BFD's idea of an architecture is implemented in @file{archures.c}.
24 @subsection bfd_architecture
27 @strong{Description}@*
28 This enum gives the object file's CPU architecture, in a
29 global sense---i.e., what processor family does it belong to?
30 Another field indicates which processor within
31 the family is in use. The machine gives a number which
32 distinguishes different versions of the architecture,
33 containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
34 and 68020 and 68030 for Motorola 68020 and 68030.
38 bfd_arch_unknown, /* File arch not known. */
39 bfd_arch_obscure, /* Arch known, not one of these. */
40 bfd_arch_m68k, /* Motorola 68xxx */
41 #define bfd_mach_m68000 1
42 #define bfd_mach_m68008 2
43 #define bfd_mach_m68010 3
44 #define bfd_mach_m68020 4
45 #define bfd_mach_m68030 5
46 #define bfd_mach_m68040 6
47 #define bfd_mach_m68060 7
48 #define bfd_mach_cpu32 8
49 #define bfd_mach_fido 9
50 #define bfd_mach_mcf_isa_a_nodiv 10
51 #define bfd_mach_mcf_isa_a 11
52 #define bfd_mach_mcf_isa_a_mac 12
53 #define bfd_mach_mcf_isa_a_emac 13
54 #define bfd_mach_mcf_isa_aplus 14
55 #define bfd_mach_mcf_isa_aplus_mac 15
56 #define bfd_mach_mcf_isa_aplus_emac 16
57 #define bfd_mach_mcf_isa_b_nousp 17
58 #define bfd_mach_mcf_isa_b_nousp_mac 18
59 #define bfd_mach_mcf_isa_b_nousp_emac 19
60 #define bfd_mach_mcf_isa_b 20
61 #define bfd_mach_mcf_isa_b_mac 21
62 #define bfd_mach_mcf_isa_b_emac 22
63 #define bfd_mach_mcf_isa_b_float 23
64 #define bfd_mach_mcf_isa_b_float_mac 24
65 #define bfd_mach_mcf_isa_b_float_emac 25
66 #define bfd_mach_mcf_isa_c 26
67 #define bfd_mach_mcf_isa_c_mac 27
68 #define bfd_mach_mcf_isa_c_emac 28
69 bfd_arch_vax, /* DEC Vax */
70 bfd_arch_i960, /* Intel 960 */
71 /* The order of the following is important.
72 lower number indicates a machine type that
73 only accepts a subset of the instructions
74 available to machines with higher numbers.
75 The exception is the "ca", which is
76 incompatible with all other machines except
79 #define bfd_mach_i960_core 1
80 #define bfd_mach_i960_ka_sa 2
81 #define bfd_mach_i960_kb_sb 3
82 #define bfd_mach_i960_mc 4
83 #define bfd_mach_i960_xa 5
84 #define bfd_mach_i960_ca 6
85 #define bfd_mach_i960_jx 7
86 #define bfd_mach_i960_hx 8
88 bfd_arch_or32, /* OpenRISC 32 */
90 bfd_arch_sparc, /* SPARC */
91 #define bfd_mach_sparc 1
92 /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
93 #define bfd_mach_sparc_sparclet 2
94 #define bfd_mach_sparc_sparclite 3
95 #define bfd_mach_sparc_v8plus 4
96 #define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
97 #define bfd_mach_sparc_sparclite_le 6
98 #define bfd_mach_sparc_v9 7
99 #define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
100 #define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
101 #define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
102 /* Nonzero if MACH has the v9 instruction set. */
103 #define bfd_mach_sparc_v9_p(mach) \
104 ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
105 && (mach) != bfd_mach_sparc_sparclite_le)
106 /* Nonzero if MACH is a 64 bit sparc architecture. */
107 #define bfd_mach_sparc_64bit_p(mach) \
108 ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
109 bfd_arch_spu, /* PowerPC SPU */
110 #define bfd_mach_spu 256
111 bfd_arch_mips, /* MIPS Rxxxx */
112 #define bfd_mach_mips3000 3000
113 #define bfd_mach_mips3900 3900
114 #define bfd_mach_mips4000 4000
115 #define bfd_mach_mips4010 4010
116 #define bfd_mach_mips4100 4100
117 #define bfd_mach_mips4111 4111
118 #define bfd_mach_mips4120 4120
119 #define bfd_mach_mips4300 4300
120 #define bfd_mach_mips4400 4400
121 #define bfd_mach_mips4600 4600
122 #define bfd_mach_mips4650 4650
123 #define bfd_mach_mips5000 5000
124 #define bfd_mach_mips5400 5400
125 #define bfd_mach_mips5500 5500
126 #define bfd_mach_mips6000 6000
127 #define bfd_mach_mips7000 7000
128 #define bfd_mach_mips8000 8000
129 #define bfd_mach_mips9000 9000
130 #define bfd_mach_mips10000 10000
131 #define bfd_mach_mips12000 12000
132 #define bfd_mach_mips16 16
133 #define bfd_mach_mips5 5
134 #define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
135 #define bfd_mach_mipsisa32 32
136 #define bfd_mach_mipsisa32r2 33
137 #define bfd_mach_mipsisa64 64
138 #define bfd_mach_mipsisa64r2 65
139 bfd_arch_i386, /* Intel 386 */
140 #define bfd_mach_i386_i386 1
141 #define bfd_mach_i386_i8086 2
142 #define bfd_mach_i386_i386_intel_syntax 3
143 #define bfd_mach_x86_64 64
144 #define bfd_mach_x86_64_intel_syntax 65
145 bfd_arch_we32k, /* AT&T WE32xxx */
146 bfd_arch_tahoe, /* CCI/Harris Tahoe */
147 bfd_arch_i860, /* Intel 860 */
148 bfd_arch_i370, /* IBM 360/370 Mainframes */
149 bfd_arch_romp, /* IBM ROMP PC/RT */
150 bfd_arch_convex, /* Convex */
151 bfd_arch_m88k, /* Motorola 88xxx */
152 bfd_arch_m98k, /* Motorola 98xxx */
153 bfd_arch_pyramid, /* Pyramid Technology */
154 bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
155 #define bfd_mach_h8300 1
156 #define bfd_mach_h8300h 2
157 #define bfd_mach_h8300s 3
158 #define bfd_mach_h8300hn 4
159 #define bfd_mach_h8300sn 5
160 #define bfd_mach_h8300sx 6
161 #define bfd_mach_h8300sxn 7
162 bfd_arch_pdp11, /* DEC PDP-11 */
163 bfd_arch_powerpc, /* PowerPC */
164 #define bfd_mach_ppc 32
165 #define bfd_mach_ppc64 64
166 #define bfd_mach_ppc_403 403
167 #define bfd_mach_ppc_403gc 4030
168 #define bfd_mach_ppc_505 505
169 #define bfd_mach_ppc_601 601
170 #define bfd_mach_ppc_602 602
171 #define bfd_mach_ppc_603 603
172 #define bfd_mach_ppc_ec603e 6031
173 #define bfd_mach_ppc_604 604
174 #define bfd_mach_ppc_620 620
175 #define bfd_mach_ppc_630 630
176 #define bfd_mach_ppc_750 750
177 #define bfd_mach_ppc_860 860
178 #define bfd_mach_ppc_a35 35
179 #define bfd_mach_ppc_rs64ii 642
180 #define bfd_mach_ppc_rs64iii 643
181 #define bfd_mach_ppc_7400 7400
182 #define bfd_mach_ppc_e500 500
183 bfd_arch_rs6000, /* IBM RS/6000 */
184 #define bfd_mach_rs6k 6000
185 #define bfd_mach_rs6k_rs1 6001
186 #define bfd_mach_rs6k_rsc 6003
187 #define bfd_mach_rs6k_rs2 6002
188 bfd_arch_hppa, /* HP PA RISC */
189 #define bfd_mach_hppa10 10
190 #define bfd_mach_hppa11 11
191 #define bfd_mach_hppa20 20
192 #define bfd_mach_hppa20w 25
193 bfd_arch_d10v, /* Mitsubishi D10V */
194 #define bfd_mach_d10v 1
195 #define bfd_mach_d10v_ts2 2
196 #define bfd_mach_d10v_ts3 3
197 bfd_arch_d30v, /* Mitsubishi D30V */
198 bfd_arch_dlx, /* DLX */
199 bfd_arch_m68hc11, /* Motorola 68HC11 */
200 bfd_arch_m68hc12, /* Motorola 68HC12 */
201 #define bfd_mach_m6812_default 0
202 #define bfd_mach_m6812 1
203 #define bfd_mach_m6812s 2
204 bfd_arch_z8k, /* Zilog Z8000 */
205 #define bfd_mach_z8001 1
206 #define bfd_mach_z8002 2
207 bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
208 bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
209 #define bfd_mach_sh 1
210 #define bfd_mach_sh2 0x20
211 #define bfd_mach_sh_dsp 0x2d
212 #define bfd_mach_sh2a 0x2a
213 #define bfd_mach_sh2a_nofpu 0x2b
214 #define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
215 #define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
216 #define bfd_mach_sh2a_or_sh4 0x2a3
217 #define bfd_mach_sh2a_or_sh3e 0x2a4
218 #define bfd_mach_sh2e 0x2e
219 #define bfd_mach_sh3 0x30
220 #define bfd_mach_sh3_nommu 0x31
221 #define bfd_mach_sh3_dsp 0x3d
222 #define bfd_mach_sh3e 0x3e
223 #define bfd_mach_sh4 0x40
224 #define bfd_mach_sh4_nofpu 0x41
225 #define bfd_mach_sh4_nommu_nofpu 0x42
226 #define bfd_mach_sh4a 0x4a
227 #define bfd_mach_sh4a_nofpu 0x4b
228 #define bfd_mach_sh4al_dsp 0x4d
229 #define bfd_mach_sh5 0x50
230 bfd_arch_alpha, /* Dec Alpha */
231 #define bfd_mach_alpha_ev4 0x10
232 #define bfd_mach_alpha_ev5 0x20
233 #define bfd_mach_alpha_ev6 0x30
234 bfd_arch_arm, /* Advanced Risc Machines ARM. */
235 #define bfd_mach_arm_unknown 0
236 #define bfd_mach_arm_2 1
237 #define bfd_mach_arm_2a 2
238 #define bfd_mach_arm_3 3
239 #define bfd_mach_arm_3M 4
240 #define bfd_mach_arm_4 5
241 #define bfd_mach_arm_4T 6
242 #define bfd_mach_arm_5 7
243 #define bfd_mach_arm_5T 8
244 #define bfd_mach_arm_5TE 9
245 #define bfd_mach_arm_XScale 10
246 #define bfd_mach_arm_ep9312 11
247 #define bfd_mach_arm_iWMMXt 12
248 #define bfd_mach_arm_iWMMXt2 13
249 bfd_arch_ns32k, /* National Semiconductors ns32000 */
250 bfd_arch_w65, /* WDC 65816 */
251 bfd_arch_tic30, /* Texas Instruments TMS320C30 */
252 bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
253 #define bfd_mach_tic3x 30
254 #define bfd_mach_tic4x 40
255 bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
256 bfd_arch_tic80, /* TI TMS320c80 (MVP) */
257 bfd_arch_v850, /* NEC V850 */
258 #define bfd_mach_v850 1
259 #define bfd_mach_v850e 'E'
260 #define bfd_mach_v850e1 '1'
261 bfd_arch_arc, /* ARC Cores */
262 #define bfd_mach_arc_5 5
263 #define bfd_mach_arc_6 6
264 #define bfd_mach_arc_7 7
265 #define bfd_mach_arc_8 8
266 bfd_arch_m32c, /* Renesas M16C/M32C. */
267 #define bfd_mach_m16c 0x75
268 #define bfd_mach_m32c 0x78
269 bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
270 #define bfd_mach_m32r 1 /* For backwards compatibility. */
271 #define bfd_mach_m32rx 'x'
272 #define bfd_mach_m32r2 '2'
273 bfd_arch_mn10200, /* Matsushita MN10200 */
274 bfd_arch_mn10300, /* Matsushita MN10300 */
275 #define bfd_mach_mn10300 300
276 #define bfd_mach_am33 330
277 #define bfd_mach_am33_2 332
279 #define bfd_mach_fr30 0x46523330
281 #define bfd_mach_frv 1
282 #define bfd_mach_frvsimple 2
283 #define bfd_mach_fr300 300
284 #define bfd_mach_fr400 400
285 #define bfd_mach_fr450 450
286 #define bfd_mach_frvtomcat 499 /* fr500 prototype */
287 #define bfd_mach_fr500 500
288 #define bfd_mach_fr550 550
291 #define bfd_mach_mep 1
292 #define bfd_mach_mep_h1 0x6831
293 bfd_arch_ia64, /* HP/Intel ia64 */
294 #define bfd_mach_ia64_elf64 64
295 #define bfd_mach_ia64_elf32 32
296 bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
297 #define bfd_mach_ip2022 1
298 #define bfd_mach_ip2022ext 2
299 bfd_arch_iq2000, /* Vitesse IQ2000. */
300 #define bfd_mach_iq2000 1
301 #define bfd_mach_iq10 2
303 #define bfd_mach_ms1 1
304 #define bfd_mach_mrisc2 2
305 #define bfd_mach_ms2 3
307 bfd_arch_avr, /* Atmel AVR microcontrollers. */
308 #define bfd_mach_avr1 1
309 #define bfd_mach_avr2 2
310 #define bfd_mach_avr3 3
311 #define bfd_mach_avr4 4
312 #define bfd_mach_avr5 5
313 #define bfd_mach_avr6 6
314 bfd_arch_bfin, /* ADI Blackfin */
315 #define bfd_mach_bfin 1
316 bfd_arch_cr16, /* National Semiconductor CompactRISC (ie CR16). */
317 #define bfd_mach_cr16 1
318 bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
319 #define bfd_mach_cr16c 1
320 bfd_arch_crx, /* National Semiconductor CRX. */
321 #define bfd_mach_crx 1
322 bfd_arch_cris, /* Axis CRIS */
323 #define bfd_mach_cris_v0_v10 255
324 #define bfd_mach_cris_v32 32
325 #define bfd_mach_cris_v10_v32 1032
326 bfd_arch_s390, /* IBM s390 */
327 #define bfd_mach_s390_31 31
328 #define bfd_mach_s390_64 64
329 bfd_arch_score, /* Sunplus score */
330 bfd_arch_openrisc, /* OpenRISC */
331 bfd_arch_mmix, /* Donald Knuth's educational processor. */
333 #define bfd_mach_xstormy16 1
334 bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
335 #define bfd_mach_msp11 11
336 #define bfd_mach_msp110 110
337 #define bfd_mach_msp12 12
338 #define bfd_mach_msp13 13
339 #define bfd_mach_msp14 14
340 #define bfd_mach_msp15 15
341 #define bfd_mach_msp16 16
342 #define bfd_mach_msp21 21
343 #define bfd_mach_msp31 31
344 #define bfd_mach_msp32 32
345 #define bfd_mach_msp33 33
346 #define bfd_mach_msp41 41
347 #define bfd_mach_msp42 42
348 #define bfd_mach_msp43 43
349 #define bfd_mach_msp44 44
350 bfd_arch_xc16x, /* Infineon's XC16X Series. */
351 #define bfd_mach_xc16x 1
352 #define bfd_mach_xc16xl 2
353 #define bfd_mach_xc16xs 3
354 bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
355 #define bfd_mach_xtensa 1
356 bfd_arch_maxq, /* Dallas MAXQ 10/20 */
357 #define bfd_mach_maxq10 10
358 #define bfd_mach_maxq20 20
360 #define bfd_mach_z80strict 1 /* No undocumented opcodes. */
361 #define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
362 #define bfd_mach_z80full 7 /* All undocumented instructions. */
363 #define bfd_mach_r800 11 /* R800: successor with multiplication. */
368 @subsection bfd_arch_info
371 @strong{Description}@*
372 This structure contains information on architectures for use
376 typedef struct bfd_arch_info
379 int bits_per_address;
381 enum bfd_architecture arch;
383 const char *arch_name;
384 const char *printable_name;
385 unsigned int section_align_power;
386 /* TRUE if this is the default machine for the architecture.
387 The default arch should be the first entry for an arch so that
388 all the entries for that arch can be accessed via @code{next}. */
389 bfd_boolean the_default;
390 const struct bfd_arch_info * (*compatible)
391 (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
393 bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
395 const struct bfd_arch_info *next;
401 @findex bfd_printable_name
402 @subsubsection @code{bfd_printable_name}
405 const char *bfd_printable_name (bfd *abfd);
407 @strong{Description}@*
408 Return a printable string representing the architecture and machine
409 from the pointer to the architecture info structure.
411 @findex bfd_scan_arch
412 @subsubsection @code{bfd_scan_arch}
415 const bfd_arch_info_type *bfd_scan_arch (const char *string);
417 @strong{Description}@*
418 Figure out if BFD supports any cpu which could be described with
419 the name @var{string}. Return a pointer to an @code{arch_info}
420 structure if a machine is found, otherwise NULL.
422 @findex bfd_arch_list
423 @subsubsection @code{bfd_arch_list}
426 const char **bfd_arch_list (void);
428 @strong{Description}@*
429 Return a freshly malloced NULL-terminated vector of the names
430 of all the valid BFD architectures. Do not modify the names.
432 @findex bfd_arch_get_compatible
433 @subsubsection @code{bfd_arch_get_compatible}
436 const bfd_arch_info_type *bfd_arch_get_compatible
437 (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
439 @strong{Description}@*
440 Determine whether two BFDs' architectures and machine types
441 are compatible. Calculates the lowest common denominator
442 between the two architectures and machine types implied by
443 the BFDs and returns a pointer to an @code{arch_info} structure
444 describing the compatible machine.
446 @findex bfd_default_arch_struct
447 @subsubsection @code{bfd_default_arch_struct}
448 @strong{Description}@*
449 The @code{bfd_default_arch_struct} is an item of
450 @code{bfd_arch_info_type} which has been initialized to a fairly
451 generic state. A BFD starts life by pointing to this
452 structure, until the correct back end has determined the real
453 architecture of the file.
455 extern const bfd_arch_info_type bfd_default_arch_struct;
458 @findex bfd_set_arch_info
459 @subsubsection @code{bfd_set_arch_info}
462 void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
464 @strong{Description}@*
465 Set the architecture info of @var{abfd} to @var{arg}.
467 @findex bfd_default_set_arch_mach
468 @subsubsection @code{bfd_default_set_arch_mach}
471 bfd_boolean bfd_default_set_arch_mach
472 (bfd *abfd, enum bfd_architecture arch, unsigned long mach);
474 @strong{Description}@*
475 Set the architecture and machine type in BFD @var{abfd}
476 to @var{arch} and @var{mach}. Find the correct
477 pointer to a structure and insert it into the @code{arch_info}
481 @subsubsection @code{bfd_get_arch}
484 enum bfd_architecture bfd_get_arch (bfd *abfd);
486 @strong{Description}@*
487 Return the enumerated type which describes the BFD @var{abfd}'s
491 @subsubsection @code{bfd_get_mach}
494 unsigned long bfd_get_mach (bfd *abfd);
496 @strong{Description}@*
497 Return the long type which describes the BFD @var{abfd}'s
500 @findex bfd_arch_bits_per_byte
501 @subsubsection @code{bfd_arch_bits_per_byte}
504 unsigned int bfd_arch_bits_per_byte (bfd *abfd);
506 @strong{Description}@*
507 Return the number of bits in one of the BFD @var{abfd}'s
508 architecture's bytes.
510 @findex bfd_arch_bits_per_address
511 @subsubsection @code{bfd_arch_bits_per_address}
514 unsigned int bfd_arch_bits_per_address (bfd *abfd);
516 @strong{Description}@*
517 Return the number of bits in one of the BFD @var{abfd}'s
518 architecture's addresses.
520 @findex bfd_default_compatible
521 @subsubsection @code{bfd_default_compatible}
524 const bfd_arch_info_type *bfd_default_compatible
525 (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
527 @strong{Description}@*
528 The default function for testing for compatibility.
530 @findex bfd_default_scan
531 @subsubsection @code{bfd_default_scan}
534 bfd_boolean bfd_default_scan
535 (const struct bfd_arch_info *info, const char *string);
537 @strong{Description}@*
538 The default function for working out whether this is an
539 architecture hit and a machine hit.
541 @findex bfd_get_arch_info
542 @subsubsection @code{bfd_get_arch_info}
545 const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
547 @strong{Description}@*
548 Return the architecture info struct in @var{abfd}.
550 @findex bfd_lookup_arch
551 @subsubsection @code{bfd_lookup_arch}
554 const bfd_arch_info_type *bfd_lookup_arch
555 (enum bfd_architecture arch, unsigned long machine);
557 @strong{Description}@*
558 Look for the architecture info structure which matches the
559 arguments @var{arch} and @var{machine}. A machine of 0 matches the
560 machine/architecture structure which marks itself as the
563 @findex bfd_printable_arch_mach
564 @subsubsection @code{bfd_printable_arch_mach}
567 const char *bfd_printable_arch_mach
568 (enum bfd_architecture arch, unsigned long machine);
570 @strong{Description}@*
571 Return a printable string representing the architecture and
574 This routine is depreciated.
576 @findex bfd_octets_per_byte
577 @subsubsection @code{bfd_octets_per_byte}
580 unsigned int bfd_octets_per_byte (bfd *abfd);
582 @strong{Description}@*
583 Return the number of octets (8-bit quantities) per target byte
584 (minimum addressable unit). In most cases, this will be one, but some
585 DSP targets have 16, 32, or even 48 bits per byte.
587 @findex bfd_arch_mach_octets_per_byte
588 @subsubsection @code{bfd_arch_mach_octets_per_byte}
591 unsigned int bfd_arch_mach_octets_per_byte
592 (enum bfd_architecture arch, unsigned long machine);
594 @strong{Description}@*
595 See bfd_octets_per_byte.
597 This routine is provided for those cases where a bfd * is not