]>
Commit | Line | Data |
---|---|---|
18fe0e9f JG |
1 | /* Main header file for the bfd library -- portable access to object files. |
2 | ==> The bfd.h file is generated from bfd-in.h and various .c files; if you | |
3 | ==> change it, your changes will probably be lost. | |
c98d03ea | 4 | Copyright 1990, 1991, 1992 Free Software Foundation, Inc. |
095c7223 | 5 | Contributed by Cygnus Support. |
a07cc613 | 6 | |
2c346475 | 7 | This file is part of BFD, the Binary File Descriptor library. |
a07cc613 | 8 | |
095c7223 | 9 | This program is free software; you can redistribute it and/or modify |
a07cc613 | 10 | it under the terms of the GNU General Public License as published by |
095c7223 JG |
11 | the Free Software Foundation; either version 2 of the License, or |
12 | (at your option) any later version. | |
a07cc613 | 13 | |
095c7223 | 14 | This program is distributed in the hope that it will be useful, |
a07cc613 JG |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
095c7223 JG |
20 | along with this program; if not, write to the Free Software |
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
22 | ||
23 | /* bfd.h -- The only header file required by users of the bfd library | |
24 | ||
18fe0e9f JG |
25 | The bfd.h file is generated from bfd-in.h and various .c files; if you |
26 | change it, your changes will probably be lost. | |
095c7223 JG |
27 | |
28 | All the prototypes and definitions following the comment "THE FOLLOWING | |
29 | IS EXTRACTED FROM THE SOURCE" are extracted from the source files for | |
30 | BFD. If you change it, someone oneday will extract it from the source | |
31 | again, and your changes will be lost. To save yourself from this bind, | |
32 | change the definitions in the source in the bfd directory. Type "make | |
33 | docs" and then "make headers" in that directory, and magically this file | |
34 | will change to reflect your changes. | |
35 | ||
36 | If you don't have the tools to perform the extraction, then you are | |
37 | safe from someone on your system trampling over your header files. | |
38 | You should still maintain the equivalence between the source and this | |
39 | file though; every change you make to the .c file should be reflected | |
40 | here. */ | |
a07cc613 | 41 | |
a07cc613 JG |
42 | #ifndef __BFD_H_SEEN__ |
43 | #define __BFD_H_SEEN__ | |
44 | ||
45 | #include "ansidecl.h" | |
46 | #include "obstack.h" | |
47 | ||
60289922 | 48 | #define BFD_VERSION "2.0" |
ec08b077 | 49 | |
a07cc613 | 50 | /* forward declaration */ |
9c6a9c92 | 51 | typedef struct _bfd bfd; |
a07cc613 | 52 | |
ec08b077 JG |
53 | /* General rules: functions which are boolean return true on success |
54 | and false on failure (unless they're a predicate). -- bfd.doc */ | |
a07cc613 JG |
55 | /* I'm sure this is going to break something and someone is going to |
56 | force me to change it. */ | |
f7cfc4a6 JG |
57 | /* typedef enum boolean {false, true} boolean; */ |
58 | /* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */ | |
59 | typedef enum bfd_boolean {false, true} boolean; | |
a07cc613 | 60 | |
c98d03ea JG |
61 | /* A pointer to a position in a file. */ |
62 | /* FIXME: This should be using off_t from <sys/types.h>. | |
63 | For now, try to avoid breaking stuff by not including <sys/types.h> here. | |
64 | This will break on systems with 64-bit file offsets (e.g. 4.4BSD). | |
65 | Probably the best long-term answer is to avoid using file_ptr AND off_t | |
66 | in this header file, and to handle this in the BFD implementation | |
67 | rather than in its interface. */ | |
68 | /* typedef off_t file_ptr; */ | |
69 | typedef long int file_ptr; | |
a07cc613 | 70 | |
9b9c5c39 | 71 | /* Support for different sizes of target format ints and addresses */ |
19b03b7a | 72 | |
9b9c5c39 | 73 | #ifdef HOST_64_BIT |
7ed4093a SC |
74 | typedef HOST_64_BIT rawdata_offset; |
75 | typedef HOST_64_BIT bfd_vma; | |
76 | typedef HOST_64_BIT bfd_word; | |
77 | typedef HOST_64_BIT bfd_offset; | |
78 | typedef HOST_64_BIT bfd_size_type; | |
9b9c5c39 | 79 | typedef HOST_64_BIT symvalue; |
7ed4093a | 80 | typedef HOST_64_BIT bfd_64_type; |
9b9c5c39 JG |
81 | #define fprintf_vma(s,x) \ |
82 | fprintf(s,"%08x%08x", uint64_typeHIGH(x), uint64_typeLOW(x)) | |
19b03b7a | 83 | #else |
9b9c5c39 JG |
84 | typedef struct {int a,b;} bfd_64_type; |
85 | typedef unsigned long rawdata_offset; | |
a07cc613 JG |
86 | typedef unsigned long bfd_vma; |
87 | typedef unsigned long bfd_offset; | |
19b03b7a SC |
88 | typedef unsigned long bfd_word; |
89 | typedef unsigned long bfd_size; | |
90 | typedef unsigned long symvalue; | |
91 | typedef unsigned long bfd_size_type; | |
a737c70b | 92 | #define fprintf_vma(s,x) fprintf(s, "%08lx", x) |
19b03b7a | 93 | #endif |
1d2c5574 | 94 | #define printf_vma(x) fprintf_vma(stdout,x) |
a07cc613 JG |
95 | |
96 | typedef unsigned int flagword; /* 32 bits of flags */ | |
97 | \f | |
98 | /** File formats */ | |
99 | ||
100 | typedef enum bfd_format { | |
101 | bfd_unknown = 0, /* file format is unknown */ | |
102 | bfd_object, /* linker/assember/compiler output */ | |
103 | bfd_archive, /* object archive file */ | |
104 | bfd_core, /* core dump */ | |
105 | bfd_type_end} /* marks the end; don't use it! */ | |
106 | bfd_format; | |
107 | ||
108 | /* Object file flag values */ | |
01bbba25 SC |
109 | #define NO_FLAGS 0x00 |
110 | #define HAS_RELOC 0x01 | |
111 | #define EXEC_P 0x02 | |
112 | #define HAS_LINENO 0x04 | |
113 | #define HAS_DEBUG 0x08 | |
114 | #define HAS_SYMS 0x10 | |
115 | #define HAS_LOCALS 0x20 | |
116 | #define DYNAMIC 0x40 | |
117 | #define WP_TEXT 0x80 | |
118 | #define D_PAGED 0x100 | |
119 | #define BFD_IS_RELAXABLE 0x200 | |
a07cc613 JG |
120 | \f |
121 | /* symbols and relocation */ | |
122 | ||
123 | typedef unsigned long symindex; | |
124 | ||
125 | #define BFD_NO_MORE_SYMBOLS ((symindex) ~0) | |
126 | ||
fb3ee1c0 JG |
127 | typedef enum bfd_symclass { |
128 | bfd_symclass_unknown = 0, | |
a07cc613 JG |
129 | bfd_symclass_fcommon, /* fortran common symbols */ |
130 | bfd_symclass_global, /* global symbol, what a surprise */ | |
131 | bfd_symclass_debugger, /* some debugger symbol */ | |
132 | bfd_symclass_undefined /* none known */ | |
133 | } symclass; | |
134 | ||
19b03b7a | 135 | |
a07cc613 | 136 | typedef int symtype; /* Who knows, yet? */ |
19b03b7a | 137 | |
a07cc613 | 138 | |
9b9c5c39 JG |
139 | /* general purpose part of a symbol; |
140 | target specific parts will be found in libcoff.h, liba.out.h etc */ | |
7a276b09 | 141 | |
a07cc613 JG |
142 | |
143 | #define bfd_get_section(x) ((x)->section) | |
144 | #define bfd_get_output_section(x) ((x)->section->output_section) | |
145 | #define bfd_set_section(x,y) ((x)->section) = (y) | |
146 | #define bfd_asymbol_base(x) ((x)->section?((x)->section->vma):0) | |
147 | #define bfd_asymbol_value(x) (bfd_asymbol_base(x) + x->value) | |
148 | #define bfd_asymbol_name(x) ((x)->name) | |
149 | ||
a07cc613 | 150 | /* This is a type pun with struct ranlib on purpose! */ |
9c6a9c92 | 151 | typedef struct carsym { |
a07cc613 JG |
152 | char *name; |
153 | file_ptr file_offset; /* look here to find the file */ | |
154 | } carsym; /* to make these you call a carsymogen */ | |
155 | ||
a07cc613 JG |
156 | |
157 | /* Used in generating armaps. Perhaps just a forward definition would do? */ | |
158 | struct orl { /* output ranlib */ | |
159 | char **name; /* symbol name */ | |
c93e2c55 | 160 | file_ptr pos; /* bfd* or file position */ |
a07cc613 JG |
161 | int namidx; /* index into string table */ |
162 | }; | |
163 | ||
164 | \f | |
165 | ||
166 | /* Linenumber stuff */ | |
167 | typedef struct lineno_cache_entry { | |
168 | unsigned int line_number; /* Linenumber from start of function*/ | |
169 | union { | |
7a276b09 | 170 | struct symbol_cache_entry *sym; /* Function name */ |
a07cc613 JG |
171 | unsigned long offset; /* Offset into section */ |
172 | } u; | |
173 | } alent; | |
174 | \f | |
175 | /* object and core file sections */ | |
176 | ||
a07cc613 JG |
177 | |
178 | #define align_power(addr, align) \ | |
179 | ( ((addr) + ((1<<(align))-1)) & (-1 << (align))) | |
180 | ||
9c6a9c92 | 181 | typedef struct sec *sec_ptr; |
a07cc613 | 182 | |
d5ceae78 KR |
183 | #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0) |
184 | #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0) | |
185 | #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0) | |
a07cc613 | 186 | #define bfd_section_name(bfd, ptr) ((ptr)->name) |
9a7c5449 | 187 | #define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr)) |
a07cc613 JG |
188 | #define bfd_section_vma(bfd, ptr) ((ptr)->vma) |
189 | #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) | |
d5ceae78 | 190 | #define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0) |
a07cc613 JG |
191 | #define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata) |
192 | ||
9a51287f | 193 | #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (val)), ((ptr)->user_set_vma = true), true) |
a07cc613 JG |
194 | #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true) |
195 | #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true) | |
4322f04d SC |
196 | |
197 | typedef struct stat stat_type; | |
a07cc613 JG |
198 | \f |
199 | /** Error handling */ | |
200 | ||
fb3ee1c0 JG |
201 | typedef enum bfd_error { |
202 | no_error = 0, system_call_error, invalid_target, | |
a07cc613 JG |
203 | wrong_format, invalid_operation, no_memory, |
204 | no_symbols, no_relocation_info, | |
205 | no_more_archived_files, malformed_archive, | |
206 | symbol_not_found, file_not_recognized, | |
207 | file_ambiguously_recognized, no_contents, | |
6603bf38 | 208 | bfd_error_nonrepresentable_section, |
d5ceae78 | 209 | no_debug_section, bad_value, |
a07cc613 JG |
210 | invalid_error_code} bfd_ec; |
211 | ||
212 | extern bfd_ec bfd_error; | |
9a7c5449 | 213 | struct reloc_cache_entry; |
f6047bbd | 214 | struct bfd_seclet; |
9a7c5449 | 215 | |
a07cc613 | 216 | |
9c6a9c92 | 217 | typedef struct bfd_error_vector { |
d4a06831 JG |
218 | void (* nonrepresentable_section ) PARAMS ((CONST bfd *CONST abfd, |
219 | CONST char *CONST name)); | |
220 | void (* undefined_symbol) PARAMS ((CONST struct reloc_cache_entry *rel, | |
221 | CONST struct bfd_seclet *sec)); | |
222 | void (* reloc_value_truncated) PARAMS ((CONST struct | |
9a7c5449 | 223 | reloc_cache_entry *rel, |
f6047bbd | 224 | struct bfd_seclet *sec)); |
9a7c5449 | 225 | |
d4a06831 JG |
226 | void (* reloc_dangerous) PARAMS ((CONST struct reloc_cache_entry *rel, |
227 | CONST struct bfd_seclet *sec)); | |
9a7c5449 | 228 | |
a07cc613 JG |
229 | } bfd_error_vector_type; |
230 | ||
d4a06831 JG |
231 | CONST char *bfd_errmsg PARAMS ((bfd_ec error_tag)); |
232 | void bfd_perror PARAMS ((CONST char *message)); | |
a07cc613 JG |
233 | \f |
234 | ||
9b9c5c39 | 235 | typedef enum bfd_print_symbol |
a07cc613 | 236 | { |
81f8fee9 JG |
237 | bfd_print_symbol_name, |
238 | bfd_print_symbol_more, | |
b941cb35 | 239 | bfd_print_symbol_all, |
0aa70210 | 240 | bfd_print_symbol_nm /* Pretty format suitable for nm program. */ |
81f8fee9 | 241 | } bfd_print_symbol_type; |
a07cc613 JG |
242 | |
243 | \f | |
a07cc613 JG |
244 | \f |
245 | /* The code that implements targets can initialize a jump table with this | |
246 | macro. It must name all its routines the same way (a prefix plus | |
247 | the standard routine suffix), or it must #define the routines that | |
248 | are not so named, before calling JUMP_TABLE in the initializer. */ | |
249 | ||
250 | /* Semi-portable string concatenation in cpp */ | |
251 | #ifndef CAT | |
252 | #ifdef __STDC__ | |
253 | #define CAT(a,b) a##b | |
254 | #else | |
255 | #define CAT(a,b) a/**/b | |
256 | #endif | |
257 | #endif | |
258 | ||
259 | #define JUMP_TABLE(NAME)\ | |
260 | CAT(NAME,_core_file_failing_command),\ | |
261 | CAT(NAME,_core_file_failing_signal),\ | |
262 | CAT(NAME,_core_file_matches_executable_p),\ | |
263 | CAT(NAME,_slurp_armap),\ | |
264 | CAT(NAME,_slurp_extended_name_table),\ | |
265 | CAT(NAME,_truncate_arname),\ | |
266 | CAT(NAME,_write_armap),\ | |
267 | CAT(NAME,_close_and_cleanup), \ | |
268 | CAT(NAME,_set_section_contents),\ | |
269 | CAT(NAME,_get_section_contents),\ | |
270 | CAT(NAME,_new_section_hook),\ | |
271 | CAT(NAME,_get_symtab_upper_bound),\ | |
272 | CAT(NAME,_get_symtab),\ | |
273 | CAT(NAME,_get_reloc_upper_bound),\ | |
274 | CAT(NAME,_canonicalize_reloc),\ | |
275 | CAT(NAME,_make_empty_symbol),\ | |
276 | CAT(NAME,_print_symbol),\ | |
277 | CAT(NAME,_get_lineno),\ | |
278 | CAT(NAME,_set_arch_mach),\ | |
279 | CAT(NAME,_openr_next_archived_file),\ | |
280 | CAT(NAME,_find_nearest_line),\ | |
281 | CAT(NAME,_generic_stat_arch_elt),\ | |
7a276b09 SC |
282 | CAT(NAME,_sizeof_headers),\ |
283 | CAT(NAME,_bfd_debug_info_start),\ | |
284 | CAT(NAME,_bfd_debug_info_end),\ | |
9a7c5449 | 285 | CAT(NAME,_bfd_debug_info_accumulate),\ |
daa91756 SC |
286 | CAT(NAME,_bfd_get_relocated_section_contents),\ |
287 | CAT(NAME,_bfd_relax_section) | |
2700c3c7 | 288 | |
0c210c9c SC |
289 | #define COFF_SWAP_TABLE \ |
290 | coff_swap_aux_in, coff_swap_sym_in, coff_swap_lineno_in, \ | |
291 | coff_swap_aux_out, coff_swap_sym_out, \ | |
292 | coff_swap_lineno_out, coff_swap_reloc_out, \ | |
293 | coff_swap_filehdr_out, coff_swap_aouthdr_out, \ | |
294 | coff_swap_scnhdr_out | |
295 | ||
296 | ||
a07cc613 JG |
297 | \f |
298 | /* User program access to BFD facilities */ | |
299 | ||
300 | extern CONST short _bfd_host_big_endian; | |
301 | #define HOST_BYTE_ORDER_BIG_P (*(char *)&_bfd_host_big_endian) | |
302 | ||
303 | /* The bfd itself */ | |
304 | ||
8c01a0ea JK |
305 | /* Cast from const char * to char * so that caller can assign to |
306 | a char * without a warning. */ | |
307 | #define bfd_get_filename(abfd) ((char *) (abfd)->filename) | |
a07cc613 JG |
308 | #define bfd_get_format(abfd) ((abfd)->format) |
309 | #define bfd_get_target(abfd) ((abfd)->xvec->name) | |
310 | #define bfd_get_file_flags(abfd) ((abfd)->flags) | |
311 | #define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags) | |
312 | #define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags) | |
22ef104a | 313 | #define bfd_my_archive(abfd) ((abfd)->my_archive) |
a07cc613 JG |
314 | #define bfd_has_map(abfd) ((abfd)->has_armap) |
315 | #define bfd_header_twiddle_required(abfd) \ | |
316 | ((((abfd)->xvec->header_byteorder_big_p) \ | |
317 | != (boolean)HOST_BYTE_ORDER_BIG_P) ? true:false) | |
318 | ||
319 | #define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types) | |
320 | #define bfd_usrdata(abfd) ((abfd)->usrdata) | |
321 | ||
322 | #define bfd_get_start_address(abfd) ((abfd)->start_address) | |
323 | #define bfd_get_symcount(abfd) ((abfd)->symcount) | |
324 | #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) | |
325 | #define bfd_count_sections(abfd) ((abfd)->section_count) | |
326 | #define bfd_get_architecture(abfd) ((abfd)->obj_arch) | |
327 | #define bfd_get_machine(abfd) ((abfd)->obj_machine) | |
328 | ||
ab414d87 | 329 | #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) |
a07cc613 | 330 | |
7a276b09 SC |
331 | #define BYTE_SIZE 1 |
332 | #define SHORT_SIZE 2 | |
333 | #define LONG_SIZE 4 | |
334 | ||
d5ceae78 | 335 | /* And more from the source. */ |
18fe0e9f JG |
336 | void |
337 | bfd_init PARAMS ((void)); | |
338 | ||
339 | bfd * | |
340 | bfd_openr PARAMS ((CONST char *filename, CONST char*target)); | |
341 | ||
342 | bfd * | |
343 | bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd)); | |
344 | ||
345 | bfd * | |
346 | bfd_openw PARAMS ((CONST char *filename, CONST char *target)); | |
347 | ||
348 | boolean | |
349 | bfd_close PARAMS ((bfd *)); | |
350 | ||
351 | boolean | |
352 | bfd_close_all_done PARAMS ((bfd *)); | |
353 | ||
354 | bfd_size_type | |
355 | bfd_alloc_size PARAMS ((bfd *abfd)); | |
356 | ||
357 | bfd * | |
358 | bfd_create PARAMS ((CONST char *filename, bfd *template)); | |
359 | ||
7a276b09 SC |
360 | #define bfd_put_8(abfd, val, ptr) \ |
361 | (*((char *)ptr) = (char)val) | |
362 | #define bfd_get_8(abfd, ptr) \ | |
363 | (*((char *)ptr)) | |
364 | #define bfd_put_16(abfd, val, ptr) \ | |
365 | BFD_SEND(abfd, bfd_putx16, (val,ptr)) | |
366 | #define bfd_get_16(abfd, ptr) \ | |
367 | BFD_SEND(abfd, bfd_getx16, (ptr)) | |
368 | #define bfd_put_32(abfd, val, ptr) \ | |
369 | BFD_SEND(abfd, bfd_putx32, (val,ptr)) | |
370 | #define bfd_get_32(abfd, ptr) \ | |
371 | BFD_SEND(abfd, bfd_getx32, (ptr)) | |
372 | #define bfd_put_64(abfd, val, ptr) \ | |
373 | BFD_SEND(abfd, bfd_putx64, (val, ptr)) | |
374 | #define bfd_get_64(abfd, ptr) \ | |
375 | BFD_SEND(abfd, bfd_getx64, (ptr)) | |
7a276b09 SC |
376 | #define bfd_h_put_8(abfd, val, ptr) \ |
377 | (*((char *)ptr) = (char)val) | |
378 | #define bfd_h_get_8(abfd, ptr) \ | |
379 | (*((char *)ptr)) | |
380 | #define bfd_h_put_16(abfd, val, ptr) \ | |
381 | BFD_SEND(abfd, bfd_h_putx16,(val,ptr)) | |
382 | #define bfd_h_get_16(abfd, ptr) \ | |
383 | BFD_SEND(abfd, bfd_h_getx16,(ptr)) | |
384 | #define bfd_h_put_32(abfd, val, ptr) \ | |
385 | BFD_SEND(abfd, bfd_h_putx32,(val,ptr)) | |
386 | #define bfd_h_get_32(abfd, ptr) \ | |
387 | BFD_SEND(abfd, bfd_h_getx32,(ptr)) | |
388 | #define bfd_h_put_64(abfd, val, ptr) \ | |
389 | BFD_SEND(abfd, bfd_h_putx64,(val, ptr)) | |
390 | #define bfd_h_get_64(abfd, ptr) \ | |
391 | BFD_SEND(abfd, bfd_h_getx64,(ptr)) | |
332b6327 SC |
392 | typedef struct sec |
393 | { | |
394 | /* The name of the section, the name isn't a copy, the pointer is | |
395 | the same as that passed to bfd_make_section. */ | |
396 | ||
7a276b09 | 397 | CONST char *name; |
332b6327 | 398 | |
9a7c5449 SC |
399 | |
400 | /* Which section is it 0.nth */ | |
401 | ||
402 | int index; | |
403 | ||
332b6327 SC |
404 | /* The next section in the list belonging to the BFD, or NULL. */ |
405 | ||
7a276b09 | 406 | struct sec *next; |
332b6327 SC |
407 | |
408 | /* The field flags contains attributes of the section. Some of | |
409 | flags are read in from the object file, and some are | |
410 | synthesized from other information. */ | |
411 | ||
6d56c69a | 412 | flagword flags; |
332b6327 | 413 | |
7a276b09 | 414 | #define SEC_NO_FLAGS 0x000 |
332b6327 SC |
415 | |
416 | /* Tells the OS to allocate space for this section when loaded. | |
417 | This would clear for a section containing debug information | |
418 | only. */ | |
419 | ||
420 | ||
7a276b09 | 421 | #define SEC_ALLOC 0x001 |
332b6327 SC |
422 | /* Tells the OS to load the section from the file when loading. |
423 | This would be clear for a .bss section */ | |
424 | ||
7a276b09 | 425 | #define SEC_LOAD 0x002 |
332b6327 SC |
426 | /* The section contains data still to be relocated, so there will |
427 | be some relocation information too. */ | |
428 | ||
7a276b09 | 429 | #define SEC_RELOC 0x004 |
332b6327 SC |
430 | |
431 | /* Obsolete ? */ | |
432 | ||
7a276b09 | 433 | #define SEC_BALIGN 0x008 |
332b6327 SC |
434 | |
435 | /* A signal to the OS that the section contains read only | |
436 | data. */ | |
7a276b09 | 437 | #define SEC_READONLY 0x010 |
332b6327 SC |
438 | |
439 | /* The section contains code only. */ | |
440 | ||
7a276b09 | 441 | #define SEC_CODE 0x020 |
332b6327 SC |
442 | |
443 | /* The section contains data only. */ | |
444 | ||
7a276b09 | 445 | #define SEC_DATA 0x040 |
332b6327 SC |
446 | |
447 | /* The section will reside in ROM. */ | |
448 | ||
7a276b09 | 449 | #define SEC_ROM 0x080 |
332b6327 SC |
450 | |
451 | /* The section contains constructor information. This section | |
452 | type is used by the linker to create lists of constructors and | |
453 | destructors used by <<g++>>. When a back end sees a symbol | |
454 | which should be used in a constructor list, it creates a new | |
455 | section for the type of name (eg <<__CTOR_LIST__>>), attaches | |
456 | the symbol to it and builds a relocation. To build the lists | |
457 | of constructors, all the linker has to to is catenate all the | |
458 | sections called <<__CTOR_LIST__>> and relocte the data | |
459 | contained within - exactly the operations it would peform on | |
460 | standard data. */ | |
461 | ||
7a276b09 | 462 | #define SEC_CONSTRUCTOR 0x100 |
332b6327 SC |
463 | |
464 | /* The section is a constuctor, and should be placed at the | |
465 | end of the . */ | |
466 | ||
467 | ||
1c6c6598 | 468 | #define SEC_CONSTRUCTOR_TEXT 0x1100 |
332b6327 | 469 | |
1c6c6598 | 470 | #define SEC_CONSTRUCTOR_DATA 0x2100 |
332b6327 | 471 | |
1c6c6598 | 472 | #define SEC_CONSTRUCTOR_BSS 0x3100 |
332b6327 SC |
473 | |
474 | ||
475 | /* The section has contents - a bss section could be | |
476 | <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>, a debug section could be | |
477 | <<SEC_HAS_CONTENTS>> */ | |
478 | ||
7a276b09 | 479 | #define SEC_HAS_CONTENTS 0x200 |
332b6327 SC |
480 | |
481 | /* An instruction to the linker not to output sections | |
482 | containing this flag even if they have information which | |
483 | would normally be written. */ | |
484 | ||
7a276b09 | 485 | #define SEC_NEVER_LOAD 0x400 |
332b6327 | 486 | |
41d1b02f ILT |
487 | /* The section is a shared library section. The linker must leave |
488 | these completely alone, as the vma and size are used when | |
489 | the executable is loaded. */ | |
490 | ||
491 | #define SEC_SHARED_LIBRARY 0x800 | |
9a7c5449 | 492 | |
332b6327 | 493 | |
7a276b09 | 494 | bfd_vma vma; |
9a51287f | 495 | boolean user_set_vma; |
332b6327 | 496 | |
9a7c5449 | 497 | /* The size of the section in bytes, as it will be output. |
332b6327 | 498 | contains a value even if the section has no contents (eg, the |
9a7c5449 | 499 | size of <<.bss>>). This will be filled in after relocation */ |
332b6327 | 500 | |
9a7c5449 SC |
501 | bfd_size_type _cooked_size; |
502 | ||
503 | /* The size on disk of the section in bytes originally. Normally this | |
504 | value is the same as the size, but if some relaxing has | |
505 | been done, then this value will be bigger. */ | |
506 | ||
507 | bfd_size_type _raw_size; | |
332b6327 SC |
508 | |
509 | /* If this section is going to be output, then this value is the | |
510 | offset into the output section of the first byte in the input | |
511 | section. Eg, if this was going to start at the 100th byte in | |
512 | the output section, this value would be 100. */ | |
513 | ||
7a276b09 | 514 | bfd_vma output_offset; |
332b6327 SC |
515 | |
516 | /* The output section through which to map on output. */ | |
517 | ||
7a276b09 | 518 | struct sec *output_section; |
332b6327 SC |
519 | |
520 | /* The alignment requirement of the section, as an exponent - eg | |
521 | 3 aligns to 2^3 (or 8) */ | |
522 | ||
7a276b09 | 523 | unsigned int alignment_power; |
332b6327 SC |
524 | |
525 | /* If an input section, a pointer to a vector of relocation | |
526 | records for the data in this section. */ | |
527 | ||
7a276b09 | 528 | struct reloc_cache_entry *relocation; |
332b6327 SC |
529 | |
530 | /* If an output section, a pointer to a vector of pointers to | |
531 | relocation records for the data in this section. */ | |
532 | ||
7a276b09 | 533 | struct reloc_cache_entry **orelocation; |
332b6327 SC |
534 | |
535 | /* The number of relocation records in one of the above */ | |
536 | ||
7a276b09 | 537 | unsigned reloc_count; |
332b6327 | 538 | |
332b6327 SC |
539 | /* Information below is back end specific - and not always used |
540 | or updated | |
541 | ||
542 | File position of section data */ | |
543 | ||
7a276b09 | 544 | file_ptr filepos; |
332b6327 SC |
545 | |
546 | /* File position of relocation info */ | |
547 | ||
7a276b09 | 548 | file_ptr rel_filepos; |
332b6327 SC |
549 | |
550 | /* File position of line data */ | |
551 | ||
7a276b09 | 552 | file_ptr line_filepos; |
332b6327 SC |
553 | |
554 | /* Pointer to data for applications */ | |
555 | ||
7a276b09 | 556 | PTR userdata; |
332b6327 | 557 | |
7a276b09 | 558 | struct lang_output_section *otheruserdata; |
332b6327 SC |
559 | |
560 | /* Attached line number information */ | |
561 | ||
7a276b09 | 562 | alent *lineno; |
332b6327 SC |
563 | |
564 | /* Number of line number records */ | |
565 | ||
7a276b09 | 566 | unsigned int lineno_count; |
332b6327 SC |
567 | |
568 | /* When a section is being output, this value changes as more | |
569 | linenumbers are written out */ | |
570 | ||
7a276b09 | 571 | file_ptr moving_line_filepos; |
332b6327 SC |
572 | |
573 | /* what the section number is in the target world */ | |
574 | ||
9a7c5449 | 575 | int target_index; |
332b6327 | 576 | |
7a276b09 | 577 | PTR used_by_bfd; |
332b6327 SC |
578 | |
579 | /* If this is a constructor section then here is a list of the | |
580 | relocations created to relocate items within it. */ | |
581 | ||
7a276b09 | 582 | struct relent_chain *constructor_chain; |
332b6327 SC |
583 | |
584 | /* The BFD which owns the section. */ | |
585 | ||
7a276b09 | 586 | bfd *owner; |
332b6327 | 587 | |
9a7c5449 SC |
588 | boolean reloc_done; |
589 | /* A symbol which points at this section only */ | |
590 | struct symbol_cache_entry *symbol; | |
591 | struct symbol_cache_entry **symbol_ptr_ptr; | |
f6047bbd JG |
592 | struct bfd_seclet *seclets_head; |
593 | struct bfd_seclet *seclets_tail; | |
7a276b09 | 594 | } asection ; |
9a7c5449 SC |
595 | |
596 | ||
597 | #define BFD_ABS_SECTION_NAME "*ABS*" | |
598 | #define BFD_UND_SECTION_NAME "*UND*" | |
599 | #define BFD_COM_SECTION_NAME "*COM*" | |
600 | ||
601 | /* the absolute section */ | |
602 | extern asection bfd_abs_section; | |
603 | /* Pointer to the undefined section */ | |
604 | extern asection bfd_und_section; | |
605 | /* Pointer to the common section */ | |
606 | extern asection bfd_com_section; | |
607 | ||
608 | extern struct symbol_cache_entry *bfd_abs_symbol; | |
609 | extern struct symbol_cache_entry *bfd_com_symbol; | |
610 | extern struct symbol_cache_entry *bfd_und_symbol; | |
611 | #define bfd_get_section_size_before_reloc(section) \ | |
612 | (section->reloc_done ? (abort(),1): (section)->_raw_size) | |
613 | #define bfd_get_section_size_after_reloc(section) \ | |
614 | ((section->reloc_done) ? (section)->_cooked_size: (abort(),1)) | |
18fe0e9f JG |
615 | asection * |
616 | bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name)); | |
617 | ||
618 | asection * | |
619 | bfd_make_section_old_way PARAMS ((bfd *, CONST char *name)); | |
620 | ||
621 | asection * | |
622 | bfd_make_section PARAMS ((bfd *, CONST char *name)); | |
623 | ||
624 | boolean | |
625 | bfd_set_section_flags PARAMS ((bfd *, asection *, flagword)); | |
626 | ||
627 | void | |
628 | bfd_map_over_sections PARAMS ((bfd *abfd, | |
f48e5efe JG |
629 | void (*func)(bfd *abfd, |
630 | asection *sect, | |
631 | PTR obj), | |
632 | PTR obj)); | |
18fe0e9f JG |
633 | |
634 | boolean | |
635 | bfd_set_section_size PARAMS ((bfd *, asection *, bfd_size_type val)); | |
636 | ||
637 | boolean | |
638 | bfd_set_section_contents | |
639 | PARAMS ((bfd *abfd, | |
332b6327 SC |
640 | asection *section, |
641 | PTR data, | |
642 | file_ptr offset, | |
643 | bfd_size_type count)); | |
18fe0e9f JG |
644 | |
645 | boolean | |
646 | bfd_get_section_contents | |
647 | PARAMS ((bfd *abfd, asection *section, PTR location, | |
332b6327 | 648 | file_ptr offset, bfd_size_type count)); |
18fe0e9f | 649 | |
b39096a4 | 650 | enum bfd_architecture |
7a276b09 | 651 | { |
6d56c69a SC |
652 | bfd_arch_unknown, /* File arch not known */ |
653 | bfd_arch_obscure, /* Arch known, not one of these */ | |
654 | bfd_arch_m68k, /* Motorola 68xxx */ | |
655 | bfd_arch_vax, /* DEC Vax */ | |
656 | bfd_arch_i960, /* Intel 960 */ | |
657 | /* The order of the following is important. | |
b39096a4 SC |
658 | lower number indicates a machine type that |
659 | only accepts a subset of the instructions | |
660 | available to machines with higher numbers. | |
661 | The exception is the "ca", which is | |
662 | incompatible with all other machines except | |
663 | "core". */ | |
7a276b09 | 664 | |
b39096a4 SC |
665 | #define bfd_mach_i960_core 1 |
666 | #define bfd_mach_i960_ka_sa 2 | |
667 | #define bfd_mach_i960_kb_sb 3 | |
668 | #define bfd_mach_i960_mc 4 | |
669 | #define bfd_mach_i960_xa 5 | |
670 | #define bfd_mach_i960_ca 6 | |
671 | ||
6d56c69a SC |
672 | bfd_arch_a29k, /* AMD 29000 */ |
673 | bfd_arch_sparc, /* SPARC */ | |
674 | bfd_arch_mips, /* MIPS Rxxxx */ | |
675 | bfd_arch_i386, /* Intel 386 */ | |
60289922 | 676 | bfd_arch_we32k, /* AT&T WE32xxx */ |
6d56c69a SC |
677 | bfd_arch_tahoe, /* CCI/Harris Tahoe */ |
678 | bfd_arch_i860, /* Intel 860 */ | |
679 | bfd_arch_romp, /* IBM ROMP PC/RT */ | |
680 | bfd_arch_alliant, /* Alliant */ | |
681 | bfd_arch_convex, /* Convex */ | |
682 | bfd_arch_m88k, /* Motorola 88xxx */ | |
683 | bfd_arch_pyramid, /* Pyramid Technology */ | |
684 | bfd_arch_h8300, /* Hitachi H8/300 */ | |
685 | bfd_arch_rs6000, /* IBM RS/6000 */ | |
5e511f6f | 686 | bfd_arch_hppa, /* HP PA RISC */ |
3ab9faab SC |
687 | bfd_arch_z8k, /* Zilog Z8000 */ |
688 | #define bfd_mach_z8001 1 | |
689 | #define bfd_mach_z8002 2 | |
b39096a4 SC |
690 | bfd_arch_last |
691 | }; | |
bded7de2 | 692 | |
81f8fee9 | 693 | typedef struct bfd_arch_info |
b39096a4 SC |
694 | { |
695 | int bits_per_word; | |
696 | int bits_per_address; | |
697 | int bits_per_byte; | |
698 | enum bfd_architecture arch; | |
699 | long mach; | |
700 | char *arch_name; | |
701 | CONST char *printable_name; | |
9a51287f | 702 | unsigned int section_align_power; |
43857158 | 703 | /* true if this is the default machine for the architecture */ |
b39096a4 | 704 | boolean the_default; |
18fe0e9f JG |
705 | CONST struct bfd_arch_info * (*compatible) |
706 | PARAMS ((CONST struct bfd_arch_info *a, | |
707 | CONST struct bfd_arch_info *b)); | |
b39096a4 | 708 | |
18fe0e9f JG |
709 | boolean (*scan) PARAMS ((CONST struct bfd_arch_info *, CONST char *)); |
710 | unsigned int (*disassemble) PARAMS ((bfd_vma addr, CONST char *data, | |
711 | PTR stream)); | |
b39096a4 | 712 | |
9a51287f | 713 | struct bfd_arch_info *next; |
81f8fee9 | 714 | } bfd_arch_info_type; |
18fe0e9f JG |
715 | CONST char * |
716 | bfd_printable_name PARAMS ((bfd *abfd)); | |
717 | ||
718 | bfd_arch_info_type * | |
719 | bfd_scan_arch PARAMS ((CONST char *)); | |
720 | ||
721 | CONST bfd_arch_info_type * | |
722 | bfd_arch_get_compatible PARAMS (( | |
332b6327 SC |
723 | CONST bfd *abfd, |
724 | CONST bfd *bbfd)); | |
18fe0e9f JG |
725 | |
726 | void | |
727 | bfd_set_arch_info PARAMS ((bfd *, bfd_arch_info_type *)); | |
728 | ||
729 | enum bfd_architecture | |
730 | bfd_get_arch PARAMS ((bfd *abfd)); | |
731 | ||
732 | unsigned long | |
733 | bfd_get_mach PARAMS ((bfd *abfd)); | |
734 | ||
735 | unsigned int | |
736 | bfd_arch_bits_per_byte PARAMS ((bfd *abfd)); | |
737 | ||
738 | unsigned int | |
739 | bfd_arch_bits_per_address PARAMS ((bfd *abfd)); | |
740 | ||
741 | bfd_arch_info_type * | |
742 | bfd_get_arch_info PARAMS ((bfd *)); | |
743 | ||
744 | bfd_arch_info_type * | |
745 | bfd_lookup_arch | |
746 | PARAMS ((enum bfd_architecture | |
332b6327 SC |
747 | arch, |
748 | long machine)); | |
18fe0e9f JG |
749 | |
750 | CONST char * | |
751 | bfd_printable_arch_mach | |
752 | PARAMS ((enum bfd_architecture arch, unsigned long machine)); | |
753 | ||
332b6327 SC |
754 | typedef enum bfd_reloc_status |
755 | { | |
756 | /* No errors detected */ | |
b39096a4 | 757 | bfd_reloc_ok, |
332b6327 SC |
758 | |
759 | /* The relocation was performed, but there was an overflow. */ | |
b39096a4 | 760 | bfd_reloc_overflow, |
332b6327 SC |
761 | |
762 | /* The address to relocate was not within the section supplied*/ | |
b39096a4 | 763 | bfd_reloc_outofrange, |
332b6327 SC |
764 | |
765 | /* Used by special functions */ | |
b39096a4 | 766 | bfd_reloc_continue, |
332b6327 SC |
767 | |
768 | /* Unused */ | |
b39096a4 | 769 | bfd_reloc_notsupported, |
332b6327 SC |
770 | |
771 | /* Unsupported relocation size requested. */ | |
b39096a4 | 772 | bfd_reloc_other, |
332b6327 SC |
773 | |
774 | /* The symbol to relocate against was undefined.*/ | |
b39096a4 | 775 | bfd_reloc_undefined, |
332b6327 SC |
776 | |
777 | /* The relocation was performed, but may not be ok - presently | |
778 | generated only when linking i960 coff files with i960 b.out | |
779 | symbols. */ | |
b39096a4 | 780 | bfd_reloc_dangerous |
332b6327 | 781 | } |
81f8fee9 | 782 | bfd_reloc_status_type; |
332b6327 SC |
783 | |
784 | ||
b39096a4 SC |
785 | typedef struct reloc_cache_entry |
786 | { | |
332b6327 | 787 | /* A pointer into the canonical table of pointers */ |
b39096a4 | 788 | struct symbol_cache_entry **sym_ptr_ptr; |
332b6327 SC |
789 | |
790 | /* offset in section */ | |
b39096a4 | 791 | rawdata_offset address; |
332b6327 SC |
792 | |
793 | /* addend for relocation value */ | |
b39096a4 | 794 | bfd_vma addend; |
332b6327 | 795 | |
332b6327 | 796 | /* Pointer to how to perform the required relocation */ |
b39096a4 | 797 | CONST struct reloc_howto_struct *howto; |
332b6327 | 798 | |
b39096a4 | 799 | } arelent; |
f48e5efe | 800 | |
b39096a4 SC |
801 | typedef CONST struct reloc_howto_struct |
802 | { | |
332b6327 SC |
803 | /* The type field has mainly a documetary use - the back end can |
804 | to what it wants with it, though the normally the back end's | |
805 | external idea of what a reloc number would be would be stored | |
806 | in this field. For example, the a PC relative word relocation | |
807 | in a coff environment would have the type 023 - because that's | |
808 | what the outside world calls a R_PCRWORD reloc. */ | |
b39096a4 | 809 | unsigned int type; |
332b6327 SC |
810 | |
811 | /* The value the final relocation is shifted right by. This drops | |
812 | unwanted data from the relocation. */ | |
b39096a4 | 813 | unsigned int rightshift; |
332b6327 SC |
814 | |
815 | /* The size of the item to be relocated - 0, is one byte, 1 is 2 | |
3ae49aef KR |
816 | bytes, 3 is four bytes. A -ve value indicates that the |
817 | result is to be subtracted from the data*/ | |
2c0e53a4 | 818 | int size; |
332b6327 SC |
819 | |
820 | /* Now obsolete */ | |
b39096a4 | 821 | unsigned int bitsize; |
332b6327 SC |
822 | |
823 | /* Notes that the relocation is relative to the location in the | |
824 | data section of the addend. The relocation function will | |
825 | subtract from the relocation value the address of the location | |
826 | being relocated. */ | |
b39096a4 | 827 | boolean pc_relative; |
332b6327 SC |
828 | |
829 | /* Now obsolete */ | |
b39096a4 | 830 | unsigned int bitpos; |
332b6327 SC |
831 | |
832 | /* Now obsolete */ | |
b39096a4 | 833 | boolean absolute; |
332b6327 SC |
834 | |
835 | /* Causes the relocation routine to return an error if overflow | |
836 | is detected when relocating. */ | |
b39096a4 | 837 | boolean complain_on_overflow; |
332b6327 SC |
838 | |
839 | /* If this field is non null, then the supplied function is | |
840 | called rather than the normal function. This allows really | |
841 | strange relocation methods to be accomodated (eg, i960 callj | |
842 | instructions). */ | |
18fe0e9f JG |
843 | bfd_reloc_status_type (*special_function) |
844 | PARAMS ((bfd *abfd, | |
f48e5efe JG |
845 | arelent *reloc_entry, |
846 | struct symbol_cache_entry *symbol, | |
847 | PTR data, | |
2d690b0a | 848 | asection *input_section, |
18fe0e9f | 849 | bfd *output_bfd)); |
332b6327 SC |
850 | |
851 | /* The textual name of the relocation type. */ | |
b39096a4 | 852 | char *name; |
332b6327 SC |
853 | |
854 | /* When performing a partial link, some formats must modify the | |
855 | relocations rather than the data - this flag signals this.*/ | |
b39096a4 | 856 | boolean partial_inplace; |
332b6327 SC |
857 | |
858 | /* The src_mask is used to select what parts of the read in data | |
859 | are to be used in the relocation sum. Eg, if this was an 8 bit | |
860 | bit of data which we read and relocated, this would be | |
861 | 0x000000ff. When we have relocs which have an addend, such as | |
862 | sun4 extended relocs, the value in the offset part of a | |
863 | relocating field is garbage so we never use it. In this case | |
864 | the mask would be 0x00000000. */ | |
b39096a4 | 865 | bfd_word src_mask; |
332b6327 SC |
866 | |
867 | /* The dst_mask is what parts of the instruction are replaced | |
868 | into the instruction. In most cases src_mask == dst_mask, | |
869 | except in the above special case, where dst_mask would be | |
870 | 0x000000ff, and src_mask would be 0x00000000. */ | |
b39096a4 | 871 | bfd_word dst_mask; |
332b6327 SC |
872 | |
873 | /* When some formats create PC relative instructions, they leave | |
874 | the value of the pc of the place being relocated in the offset | |
875 | slot of the instruction, so that a PC relative relocation can | |
876 | be made just by adding in an ordinary offset (eg sun3 a.out). | |
877 | Some formats leave the displacement part of an instruction | |
878 | empty (eg m88k bcs), this flag signals the fact.*/ | |
b39096a4 | 879 | boolean pcrel_offset; |
332b6327 | 880 | |
b39096a4 | 881 | } reloc_howto_type; |
b39096a4 SC |
882 | #define HOWTO(C, R,S,B, P, BI, ABS, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ |
883 | {(unsigned)C,R,S,B, P, BI, ABS,O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC} | |
46773090 | 884 | #define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,false,false,FUNCTION, NAME,false,0,0,IN) |
7a276b09 | 885 | |
332b6327 SC |
886 | #define HOWTO_PREPARE(relocation, symbol) \ |
887 | { \ | |
888 | if (symbol != (asymbol *)NULL) { \ | |
9a7c5449 | 889 | if (symbol->section == &bfd_com_section) { \ |
332b6327 SC |
890 | relocation = 0; \ |
891 | } \ | |
892 | else { \ | |
893 | relocation = symbol->value; \ | |
894 | } \ | |
895 | } \ | |
332b6327 | 896 | } |
b39096a4 | 897 | typedef unsigned char bfd_byte; |
bded7de2 | 898 | |
b39096a4 SC |
899 | typedef struct relent_chain { |
900 | arelent relent; | |
901 | struct relent_chain *next; | |
902 | } arelent_chain; | |
6d56c69a | 903 | bfd_reloc_status_type |
18fe0e9f JG |
904 | |
905 | bfd_perform_relocation | |
906 | PARAMS ((bfd * abfd, | |
332b6327 SC |
907 | arelent *reloc_entry, |
908 | PTR data, | |
909 | asection *input_section, | |
910 | bfd *output_bfd)); | |
18fe0e9f | 911 | |
332b6327 | 912 | typedef enum bfd_reloc_code_real |
3ab9faab | 913 | |
332b6327 SC |
914 | { |
915 | /* 16 bits wide, simple reloc */ | |
916 | BFD_RELOC_16, | |
917 | ||
918 | /* 8 bits wide, but used to form an address like 0xffnn */ | |
de7e640d | 919 | BFD_RELOC_8_FFnn, |
332b6327 SC |
920 | |
921 | /* 8 bits wide, simple */ | |
de7e640d | 922 | BFD_RELOC_8, |
332b6327 SC |
923 | |
924 | /* 8 bits wide, pc relative */ | |
358c1d4d | 925 | BFD_RELOC_8_PCREL, |
332b6327 SC |
926 | |
927 | /* The type of reloc used to build a contructor table - at the | |
928 | moment probably a 32 bit wide abs address, but the cpu can | |
929 | choose. */ | |
930 | ||
d5ceae78 KR |
931 | BFD_RELOC_CTOR, |
932 | ||
933 | /* 32 bits wide, simple reloc */ | |
934 | BFD_RELOC_32, | |
935 | /* 32 bits, PC-relative */ | |
936 | BFD_RELOC_32_PCREL, | |
937 | ||
938 | /* High 22 bits of 32-bit value; simple reloc. */ | |
939 | BFD_RELOC_HI22, | |
940 | /* Low 10 bits. */ | |
941 | BFD_RELOC_LO10, | |
942 | ||
943 | /* Reloc types used for i960/b.out. */ | |
944 | BFD_RELOC_24_PCREL, | |
945 | BFD_RELOC_I960_CALLJ, | |
946 | ||
947 | BFD_RELOC_16_PCREL, | |
948 | /* 32-bit pc-relative, shifted right 2 bits (i.e., 30-bit | |
949 | word displacement, e.g. for SPARC) */ | |
950 | BFD_RELOC_32_PCREL_S2, | |
951 | ||
952 | /* now for the sparc/elf codes */ | |
953 | BFD_RELOC_NONE, /* actually used */ | |
954 | BFD_RELOC_SPARC_WDISP22, | |
955 | BFD_RELOC_SPARC22, | |
956 | BFD_RELOC_SPARC13, | |
957 | BFD_RELOC_SPARC_BASE13, | |
958 | BFD_RELOC_SPARC_GOT10, | |
959 | BFD_RELOC_SPARC_GOT13, | |
960 | BFD_RELOC_SPARC_GOT22, | |
961 | BFD_RELOC_SPARC_PC10, | |
962 | BFD_RELOC_SPARC_PC22, | |
963 | BFD_RELOC_SPARC_WPLT30, | |
964 | BFD_RELOC_SPARC_COPY, | |
965 | BFD_RELOC_SPARC_GLOB_DAT, | |
966 | BFD_RELOC_SPARC_JMP_SLOT, | |
967 | BFD_RELOC_SPARC_RELATIVE, | |
968 | BFD_RELOC_SPARC_UA32, | |
969 | ||
970 | /* this one is a.out specific? */ | |
971 | BFD_RELOC_SPARC_BASE22, | |
972 | ||
973 | /* this must be the highest numeric value */ | |
974 | BFD_RELOC_UNUSED | |
81f8fee9 | 975 | } bfd_reloc_code_real_type; |
6d56c69a | 976 | CONST struct reloc_howto_struct * |
18fe0e9f JG |
977 | |
978 | bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); | |
979 | ||
b39096a4 SC |
980 | typedef struct symbol_cache_entry |
981 | { | |
332b6327 SC |
982 | /* A pointer to the BFD which owns the symbol. This information |
983 | is necessary so that a back end can work out what additional | |
984 | (invisible to the application writer) information is carried | |
985 | with the symbol. */ | |
986 | ||
b39096a4 | 987 | struct _bfd *the_bfd; |
332b6327 SC |
988 | |
989 | /* The text of the symbol. The name is left alone, and not copied - the | |
990 | application may not alter it. */ | |
991 | CONST char *name; | |
992 | ||
993 | /* The value of the symbol.*/ | |
994 | symvalue value; | |
995 | ||
996 | /* Attributes of a symbol: */ | |
997 | ||
b39096a4 | 998 | #define BSF_NO_FLAGS 0x00 |
332b6327 SC |
999 | |
1000 | /* The symbol has local scope; <<static>> in <<C>>. The value | |
1001 | is the offset into the section of the data. */ | |
b39096a4 | 1002 | #define BSF_LOCAL 0x01 |
332b6327 SC |
1003 | |
1004 | /* The symbol has global scope; initialized data in <<C>>. The | |
1005 | value is the offset into the section of the data. */ | |
b39096a4 | 1006 | #define BSF_GLOBAL 0x02 |
332b6327 SC |
1007 | |
1008 | /* Obsolete */ | |
b39096a4 | 1009 | #define BSF_IMPORT 0x04 |
332b6327 SC |
1010 | |
1011 | /* The symbol has global scope, and is exported. The value is | |
1012 | the offset into the section of the data. */ | |
b39096a4 | 1013 | #define BSF_EXPORT 0x08 |
332b6327 SC |
1014 | |
1015 | /* The symbol is undefined. <<extern>> in <<C>>. The value has | |
1016 | no meaning. */ | |
9a7c5449 | 1017 | #define BSF_UNDEFINED_OBS 0x10 |
332b6327 SC |
1018 | |
1019 | /* The symbol is common, initialized to zero; default in | |
1020 | <<C>>. The value is the size of the object in bytes. */ | |
9a7c5449 | 1021 | #define BSF_FORT_COMM_OBS 0x20 |
332b6327 SC |
1022 | |
1023 | /* A normal C symbol would be one of: | |
1024 | <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or | |
1025 | <<BSF_EXPORT|BSD_GLOBAL>> */ | |
1026 | ||
1027 | /* The symbol is a debugging record. The value has an arbitary | |
1028 | meaning. */ | |
b39096a4 | 1029 | #define BSF_DEBUGGING 0x40 |
332b6327 | 1030 | |
332b6327 | 1031 | /* Used by the linker */ |
b39096a4 SC |
1032 | #define BSF_KEEP 0x10000 |
1033 | #define BSF_KEEP_G 0x80000 | |
332b6327 SC |
1034 | |
1035 | /* Unused */ | |
b39096a4 SC |
1036 | #define BSF_WEAK 0x100000 |
1037 | #define BSF_CTOR 0x200000 | |
9a7c5449 | 1038 | |
bc718e87 JG |
1039 | /* This symbol was created to point to a section, e.g. ELF's |
1040 | STT_SECTION symbols. */ | |
9a7c5449 | 1041 | #define BSF_SECTION_SYM 0x400000 |
332b6327 SC |
1042 | |
1043 | /* The symbol used to be a common symbol, but now it is | |
1044 | allocated. */ | |
b39096a4 | 1045 | #define BSF_OLD_COMMON 0x800000 |
332b6327 SC |
1046 | |
1047 | /* The default value for common data. */ | |
b39096a4 | 1048 | #define BFD_FORT_COMM_DEFAULT_VALUE 0 |
332b6327 SC |
1049 | |
1050 | /* In some files the type of a symbol sometimes alters its | |
1051 | location in an output file - ie in coff a <<ISFCN>> symbol | |
1052 | which is also <<C_EXT>> symbol appears where it was | |
1053 | declared and not at the end of a section. This bit is set | |
1054 | by the target BFD part to convey this information. */ | |
1055 | ||
b39096a4 | 1056 | #define BSF_NOT_AT_END 0x40000 |
332b6327 SC |
1057 | |
1058 | /* Signal that the symbol is the label of constructor section. */ | |
b39096a4 | 1059 | #define BSF_CONSTRUCTOR 0x1000000 |
332b6327 SC |
1060 | |
1061 | /* Signal that the symbol is a warning symbol. If the symbol | |
1062 | is a warning symbol, then the value field (I know this is | |
1063 | tacky) will point to the asymbol which when referenced will | |
1064 | cause the warning. */ | |
b39096a4 | 1065 | #define BSF_WARNING 0x2000000 |
332b6327 SC |
1066 | |
1067 | /* Signal that the symbol is indirect. The value of the symbol | |
1068 | is a pointer to an undefined asymbol which contains the | |
1069 | name to use instead. */ | |
bc718e87 JG |
1070 | #define BSF_INDIRECT 0x4000000 |
1071 | ||
1072 | /* BSF_FILE marks symbols that contain a file name. This is used | |
1073 | for ELF STT_FILE symbols. */ | |
1074 | #define BSF_FILE 0x08000000 | |
332b6327 | 1075 | |
b39096a4 | 1076 | flagword flags; |
332b6327 | 1077 | |
9a7c5449 SC |
1078 | /* A pointer to the section to which this symbol is |
1079 | relative. This will always be non NULL, there are special | |
1080 | sections for undefined and absolute symbols */ | |
b39096a4 | 1081 | struct sec *section; |
332b6327 SC |
1082 | |
1083 | /* Back end special data. This is being phased out in favour | |
1084 | of making this a union. */ | |
b39096a4 | 1085 | PTR udata; |
332b6327 | 1086 | |
b39096a4 | 1087 | } asymbol; |
b39096a4 SC |
1088 | #define get_symtab_upper_bound(abfd) \ |
1089 | BFD_SEND (abfd, _get_symtab_upper_bound, (abfd)) | |
b39096a4 SC |
1090 | #define bfd_canonicalize_symtab(abfd, location) \ |
1091 | BFD_SEND (abfd, _bfd_canonicalize_symtab,\ | |
1092 | (abfd, location)) | |
18fe0e9f JG |
1093 | boolean |
1094 | bfd_set_symtab PARAMS ((bfd *, asymbol **, unsigned int )); | |
1095 | ||
1096 | void | |
1097 | bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol)); | |
1098 | ||
b39096a4 SC |
1099 | #define bfd_make_empty_symbol(abfd) \ |
1100 | BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) | |
d5ceae78 KR |
1101 | #define bfd_make_debug_symbol(abfd,ptr,size) \ |
1102 | BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) | |
18fe0e9f JG |
1103 | int |
1104 | bfd_decode_symclass PARAMS ((asymbol *symbol)); | |
1105 | ||
b39096a4 SC |
1106 | struct _bfd |
1107 | { | |
332b6327 SC |
1108 | /* The filename the application opened the BFD with. */ |
1109 | CONST char *filename; | |
1110 | ||
1111 | /* A pointer to the target jump table. */ | |
1112 | struct bfd_target *xvec; | |
1113 | ||
1114 | /* To avoid dragging too many header files into every file that | |
0aa70210 | 1115 | includes `<<bfd.h>>', IOSTREAM has been declared as a "char |
332b6327 SC |
1116 | *", and MTIME as a "long". Their correct types, to which they |
1117 | are cast when used, are "FILE *" and "time_t". The iostream | |
1118 | is the result of an fopen on the filename. */ | |
1119 | char *iostream; | |
1120 | ||
1121 | /* Is the file being cached */ | |
1122 | ||
1123 | boolean cacheable; | |
1124 | ||
1125 | /* Marks whether there was a default target specified when the | |
1126 | BFD was opened. This is used to select what matching algorithm | |
1127 | to use to chose the back end. */ | |
1128 | ||
1129 | boolean target_defaulted; | |
1130 | ||
1131 | /* The caching routines use these to maintain a | |
1132 | least-recently-used list of BFDs */ | |
1133 | ||
1134 | struct _bfd *lru_prev, *lru_next; | |
1135 | ||
1136 | /* When a file is closed by the caching routines, BFD retains | |
1137 | state information on the file here: | |
1138 | */ | |
1139 | ||
1140 | file_ptr where; | |
1141 | ||
1142 | /* and here:*/ | |
1143 | ||
1144 | boolean opened_once; | |
1145 | ||
1146 | /* Set if we have a locally maintained mtime value, rather than | |
1147 | getting it from the file each time: */ | |
1148 | ||
1149 | boolean mtime_set; | |
1150 | ||
1151 | /* File modified time, if mtime_set is true: */ | |
1152 | ||
1153 | long mtime; | |
1154 | ||
1155 | /* Reserved for an unimplemented file locking extension.*/ | |
1156 | ||
1157 | int ifd; | |
1158 | ||
1159 | /* The format which belongs to the BFD.*/ | |
1160 | ||
1161 | bfd_format format; | |
1162 | ||
1163 | /* The direction the BFD was opened with*/ | |
1164 | ||
1165 | enum bfd_direction {no_direction = 0, | |
1166 | read_direction = 1, | |
1167 | write_direction = 2, | |
1168 | both_direction = 3} direction; | |
1169 | ||
1170 | /* Format_specific flags*/ | |
1171 | ||
1172 | flagword flags; | |
1173 | ||
1174 | /* Currently my_archive is tested before adding origin to | |
1175 | anything. I believe that this can become always an add of | |
1176 | origin, with origin set to 0 for non archive files. */ | |
1177 | ||
1178 | file_ptr origin; | |
1179 | ||
1180 | /* Remember when output has begun, to stop strange things | |
1181 | happening. */ | |
1182 | boolean output_has_begun; | |
1183 | ||
1184 | /* Pointer to linked list of sections*/ | |
1185 | struct sec *sections; | |
1186 | ||
1187 | /* The number of sections */ | |
1188 | unsigned int section_count; | |
1189 | ||
1190 | /* Stuff only useful for object files: | |
1191 | The start address. */ | |
1192 | bfd_vma start_address; | |
1193 | ||
1194 | /* Used for input and output*/ | |
1195 | unsigned int symcount; | |
1196 | ||
1197 | /* Symbol table for output BFD*/ | |
1198 | struct symbol_cache_entry **outsymbols; | |
1199 | ||
1200 | /* Pointer to structure which contains architecture information*/ | |
1201 | struct bfd_arch_info *arch_info; | |
1202 | ||
1203 | /* Stuff only useful for archives:*/ | |
1204 | PTR arelt_data; | |
1205 | struct _bfd *my_archive; | |
1206 | struct _bfd *next; | |
1207 | struct _bfd *archive_head; | |
1208 | boolean has_armap; | |
1209 | ||
1210 | /* Used by the back end to hold private data. */ | |
332b6327 | 1211 | |
9a7c5449 SC |
1212 | union |
1213 | { | |
1214 | struct aout_data_struct *aout_data; | |
1215 | struct artdata *aout_ar_data; | |
1216 | struct _oasys_data *oasys_obj_data; | |
1217 | struct _oasys_ar_data *oasys_ar_data; | |
1218 | struct coff_tdata *coff_obj_data; | |
1219 | struct ieee_data_struct *ieee_data; | |
1220 | struct ieee_ar_data_struct *ieee_ar_data; | |
1221 | struct srec_data_struct *srec_data; | |
2d690b0a | 1222 | struct srec_data_struct *tekhex_data; |
3ce7a824 | 1223 | struct elf_obj_tdata *elf_obj_data; |
9a7c5449 SC |
1224 | struct bout_data_struct *bout_data; |
1225 | struct sun_core_struct *sun_core_data; | |
2b74083c | 1226 | struct trad_core_struct *trad_core_data; |
d63a3da9 | 1227 | struct hppa_data_struct *hppa_data; |
9a7c5449 SC |
1228 | PTR any; |
1229 | } tdata; | |
1230 | ||
332b6327 SC |
1231 | /* Used by the application to hold private data*/ |
1232 | PTR usrdata; | |
1233 | ||
1234 | /* Where all the allocated stuff under this BFD goes */ | |
1235 | struct obstack memory; | |
9a7c5449 | 1236 | |
d5ceae78 | 1237 | /* Is this really needed in addition to usrdata? */ |
9a7c5449 | 1238 | asymbol **ld_symbols; |
b39096a4 | 1239 | }; |
332b6327 | 1240 | |
18fe0e9f JG |
1241 | unsigned int |
1242 | bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect)); | |
1243 | ||
1244 | unsigned int | |
1245 | bfd_canonicalize_reloc | |
1246 | PARAMS ((bfd *abfd, | |
332b6327 SC |
1247 | asection *sec, |
1248 | arelent **loc, | |
1249 | asymbol **syms)); | |
18fe0e9f JG |
1250 | |
1251 | boolean | |
1252 | bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags)); | |
1253 | ||
1254 | void | |
1255 | bfd_set_reloc | |
1256 | PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count) | |
332b6327 SC |
1257 | |
1258 | ); | |
18fe0e9f JG |
1259 | |
1260 | boolean | |
1261 | bfd_set_start_address PARAMS ((bfd *, bfd_vma)); | |
1262 | ||
1263 | long | |
1264 | bfd_get_mtime PARAMS ((bfd *)); | |
1265 | ||
b39096a4 SC |
1266 | #define bfd_sizeof_headers(abfd, reloc) \ |
1267 | BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) | |
1268 | ||
332b6327 SC |
1269 | #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ |
1270 | BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line)) | |
b39096a4 | 1271 | |
d5ceae78 | 1272 | /* Do these three do anything useful at all, for any back end? */ |
b39096a4 SC |
1273 | #define bfd_debug_info_start(abfd) \ |
1274 | BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) | |
1275 | ||
1276 | #define bfd_debug_info_end(abfd) \ | |
1277 | BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) | |
1278 | ||
1279 | #define bfd_debug_info_accumulate(abfd, section) \ | |
1280 | BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) | |
1281 | ||
d5ceae78 | 1282 | |
b39096a4 SC |
1283 | #define bfd_stat_arch_elt(abfd, stat) \ |
1284 | BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) | |
1285 | ||
1286 | #define bfd_coff_swap_aux_in(a,e,t,c,i) \ | |
1287 | BFD_SEND (a, _bfd_coff_swap_aux_in, (a,e,t,c,i)) | |
1288 | ||
1289 | #define bfd_coff_swap_sym_in(a,e,i) \ | |
1290 | BFD_SEND (a, _bfd_coff_swap_sym_in, (a,e,i)) | |
1291 | ||
1292 | #define bfd_coff_swap_lineno_in(a,e,i) \ | |
1293 | BFD_SEND ( a, _bfd_coff_swap_lineno_in, (a,e,i)) | |
1294 | ||
1295 | #define bfd_set_arch_mach(abfd, arch, mach)\ | |
1296 | BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) | |
7f3d9f46 | 1297 | |
0c210c9c SC |
1298 | #define bfd_coff_swap_reloc_out(abfd, i, o) \ |
1299 | BFD_SEND (abfd, _bfd_coff_swap_reloc_out, (abfd, i, o)) | |
1300 | ||
1301 | #define bfd_coff_swap_lineno_out(abfd, i, o) \ | |
1302 | BFD_SEND (abfd, _bfd_coff_swap_lineno_out, (abfd, i, o)) | |
1303 | ||
1304 | #define bfd_coff_swap_aux_out(abfd, i, t,c,o) \ | |
1305 | BFD_SEND (abfd, _bfd_coff_swap_aux_out, (abfd, i,t,c, o)) | |
1306 | ||
1307 | #define bfd_coff_swap_sym_out(abfd, i,o) \ | |
1308 | BFD_SEND (abfd, _bfd_coff_swap_sym_out, (abfd, i, o)) | |
1309 | ||
1310 | #define bfd_coff_swap_scnhdr_out(abfd, i,o) \ | |
1311 | BFD_SEND (abfd, _bfd_coff_swap_scnhdr_out, (abfd, i, o)) | |
1312 | ||
1313 | #define bfd_coff_swap_filehdr_out(abfd, i,o) \ | |
1314 | BFD_SEND (abfd, _bfd_coff_swap_filehdr_out, (abfd, i, o)) | |
1315 | ||
1316 | #define bfd_coff_swap_aouthdr_out(abfd, i,o) \ | |
1317 | BFD_SEND (abfd, _bfd_coff_swap_aouthdr_out, (abfd, i, o)) | |
1318 | ||
2d690b0a SC |
1319 | #define bfd_get_relocated_section_contents(abfd, seclet, data) \ |
1320 | BFD_SEND (abfd, _bfd_get_relocated_section_contents, (abfd, seclet, data)) | |
1321 | ||
daa91756 SC |
1322 | #define bfd_relax_section(abfd, section, symbols) \ |
1323 | BFD_SEND (abfd, _bfd_relax_section, (abfd, section, symbols)) | |
18fe0e9f JG |
1324 | symindex |
1325 | bfd_get_next_mapent PARAMS ((bfd *, symindex previous, carsym ** sym)); | |
1326 | ||
1327 | boolean | |
1328 | bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head)); | |
1329 | ||
1330 | bfd * | |
1331 | bfd_get_elt_at_index PARAMS ((bfd * archive, int index)); | |
1332 | ||
1333 | bfd* | |
1334 | bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous)); | |
1335 | ||
1336 | CONST char * | |
1337 | bfd_core_file_failing_command PARAMS ((bfd *)); | |
1338 | ||
1339 | int | |
1340 | bfd_core_file_failing_signal PARAMS ((bfd *)); | |
1341 | ||
1342 | boolean | |
1343 | core_file_matches_executable_p | |
1344 | PARAMS ((bfd *core_bfd, bfd *exec_bfd)); | |
1345 | ||
7a276b09 SC |
1346 | #define BFD_SEND(bfd, message, arglist) \ |
1347 | ((*((bfd)->xvec->message)) arglist) | |
7a276b09 SC |
1348 | #define BFD_SEND_FMT(bfd, message, arglist) \ |
1349 | (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) | |
7a276b09 SC |
1350 | typedef struct bfd_target |
1351 | { | |
7a276b09 | 1352 | char *name; |
81f8fee9 JG |
1353 | enum target_flavour { |
1354 | bfd_target_unknown_flavour, | |
1355 | bfd_target_aout_flavour, | |
1356 | bfd_target_coff_flavour, | |
1357 | bfd_target_elf_flavour, | |
1358 | bfd_target_ieee_flavour, | |
1359 | bfd_target_oasys_flavour, | |
c3089ec9 | 1360 | bfd_target_tekhex_flavour, |
5e511f6f SG |
1361 | bfd_target_srec_flavour, |
1362 | bfd_target_hppa_flavour} flavour; | |
7a276b09 | 1363 | boolean byteorder_big_p; |
7a276b09 | 1364 | boolean header_byteorder_big_p; |
7a276b09 | 1365 | flagword object_flags; |
7a276b09 | 1366 | flagword section_flags; |
ab414d87 | 1367 | char symbol_leading_char; |
7a276b09 | 1368 | char ar_pad_char; |
a4c22791 | 1369 | unsigned short ar_max_namelen; |
7a276b09 | 1370 | unsigned int align_power_min; |
a4c22791 JG |
1371 | bfd_vma (*bfd_getx64) PARAMS ((bfd_byte *)); |
1372 | void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); | |
1373 | bfd_vma (*bfd_getx32) PARAMS ((bfd_byte *)); | |
1374 | void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); | |
1375 | bfd_vma (*bfd_getx16) PARAMS ((bfd_byte *)); | |
1376 | void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); | |
1377 | bfd_vma (*bfd_h_getx64) PARAMS ((bfd_byte *)); | |
1378 | void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); | |
1379 | bfd_vma (*bfd_h_getx32) PARAMS ((bfd_byte *)); | |
1380 | void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); | |
1381 | bfd_vma (*bfd_h_getx16) PARAMS ((bfd_byte *)); | |
1382 | void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); | |
1383 | struct bfd_target * (*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); | |
1384 | boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); | |
1385 | boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); | |
1386 | char * (*_core_file_failing_command) PARAMS ((bfd *)); | |
1387 | int (*_core_file_failing_signal) PARAMS ((bfd *)); | |
1388 | boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); | |
1389 | boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); | |
1390 | boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); | |
1391 | void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *)); | |
1392 | boolean (*write_armap) PARAMS ((bfd *arch, | |
7a276b09 SC |
1393 | unsigned int elength, |
1394 | struct orl *map, | |
a0788ae3 | 1395 | unsigned int orl_count, |
7a276b09 | 1396 | int stridx)); |
a4c22791 JG |
1397 | boolean (*_close_and_cleanup) PARAMS ((bfd *)); |
1398 | boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR, | |
7a276b09 | 1399 | file_ptr, bfd_size_type)); |
a4c22791 | 1400 | boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, |
7a276b09 | 1401 | file_ptr, bfd_size_type)); |
a4c22791 JG |
1402 | boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); |
1403 | unsigned int (*_get_symtab_upper_bound) PARAMS ((bfd *)); | |
1404 | unsigned int (*_bfd_canonicalize_symtab) PARAMS ((bfd *, | |
1405 | struct symbol_cache_entry **)); | |
1406 | unsigned int (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); | |
1407 | unsigned int (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **, | |
1408 | struct symbol_cache_entry **)); | |
1409 | struct symbol_cache_entry * | |
1410 | (*_bfd_make_empty_symbol) PARAMS ((bfd *)); | |
1411 | void (*_bfd_print_symbol) PARAMS ((bfd *, PTR, | |
1412 | struct symbol_cache_entry *, | |
81f8fee9 | 1413 | bfd_print_symbol_type)); |
7a276b09 | 1414 | #define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) |
a4c22791 JG |
1415 | alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); |
1416 | ||
1417 | boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture, | |
1418 | unsigned long)); | |
1419 | ||
1420 | bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); | |
1421 | ||
1422 | boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd, | |
1423 | struct sec *section, struct symbol_cache_entry **symbols, | |
1424 | bfd_vma offset, CONST char **file, CONST char **func, | |
1425 | unsigned int *line)); | |
1426 | ||
1427 | int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); | |
1428 | ||
1429 | int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean)); | |
1430 | ||
1431 | void (*_bfd_debug_info_start) PARAMS ((bfd *)); | |
1432 | void (*_bfd_debug_info_end) PARAMS ((bfd *)); | |
1433 | void (*_bfd_debug_info_accumulate) PARAMS ((bfd *, struct sec *)); | |
1434 | ||
1435 | bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *, | |
1436 | struct bfd_seclet *, bfd_byte *data)); | |
1437 | ||
1438 | boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *, | |
1439 | struct symbol_cache_entry **)); | |
1440 | void (*_bfd_coff_swap_aux_in) PARAMS (( | |
7a276b09 SC |
1441 | bfd *abfd , |
1442 | PTR ext, | |
1443 | int type, | |
1444 | int class , | |
1445 | PTR in)); | |
1446 | ||
a4c22791 | 1447 | void (*_bfd_coff_swap_sym_in) PARAMS (( |
7a276b09 SC |
1448 | bfd *abfd , |
1449 | PTR ext, | |
1450 | PTR in)); | |
1451 | ||
a4c22791 | 1452 | void (*_bfd_coff_swap_lineno_in) PARAMS (( |
7a276b09 SC |
1453 | bfd *abfd, |
1454 | PTR ext, | |
1455 | PTR in)); | |
1456 | ||
a4c22791 | 1457 | unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( |
0c210c9c SC |
1458 | bfd *abfd, |
1459 | PTR in, | |
1460 | int type, | |
1461 | int class, | |
1462 | PTR ext)); | |
1463 | ||
a4c22791 | 1464 | unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( |
0c210c9c SC |
1465 | bfd *abfd, |
1466 | PTR in, | |
1467 | PTR ext)); | |
1468 | ||
a4c22791 | 1469 | unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( |
0c210c9c SC |
1470 | bfd *abfd, |
1471 | PTR in, | |
1472 | PTR ext)); | |
1473 | ||
a4c22791 | 1474 | unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( |
0c210c9c SC |
1475 | bfd *abfd, |
1476 | PTR src, | |
1477 | PTR dst)); | |
1478 | ||
a4c22791 | 1479 | unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( |
0c210c9c SC |
1480 | bfd *abfd, |
1481 | PTR in, | |
1482 | PTR out)); | |
1483 | ||
a4c22791 | 1484 | unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( |
0c210c9c SC |
1485 | bfd *abfd, |
1486 | PTR in, | |
1487 | PTR out)); | |
1488 | ||
a4c22791 | 1489 | unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( |
0c210c9c SC |
1490 | bfd *abfd, |
1491 | PTR in, | |
1492 | PTR out)); | |
1493 | ||
d5ceae78 | 1494 | /* See documentation on reloc types. */ |
a4c22791 JG |
1495 | CONST struct reloc_howto_struct * |
1496 | (*reloc_type_lookup) PARAMS ((bfd *abfd, | |
1497 | bfd_reloc_code_real_type code)); | |
d5ceae78 | 1498 | |
a4c22791 JG |
1499 | /* Back-door to allow format-aware applications to create debug symbols |
1500 | while using BFD for everything else. Currently used by the assembler | |
d5ceae78 | 1501 | when creating COFF files. */ |
a4c22791 | 1502 | asymbol * (*_bfd_make_debug_symbol) PARAMS (( |
d5ceae78 KR |
1503 | bfd *abfd, |
1504 | void *ptr, | |
1505 | unsigned long size)); | |
9a51287f | 1506 | PTR backend_data; |
7a276b09 | 1507 | } bfd_target; |
18fe0e9f JG |
1508 | bfd_target * |
1509 | bfd_find_target PARAMS ((CONST char *, bfd *)); | |
1510 | ||
1511 | CONST char ** | |
1512 | bfd_target_list PARAMS ((void)); | |
1513 | ||
1514 | boolean | |
1515 | bfd_check_format PARAMS ((bfd *abfd, bfd_format format)); | |
1516 | ||
1517 | boolean | |
1518 | bfd_set_format PARAMS ((bfd *, bfd_format)); | |
1519 | ||
1520 | CONST char * | |
1521 | bfd_format_string PARAMS ((bfd_format)); | |
1522 | ||
1484208f | 1523 | #endif |