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