1 |
104 |
markom |
@section Architectures
|
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}.
|
5 |
|
|
|
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.
|
9 |
|
|
|
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.
|
15 |
|
|
|
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).
|
21 |
|
|
|
22 |
|
|
BFD's idea of an architecture is implemented in @file{archures.c}.
|
23 |
|
|
|
24 |
|
|
@subsection bfd_architecture
|
25 |
|
|
|
26 |
|
|
|
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.
|
35 |
|
|
@example
|
36 |
|
|
enum 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 |
|
|
bfd_arch_vax, /* DEC Vax */
|
50 |
|
|
bfd_arch_i960, /* Intel 960 */
|
51 |
|
|
/* The order of the following is important.
|
52 |
|
|
lower number indicates a machine type that
|
53 |
|
|
only accepts a subset of the instructions
|
54 |
|
|
available to machines with higher numbers.
|
55 |
|
|
The exception is the "ca", which is
|
56 |
|
|
incompatible with all other machines except
|
57 |
|
|
"core". */
|
58 |
|
|
|
59 |
|
|
#define bfd_mach_i960_core 1
|
60 |
|
|
#define bfd_mach_i960_ka_sa 2
|
61 |
|
|
#define bfd_mach_i960_kb_sb 3
|
62 |
|
|
#define bfd_mach_i960_mc 4
|
63 |
|
|
#define bfd_mach_i960_xa 5
|
64 |
|
|
#define bfd_mach_i960_ca 6
|
65 |
|
|
#define bfd_mach_i960_jx 7
|
66 |
|
|
#define bfd_mach_i960_hx 8
|
67 |
|
|
|
68 |
|
|
bfd_arch_a29k, /* AMD 29000 */
|
69 |
|
|
bfd_arch_sparc, /* SPARC */
|
70 |
|
|
#define bfd_mach_sparc 1
|
71 |
|
|
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
|
72 |
|
|
#define bfd_mach_sparc_sparclet 2
|
73 |
|
|
#define bfd_mach_sparc_sparclite 3
|
74 |
|
|
#define bfd_mach_sparc_v8plus 4
|
75 |
|
|
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */
|
76 |
|
|
#define bfd_mach_sparc_sparclite_le 6
|
77 |
|
|
#define bfd_mach_sparc_v9 7
|
78 |
|
|
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */
|
79 |
|
|
/* Nonzero if MACH has the v9 instruction set. */
|
80 |
|
|
#define bfd_mach_sparc_v9_p(mach) \
|
81 |
|
|
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
|
82 |
|
|
bfd_arch_mips, /* MIPS Rxxxx */
|
83 |
|
|
#define bfd_mach_mips3000 3000
|
84 |
|
|
#define bfd_mach_mips3900 3900
|
85 |
|
|
#define bfd_mach_mips4000 4000
|
86 |
|
|
#define bfd_mach_mips4010 4010
|
87 |
|
|
#define bfd_mach_mips4100 4100
|
88 |
|
|
#define bfd_mach_mips4111 4111
|
89 |
|
|
#define bfd_mach_mips4300 4300
|
90 |
|
|
#define bfd_mach_mips4400 4400
|
91 |
|
|
#define bfd_mach_mips4600 4600
|
92 |
|
|
#define bfd_mach_mips4650 4650
|
93 |
|
|
#define bfd_mach_mips5000 5000
|
94 |
|
|
#define bfd_mach_mips6000 6000
|
95 |
|
|
#define bfd_mach_mips8000 8000
|
96 |
|
|
#define bfd_mach_mips10000 10000
|
97 |
|
|
#define bfd_mach_mips16 16
|
98 |
|
|
bfd_arch_i386, /* Intel 386 */
|
99 |
|
|
#define bfd_mach_i386_i386 0
|
100 |
|
|
#define bfd_mach_i386_i8086 1
|
101 |
|
|
#define bfd_mach_i386_i386_intel_syntax 2
|
102 |
|
|
bfd_arch_we32k, /* AT&T WE32xxx */
|
103 |
|
|
bfd_arch_tahoe, /* CCI/Harris Tahoe */
|
104 |
|
|
bfd_arch_i860, /* Intel 860 */
|
105 |
|
|
bfd_arch_i370, /* IBM 360/370 Mainframes */
|
106 |
|
|
bfd_arch_romp, /* IBM ROMP PC/RT */
|
107 |
|
|
bfd_arch_alliant, /* Alliant */
|
108 |
|
|
bfd_arch_convex, /* Convex */
|
109 |
|
|
bfd_arch_m88k, /* Motorola 88xxx */
|
110 |
|
|
bfd_arch_pyramid, /* Pyramid Technology */
|
111 |
|
|
bfd_arch_h8300, /* Hitachi H8/300 */
|
112 |
|
|
#define bfd_mach_h8300 1
|
113 |
|
|
#define bfd_mach_h8300h 2
|
114 |
|
|
#define bfd_mach_h8300s 3
|
115 |
|
|
bfd_arch_powerpc, /* PowerPC */
|
116 |
|
|
bfd_arch_rs6000, /* IBM RS/6000 */
|
117 |
|
|
bfd_arch_hppa, /* HP PA RISC */
|
118 |
|
|
bfd_arch_d10v, /* Mitsubishi D10V */
|
119 |
|
|
#define bfd_mach_d10v 0
|
120 |
|
|
#define bfd_mach_d10v_ts2 2
|
121 |
|
|
#define bfd_mach_d10v_ts3 3
|
122 |
|
|
bfd_arch_d30v, /* Mitsubishi D30V */
|
123 |
|
|
bfd_arch_z8k, /* Zilog Z8000 */
|
124 |
|
|
#define bfd_mach_z8001 1
|
125 |
|
|
#define bfd_mach_z8002 2
|
126 |
|
|
bfd_arch_h8500, /* Hitachi H8/500 */
|
127 |
|
|
bfd_arch_sh, /* Hitachi SH */
|
128 |
|
|
#define bfd_mach_sh 0
|
129 |
|
|
#define bfd_mach_sh2 0x20
|
130 |
|
|
#define bfd_mach_sh_dsp 0x2d
|
131 |
|
|
#define bfd_mach_sh3 0x30
|
132 |
|
|
#define bfd_mach_sh3_dsp 0x3d
|
133 |
|
|
#define bfd_mach_sh3e 0x3e
|
134 |
|
|
#define bfd_mach_sh4 0x40
|
135 |
|
|
bfd_arch_alpha, /* Dec Alpha */
|
136 |
|
|
#define bfd_mach_alpha_ev4 0x10
|
137 |
|
|
#define bfd_mach_alpha_ev5 0x20
|
138 |
|
|
#define bfd_mach_alpha_ev6 0x30
|
139 |
|
|
bfd_arch_arm, /* Advanced Risc Machines ARM */
|
140 |
|
|
#define bfd_mach_arm_2 1
|
141 |
|
|
#define bfd_mach_arm_2a 2
|
142 |
|
|
#define bfd_mach_arm_3 3
|
143 |
|
|
#define bfd_mach_arm_3M 4
|
144 |
|
|
#define bfd_mach_arm_4 5
|
145 |
|
|
#define bfd_mach_arm_4T 6
|
146 |
|
|
#define bfd_mach_arm_5 7
|
147 |
|
|
#define bfd_mach_arm_5T 8
|
148 |
|
|
bfd_arch_ns32k, /* National Semiconductors ns32000 */
|
149 |
|
|
bfd_arch_w65, /* WDC 65816 */
|
150 |
|
|
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
|
151 |
|
|
bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
|
152 |
|
|
bfd_arch_tic80, /* TI TMS320c80 (MVP) */
|
153 |
|
|
bfd_arch_v850, /* NEC V850 */
|
154 |
|
|
#define bfd_mach_v850 0
|
155 |
|
|
#define bfd_mach_v850e 'E'
|
156 |
|
|
#define bfd_mach_v850ea 'A'
|
157 |
|
|
bfd_arch_arc, /* Argonaut RISC Core */
|
158 |
|
|
#define bfd_mach_arc_base 0
|
159 |
|
|
bfd_arch_m32r, /* Mitsubishi M32R/D */
|
160 |
|
|
#define bfd_mach_m32r 0 /* backwards compatibility */
|
161 |
|
|
#define bfd_mach_m32rx 'x'
|
162 |
|
|
bfd_arch_mn10200, /* Matsushita MN10200 */
|
163 |
|
|
bfd_arch_mn10300, /* Matsushita MN10300 */
|
164 |
|
|
#define bfd_mach_mn10300 300
|
165 |
|
|
#define bfd_mach_am33 330
|
166 |
|
|
bfd_arch_fr30,
|
167 |
|
|
#define bfd_mach_fr30 0x46523330
|
168 |
|
|
bfd_arch_mcore,
|
169 |
|
|
bfd_arch_pj,
|
170 |
|
|
bfd_arch_avr, /* Atmel AVR microcontrollers */
|
171 |
|
|
#define bfd_mach_avr1 1
|
172 |
|
|
#define bfd_mach_avr2 2
|
173 |
|
|
#define bfd_mach_avr3 3
|
174 |
|
|
#define bfd_mach_avr4 4
|
175 |
|
|
bfd_arch_last
|
176 |
|
|
@};
|
177 |
|
|
@end example
|
178 |
|
|
|
179 |
|
|
@subsection bfd_arch_info
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
@strong{Description}@*
|
183 |
|
|
This structure contains information on architectures for use
|
184 |
|
|
within BFD.
|
185 |
|
|
@example
|
186 |
|
|
|
187 |
|
|
typedef struct bfd_arch_info
|
188 |
|
|
@{
|
189 |
|
|
int bits_per_word;
|
190 |
|
|
int bits_per_address;
|
191 |
|
|
int bits_per_byte;
|
192 |
|
|
enum bfd_architecture arch;
|
193 |
|
|
unsigned long mach;
|
194 |
|
|
const char *arch_name;
|
195 |
|
|
const char *printable_name;
|
196 |
|
|
unsigned int section_align_power;
|
197 |
|
|
/* true if this is the default machine for the architecture */
|
198 |
|
|
boolean the_default;
|
199 |
|
|
const struct bfd_arch_info * (*compatible)
|
200 |
|
|
PARAMS ((const struct bfd_arch_info *a,
|
201 |
|
|
const struct bfd_arch_info *b));
|
202 |
|
|
|
203 |
|
|
boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
|
204 |
|
|
|
205 |
|
|
const struct bfd_arch_info *next;
|
206 |
|
|
@} bfd_arch_info_type;
|
207 |
|
|
@end example
|
208 |
|
|
|
209 |
|
|
@findex bfd_printable_name
|
210 |
|
|
@subsubsection @code{bfd_printable_name}
|
211 |
|
|
@strong{Synopsis}
|
212 |
|
|
@example
|
213 |
|
|
const char *bfd_printable_name(bfd *abfd);
|
214 |
|
|
@end example
|
215 |
|
|
@strong{Description}@*
|
216 |
|
|
Return a printable string representing the architecture and machine
|
217 |
|
|
from the pointer to the architecture info structure.
|
218 |
|
|
|
219 |
|
|
@findex bfd_scan_arch
|
220 |
|
|
@subsubsection @code{bfd_scan_arch}
|
221 |
|
|
@strong{Synopsis}
|
222 |
|
|
@example
|
223 |
|
|
const bfd_arch_info_type *bfd_scan_arch(const char *string);
|
224 |
|
|
@end example
|
225 |
|
|
@strong{Description}@*
|
226 |
|
|
Figure out if BFD supports any cpu which could be described with
|
227 |
|
|
the name @var{string}. Return a pointer to an @code{arch_info}
|
228 |
|
|
structure if a machine is found, otherwise NULL.
|
229 |
|
|
|
230 |
|
|
@findex bfd_arch_list
|
231 |
|
|
@subsubsection @code{bfd_arch_list}
|
232 |
|
|
@strong{Synopsis}
|
233 |
|
|
@example
|
234 |
|
|
const char **bfd_arch_list(void);
|
235 |
|
|
@end example
|
236 |
|
|
@strong{Description}@*
|
237 |
|
|
Return a freshly malloced NULL-terminated vector of the names
|
238 |
|
|
of all the valid BFD architectures. Do not modify the names.
|
239 |
|
|
|
240 |
|
|
@findex bfd_arch_get_compatible
|
241 |
|
|
@subsubsection @code{bfd_arch_get_compatible}
|
242 |
|
|
@strong{Synopsis}
|
243 |
|
|
@example
|
244 |
|
|
const bfd_arch_info_type *bfd_arch_get_compatible(
|
245 |
|
|
const bfd *abfd,
|
246 |
|
|
const bfd *bbfd);
|
247 |
|
|
@end example
|
248 |
|
|
@strong{Description}@*
|
249 |
|
|
Determine whether two BFDs'
|
250 |
|
|
architectures and machine types are compatible. Calculates
|
251 |
|
|
the lowest common denominator between the two architectures
|
252 |
|
|
and machine types implied by the BFDs and returns a pointer to
|
253 |
|
|
an @code{arch_info} structure describing the compatible machine.
|
254 |
|
|
|
255 |
|
|
@findex bfd_default_arch_struct
|
256 |
|
|
@subsubsection @code{bfd_default_arch_struct}
|
257 |
|
|
@strong{Description}@*
|
258 |
|
|
The @code{bfd_default_arch_struct} is an item of
|
259 |
|
|
@code{bfd_arch_info_type} which has been initialized to a fairly
|
260 |
|
|
generic state. A BFD starts life by pointing to this
|
261 |
|
|
structure, until the correct back end has determined the real
|
262 |
|
|
architecture of the file.
|
263 |
|
|
@example
|
264 |
|
|
extern const bfd_arch_info_type bfd_default_arch_struct;
|
265 |
|
|
@end example
|
266 |
|
|
|
267 |
|
|
@findex bfd_set_arch_info
|
268 |
|
|
@subsubsection @code{bfd_set_arch_info}
|
269 |
|
|
@strong{Synopsis}
|
270 |
|
|
@example
|
271 |
|
|
void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
|
272 |
|
|
@end example
|
273 |
|
|
@strong{Description}@*
|
274 |
|
|
Set the architecture info of @var{abfd} to @var{arg}.
|
275 |
|
|
|
276 |
|
|
@findex bfd_default_set_arch_mach
|
277 |
|
|
@subsubsection @code{bfd_default_set_arch_mach}
|
278 |
|
|
@strong{Synopsis}
|
279 |
|
|
@example
|
280 |
|
|
boolean bfd_default_set_arch_mach(bfd *abfd,
|
281 |
|
|
enum bfd_architecture arch,
|
282 |
|
|
unsigned long mach);
|
283 |
|
|
@end example
|
284 |
|
|
@strong{Description}@*
|
285 |
|
|
Set the architecture and machine type in BFD @var{abfd}
|
286 |
|
|
to @var{arch} and @var{mach}. Find the correct
|
287 |
|
|
pointer to a structure and insert it into the @code{arch_info}
|
288 |
|
|
pointer.
|
289 |
|
|
|
290 |
|
|
@findex bfd_get_arch
|
291 |
|
|
@subsubsection @code{bfd_get_arch}
|
292 |
|
|
@strong{Synopsis}
|
293 |
|
|
@example
|
294 |
|
|
enum bfd_architecture bfd_get_arch(bfd *abfd);
|
295 |
|
|
@end example
|
296 |
|
|
@strong{Description}@*
|
297 |
|
|
Return the enumerated type which describes the BFD @var{abfd}'s
|
298 |
|
|
architecture.
|
299 |
|
|
|
300 |
|
|
@findex bfd_get_mach
|
301 |
|
|
@subsubsection @code{bfd_get_mach}
|
302 |
|
|
@strong{Synopsis}
|
303 |
|
|
@example
|
304 |
|
|
unsigned long bfd_get_mach(bfd *abfd);
|
305 |
|
|
@end example
|
306 |
|
|
@strong{Description}@*
|
307 |
|
|
Return the long type which describes the BFD @var{abfd}'s
|
308 |
|
|
machine.
|
309 |
|
|
|
310 |
|
|
@findex bfd_arch_bits_per_byte
|
311 |
|
|
@subsubsection @code{bfd_arch_bits_per_byte}
|
312 |
|
|
@strong{Synopsis}
|
313 |
|
|
@example
|
314 |
|
|
unsigned int bfd_arch_bits_per_byte(bfd *abfd);
|
315 |
|
|
@end example
|
316 |
|
|
@strong{Description}@*
|
317 |
|
|
Return the number of bits in one of the BFD @var{abfd}'s
|
318 |
|
|
architecture's bytes.
|
319 |
|
|
|
320 |
|
|
@findex bfd_arch_bits_per_address
|
321 |
|
|
@subsubsection @code{bfd_arch_bits_per_address}
|
322 |
|
|
@strong{Synopsis}
|
323 |
|
|
@example
|
324 |
|
|
unsigned int bfd_arch_bits_per_address(bfd *abfd);
|
325 |
|
|
@end example
|
326 |
|
|
@strong{Description}@*
|
327 |
|
|
Return the number of bits in one of the BFD @var{abfd}'s
|
328 |
|
|
architecture's addresses.
|
329 |
|
|
|
330 |
|
|
@findex bfd_default_compatible
|
331 |
|
|
@subsubsection @code{bfd_default_compatible}
|
332 |
|
|
@strong{Synopsis}
|
333 |
|
|
@example
|
334 |
|
|
const bfd_arch_info_type *bfd_default_compatible
|
335 |
|
|
(const bfd_arch_info_type *a,
|
336 |
|
|
const bfd_arch_info_type *b);
|
337 |
|
|
@end example
|
338 |
|
|
@strong{Description}@*
|
339 |
|
|
The default function for testing for compatibility.
|
340 |
|
|
|
341 |
|
|
@findex bfd_default_scan
|
342 |
|
|
@subsubsection @code{bfd_default_scan}
|
343 |
|
|
@strong{Synopsis}
|
344 |
|
|
@example
|
345 |
|
|
boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
|
346 |
|
|
@end example
|
347 |
|
|
@strong{Description}@*
|
348 |
|
|
The default function for working out whether this is an
|
349 |
|
|
architecture hit and a machine hit.
|
350 |
|
|
|
351 |
|
|
@findex bfd_get_arch_info
|
352 |
|
|
@subsubsection @code{bfd_get_arch_info}
|
353 |
|
|
@strong{Synopsis}
|
354 |
|
|
@example
|
355 |
|
|
const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
|
356 |
|
|
@end example
|
357 |
|
|
@strong{Description}@*
|
358 |
|
|
Return the architecture info struct in @var{abfd}.
|
359 |
|
|
|
360 |
|
|
@findex bfd_lookup_arch
|
361 |
|
|
@subsubsection @code{bfd_lookup_arch}
|
362 |
|
|
@strong{Synopsis}
|
363 |
|
|
@example
|
364 |
|
|
const bfd_arch_info_type *bfd_lookup_arch
|
365 |
|
|
(enum bfd_architecture
|
366 |
|
|
arch,
|
367 |
|
|
unsigned long machine);
|
368 |
|
|
@end example
|
369 |
|
|
@strong{Description}@*
|
370 |
|
|
Look for the architecure info structure which matches the
|
371 |
|
|
arguments @var{arch} and @var{machine}. A machine of 0 matches the
|
372 |
|
|
machine/architecture structure which marks itself as the
|
373 |
|
|
default.
|
374 |
|
|
|
375 |
|
|
@findex bfd_printable_arch_mach
|
376 |
|
|
@subsubsection @code{bfd_printable_arch_mach}
|
377 |
|
|
@strong{Synopsis}
|
378 |
|
|
@example
|
379 |
|
|
const char *bfd_printable_arch_mach
|
380 |
|
|
(enum bfd_architecture arch, unsigned long machine);
|
381 |
|
|
@end example
|
382 |
|
|
@strong{Description}@*
|
383 |
|
|
Return a printable string representing the architecture and
|
384 |
|
|
machine type.
|
385 |
|
|
|
386 |
|
|
This routine is depreciated.
|
387 |
|
|
|
388 |
|
|
@findex bfd_octets_per_byte
|
389 |
|
|
@subsubsection @code{bfd_octets_per_byte}
|
390 |
|
|
@strong{Synopsis}
|
391 |
|
|
@example
|
392 |
|
|
unsigned int bfd_octets_per_byte(bfd *abfd);
|
393 |
|
|
@end example
|
394 |
|
|
@strong{Description}@*
|
395 |
|
|
Return the number of octets (8-bit quantities) per target byte
|
396 |
|
|
(minimum addressable unit). In most cases, this will be one, but some
|
397 |
|
|
DSP targets have 16, 32, or even 48 bits per byte.
|
398 |
|
|
|
399 |
|
|
@findex bfd_arch_mach_octets_per_byte
|
400 |
|
|
@subsubsection @code{bfd_arch_mach_octets_per_byte}
|
401 |
|
|
@strong{Synopsis}
|
402 |
|
|
@example
|
403 |
|
|
unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
|
404 |
|
|
unsigned long machine);
|
405 |
|
|
@end example
|
406 |
|
|
@strong{Description}@*
|
407 |
|
|
See bfd_octets_per_byte.
|
408 |
|
|
This routine is provided for those cases where a bfd * is not
|
409 |
|
|
available
|
410 |
|
|
|