1 | This is bfd.info, produced by makeinfo version 4.3 from bfd.texinfo.
|
---|
2 |
|
---|
3 | START-INFO-DIR-ENTRY
|
---|
4 | * Bfd: (bfd). The Binary File Descriptor library.
|
---|
5 | END-INFO-DIR-ENTRY
|
---|
6 |
|
---|
7 | This file documents the BFD library.
|
---|
8 |
|
---|
9 | Copyright (C) 1991, 2000, 2001, 2003 Free Software Foundation, Inc.
|
---|
10 |
|
---|
11 | Permission is granted to copy, distribute and/or modify this document
|
---|
12 | under the terms of the GNU Free Documentation License, Version 1.1
|
---|
13 | or any later version published by the Free Software Foundation;
|
---|
14 | with no Invariant Sections, with no Front-Cover Texts, and with no
|
---|
15 | Back-Cover Texts. A copy of the license is included in the
|
---|
16 | section entitled "GNU Free Documentation License".
|
---|
17 |
|
---|
18 |
|
---|
19 | File: bfd.info, Node: bfd_target, Prev: Targets, Up: Targets
|
---|
20 |
|
---|
21 | bfd_target
|
---|
22 | ----------
|
---|
23 |
|
---|
24 | *Description*
|
---|
25 | This structure contains everything that BFD knows about a target. It
|
---|
26 | includes things like its byte order, name, and which routines to call
|
---|
27 | to do various operations.
|
---|
28 |
|
---|
29 | Every BFD points to a target structure with its `xvec' member.
|
---|
30 |
|
---|
31 | The macros below are used to dispatch to functions through the
|
---|
32 | `bfd_target' vector. They are used in a number of macros further down
|
---|
33 | in `bfd.h', and are also used when calling various routines by hand
|
---|
34 | inside the BFD implementation. The ARGLIST argument must be
|
---|
35 | parenthesized; it contains all the arguments to the called function.
|
---|
36 |
|
---|
37 | They make the documentation (more) unpleasant to read, so if someone
|
---|
38 | wants to fix this and not break the above, please do.
|
---|
39 | #define BFD_SEND(bfd, message, arglist) \
|
---|
40 | ((*((bfd)->xvec->message)) arglist)
|
---|
41 |
|
---|
42 | #ifdef DEBUG_BFD_SEND
|
---|
43 | #undef BFD_SEND
|
---|
44 | #define BFD_SEND(bfd, message, arglist) \
|
---|
45 | (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
---|
46 | ((*((bfd)->xvec->message)) arglist) : \
|
---|
47 | (bfd_assert (__FILE__,__LINE__), NULL))
|
---|
48 | #endif
|
---|
49 | For operations which index on the BFD format:
|
---|
50 | #define BFD_SEND_FMT(bfd, message, arglist) \
|
---|
51 | (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
|
---|
52 |
|
---|
53 | #ifdef DEBUG_BFD_SEND
|
---|
54 | #undef BFD_SEND_FMT
|
---|
55 | #define BFD_SEND_FMT(bfd, message, arglist) \
|
---|
56 | (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
---|
57 | (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
|
---|
58 | (bfd_assert (__FILE__,__LINE__), NULL))
|
---|
59 | #endif
|
---|
60 | This is the structure which defines the type of BFD this is. The
|
---|
61 | `xvec' member of the struct `bfd' itself points here. Each module that
|
---|
62 | implements access to a different target under BFD, defines one of these.
|
---|
63 |
|
---|
64 | FIXME, these names should be rationalised with the names of the
|
---|
65 | entry points which call them. Too bad we can't have one macro to define
|
---|
66 | them both!
|
---|
67 | enum bfd_flavour
|
---|
68 | {
|
---|
69 | bfd_target_unknown_flavour,
|
---|
70 | bfd_target_aout_flavour,
|
---|
71 | bfd_target_coff_flavour,
|
---|
72 | bfd_target_ecoff_flavour,
|
---|
73 | bfd_target_xcoff_flavour,
|
---|
74 | bfd_target_elf_flavour,
|
---|
75 | bfd_target_ieee_flavour,
|
---|
76 | bfd_target_nlm_flavour,
|
---|
77 | bfd_target_oasys_flavour,
|
---|
78 | bfd_target_tekhex_flavour,
|
---|
79 | bfd_target_srec_flavour,
|
---|
80 | bfd_target_ihex_flavour,
|
---|
81 | bfd_target_som_flavour,
|
---|
82 | bfd_target_os9k_flavour,
|
---|
83 | bfd_target_versados_flavour,
|
---|
84 | bfd_target_msdos_flavour,
|
---|
85 | bfd_target_ovax_flavour,
|
---|
86 | bfd_target_evax_flavour,
|
---|
87 | bfd_target_mmo_flavour,
|
---|
88 | bfd_target_mach_o_flavour,
|
---|
89 | bfd_target_pef_flavour,
|
---|
90 | bfd_target_pef_xlib_flavour,
|
---|
91 | bfd_target_sym_flavour
|
---|
92 | };
|
---|
93 |
|
---|
94 | enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
|
---|
95 |
|
---|
96 | /* Forward declaration. */
|
---|
97 | typedef struct bfd_link_info _bfd_link_info;
|
---|
98 |
|
---|
99 | typedef struct bfd_target
|
---|
100 | {
|
---|
101 | /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
|
---|
102 | char *name;
|
---|
103 |
|
---|
104 | /* The "flavour" of a back end is a general indication about
|
---|
105 | the contents of a file. */
|
---|
106 | enum bfd_flavour flavour;
|
---|
107 |
|
---|
108 | /* The order of bytes within the data area of a file. */
|
---|
109 | enum bfd_endian byteorder;
|
---|
110 |
|
---|
111 | /* The order of bytes within the header parts of a file. */
|
---|
112 | enum bfd_endian header_byteorder;
|
---|
113 |
|
---|
114 | /* A mask of all the flags which an executable may have set -
|
---|
115 | from the set `BFD_NO_FLAGS', `HAS_RELOC', ...`D_PAGED'. */
|
---|
116 | flagword object_flags;
|
---|
117 |
|
---|
118 | /* A mask of all the flags which a section may have set - from
|
---|
119 | the set `SEC_NO_FLAGS', `SEC_ALLOC', ...`SET_NEVER_LOAD'. */
|
---|
120 | flagword section_flags;
|
---|
121 |
|
---|
122 | /* The character normally found at the front of a symbol.
|
---|
123 | (if any), perhaps `_'. */
|
---|
124 | char symbol_leading_char;
|
---|
125 |
|
---|
126 | /* The pad character for file names within an archive header. */
|
---|
127 | char ar_pad_char;
|
---|
128 |
|
---|
129 | /* The maximum number of characters in an archive header. */
|
---|
130 | unsigned short ar_max_namelen;
|
---|
131 |
|
---|
132 | /* Entries for byte swapping for data. These are different from the
|
---|
133 | other entry points, since they don't take a BFD asthe first argument.
|
---|
134 | Certain other handlers could do the same. */
|
---|
135 | bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
|
---|
136 | bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
|
---|
137 | void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
---|
138 | bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
|
---|
139 | bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
|
---|
140 | void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
---|
141 | bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
|
---|
142 | bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
|
---|
143 | void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
---|
144 |
|
---|
145 | /* Byte swapping for the headers. */
|
---|
146 | bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
|
---|
147 | bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
|
---|
148 | void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
---|
149 | bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
|
---|
150 | bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
|
---|
151 | void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
---|
152 | bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
|
---|
153 | bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
|
---|
154 | void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
---|
155 |
|
---|
156 | /* Format dependent routines: these are vectors of entry points
|
---|
157 | within the target vector structure, one for each format to check. */
|
---|
158 |
|
---|
159 | /* Check the format of a file being read. Return a `bfd_target *' or zero. */
|
---|
160 | const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
|
---|
161 |
|
---|
162 | /* Set the format of a file being written. */
|
---|
163 | bfd_boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
|
---|
164 |
|
---|
165 | /* Write cached information into a file being written, at `bfd_close'. */
|
---|
166 | bfd_boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
|
---|
167 | The general target vector. These vectors are initialized using the
|
---|
168 | BFD_JUMP_TABLE macros.
|
---|
169 |
|
---|
170 | /* Generic entry points. */
|
---|
171 | Do not "beautify" the CONCAT* macro args. Traditional C will not
|
---|
172 | remove whitespace added here, and thus will fail to concatenate the
|
---|
173 | tokens.
|
---|
174 | #define BFD_JUMP_TABLE_GENERIC(NAME) \
|
---|
175 | CONCAT2 (NAME,_close_and_cleanup), \
|
---|
176 | CONCAT2 (NAME,_bfd_free_cached_info), \
|
---|
177 | CONCAT2 (NAME,_new_section_hook), \
|
---|
178 | CONCAT2 (NAME,_get_section_contents), \
|
---|
179 | CONCAT2 (NAME,_get_section_contents_in_window)
|
---|
180 |
|
---|
181 | /* Called when the BFD is being closed to do any necessary cleanup. */
|
---|
182 | bfd_boolean (*_close_and_cleanup) PARAMS ((bfd *));
|
---|
183 | /* Ask the BFD to free all cached information. */
|
---|
184 | bfd_boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
|
---|
185 | /* Called when a new section is created. */
|
---|
186 | bfd_boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
|
---|
187 | /* Read the contents of a section. */
|
---|
188 | bfd_boolean (*_bfd_get_section_contents)
|
---|
189 | PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
|
---|
190 | bfd_boolean (*_bfd_get_section_contents_in_window)
|
---|
191 | PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type));
|
---|
192 |
|
---|
193 | /* Entry points to copy private data. */
|
---|
194 | #define BFD_JUMP_TABLE_COPY(NAME) \
|
---|
195 | CONCAT2 (NAME,_bfd_copy_private_bfd_data), \
|
---|
196 | CONCAT2 (NAME,_bfd_merge_private_bfd_data), \
|
---|
197 | CONCAT2 (NAME,_bfd_copy_private_section_data), \
|
---|
198 | CONCAT2 (NAME,_bfd_copy_private_symbol_data), \
|
---|
199 | CONCAT2 (NAME,_bfd_set_private_flags), \
|
---|
200 | CONCAT2 (NAME,_bfd_print_private_bfd_data) \
|
---|
201 | /* Called to copy BFD general private data from one object file
|
---|
202 | to another. */
|
---|
203 | bfd_boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
|
---|
204 | /* Called to merge BFD general private data from one object file
|
---|
205 | to a common output file when linking. */
|
---|
206 | bfd_boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
|
---|
207 | /* Called to copy BFD private section data from one object file
|
---|
208 | to another. */
|
---|
209 | bfd_boolean (*_bfd_copy_private_section_data)
|
---|
210 | PARAMS ((bfd *, sec_ptr, bfd *, sec_ptr));
|
---|
211 | /* Called to copy BFD private symbol data from one symbol
|
---|
212 | to another. */
|
---|
213 | bfd_boolean (*_bfd_copy_private_symbol_data)
|
---|
214 | PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
|
---|
215 | /* Called to set private backend flags. */
|
---|
216 | bfd_boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
|
---|
217 |
|
---|
218 | /* Called to print private BFD data. */
|
---|
219 | bfd_boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));
|
---|
220 |
|
---|
221 | /* Core file entry points. */
|
---|
222 | #define BFD_JUMP_TABLE_CORE(NAME) \
|
---|
223 | CONCAT2 (NAME,_core_file_failing_command), \
|
---|
224 | CONCAT2 (NAME,_core_file_failing_signal), \
|
---|
225 | CONCAT2 (NAME,_core_file_matches_executable_p)
|
---|
226 | char * (*_core_file_failing_command) PARAMS ((bfd *));
|
---|
227 | int (*_core_file_failing_signal) PARAMS ((bfd *));
|
---|
228 | bfd_boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
|
---|
229 |
|
---|
230 | /* Archive entry points. */
|
---|
231 | #define BFD_JUMP_TABLE_ARCHIVE(NAME) \
|
---|
232 | CONCAT2 (NAME,_slurp_armap), \
|
---|
233 | CONCAT2 (NAME,_slurp_extended_name_table), \
|
---|
234 | CONCAT2 (NAME,_construct_extended_name_table), \
|
---|
235 | CONCAT2 (NAME,_truncate_arname), \
|
---|
236 | CONCAT2 (NAME,_write_armap), \
|
---|
237 | CONCAT2 (NAME,_read_ar_hdr), \
|
---|
238 | CONCAT2 (NAME,_openr_next_archived_file), \
|
---|
239 | CONCAT2 (NAME,_get_elt_at_index), \
|
---|
240 | CONCAT2 (NAME,_generic_stat_arch_elt), \
|
---|
241 | CONCAT2 (NAME,_update_armap_timestamp)
|
---|
242 | bfd_boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
|
---|
243 | bfd_boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
|
---|
244 | bfd_boolean (*_bfd_construct_extended_name_table)
|
---|
245 | PARAMS ((bfd *, char **, bfd_size_type *, const char **));
|
---|
246 | void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *));
|
---|
247 | bfd_boolean (*write_armap)
|
---|
248 | PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
---|
249 | PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
|
---|
250 | bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *));
|
---|
251 | #define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
|
---|
252 | bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
|
---|
253 | int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
|
---|
254 | bfd_boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
|
---|
255 |
|
---|
256 | /* Entry points used for symbols. */
|
---|
257 | #define BFD_JUMP_TABLE_SYMBOLS(NAME) \
|
---|
258 | CONCAT2 (NAME,_get_symtab_upper_bound), \
|
---|
259 | CONCAT2 (NAME,_get_symtab), \
|
---|
260 | CONCAT2 (NAME,_make_empty_symbol), \
|
---|
261 | CONCAT2 (NAME,_print_symbol), \
|
---|
262 | CONCAT2 (NAME,_get_symbol_info), \
|
---|
263 | CONCAT2 (NAME,_bfd_is_local_label_name), \
|
---|
264 | CONCAT2 (NAME,_get_lineno), \
|
---|
265 | CONCAT2 (NAME,_find_nearest_line), \
|
---|
266 | CONCAT2 (NAME,_bfd_make_debug_symbol), \
|
---|
267 | CONCAT2 (NAME,_read_minisymbols), \
|
---|
268 | CONCAT2 (NAME,_minisymbol_to_symbol)
|
---|
269 | long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
|
---|
270 | long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
---|
271 | struct symbol_cache_entry **));
|
---|
272 | struct symbol_cache_entry *
|
---|
273 | (*_bfd_make_empty_symbol) PARAMS ((bfd *));
|
---|
274 | void (*_bfd_print_symbol)
|
---|
275 | PARAMS ((bfd *, PTR, struct symbol_cache_entry *, bfd_print_symbol_type));
|
---|
276 | #define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
|
---|
277 | void (*_bfd_get_symbol_info)
|
---|
278 | PARAMS ((bfd *, struct symbol_cache_entry *, symbol_info *));
|
---|
279 | #define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
|
---|
280 | bfd_boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
|
---|
281 |
|
---|
282 | alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
|
---|
283 | bfd_boolean (*_bfd_find_nearest_line)
|
---|
284 | PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma,
|
---|
285 | const char **, const char **, unsigned int *));
|
---|
286 | /* Back-door to allow format-aware applications to create debug symbols
|
---|
287 | while using BFD for everything else. Currently used by the assembler
|
---|
288 | when creating COFF files. */
|
---|
289 | asymbol * (*_bfd_make_debug_symbol)
|
---|
290 | PARAMS ((bfd *, void *, unsigned long size));
|
---|
291 | #define bfd_read_minisymbols(b, d, m, s) \
|
---|
292 | BFD_SEND (b, _read_minisymbols, (b, d, m, s))
|
---|
293 | long (*_read_minisymbols)
|
---|
294 | PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *));
|
---|
295 | #define bfd_minisymbol_to_symbol(b, d, m, f) \
|
---|
296 | BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
|
---|
297 | asymbol * (*_minisymbol_to_symbol)
|
---|
298 | PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *));
|
---|
299 |
|
---|
300 | /* Routines for relocs. */
|
---|
301 | #define BFD_JUMP_TABLE_RELOCS(NAME) \
|
---|
302 | CONCAT2 (NAME,_get_reloc_upper_bound), \
|
---|
303 | CONCAT2 (NAME,_canonicalize_reloc), \
|
---|
304 | CONCAT2 (NAME,_bfd_reloc_type_lookup)
|
---|
305 | long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
---|
306 | long (*_bfd_canonicalize_reloc)
|
---|
307 | PARAMS ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry **));
|
---|
308 | /* See documentation on reloc types. */
|
---|
309 | reloc_howto_type *
|
---|
310 | (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type));
|
---|
311 |
|
---|
312 | /* Routines used when writing an object file. */
|
---|
313 | #define BFD_JUMP_TABLE_WRITE(NAME) \
|
---|
314 | CONCAT2 (NAME,_set_arch_mach), \
|
---|
315 | CONCAT2 (NAME,_set_section_contents)
|
---|
316 | bfd_boolean (*_bfd_set_arch_mach)
|
---|
317 | PARAMS ((bfd *, enum bfd_architecture, unsigned long));
|
---|
318 | bfd_boolean (*_bfd_set_section_contents)
|
---|
319 | PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
|
---|
320 |
|
---|
321 | /* Routines used by the linker. */
|
---|
322 | #define BFD_JUMP_TABLE_LINK(NAME) \
|
---|
323 | CONCAT2 (NAME,_sizeof_headers), \
|
---|
324 | CONCAT2 (NAME,_bfd_get_relocated_section_contents), \
|
---|
325 | CONCAT2 (NAME,_bfd_relax_section), \
|
---|
326 | CONCAT2 (NAME,_bfd_link_hash_table_create), \
|
---|
327 | CONCAT2 (NAME,_bfd_link_hash_table_free), \
|
---|
328 | CONCAT2 (NAME,_bfd_link_add_symbols), \
|
---|
329 | CONCAT2 (NAME,_bfd_link_just_syms), \
|
---|
330 | CONCAT2 (NAME,_bfd_final_link), \
|
---|
331 | CONCAT2 (NAME,_bfd_link_split_section), \
|
---|
332 | CONCAT2 (NAME,_bfd_gc_sections), \
|
---|
333 | CONCAT2 (NAME,_bfd_merge_sections), \
|
---|
334 | CONCAT2 (NAME,_bfd_discard_group)
|
---|
335 | int (*_bfd_sizeof_headers) PARAMS ((bfd *, bfd_boolean));
|
---|
336 | bfd_byte * (*_bfd_get_relocated_section_contents)
|
---|
337 | PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
|
---|
338 | bfd_byte *, bfd_boolean, struct symbol_cache_entry **));
|
---|
339 |
|
---|
340 | bfd_boolean (*_bfd_relax_section)
|
---|
341 | PARAMS ((bfd *, struct sec *, struct bfd_link_info *, bfd_boolean *));
|
---|
342 |
|
---|
343 | /* Create a hash table for the linker. Different backends store
|
---|
344 | different information in this table. */
|
---|
345 | struct bfd_link_hash_table *
|
---|
346 | (*_bfd_link_hash_table_create) PARAMS ((bfd *));
|
---|
347 |
|
---|
348 | /* Release the memory associated with the linker hash table. */
|
---|
349 | void (*_bfd_link_hash_table_free)
|
---|
350 | PARAMS ((struct bfd_link_hash_table *));
|
---|
351 |
|
---|
352 | /* Add symbols from this object file into the hash table. */
|
---|
353 | bfd_boolean (*_bfd_link_add_symbols)
|
---|
354 | PARAMS ((bfd *, struct bfd_link_info *));
|
---|
355 |
|
---|
356 | /* Indicate that we are only retrieving symbol values from this section. */
|
---|
357 | void (*_bfd_link_just_syms)
|
---|
358 | PARAMS ((asection *, struct bfd_link_info *));
|
---|
359 |
|
---|
360 | /* Do a link based on the link_order structures attached to each
|
---|
361 | section of the BFD. */
|
---|
362 | bfd_boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
|
---|
363 |
|
---|
364 | /* Should this section be split up into smaller pieces during linking. */
|
---|
365 | bfd_boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
|
---|
366 |
|
---|
367 | /* Remove sections that are not referenced from the output. */
|
---|
368 | bfd_boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
|
---|
369 |
|
---|
370 | /* Attempt to merge SEC_MERGE sections. */
|
---|
371 | bfd_boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
|
---|
372 |
|
---|
373 | /* Discard members of a group. */
|
---|
374 | bfd_boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *));
|
---|
375 |
|
---|
376 | /* Routines to handle dynamic symbols and relocs. */
|
---|
377 | #define BFD_JUMP_TABLE_DYNAMIC(NAME) \
|
---|
378 | CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \
|
---|
379 | CONCAT2 (NAME,_canonicalize_dynamic_symtab), \
|
---|
380 | CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \
|
---|
381 | CONCAT2 (NAME,_canonicalize_dynamic_reloc)
|
---|
382 | /* Get the amount of memory required to hold the dynamic symbols. */
|
---|
383 | long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
|
---|
384 | /* Read in the dynamic symbols. */
|
---|
385 | long (*_bfd_canonicalize_dynamic_symtab)
|
---|
386 | PARAMS ((bfd *, struct symbol_cache_entry **));
|
---|
387 | /* Get the amount of memory required to hold the dynamic relocs. */
|
---|
388 | long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
|
---|
389 | /* Read in the dynamic relocs. */
|
---|
390 | long (*_bfd_canonicalize_dynamic_reloc)
|
---|
391 | PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
|
---|
392 | A pointer to an alternative bfd_target in case the current one is not
|
---|
393 | satisfactory. This can happen when the target cpu supports both big
|
---|
394 | and little endian code, and target chosen by the linker has the wrong
|
---|
395 | endianness. The function open_output() in ld/ldlang.c uses this field
|
---|
396 | to find an alternative output format that is suitable.
|
---|
397 | /* Opposite endian version of this target. */
|
---|
398 | const struct bfd_target * alternative_target;
|
---|
399 |
|
---|
400 | /* Data for use by back-end routines, which isn't
|
---|
401 | generic enough to belong in this structure. */
|
---|
402 | PTR backend_data;
|
---|
403 |
|
---|
404 | } bfd_target;
|
---|
405 |
|
---|
406 | `bfd_set_default_target'
|
---|
407 | ........................
|
---|
408 |
|
---|
409 | *Synopsis*
|
---|
410 | bfd_boolean bfd_set_default_target (const char *name);
|
---|
411 | *Description*
|
---|
412 | Set the default target vector to use when recognizing a BFD. This
|
---|
413 | takes the name of the target, which may be a BFD target name or a
|
---|
414 | configuration triplet.
|
---|
415 |
|
---|
416 | `bfd_find_target'
|
---|
417 | .................
|
---|
418 |
|
---|
419 | *Synopsis*
|
---|
420 | const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
|
---|
421 | *Description*
|
---|
422 | Return a pointer to the transfer vector for the object target named
|
---|
423 | TARGET_NAME. If TARGET_NAME is `NULL', choose the one in the
|
---|
424 | environment variable `GNUTARGET'; if that is null or not defined, then
|
---|
425 | choose the first entry in the target list. Passing in the string
|
---|
426 | "default" or setting the environment variable to "default" will cause
|
---|
427 | the first entry in the target list to be returned, and
|
---|
428 | "target_defaulted" will be set in the BFD. This causes
|
---|
429 | `bfd_check_format' to loop over all the targets to find the one that
|
---|
430 | matches the file being read.
|
---|
431 |
|
---|
432 | `bfd_target_list'
|
---|
433 | .................
|
---|
434 |
|
---|
435 | *Synopsis*
|
---|
436 | const char ** bfd_target_list (void);
|
---|
437 | *Description*
|
---|
438 | Return a freshly malloced NULL-terminated vector of the names of all
|
---|
439 | the valid BFD targets. Do not modify the names.
|
---|
440 |
|
---|
441 | `bfd_seach_for_target'
|
---|
442 | ......................
|
---|
443 |
|
---|
444 | *Synopsis*
|
---|
445 | const bfd_target * bfd_search_for_target (int (* search_func)
|
---|
446 | (const bfd_target *, void *),
|
---|
447 | void *);
|
---|
448 | *Description*
|
---|
449 | Return a pointer to the first transfer vector in the list of transfer
|
---|
450 | vectors maintained by BFD that produces a non-zero result when passed
|
---|
451 | to the function SEARCH_FUNC. The parameter DATA is passed, unexamined,
|
---|
452 | to the search function.
|
---|
453 |
|
---|
454 |
|
---|
455 | File: bfd.info, Node: Architectures, Next: Opening and Closing, Prev: Targets, Up: BFD front end
|
---|
456 |
|
---|
457 | Architectures
|
---|
458 | =============
|
---|
459 |
|
---|
460 | BFD keeps one atom in a BFD describing the architecture of the data
|
---|
461 | attached to the BFD: a pointer to a `bfd_arch_info_type'.
|
---|
462 |
|
---|
463 | Pointers to structures can be requested independently of a BFD so
|
---|
464 | that an architecture's information can be interrogated without access
|
---|
465 | to an open BFD.
|
---|
466 |
|
---|
467 | The architecture information is provided by each architecture
|
---|
468 | package. The set of default architectures is selected by the macro
|
---|
469 | `SELECT_ARCHITECTURES'. This is normally set up in the
|
---|
470 | `config/TARGET.mt' file of your choice. If the name is not defined,
|
---|
471 | then all the architectures supported are included.
|
---|
472 |
|
---|
473 | When BFD starts up, all the architectures are called with an
|
---|
474 | initialize method. It is up to the architecture back end to insert as
|
---|
475 | many items into the list of architectures as it wants to; generally
|
---|
476 | this would be one for each machine and one for the default case (an
|
---|
477 | item with a machine field of 0).
|
---|
478 |
|
---|
479 | BFD's idea of an architecture is implemented in `archures.c'.
|
---|
480 |
|
---|
481 | bfd_architecture
|
---|
482 | ----------------
|
---|
483 |
|
---|
484 | *Description*
|
---|
485 | This enum gives the object file's CPU architecture, in a global
|
---|
486 | sense--i.e., what processor family does it belong to? Another field
|
---|
487 | indicates which processor within the family is in use. The machine
|
---|
488 | gives a number which distinguishes different versions of the
|
---|
489 | architecture, containing, for example, 2 and 3 for Intel i960 KA and
|
---|
490 | i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.
|
---|
491 | enum bfd_architecture
|
---|
492 | {
|
---|
493 | bfd_arch_unknown, /* File arch not known. */
|
---|
494 | bfd_arch_obscure, /* Arch known, not one of these. */
|
---|
495 | bfd_arch_m68k, /* Motorola 68xxx */
|
---|
496 | #define bfd_mach_m68000 1
|
---|
497 | #define bfd_mach_m68008 2
|
---|
498 | #define bfd_mach_m68010 3
|
---|
499 | #define bfd_mach_m68020 4
|
---|
500 | #define bfd_mach_m68030 5
|
---|
501 | #define bfd_mach_m68040 6
|
---|
502 | #define bfd_mach_m68060 7
|
---|
503 | #define bfd_mach_cpu32 8
|
---|
504 | #define bfd_mach_mcf5200 9
|
---|
505 | #define bfd_mach_mcf5206e 10
|
---|
506 | #define bfd_mach_mcf5307 11
|
---|
507 | #define bfd_mach_mcf5407 12
|
---|
508 | bfd_arch_vax, /* DEC Vax */
|
---|
509 | bfd_arch_i960, /* Intel 960 */
|
---|
510 | /* The order of the following is important.
|
---|
511 | lower number indicates a machine type that
|
---|
512 | only accepts a subset of the instructions
|
---|
513 | available to machines with higher numbers.
|
---|
514 | The exception is the "ca", which is
|
---|
515 | incompatible with all other machines except
|
---|
516 | "core". */
|
---|
517 |
|
---|
518 | #define bfd_mach_i960_core 1
|
---|
519 | #define bfd_mach_i960_ka_sa 2
|
---|
520 | #define bfd_mach_i960_kb_sb 3
|
---|
521 | #define bfd_mach_i960_mc 4
|
---|
522 | #define bfd_mach_i960_xa 5
|
---|
523 | #define bfd_mach_i960_ca 6
|
---|
524 | #define bfd_mach_i960_jx 7
|
---|
525 | #define bfd_mach_i960_hx 8
|
---|
526 |
|
---|
527 | bfd_arch_or32, /* OpenRISC 32 */
|
---|
528 |
|
---|
529 | bfd_arch_a29k, /* AMD 29000 */
|
---|
530 | bfd_arch_sparc, /* SPARC */
|
---|
531 | #define bfd_mach_sparc 1
|
---|
532 | /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
|
---|
533 | #define bfd_mach_sparc_sparclet 2
|
---|
534 | #define bfd_mach_sparc_sparclite 3
|
---|
535 | #define bfd_mach_sparc_v8plus 4
|
---|
536 | #define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
|
---|
537 | #define bfd_mach_sparc_sparclite_le 6
|
---|
538 | #define bfd_mach_sparc_v9 7
|
---|
539 | #define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
|
---|
540 | #define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
|
---|
541 | #define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
|
---|
542 | /* Nonzero if MACH has the v9 instruction set. */
|
---|
543 | #define bfd_mach_sparc_v9_p(mach) \
|
---|
544 | ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
|
---|
545 | && (mach) != bfd_mach_sparc_sparclite_le)
|
---|
546 | bfd_arch_mips, /* MIPS Rxxxx */
|
---|
547 | #define bfd_mach_mips3000 3000
|
---|
548 | #define bfd_mach_mips3900 3900
|
---|
549 | #define bfd_mach_mips4000 4000
|
---|
550 | #define bfd_mach_mips4010 4010
|
---|
551 | #define bfd_mach_mips4100 4100
|
---|
552 | #define bfd_mach_mips4111 4111
|
---|
553 | #define bfd_mach_mips4120 4120
|
---|
554 | #define bfd_mach_mips4300 4300
|
---|
555 | #define bfd_mach_mips4400 4400
|
---|
556 | #define bfd_mach_mips4600 4600
|
---|
557 | #define bfd_mach_mips4650 4650
|
---|
558 | #define bfd_mach_mips5000 5000
|
---|
559 | #define bfd_mach_mips5400 5400
|
---|
560 | #define bfd_mach_mips5500 5500
|
---|
561 | #define bfd_mach_mips6000 6000
|
---|
562 | #define bfd_mach_mips8000 8000
|
---|
563 | #define bfd_mach_mips10000 10000
|
---|
564 | #define bfd_mach_mips12000 12000
|
---|
565 | #define bfd_mach_mips16 16
|
---|
566 | #define bfd_mach_mips5 5
|
---|
567 | #define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
|
---|
568 | #define bfd_mach_mipsisa32 32
|
---|
569 | #define bfd_mach_mipsisa32r2 33
|
---|
570 | #define bfd_mach_mipsisa64 64
|
---|
571 | bfd_arch_i386, /* Intel 386 */
|
---|
572 | #define bfd_mach_i386_i386 1
|
---|
573 | #define bfd_mach_i386_i8086 2
|
---|
574 | #define bfd_mach_i386_i386_intel_syntax 3
|
---|
575 | #define bfd_mach_x86_64 64
|
---|
576 | #define bfd_mach_x86_64_intel_syntax 65
|
---|
577 | bfd_arch_we32k, /* AT&T WE32xxx */
|
---|
578 | bfd_arch_tahoe, /* CCI/Harris Tahoe */
|
---|
579 | bfd_arch_i860, /* Intel 860 */
|
---|
580 | bfd_arch_i370, /* IBM 360/370 Mainframes */
|
---|
581 | bfd_arch_romp, /* IBM ROMP PC/RT */
|
---|
582 | bfd_arch_alliant, /* Alliant */
|
---|
583 | bfd_arch_convex, /* Convex */
|
---|
584 | bfd_arch_m88k, /* Motorola 88xxx */
|
---|
585 | bfd_arch_m98k, /* Motorola 98xxx */
|
---|
586 | bfd_arch_pyramid, /* Pyramid Technology */
|
---|
587 | bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
|
---|
588 | #define bfd_mach_h8300 1
|
---|
589 | #define bfd_mach_h8300h 2
|
---|
590 | #define bfd_mach_h8300s 3
|
---|
591 | #define bfd_mach_h8300hn 4
|
---|
592 | #define bfd_mach_h8300sn 5
|
---|
593 | bfd_arch_pdp11, /* DEC PDP-11 */
|
---|
594 | bfd_arch_powerpc, /* PowerPC */
|
---|
595 | #define bfd_mach_ppc 32
|
---|
596 | #define bfd_mach_ppc64 64
|
---|
597 | #define bfd_mach_ppc_403 403
|
---|
598 | #define bfd_mach_ppc_403gc 4030
|
---|
599 | #define bfd_mach_ppc_505 505
|
---|
600 | #define bfd_mach_ppc_601 601
|
---|
601 | #define bfd_mach_ppc_602 602
|
---|
602 | #define bfd_mach_ppc_603 603
|
---|
603 | #define bfd_mach_ppc_ec603e 6031
|
---|
604 | #define bfd_mach_ppc_604 604
|
---|
605 | #define bfd_mach_ppc_620 620
|
---|
606 | #define bfd_mach_ppc_630 630
|
---|
607 | #define bfd_mach_ppc_750 750
|
---|
608 | #define bfd_mach_ppc_860 860
|
---|
609 | #define bfd_mach_ppc_a35 35
|
---|
610 | #define bfd_mach_ppc_rs64ii 642
|
---|
611 | #define bfd_mach_ppc_rs64iii 643
|
---|
612 | #define bfd_mach_ppc_7400 7400
|
---|
613 | #define bfd_mach_ppc_e500 500
|
---|
614 | bfd_arch_rs6000, /* IBM RS/6000 */
|
---|
615 | #define bfd_mach_rs6k 6000
|
---|
616 | #define bfd_mach_rs6k_rs1 6001
|
---|
617 | #define bfd_mach_rs6k_rsc 6003
|
---|
618 | #define bfd_mach_rs6k_rs2 6002
|
---|
619 | bfd_arch_hppa, /* HP PA RISC */
|
---|
620 | bfd_arch_d10v, /* Mitsubishi D10V */
|
---|
621 | #define bfd_mach_d10v 1
|
---|
622 | #define bfd_mach_d10v_ts2 2
|
---|
623 | #define bfd_mach_d10v_ts3 3
|
---|
624 | bfd_arch_d30v, /* Mitsubishi D30V */
|
---|
625 | bfd_arch_dlx, /* DLX */
|
---|
626 | bfd_arch_m68hc11, /* Motorola 68HC11 */
|
---|
627 | bfd_arch_m68hc12, /* Motorola 68HC12 */
|
---|
628 | #define bfd_mach_m6812_default 0
|
---|
629 | #define bfd_mach_m6812 1
|
---|
630 | #define bfd_mach_m6812s 2
|
---|
631 | bfd_arch_z8k, /* Zilog Z8000 */
|
---|
632 | #define bfd_mach_z8001 1
|
---|
633 | #define bfd_mach_z8002 2
|
---|
634 | bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
|
---|
635 | bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
|
---|
636 | #define bfd_mach_sh 1
|
---|
637 | #define bfd_mach_sh2 0x20
|
---|
638 | #define bfd_mach_sh_dsp 0x2d
|
---|
639 | #define bfd_mach_sh2e 0x2e
|
---|
640 | #define bfd_mach_sh3 0x30
|
---|
641 | #define bfd_mach_sh3_dsp 0x3d
|
---|
642 | #define bfd_mach_sh3e 0x3e
|
---|
643 | #define bfd_mach_sh4 0x40
|
---|
644 | #define bfd_mach_sh5 0x50
|
---|
645 | bfd_arch_alpha, /* Dec Alpha */
|
---|
646 | #define bfd_mach_alpha_ev4 0x10
|
---|
647 | #define bfd_mach_alpha_ev5 0x20
|
---|
648 | #define bfd_mach_alpha_ev6 0x30
|
---|
649 | bfd_arch_arm, /* Advanced Risc Machines ARM. */
|
---|
650 | #define bfd_mach_arm_unknown 0
|
---|
651 | #define bfd_mach_arm_2 1
|
---|
652 | #define bfd_mach_arm_2a 2
|
---|
653 | #define bfd_mach_arm_3 3
|
---|
654 | #define bfd_mach_arm_3M 4
|
---|
655 | #define bfd_mach_arm_4 5
|
---|
656 | #define bfd_mach_arm_4T 6
|
---|
657 | #define bfd_mach_arm_5 7
|
---|
658 | #define bfd_mach_arm_5T 8
|
---|
659 | #define bfd_mach_arm_5TE 9
|
---|
660 | #define bfd_mach_arm_XScale 10
|
---|
661 | #define bfd_mach_arm_ep9312 11
|
---|
662 | #define bfd_mach_arm_iWMMXt 12
|
---|
663 | bfd_arch_ns32k, /* National Semiconductors ns32000 */
|
---|
664 | bfd_arch_w65, /* WDC 65816 */
|
---|
665 | bfd_arch_tic30, /* Texas Instruments TMS320C30 */
|
---|
666 | bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
|
---|
667 | #define bfd_mach_tic3x 30
|
---|
668 | #define bfd_mach_tic4x 40
|
---|
669 | bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
|
---|
670 | bfd_arch_tic80, /* TI TMS320c80 (MVP) */
|
---|
671 | bfd_arch_v850, /* NEC V850 */
|
---|
672 | #define bfd_mach_v850 1
|
---|
673 | #define bfd_mach_v850e 'E'
|
---|
674 | bfd_arch_arc, /* ARC Cores */
|
---|
675 | #define bfd_mach_arc_5 5
|
---|
676 | #define bfd_mach_arc_6 6
|
---|
677 | #define bfd_mach_arc_7 7
|
---|
678 | #define bfd_mach_arc_8 8
|
---|
679 | bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
|
---|
680 | #define bfd_mach_m32r 1 /* For backwards compatibility. */
|
---|
681 | #define bfd_mach_m32rx 'x'
|
---|
682 | bfd_arch_mn10200, /* Matsushita MN10200 */
|
---|
683 | bfd_arch_mn10300, /* Matsushita MN10300 */
|
---|
684 | #define bfd_mach_mn10300 300
|
---|
685 | #define bfd_mach_am33 330
|
---|
686 | bfd_arch_fr30,
|
---|
687 | #define bfd_mach_fr30 0x46523330
|
---|
688 | bfd_arch_frv,
|
---|
689 | #define bfd_mach_frv 1
|
---|
690 | #define bfd_mach_frvsimple 2
|
---|
691 | #define bfd_mach_fr300 300
|
---|
692 | #define bfd_mach_fr400 400
|
---|
693 | #define bfd_mach_frvtomcat 499 /* fr500 prototype */
|
---|
694 | #define bfd_mach_fr500 500
|
---|
695 | bfd_arch_mcore,
|
---|
696 | bfd_arch_ia64, /* HP/Intel ia64 */
|
---|
697 | #define bfd_mach_ia64_elf64 64
|
---|
698 | #define bfd_mach_ia64_elf32 32
|
---|
699 | bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
|
---|
700 | #define bfd_mach_ip2022 1
|
---|
701 | #define bfd_mach_ip2022ext 2
|
---|
702 | bfd_arch_iq2000, /* Vitesse IQ2000. */
|
---|
703 | #define bfd_mach_iq2000 1
|
---|
704 | #define bfd_mach_iq10 2
|
---|
705 | bfd_arch_pj,
|
---|
706 | bfd_arch_avr, /* Atmel AVR microcontrollers. */
|
---|
707 | #define bfd_mach_avr1 1
|
---|
708 | #define bfd_mach_avr2 2
|
---|
709 | #define bfd_mach_avr3 3
|
---|
710 | #define bfd_mach_avr4 4
|
---|
711 | #define bfd_mach_avr5 5
|
---|
712 | bfd_arch_cris, /* Axis CRIS */
|
---|
713 | bfd_arch_s390, /* IBM s390 */
|
---|
714 | #define bfd_mach_s390_31 31
|
---|
715 | #define bfd_mach_s390_64 64
|
---|
716 | bfd_arch_openrisc, /* OpenRISC */
|
---|
717 | bfd_arch_mmix, /* Donald Knuth's educational processor. */
|
---|
718 | bfd_arch_xstormy16,
|
---|
719 | #define bfd_mach_xstormy16 1
|
---|
720 | bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
|
---|
721 | #define bfd_mach_msp110 110
|
---|
722 | #define bfd_mach_msp11 11
|
---|
723 | #define bfd_mach_msp12 12
|
---|
724 | #define bfd_mach_msp13 13
|
---|
725 | #define bfd_mach_msp14 14
|
---|
726 | #define bfd_mach_msp41 41
|
---|
727 | #define bfd_mach_msp31 31
|
---|
728 | #define bfd_mach_msp32 32
|
---|
729 | #define bfd_mach_msp33 33
|
---|
730 | #define bfd_mach_msp43 43
|
---|
731 | #define bfd_mach_msp44 44
|
---|
732 | #define bfd_mach_msp15 15
|
---|
733 | #define bfd_mach_msp16 16
|
---|
734 | bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
|
---|
735 | #define bfd_mach_xtensa 1
|
---|
736 | bfd_arch_last
|
---|
737 | };
|
---|
738 |
|
---|
739 | bfd_arch_info
|
---|
740 | -------------
|
---|
741 |
|
---|
742 | *Description*
|
---|
743 | This structure contains information on architectures for use within BFD.
|
---|
744 |
|
---|
745 | typedef struct bfd_arch_info
|
---|
746 | {
|
---|
747 | int bits_per_word;
|
---|
748 | int bits_per_address;
|
---|
749 | int bits_per_byte;
|
---|
750 | enum bfd_architecture arch;
|
---|
751 | unsigned long mach;
|
---|
752 | const char *arch_name;
|
---|
753 | const char *printable_name;
|
---|
754 | unsigned int section_align_power;
|
---|
755 | /* TRUE if this is the default machine for the architecture.
|
---|
756 | The default arch should be the first entry for an arch so that
|
---|
757 | all the entries for that arch can be accessed via `next'. */
|
---|
758 | bfd_boolean the_default;
|
---|
759 | const struct bfd_arch_info * (*compatible)
|
---|
760 | PARAMS ((const struct bfd_arch_info *a,
|
---|
761 | const struct bfd_arch_info *b));
|
---|
762 |
|
---|
763 | bfd_boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));
|
---|
764 |
|
---|
765 | const struct bfd_arch_info *next;
|
---|
766 | }
|
---|
767 | bfd_arch_info_type;
|
---|
768 |
|
---|
769 | `bfd_printable_name'
|
---|
770 | ....................
|
---|
771 |
|
---|
772 | *Synopsis*
|
---|
773 | const char *bfd_printable_name(bfd *abfd);
|
---|
774 | *Description*
|
---|
775 | Return a printable string representing the architecture and machine
|
---|
776 | from the pointer to the architecture info structure.
|
---|
777 |
|
---|
778 | `bfd_scan_arch'
|
---|
779 | ...............
|
---|
780 |
|
---|
781 | *Synopsis*
|
---|
782 | const bfd_arch_info_type *bfd_scan_arch(const char *string);
|
---|
783 | *Description*
|
---|
784 | Figure out if BFD supports any cpu which could be described with the
|
---|
785 | name STRING. Return a pointer to an `arch_info' structure if a machine
|
---|
786 | is found, otherwise NULL.
|
---|
787 |
|
---|
788 | `bfd_arch_list'
|
---|
789 | ...............
|
---|
790 |
|
---|
791 | *Synopsis*
|
---|
792 | const char **bfd_arch_list(void);
|
---|
793 | *Description*
|
---|
794 | Return a freshly malloced NULL-terminated vector of the names of all
|
---|
795 | the valid BFD architectures. Do not modify the names.
|
---|
796 |
|
---|
797 | `bfd_arch_get_compatible'
|
---|
798 | .........................
|
---|
799 |
|
---|
800 | *Synopsis*
|
---|
801 | const bfd_arch_info_type *bfd_arch_get_compatible(
|
---|
802 | const bfd *abfd,
|
---|
803 | const bfd *bbfd,
|
---|
804 | bfd_boolean accept_unknowns);
|
---|
805 | *Description*
|
---|
806 | Determine whether two BFDs' architectures and machine types are
|
---|
807 | compatible. Calculates the lowest common denominator between the two
|
---|
808 | architectures and machine types implied by the BFDs and returns a
|
---|
809 | pointer to an `arch_info' structure describing the compatible machine.
|
---|
810 |
|
---|
811 | `bfd_default_arch_struct'
|
---|
812 | .........................
|
---|
813 |
|
---|
814 | *Description*
|
---|
815 | The `bfd_default_arch_struct' is an item of `bfd_arch_info_type' which
|
---|
816 | has been initialized to a fairly generic state. A BFD starts life by
|
---|
817 | pointing to this structure, until the correct back end has determined
|
---|
818 | the real architecture of the file.
|
---|
819 | extern const bfd_arch_info_type bfd_default_arch_struct;
|
---|
820 |
|
---|
821 | `bfd_set_arch_info'
|
---|
822 | ...................
|
---|
823 |
|
---|
824 | *Synopsis*
|
---|
825 | void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
|
---|
826 | *Description*
|
---|
827 | Set the architecture info of ABFD to ARG.
|
---|
828 |
|
---|
829 | `bfd_default_set_arch_mach'
|
---|
830 | ...........................
|
---|
831 |
|
---|
832 | *Synopsis*
|
---|
833 | bfd_boolean bfd_default_set_arch_mach(bfd *abfd,
|
---|
834 | enum bfd_architecture arch,
|
---|
835 | unsigned long mach);
|
---|
836 | *Description*
|
---|
837 | Set the architecture and machine type in BFD ABFD to ARCH and MACH.
|
---|
838 | Find the correct pointer to a structure and insert it into the
|
---|
839 | `arch_info' pointer.
|
---|
840 |
|
---|
841 | `bfd_get_arch'
|
---|
842 | ..............
|
---|
843 |
|
---|
844 | *Synopsis*
|
---|
845 | enum bfd_architecture bfd_get_arch(bfd *abfd);
|
---|
846 | *Description*
|
---|
847 | Return the enumerated type which describes the BFD ABFD's architecture.
|
---|
848 |
|
---|
849 | `bfd_get_mach'
|
---|
850 | ..............
|
---|
851 |
|
---|
852 | *Synopsis*
|
---|
853 | unsigned long bfd_get_mach(bfd *abfd);
|
---|
854 | *Description*
|
---|
855 | Return the long type which describes the BFD ABFD's machine.
|
---|
856 |
|
---|
857 | `bfd_arch_bits_per_byte'
|
---|
858 | ........................
|
---|
859 |
|
---|
860 | *Synopsis*
|
---|
861 | unsigned int bfd_arch_bits_per_byte(bfd *abfd);
|
---|
862 | *Description*
|
---|
863 | Return the number of bits in one of the BFD ABFD's architecture's bytes.
|
---|
864 |
|
---|
865 | `bfd_arch_bits_per_address'
|
---|
866 | ...........................
|
---|
867 |
|
---|
868 | *Synopsis*
|
---|
869 | unsigned int bfd_arch_bits_per_address(bfd *abfd);
|
---|
870 | *Description*
|
---|
871 | Return the number of bits in one of the BFD ABFD's architecture's
|
---|
872 | addresses.
|
---|
873 |
|
---|
874 | `bfd_default_compatible'
|
---|
875 | ........................
|
---|
876 |
|
---|
877 | *Synopsis*
|
---|
878 | const bfd_arch_info_type *bfd_default_compatible
|
---|
879 | (const bfd_arch_info_type *a,
|
---|
880 | const bfd_arch_info_type *b);
|
---|
881 | *Description*
|
---|
882 | The default function for testing for compatibility.
|
---|
883 |
|
---|
884 | `bfd_default_scan'
|
---|
885 | ..................
|
---|
886 |
|
---|
887 | *Synopsis*
|
---|
888 | bfd_boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
|
---|
889 | *Description*
|
---|
890 | The default function for working out whether this is an architecture
|
---|
891 | hit and a machine hit.
|
---|
892 |
|
---|
893 | `bfd_get_arch_info'
|
---|
894 | ...................
|
---|
895 |
|
---|
896 | *Synopsis*
|
---|
897 | const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
|
---|
898 | *Description*
|
---|
899 | Return the architecture info struct in ABFD.
|
---|
900 |
|
---|
901 | `bfd_lookup_arch'
|
---|
902 | .................
|
---|
903 |
|
---|
904 | *Synopsis*
|
---|
905 | const bfd_arch_info_type *bfd_lookup_arch
|
---|
906 | (enum bfd_architecture
|
---|
907 | arch,
|
---|
908 | unsigned long machine);
|
---|
909 | *Description*
|
---|
910 | Look for the architecure info structure which matches the arguments
|
---|
911 | ARCH and MACHINE. A machine of 0 matches the machine/architecture
|
---|
912 | structure which marks itself as the default.
|
---|
913 |
|
---|
914 | `bfd_printable_arch_mach'
|
---|
915 | .........................
|
---|
916 |
|
---|
917 | *Synopsis*
|
---|
918 | const char *bfd_printable_arch_mach
|
---|
919 | (enum bfd_architecture arch, unsigned long machine);
|
---|
920 | *Description*
|
---|
921 | Return a printable string representing the architecture and machine
|
---|
922 | type.
|
---|
923 |
|
---|
924 | This routine is depreciated.
|
---|
925 |
|
---|
926 | `bfd_octets_per_byte'
|
---|
927 | .....................
|
---|
928 |
|
---|
929 | *Synopsis*
|
---|
930 | unsigned int bfd_octets_per_byte(bfd *abfd);
|
---|
931 | *Description*
|
---|
932 | Return the number of octets (8-bit quantities) per target byte (minimum
|
---|
933 | addressable unit). In most cases, this will be one, but some DSP
|
---|
934 | targets have 16, 32, or even 48 bits per byte.
|
---|
935 |
|
---|
936 | `bfd_arch_mach_octets_per_byte'
|
---|
937 | ...............................
|
---|
938 |
|
---|
939 | *Synopsis*
|
---|
940 | unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
|
---|
941 | unsigned long machine);
|
---|
942 | *Description*
|
---|
943 | See bfd_octets_per_byte.
|
---|
944 |
|
---|
945 | This routine is provided for those cases where a bfd * is not
|
---|
946 | available
|
---|
947 |
|
---|
948 |
|
---|
949 | File: bfd.info, Node: Opening and Closing, Next: Internal, Prev: Architectures, Up: BFD front end
|
---|
950 |
|
---|
951 | Opening and closing BFDs
|
---|
952 | ========================
|
---|
953 |
|
---|
954 | `bfd_openr'
|
---|
955 | ...........
|
---|
956 |
|
---|
957 | *Synopsis*
|
---|
958 | bfd *bfd_openr(const char *filename, const char *target);
|
---|
959 | *Description*
|
---|
960 | Open the file FILENAME (using `fopen') with the target TARGET. Return
|
---|
961 | a pointer to the created BFD.
|
---|
962 |
|
---|
963 | Calls `bfd_find_target', so TARGET is interpreted as by that
|
---|
964 | function.
|
---|
965 |
|
---|
966 | If `NULL' is returned then an error has occured. Possible errors
|
---|
967 | are `bfd_error_no_memory', `bfd_error_invalid_target' or `system_call'
|
---|
968 | error.
|
---|
969 |
|
---|
970 | `bfd_fdopenr'
|
---|
971 | .............
|
---|
972 |
|
---|
973 | *Synopsis*
|
---|
974 | bfd *bfd_fdopenr(const char *filename, const char *target, int fd);
|
---|
975 | *Description*
|
---|
976 | `bfd_fdopenr' is to `bfd_fopenr' much like `fdopen' is to `fopen'. It
|
---|
977 | opens a BFD on a file already described by the FD supplied.
|
---|
978 |
|
---|
979 | When the file is later `bfd_close'd, the file descriptor will be
|
---|
980 | closed. If the caller desires that this file descriptor be cached by
|
---|
981 | BFD (opened as needed, closed as needed to free descriptors for other
|
---|
982 | opens), with the supplied FD used as an initial file descriptor (but
|
---|
983 | subject to closure at any time), call bfd_set_cacheable(bfd, 1) on the
|
---|
984 | returned BFD. The default is to assume no cacheing; the file
|
---|
985 | descriptor will remain open until `bfd_close', and will not be affected
|
---|
986 | by BFD operations on other files.
|
---|
987 |
|
---|
988 | Possible errors are `bfd_error_no_memory',
|
---|
989 | `bfd_error_invalid_target' and `bfd_error_system_call'.
|
---|
990 |
|
---|
991 | `bfd_openstreamr'
|
---|
992 | .................
|
---|
993 |
|
---|
994 | *Synopsis*
|
---|
995 | bfd *bfd_openstreamr(const char *, const char *, PTR);
|
---|
996 | *Description*
|
---|
997 | Open a BFD for read access on an existing stdio stream. When the BFD
|
---|
998 | is passed to `bfd_close', the stream will be closed.
|
---|
999 |
|
---|
1000 | `bfd_openw'
|
---|
1001 | ...........
|
---|
1002 |
|
---|
1003 | *Synopsis*
|
---|
1004 | bfd *bfd_openw(const char *filename, const char *target);
|
---|
1005 | *Description*
|
---|
1006 | Create a BFD, associated with file FILENAME, using the file format
|
---|
1007 | TARGET, and return a pointer to it.
|
---|
1008 |
|
---|
1009 | Possible errors are `bfd_error_system_call', `bfd_error_no_memory',
|
---|
1010 | `bfd_error_invalid_target'.
|
---|
1011 |
|
---|
1012 | `bfd_close'
|
---|
1013 | ...........
|
---|
1014 |
|
---|
1015 | *Synopsis*
|
---|
1016 | bfd_boolean bfd_close (bfd *abfd);
|
---|
1017 | *Description*
|
---|
1018 | Close a BFD. If the BFD was open for writing, then pending operations
|
---|
1019 | are completed and the file written out and closed. If the created file
|
---|
1020 | is executable, then `chmod' is called to mark it as such.
|
---|
1021 |
|
---|
1022 | All memory attached to the BFD is released.
|
---|
1023 |
|
---|
1024 | The file descriptor associated with the BFD is closed (even if it
|
---|
1025 | was passed in to BFD by `bfd_fdopenr').
|
---|
1026 |
|
---|
1027 | *Returns*
|
---|
1028 | `TRUE' is returned if all is ok, otherwise `FALSE'.
|
---|
1029 |
|
---|
1030 | `bfd_close_all_done'
|
---|
1031 | ....................
|
---|
1032 |
|
---|
1033 | *Synopsis*
|
---|
1034 | bfd_boolean bfd_close_all_done (bfd *);
|
---|
1035 | *Description*
|
---|
1036 | Close a BFD. Differs from `bfd_close' since it does not complete any
|
---|
1037 | pending operations. This routine would be used if the application had
|
---|
1038 | just used BFD for swapping and didn't want to use any of the writing
|
---|
1039 | code.
|
---|
1040 |
|
---|
1041 | If the created file is executable, then `chmod' is called to mark it
|
---|
1042 | as such.
|
---|
1043 |
|
---|
1044 | All memory attached to the BFD is released.
|
---|
1045 |
|
---|
1046 | *Returns*
|
---|
1047 | `TRUE' is returned if all is ok, otherwise `FALSE'.
|
---|
1048 |
|
---|
1049 | `bfd_create'
|
---|
1050 | ............
|
---|
1051 |
|
---|
1052 | *Synopsis*
|
---|
1053 | bfd *bfd_create(const char *filename, bfd *templ);
|
---|
1054 | *Description*
|
---|
1055 | Create a new BFD in the manner of `bfd_openw', but without opening a
|
---|
1056 | file. The new BFD takes the target from the target used by TEMPLATE.
|
---|
1057 | The format is always set to `bfd_object'.
|
---|
1058 |
|
---|
1059 | `bfd_make_writable'
|
---|
1060 | ...................
|
---|
1061 |
|
---|
1062 | *Synopsis*
|
---|
1063 | bfd_boolean bfd_make_writable (bfd *abfd);
|
---|
1064 | *Description*
|
---|
1065 | Takes a BFD as created by `bfd_create' and converts it into one like as
|
---|
1066 | returned by `bfd_openw'. It does this by converting the BFD to
|
---|
1067 | BFD_IN_MEMORY. It's assumed that you will call `bfd_make_readable' on
|
---|
1068 | this bfd later.
|
---|
1069 |
|
---|
1070 | *Returns*
|
---|
1071 | `TRUE' is returned if all is ok, otherwise `FALSE'.
|
---|
1072 |
|
---|
1073 | `bfd_make_readable'
|
---|
1074 | ...................
|
---|
1075 |
|
---|
1076 | *Synopsis*
|
---|
1077 | bfd_boolean bfd_make_readable (bfd *abfd);
|
---|
1078 | *Description*
|
---|
1079 | Takes a BFD as created by `bfd_create' and `bfd_make_writable' and
|
---|
1080 | converts it into one like as returned by `bfd_openr'. It does this by
|
---|
1081 | writing the contents out to the memory buffer, then reversing the
|
---|
1082 | direction.
|
---|
1083 |
|
---|
1084 | *Returns*
|
---|
1085 | `TRUE' is returned if all is ok, otherwise `FALSE'.
|
---|
1086 |
|
---|
1087 | `bfd_alloc'
|
---|
1088 | ...........
|
---|
1089 |
|
---|
1090 | *Synopsis*
|
---|
1091 | PTR bfd_alloc (bfd *abfd, size_t wanted);
|
---|
1092 | *Description*
|
---|
1093 | Allocate a block of WANTED bytes of memory attached to `abfd' and
|
---|
1094 | return a pointer to it.
|
---|
1095 |
|
---|
1096 | `calc_crc32'
|
---|
1097 | ............
|
---|
1098 |
|
---|
1099 | *Synopsis*
|
---|
1100 | unsigned long calc_crc32 (unsigned long crc, const unsigned char *buf, size_t len);
|
---|
1101 | *Description*
|
---|
1102 | Advance the CRC32 given by CRC through LEN bytes of BUF. Return the
|
---|
1103 | updated CRC32 value.
|
---|
1104 |
|
---|
1105 | `get_debug_link_info'
|
---|
1106 | .....................
|
---|
1107 |
|
---|
1108 | *Synopsis*
|
---|
1109 | char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out)
|
---|
1110 | *Description*
|
---|
1111 | fetch the filename and CRC32 value for any separate debuginfo
|
---|
1112 | associated with ABFD. Return NULL if no such info found, otherwise
|
---|
1113 | return filename and update CRC32_OUT.
|
---|
1114 |
|
---|
1115 | `separate_debug_file_exists'
|
---|
1116 | ............................
|
---|
1117 |
|
---|
1118 | *Synopsis*
|
---|
1119 | bfd_boolean separate_debug_file_exists (char * name, unsigned long crc32)
|
---|
1120 | *Description*
|
---|
1121 | Checks to see if NAME is a file and if its contents match CRC32.
|
---|
1122 |
|
---|
1123 | `find_separate_debug_file'
|
---|
1124 | ..........................
|
---|
1125 |
|
---|
1126 | *Synopsis*
|
---|
1127 | char * find_separate_debug_file (bfd *abfd)
|
---|
1128 | *Description*
|
---|
1129 | Searches ABFD for a reference to separate debugging information, scans
|
---|
1130 | various locations in the filesystem, including the file tree rooted at
|
---|
1131 | DEBUG_FILE_DIRECTORY, and returns a filename of such debugging
|
---|
1132 | information if the file is found and has matching CRC32. Returns NULL
|
---|
1133 | if no reference to debugging file exists, or file cannot be found.
|
---|
1134 |
|
---|
1135 | `bfd_follow_gnu_debuglink'
|
---|
1136 | ..........................
|
---|
1137 |
|
---|
1138 | *Synopsis*
|
---|
1139 | char * bfd_follow_gnu_debuglink(bfd *abfd, const char *dir);
|
---|
1140 | *Description*
|
---|
1141 | Takes a BFD and searches it for a .gnu_debuglink section. If this
|
---|
1142 | section is found, examines the section for the name and checksum of a
|
---|
1143 | '.debug' file containing auxiliary debugging information. Searches
|
---|
1144 | filesystem for .debug file in some standard locations, including the
|
---|
1145 | directory tree rooted at DIR, and if found returns the full filename.
|
---|
1146 | If DIR is NULL, will search default path configured into libbfd at
|
---|
1147 | build time.
|
---|
1148 |
|
---|
1149 | *Returns*
|
---|
1150 | `NULL' on any errors or failure to locate the .debug file, otherwise a
|
---|
1151 | pointer to a heap-allocated string containing the filename. The caller
|
---|
1152 | is responsible for freeing this string.
|
---|
1153 |
|
---|