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