source: trunk/binutils/bfd/doc/archures.texi@ 3232

Last change on this file since 3232 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 17.3 KB
Line 
1@section Architectures
2BFD keeps one atom in a BFD describing the
3architecture of the data attached to the BFD: a pointer to a
4@code{bfd_arch_info_type}.
5
6Pointers to structures can be requested independently of a BFD
7so that an architecture's information can be interrogated
8without access to an open BFD.
9
10The architecture information is provided by each architecture package.
11The 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
14defined, then all the architectures supported are included.
15
16When BFD starts up, all the architectures are called with an
17initialize method. It is up to the architecture back end to
18insert as many items into the list of architectures as it wants to;
19generally this would be one for each machine and one for the
20default case (an item with a machine field of 0).
21
22BFD's idea of an architecture is implemented in @file{archures.c}.
23
24@subsection bfd_architecture
25
26
27@strong{Description}@*
28This enum gives the object file's CPU architecture, in a
29global sense---i.e., what processor family does it belong to?
30Another field indicates which processor within
31the family is in use. The machine gives a number which
32distinguishes different versions of the architecture,
33containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
34and 68020 and 68030 for Motorola 68020 and 68030.
35@example
36enum bfd_architecture
37@{
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_mcf5200 9
50#define bfd_mach_mcf5206e 10
51#define bfd_mach_mcf5307 11
52#define bfd_mach_mcf5407 12
53 bfd_arch_vax, /* DEC Vax */
54 bfd_arch_i960, /* Intel 960 */
55 /* The order of the following is important.
56 lower number indicates a machine type that
57 only accepts a subset of the instructions
58 available to machines with higher numbers.
59 The exception is the "ca", which is
60 incompatible with all other machines except
61 "core". */
62
63#define bfd_mach_i960_core 1
64#define bfd_mach_i960_ka_sa 2
65#define bfd_mach_i960_kb_sb 3
66#define bfd_mach_i960_mc 4
67#define bfd_mach_i960_xa 5
68#define bfd_mach_i960_ca 6
69#define bfd_mach_i960_jx 7
70#define bfd_mach_i960_hx 8
71
72 bfd_arch_or32, /* OpenRISC 32 */
73
74 bfd_arch_a29k, /* AMD 29000 */
75 bfd_arch_sparc, /* SPARC */
76#define bfd_mach_sparc 1
77/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
78#define bfd_mach_sparc_sparclet 2
79#define bfd_mach_sparc_sparclite 3
80#define bfd_mach_sparc_v8plus 4
81#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
82#define bfd_mach_sparc_sparclite_le 6
83#define bfd_mach_sparc_v9 7
84#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
85#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
86#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
87/* Nonzero if MACH has the v9 instruction set. */
88#define bfd_mach_sparc_v9_p(mach) \
89 ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
90 && (mach) != bfd_mach_sparc_sparclite_le)
91 bfd_arch_mips, /* MIPS Rxxxx */
92#define bfd_mach_mips3000 3000
93#define bfd_mach_mips3900 3900
94#define bfd_mach_mips4000 4000
95#define bfd_mach_mips4010 4010
96#define bfd_mach_mips4100 4100
97#define bfd_mach_mips4111 4111
98#define bfd_mach_mips4120 4120
99#define bfd_mach_mips4300 4300
100#define bfd_mach_mips4400 4400
101#define bfd_mach_mips4600 4600
102#define bfd_mach_mips4650 4650
103#define bfd_mach_mips5000 5000
104#define bfd_mach_mips5400 5400
105#define bfd_mach_mips5500 5500
106#define bfd_mach_mips6000 6000
107#define bfd_mach_mips8000 8000
108#define bfd_mach_mips10000 10000
109#define bfd_mach_mips12000 12000
110#define bfd_mach_mips16 16
111#define bfd_mach_mips5 5
112#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
113#define bfd_mach_mipsisa32 32
114#define bfd_mach_mipsisa32r2 33
115#define bfd_mach_mipsisa64 64
116 bfd_arch_i386, /* Intel 386 */
117#define bfd_mach_i386_i386 1
118#define bfd_mach_i386_i8086 2
119#define bfd_mach_i386_i386_intel_syntax 3
120#define bfd_mach_x86_64 64
121#define bfd_mach_x86_64_intel_syntax 65
122 bfd_arch_we32k, /* AT&T WE32xxx */
123 bfd_arch_tahoe, /* CCI/Harris Tahoe */
124 bfd_arch_i860, /* Intel 860 */
125 bfd_arch_i370, /* IBM 360/370 Mainframes */
126 bfd_arch_romp, /* IBM ROMP PC/RT */
127 bfd_arch_alliant, /* Alliant */
128 bfd_arch_convex, /* Convex */
129 bfd_arch_m88k, /* Motorola 88xxx */
130 bfd_arch_m98k, /* Motorola 98xxx */
131 bfd_arch_pyramid, /* Pyramid Technology */
132 bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
133#define bfd_mach_h8300 1
134#define bfd_mach_h8300h 2
135#define bfd_mach_h8300s 3
136#define bfd_mach_h8300hn 4
137#define bfd_mach_h8300sn 5
138 bfd_arch_pdp11, /* DEC PDP-11 */
139 bfd_arch_powerpc, /* PowerPC */
140#define bfd_mach_ppc 32
141#define bfd_mach_ppc64 64
142#define bfd_mach_ppc_403 403
143#define bfd_mach_ppc_403gc 4030
144#define bfd_mach_ppc_505 505
145#define bfd_mach_ppc_601 601
146#define bfd_mach_ppc_602 602
147#define bfd_mach_ppc_603 603
148#define bfd_mach_ppc_ec603e 6031
149#define bfd_mach_ppc_604 604
150#define bfd_mach_ppc_620 620
151#define bfd_mach_ppc_630 630
152#define bfd_mach_ppc_750 750
153#define bfd_mach_ppc_860 860
154#define bfd_mach_ppc_a35 35
155#define bfd_mach_ppc_rs64ii 642
156#define bfd_mach_ppc_rs64iii 643
157#define bfd_mach_ppc_7400 7400
158#define bfd_mach_ppc_e500 500
159 bfd_arch_rs6000, /* IBM RS/6000 */
160#define bfd_mach_rs6k 6000
161#define bfd_mach_rs6k_rs1 6001
162#define bfd_mach_rs6k_rsc 6003
163#define bfd_mach_rs6k_rs2 6002
164 bfd_arch_hppa, /* HP PA RISC */
165 bfd_arch_d10v, /* Mitsubishi D10V */
166#define bfd_mach_d10v 1
167#define bfd_mach_d10v_ts2 2
168#define bfd_mach_d10v_ts3 3
169 bfd_arch_d30v, /* Mitsubishi D30V */
170 bfd_arch_dlx, /* DLX */
171 bfd_arch_m68hc11, /* Motorola 68HC11 */
172 bfd_arch_m68hc12, /* Motorola 68HC12 */
173#define bfd_mach_m6812_default 0
174#define bfd_mach_m6812 1
175#define bfd_mach_m6812s 2
176 bfd_arch_z8k, /* Zilog Z8000 */
177#define bfd_mach_z8001 1
178#define bfd_mach_z8002 2
179 bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
180 bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
181#define bfd_mach_sh 1
182#define bfd_mach_sh2 0x20
183#define bfd_mach_sh_dsp 0x2d
184#define bfd_mach_sh2e 0x2e
185#define bfd_mach_sh3 0x30
186#define bfd_mach_sh3_dsp 0x3d
187#define bfd_mach_sh3e 0x3e
188#define bfd_mach_sh4 0x40
189#define bfd_mach_sh5 0x50
190 bfd_arch_alpha, /* Dec Alpha */
191#define bfd_mach_alpha_ev4 0x10
192#define bfd_mach_alpha_ev5 0x20
193#define bfd_mach_alpha_ev6 0x30
194 bfd_arch_arm, /* Advanced Risc Machines ARM. */
195#define bfd_mach_arm_unknown 0
196#define bfd_mach_arm_2 1
197#define bfd_mach_arm_2a 2
198#define bfd_mach_arm_3 3
199#define bfd_mach_arm_3M 4
200#define bfd_mach_arm_4 5
201#define bfd_mach_arm_4T 6
202#define bfd_mach_arm_5 7
203#define bfd_mach_arm_5T 8
204#define bfd_mach_arm_5TE 9
205#define bfd_mach_arm_XScale 10
206#define bfd_mach_arm_ep9312 11
207#define bfd_mach_arm_iWMMXt 12
208 bfd_arch_ns32k, /* National Semiconductors ns32000 */
209 bfd_arch_w65, /* WDC 65816 */
210 bfd_arch_tic30, /* Texas Instruments TMS320C30 */
211 bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
212#define bfd_mach_tic3x 30
213#define bfd_mach_tic4x 40
214 bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
215 bfd_arch_tic80, /* TI TMS320c80 (MVP) */
216 bfd_arch_v850, /* NEC V850 */
217#define bfd_mach_v850 1
218#define bfd_mach_v850e 'E'
219 bfd_arch_arc, /* ARC Cores */
220#define bfd_mach_arc_5 5
221#define bfd_mach_arc_6 6
222#define bfd_mach_arc_7 7
223#define bfd_mach_arc_8 8
224 bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
225#define bfd_mach_m32r 1 /* For backwards compatibility. */
226#define bfd_mach_m32rx 'x'
227 bfd_arch_mn10200, /* Matsushita MN10200 */
228 bfd_arch_mn10300, /* Matsushita MN10300 */
229#define bfd_mach_mn10300 300
230#define bfd_mach_am33 330
231 bfd_arch_fr30,
232#define bfd_mach_fr30 0x46523330
233 bfd_arch_frv,
234#define bfd_mach_frv 1
235#define bfd_mach_frvsimple 2
236#define bfd_mach_fr300 300
237#define bfd_mach_fr400 400
238#define bfd_mach_frvtomcat 499 /* fr500 prototype */
239#define bfd_mach_fr500 500
240 bfd_arch_mcore,
241 bfd_arch_ia64, /* HP/Intel ia64 */
242#define bfd_mach_ia64_elf64 64
243#define bfd_mach_ia64_elf32 32
244 bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
245#define bfd_mach_ip2022 1
246#define bfd_mach_ip2022ext 2
247 bfd_arch_iq2000, /* Vitesse IQ2000. */
248#define bfd_mach_iq2000 1
249#define bfd_mach_iq10 2
250 bfd_arch_pj,
251 bfd_arch_avr, /* Atmel AVR microcontrollers. */
252#define bfd_mach_avr1 1
253#define bfd_mach_avr2 2
254#define bfd_mach_avr3 3
255#define bfd_mach_avr4 4
256#define bfd_mach_avr5 5
257 bfd_arch_cris, /* Axis CRIS */
258 bfd_arch_s390, /* IBM s390 */
259#define bfd_mach_s390_31 31
260#define bfd_mach_s390_64 64
261 bfd_arch_openrisc, /* OpenRISC */
262 bfd_arch_mmix, /* Donald Knuth's educational processor. */
263 bfd_arch_xstormy16,
264#define bfd_mach_xstormy16 1
265 bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
266#define bfd_mach_msp110 110
267#define bfd_mach_msp11 11
268#define bfd_mach_msp12 12
269#define bfd_mach_msp13 13
270#define bfd_mach_msp14 14
271#define bfd_mach_msp41 41
272#define bfd_mach_msp31 31
273#define bfd_mach_msp32 32
274#define bfd_mach_msp33 33
275#define bfd_mach_msp43 43
276#define bfd_mach_msp44 44
277#define bfd_mach_msp15 15
278#define bfd_mach_msp16 16
279 bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
280#define bfd_mach_xtensa 1
281 bfd_arch_last
282 @};
283@end example
284
285@subsection bfd_arch_info
286
287
288@strong{Description}@*
289This structure contains information on architectures for use
290within BFD.
291@example
292
293typedef struct bfd_arch_info
294@{
295 int bits_per_word;
296 int bits_per_address;
297 int bits_per_byte;
298 enum bfd_architecture arch;
299 unsigned long mach;
300 const char *arch_name;
301 const char *printable_name;
302 unsigned int section_align_power;
303 /* TRUE if this is the default machine for the architecture.
304 The default arch should be the first entry for an arch so that
305 all the entries for that arch can be accessed via @code{next}. */
306 bfd_boolean the_default;
307 const struct bfd_arch_info * (*compatible)
308 PARAMS ((const struct bfd_arch_info *a,
309 const struct bfd_arch_info *b));
310
311 bfd_boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
312
313 const struct bfd_arch_info *next;
314@}
315bfd_arch_info_type;
316
317@end example
318
319@findex bfd_printable_name
320@subsubsection @code{bfd_printable_name}
321@strong{Synopsis}
322@example
323const char *bfd_printable_name(bfd *abfd);
324@end example
325@strong{Description}@*
326Return a printable string representing the architecture and machine
327from the pointer to the architecture info structure.
328
329@findex bfd_scan_arch
330@subsubsection @code{bfd_scan_arch}
331@strong{Synopsis}
332@example
333const bfd_arch_info_type *bfd_scan_arch(const char *string);
334@end example
335@strong{Description}@*
336Figure out if BFD supports any cpu which could be described with
337the name @var{string}. Return a pointer to an @code{arch_info}
338structure if a machine is found, otherwise NULL.
339
340@findex bfd_arch_list
341@subsubsection @code{bfd_arch_list}
342@strong{Synopsis}
343@example
344const char **bfd_arch_list(void);
345@end example
346@strong{Description}@*
347Return a freshly malloced NULL-terminated vector of the names
348of all the valid BFD architectures. Do not modify the names.
349
350@findex bfd_arch_get_compatible
351@subsubsection @code{bfd_arch_get_compatible}
352@strong{Synopsis}
353@example
354const bfd_arch_info_type *bfd_arch_get_compatible(
355 const bfd *abfd,
356 const bfd *bbfd,
357 bfd_boolean accept_unknowns);
358@end example
359@strong{Description}@*
360Determine whether two BFDs' architectures and machine types
361are compatible. Calculates the lowest common denominator
362between the two architectures and machine types implied by
363the BFDs and returns a pointer to an @code{arch_info} structure
364describing the compatible machine.
365
366@findex bfd_default_arch_struct
367@subsubsection @code{bfd_default_arch_struct}
368@strong{Description}@*
369The @code{bfd_default_arch_struct} is an item of
370@code{bfd_arch_info_type} which has been initialized to a fairly
371generic state. A BFD starts life by pointing to this
372structure, until the correct back end has determined the real
373architecture of the file.
374@example
375extern const bfd_arch_info_type bfd_default_arch_struct;
376@end example
377
378@findex bfd_set_arch_info
379@subsubsection @code{bfd_set_arch_info}
380@strong{Synopsis}
381@example
382void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
383@end example
384@strong{Description}@*
385Set the architecture info of @var{abfd} to @var{arg}.
386
387@findex bfd_default_set_arch_mach
388@subsubsection @code{bfd_default_set_arch_mach}
389@strong{Synopsis}
390@example
391bfd_boolean bfd_default_set_arch_mach(bfd *abfd,
392 enum bfd_architecture arch,
393 unsigned long mach);
394@end example
395@strong{Description}@*
396Set the architecture and machine type in BFD @var{abfd}
397to @var{arch} and @var{mach}. Find the correct
398pointer to a structure and insert it into the @code{arch_info}
399pointer.
400
401@findex bfd_get_arch
402@subsubsection @code{bfd_get_arch}
403@strong{Synopsis}
404@example
405enum bfd_architecture bfd_get_arch(bfd *abfd);
406@end example
407@strong{Description}@*
408Return the enumerated type which describes the BFD @var{abfd}'s
409architecture.
410
411@findex bfd_get_mach
412@subsubsection @code{bfd_get_mach}
413@strong{Synopsis}
414@example
415unsigned long bfd_get_mach(bfd *abfd);
416@end example
417@strong{Description}@*
418Return the long type which describes the BFD @var{abfd}'s
419machine.
420
421@findex bfd_arch_bits_per_byte
422@subsubsection @code{bfd_arch_bits_per_byte}
423@strong{Synopsis}
424@example
425unsigned int bfd_arch_bits_per_byte(bfd *abfd);
426@end example
427@strong{Description}@*
428Return the number of bits in one of the BFD @var{abfd}'s
429architecture's bytes.
430
431@findex bfd_arch_bits_per_address
432@subsubsection @code{bfd_arch_bits_per_address}
433@strong{Synopsis}
434@example
435unsigned int bfd_arch_bits_per_address(bfd *abfd);
436@end example
437@strong{Description}@*
438Return the number of bits in one of the BFD @var{abfd}'s
439architecture's addresses.
440
441@findex bfd_default_compatible
442@subsubsection @code{bfd_default_compatible}
443@strong{Synopsis}
444@example
445const bfd_arch_info_type *bfd_default_compatible
446 (const bfd_arch_info_type *a,
447 const bfd_arch_info_type *b);
448@end example
449@strong{Description}@*
450The default function for testing for compatibility.
451
452@findex bfd_default_scan
453@subsubsection @code{bfd_default_scan}
454@strong{Synopsis}
455@example
456bfd_boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
457@end example
458@strong{Description}@*
459The default function for working out whether this is an
460architecture hit and a machine hit.
461
462@findex bfd_get_arch_info
463@subsubsection @code{bfd_get_arch_info}
464@strong{Synopsis}
465@example
466const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
467@end example
468@strong{Description}@*
469Return the architecture info struct in @var{abfd}.
470
471@findex bfd_lookup_arch
472@subsubsection @code{bfd_lookup_arch}
473@strong{Synopsis}
474@example
475const bfd_arch_info_type *bfd_lookup_arch
476 (enum bfd_architecture
477 arch,
478 unsigned long machine);
479@end example
480@strong{Description}@*
481Look for the architecure info structure which matches the
482arguments @var{arch} and @var{machine}. A machine of 0 matches the
483machine/architecture structure which marks itself as the
484default.
485
486@findex bfd_printable_arch_mach
487@subsubsection @code{bfd_printable_arch_mach}
488@strong{Synopsis}
489@example
490const char *bfd_printable_arch_mach
491 (enum bfd_architecture arch, unsigned long machine);
492@end example
493@strong{Description}@*
494Return a printable string representing the architecture and
495machine type.
496
497This routine is depreciated.
498
499@findex bfd_octets_per_byte
500@subsubsection @code{bfd_octets_per_byte}
501@strong{Synopsis}
502@example
503unsigned int bfd_octets_per_byte(bfd *abfd);
504@end example
505@strong{Description}@*
506Return the number of octets (8-bit quantities) per target byte
507(minimum addressable unit). In most cases, this will be one, but some
508DSP targets have 16, 32, or even 48 bits per byte.
509
510@findex bfd_arch_mach_octets_per_byte
511@subsubsection @code{bfd_arch_mach_octets_per_byte}
512@strong{Synopsis}
513@example
514unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
515 unsigned long machine);
516@end example
517@strong{Description}@*
518See bfd_octets_per_byte.
519
520This routine is provided for those cases where a bfd * is not
521available
522
Note: See TracBrowser for help on using the repository browser.