Commit | Line | Data |
---|---|---|
4e6f9223 SC |
1 | /* libbfd.h -- Declarations used by bfd library *implementation*. |
2 | (This include file is not for users of the library.) | |
53d3ce37 | 3 | Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. |
4e6f9223 SC |
4 | Written by Cygnus Support. |
5 | ||
e914ed52 ILT |
6 | ** NOTE: libbfd.h is a GENERATED file. Don't change it; instead, |
7 | ** change libbfd-in.h or the other BFD source files processed to | |
8 | ** generate this file. | |
9 | ||
4e6f9223 SC |
10 | This file is part of BFD, the Binary File Descriptor library. |
11 | ||
12 | This program is free software; you can redistribute it and/or modify | |
13 | it under the terms of the GNU General Public License as published by | |
14 | the Free Software Foundation; either version 2 of the License, or | |
15 | (at your option) any later version. | |
16 | ||
17 | This program is distributed in the hope that it will be useful, | |
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | GNU General Public License for more details. | |
21 | ||
22 | You should have received a copy of the GNU General Public License | |
23 | along with this program; if not, write to the Free Software | |
4e98461f | 24 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
4e6f9223 | 25 | |
53d3ce37 TT |
26 | #ifdef ENABLE_NLS |
27 | #include <libintl.h> | |
4725e922 TT |
28 | /* FIXME: We might want to use dgettext instead, in some cases. |
29 | This is still under investigation. */ | |
30 | #define _(String) gettext (String) | |
53d3ce37 TT |
31 | #ifdef gettext_noop |
32 | #define N_(String) gettext_noop (String) | |
33 | #else | |
34 | #define N_(String) (String) | |
35 | #endif | |
36 | #else | |
37 | /* Stubs that do something close enough. */ | |
38 | #define textdomain(String) (String) | |
39 | #define gettext(String) (String) | |
40 | #define dgettext(Domain,Message) (Message) | |
41 | #define dcgettext(Domain,Message,Type) (Message) | |
42 | #define bindtextdomain(Domain,Directory) (Domain) | |
43 | #define _(String) (String) | |
44 | #define N_(String) (String) | |
45 | /* In this case we don't care about the value. */ | |
46 | #ifndef LC_MESSAGES | |
47 | #define LC_MESSAGES 0 | |
48 | #endif | |
49 | #endif | |
50 | ||
01dd1b2b | 51 | /* Align an address upward to a boundary, expressed as a number of bytes. |
53d3ce37 TT |
52 | E.g. align to an 8-byte boundary with argument of 8. Take care never |
53 | to wrap around if the address is within boundary-1 of the end of the | |
54 | address space. */ | |
55 | #define BFD_ALIGN(this, boundary) \ | |
56 | ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ | |
57 | ? (((bfd_vma) (this) + ((boundary) - 1)) & (~((boundary)-1))) \ | |
58 | : ~ (bfd_vma) 0) | |
01dd1b2b | 59 | |
4e6f9223 SC |
60 | /* If you want to read and write large blocks, you might want to do it |
61 | in quanta of this amount */ | |
62 | #define DEFAULT_BUFFERSIZE 8192 | |
63 | ||
64 | /* Set a tdata field. Can't use the other macros for this, since they | |
65 | do casts, and casting to the left of assignment isn't portable. */ | |
14e3c2e4 | 66 | #define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v)) |
4e6f9223 | 67 | |
64d5f5d0 ILT |
68 | /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points |
69 | to an instance of this structure. */ | |
70 | ||
71 | struct bfd_in_memory | |
72 | { | |
73 | /* Size of buffer. */ | |
74 | bfd_size_type size; | |
75 | /* Buffer holding contents of BFD. */ | |
76 | bfd_byte *buffer; | |
77 | }; | |
78 | ||
4e6f9223 SC |
79 | /* tdata for an archive. For an input archive, cache |
80 | needs to be free()'d. For an output archive, symdefs do. */ | |
81 | ||
82 | struct artdata { | |
83 | file_ptr first_file_filepos; | |
84 | /* Speed up searching the armap */ | |
85 | struct ar_cache *cache; | |
86 | bfd *archive_head; /* Only interesting in output routines */ | |
87 | carsym *symdefs; /* the symdef entries */ | |
88 | symindex symdef_count; /* how many there are */ | |
89 | char *extended_names; /* clever intel extension */ | |
4c3721d5 ILT |
90 | /* when more compilers are standard C, this can be a time_t */ |
91 | long armap_timestamp; /* Timestamp value written into armap. | |
a6f5fcd8 SC |
92 | This is used for BSD archives to check |
93 | that the timestamp is recent enough | |
94 | for the BSD linker to not complain, | |
95 | just before we finish writing an | |
96 | archive. */ | |
97 | file_ptr armap_datepos; /* Position within archive to seek to | |
98 | rewrite the date field. */ | |
b59f0276 | 99 | PTR tdata; /* Backend specific information. */ |
4e6f9223 SC |
100 | }; |
101 | ||
14e3c2e4 | 102 | #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) |
4e6f9223 SC |
103 | |
104 | /* Goes in bfd's arelt_data slot */ | |
105 | struct areltdata { | |
106 | char * arch_header; /* it's actually a string */ | |
107 | unsigned int parsed_size; /* octets of filesize not including ar_hdr */ | |
108 | char *filename; /* null-terminated */ | |
109 | }; | |
110 | ||
111 | #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) | |
112 | ||
64d5f5d0 ILT |
113 | extern PTR bfd_malloc PARAMS ((size_t)); |
114 | extern PTR bfd_realloc PARAMS ((PTR, size_t)); | |
115 | extern PTR bfd_zmalloc PARAMS ((size_t)); | |
4e6f9223 | 116 | |
4e98461f SC |
117 | extern bfd_error_handler_type _bfd_error_handler; |
118 | ||
3cd5cf3d | 119 | /* These routines allocate and free things on the BFD's objalloc. */ |
4e6f9223 | 120 | |
3cd5cf3d ILT |
121 | extern PTR bfd_alloc PARAMS ((bfd *, size_t)); |
122 | extern PTR bfd_zalloc PARAMS ((bfd *, size_t)); | |
123 | extern void bfd_release PARAMS ((bfd *, PTR)); | |
14e3c2e4 | 124 | |
14e3c2e4 | 125 | bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); |
f4bd7a8f | 126 | bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); |
b59f0276 | 127 | boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); |
14e3c2e4 | 128 | boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); |
e914ed52 | 129 | const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd)); |
14e3c2e4 | 130 | boolean bfd_slurp_armap PARAMS ((bfd *abfd)); |
6affd66a | 131 | boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd)); |
14e3c2e4 JK |
132 | #define bfd_slurp_bsd_armap bfd_slurp_armap |
133 | #define bfd_slurp_coff_armap bfd_slurp_armap | |
134 | boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd)); | |
4e98461f SC |
135 | extern boolean _bfd_construct_extended_name_table |
136 | PARAMS ((bfd *, boolean, char **, bfd_size_type *)); | |
14e3c2e4 | 137 | boolean _bfd_write_archive_contents PARAMS ((bfd *abfd)); |
c53fac12 | 138 | boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength)); |
f4bd7a8f | 139 | bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos)); |
64d5f5d0 | 140 | extern bfd *_bfd_generic_get_elt_at_index PARAMS ((bfd *, symindex)); |
f4bd7a8f | 141 | bfd * _bfd_new_bfd PARAMS ((void)); |
4e6f9223 | 142 | |
14e3c2e4 JK |
143 | boolean bfd_false PARAMS ((bfd *ignore)); |
144 | boolean bfd_true PARAMS ((bfd *ignore)); | |
145 | PTR bfd_nullvoidptr PARAMS ((bfd *ignore)); | |
146 | int bfd_0 PARAMS ((bfd *ignore)); | |
147 | unsigned int bfd_0u PARAMS ((bfd *ignore)); | |
326e32d7 | 148 | long bfd_0l PARAMS ((bfd *ignore)); |
6812b607 | 149 | long _bfd_n1 PARAMS ((bfd *ignore)); |
14e3c2e4 JK |
150 | void bfd_void PARAMS ((bfd *ignore)); |
151 | ||
e914ed52 ILT |
152 | bfd *_bfd_new_bfd_contained_in PARAMS ((bfd *)); |
153 | const bfd_target *_bfd_dummy_target PARAMS ((bfd *abfd)); | |
4e6f9223 | 154 | |
14e3c2e4 | 155 | void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, |
4e6f9223 | 156 | char *hdr)); |
14e3c2e4 | 157 | void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, |
4e6f9223 | 158 | char *hdr)); |
14e3c2e4 | 159 | void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename, |
4e6f9223 SC |
160 | char *hdr)); |
161 | ||
14e3c2e4 | 162 | boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength, |
01dd1b2b | 163 | struct orl *map, unsigned int orl_count, int stridx)); |
4e6f9223 | 164 | |
14e3c2e4 | 165 | boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength, |
01dd1b2b | 166 | struct orl *map, unsigned int orl_count, int stridx)); |
4e6f9223 | 167 | |
c53fac12 ILT |
168 | extern PTR _bfd_generic_read_ar_hdr PARAMS ((bfd *)); |
169 | ||
64d5f5d0 ILT |
170 | extern PTR _bfd_generic_read_ar_hdr_mag PARAMS ((bfd *, const char *)); |
171 | ||
14e3c2e4 | 172 | bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive, |
4e6f9223 SC |
173 | bfd *last_file)); |
174 | ||
14e3c2e4 | 175 | int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); |
4e6f9223 | 176 | |
c53fac12 | 177 | #define _bfd_read_ar_hdr(abfd) \ |
64d5f5d0 | 178 | BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd)) |
6812b607 ILT |
179 | \f |
180 | /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use | |
181 | BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ | |
182 | ||
183 | #define _bfd_generic_close_and_cleanup bfd_true | |
184 | #define _bfd_generic_bfd_free_cached_info bfd_true | |
185 | #define _bfd_generic_new_section_hook \ | |
186 | ((boolean (*) PARAMS ((bfd *, asection *))) bfd_true) | |
187 | extern boolean _bfd_generic_get_section_contents | |
188 | PARAMS ((bfd *, asection *, PTR location, file_ptr offset, | |
189 | bfd_size_type count)); | |
64d5f5d0 ILT |
190 | extern boolean _bfd_generic_get_section_contents_in_window |
191 | PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)); | |
6812b607 ILT |
192 | |
193 | /* Generic routines to use for BFD_JUMP_TABLE_COPY. Use | |
194 | BFD_JUMP_TABLE_COPY (_bfd_generic). */ | |
195 | ||
196 | #define _bfd_generic_bfd_copy_private_bfd_data \ | |
197 | ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) | |
4e98461f SC |
198 | #define _bfd_generic_bfd_merge_private_bfd_data \ |
199 | ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) | |
200 | #define _bfd_generic_bfd_set_private_flags \ | |
201 | ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true) | |
6812b607 ILT |
202 | #define _bfd_generic_bfd_copy_private_section_data \ |
203 | ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true) | |
4e98461f SC |
204 | #define _bfd_generic_bfd_copy_private_symbol_data \ |
205 | ((boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true) | |
206 | #define _bfd_generic_bfd_print_private_bfd_data \ | |
64d5f5d0 | 207 | ((boolean (*) PARAMS ((bfd *, PTR))) bfd_true) |
6812b607 ILT |
208 | |
209 | /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file | |
210 | support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ | |
211 | ||
212 | extern char *_bfd_nocore_core_file_failing_command PARAMS ((bfd *)); | |
213 | extern int _bfd_nocore_core_file_failing_signal PARAMS ((bfd *)); | |
214 | extern boolean _bfd_nocore_core_file_matches_executable_p | |
215 | PARAMS ((bfd *, bfd *)); | |
216 | ||
217 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive | |
218 | file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ | |
219 | ||
220 | #define _bfd_noarchive_slurp_armap bfd_false | |
221 | #define _bfd_noarchive_slurp_extended_name_table bfd_false | |
4e98461f SC |
222 | #define _bfd_noarchive_construct_extended_name_table \ |
223 | ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ | |
224 | bfd_false) | |
6812b607 ILT |
225 | #define _bfd_noarchive_truncate_arname \ |
226 | ((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void) | |
227 | #define _bfd_noarchive_write_armap \ | |
228 | ((boolean (*) \ | |
229 | PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ | |
230 | bfd_false) | |
c53fac12 | 231 | #define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr |
6812b607 ILT |
232 | #define _bfd_noarchive_openr_next_archived_file \ |
233 | ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr) | |
64d5f5d0 ILT |
234 | #define _bfd_noarchive_get_elt_at_index \ |
235 | ((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr) | |
6812b607 | 236 | #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt |
4e98461f | 237 | #define _bfd_noarchive_update_armap_timestamp bfd_false |
6812b607 ILT |
238 | |
239 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style | |
240 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */ | |
241 | ||
242 | #define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap | |
243 | #define _bfd_archive_bsd_slurp_extended_name_table \ | |
244 | _bfd_slurp_extended_name_table | |
4e98461f SC |
245 | extern boolean _bfd_archive_bsd_construct_extended_name_table |
246 | PARAMS ((bfd *, char **, bfd_size_type *, const char **)); | |
6812b607 ILT |
247 | #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname |
248 | #define _bfd_archive_bsd_write_armap bsd_write_armap | |
c53fac12 | 249 | #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr |
6812b607 ILT |
250 | #define _bfd_archive_bsd_openr_next_archived_file \ |
251 | bfd_generic_openr_next_archived_file | |
64d5f5d0 | 252 | #define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index |
6812b607 ILT |
253 | #define _bfd_archive_bsd_generic_stat_arch_elt \ |
254 | bfd_generic_stat_arch_elt | |
4e98461f | 255 | extern boolean _bfd_archive_bsd_update_armap_timestamp PARAMS ((bfd *)); |
6812b607 ILT |
256 | |
257 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style | |
258 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */ | |
259 | ||
260 | #define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap | |
261 | #define _bfd_archive_coff_slurp_extended_name_table \ | |
262 | _bfd_slurp_extended_name_table | |
4e98461f SC |
263 | extern boolean _bfd_archive_coff_construct_extended_name_table |
264 | PARAMS ((bfd *, char **, bfd_size_type *, const char **)); | |
6812b607 ILT |
265 | #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname |
266 | #define _bfd_archive_coff_write_armap coff_write_armap | |
c53fac12 | 267 | #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr |
6812b607 ILT |
268 | #define _bfd_archive_coff_openr_next_archived_file \ |
269 | bfd_generic_openr_next_archived_file | |
64d5f5d0 | 270 | #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index |
6812b607 ILT |
271 | #define _bfd_archive_coff_generic_stat_arch_elt \ |
272 | bfd_generic_stat_arch_elt | |
4e98461f | 273 | #define _bfd_archive_coff_update_armap_timestamp bfd_true |
6812b607 ILT |
274 | |
275 | /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol | |
276 | support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ | |
277 | ||
278 | #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 | |
279 | #define _bfd_nosymbols_get_symtab \ | |
280 | ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) | |
281 | #define _bfd_nosymbols_make_empty_symbol \ | |
282 | ((asymbol *(*) PARAMS ((bfd *))) bfd_nullvoidptr) | |
283 | #define _bfd_nosymbols_print_symbol \ | |
284 | ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) | |
285 | #define _bfd_nosymbols_get_symbol_info \ | |
286 | ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void) | |
35a3e78e ILT |
287 | #define _bfd_nosymbols_bfd_is_local_label_name \ |
288 | ((boolean (*) PARAMS ((bfd *, const char *))) bfd_false) | |
6812b607 ILT |
289 | #define _bfd_nosymbols_get_lineno \ |
290 | ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr) | |
291 | #define _bfd_nosymbols_find_nearest_line \ | |
292 | ((boolean (*) \ | |
293 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \ | |
294 | const char **, unsigned int *))) \ | |
295 | bfd_false) | |
296 | #define _bfd_nosymbols_bfd_make_debug_symbol \ | |
297 | ((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr) | |
4e98461f SC |
298 | #define _bfd_nosymbols_read_minisymbols \ |
299 | ((long (*) PARAMS ((bfd *, boolean, PTR *, unsigned int *))) _bfd_n1) | |
300 | #define _bfd_nosymbols_minisymbol_to_symbol \ | |
301 | ((asymbol *(*) PARAMS ((bfd *, boolean, const PTR, asymbol *))) \ | |
302 | bfd_nullvoidptr) | |
6812b607 ILT |
303 | |
304 | /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc | |
305 | support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ | |
306 | ||
307 | #define _bfd_norelocs_get_reloc_upper_bound \ | |
308 | ((long (*) PARAMS ((bfd *, asection *))) _bfd_n1) | |
309 | #define _bfd_norelocs_canonicalize_reloc \ | |
310 | ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1) | |
311 | #define _bfd_norelocs_bfd_reloc_type_lookup \ | |
4e98461f | 312 | ((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \ |
6812b607 ILT |
313 | bfd_nullvoidptr) |
314 | ||
315 | /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not | |
316 | be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ | |
317 | ||
318 | #define _bfd_nowrite_set_arch_mach \ | |
319 | ((boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \ | |
320 | bfd_false) | |
321 | #define _bfd_nowrite_set_section_contents \ | |
322 | ((boolean (*) PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \ | |
323 | bfd_false) | |
324 | ||
325 | /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use | |
326 | BFD_JUMP_TABLE_WRITE (_bfd_generic). */ | |
327 | ||
328 | #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach | |
329 | extern boolean _bfd_generic_set_section_contents | |
330 | PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); | |
331 | ||
332 | /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not | |
333 | support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ | |
334 | ||
335 | #define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, boolean))) bfd_0) | |
336 | #define _bfd_nolink_bfd_get_relocated_section_contents \ | |
337 | ((bfd_byte *(*) \ | |
338 | PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \ | |
339 | bfd_byte *, boolean, asymbol **))) \ | |
340 | bfd_nullvoidptr) | |
341 | #define _bfd_nolink_bfd_relax_section \ | |
342 | ((boolean (*) \ | |
343 | PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *))) \ | |
344 | bfd_false) | |
345 | #define _bfd_nolink_bfd_link_hash_table_create \ | |
346 | ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr) | |
347 | #define _bfd_nolink_bfd_link_add_symbols \ | |
348 | ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) | |
349 | #define _bfd_nolink_bfd_final_link \ | |
350 | ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) | |
4e98461f SC |
351 | #define _bfd_nolink_bfd_link_split_section \ |
352 | ((boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false) | |
2944131c ILT |
353 | |
354 | /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not | |
355 | have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC | |
356 | (_bfd_nodynamic). */ | |
357 | ||
358 | #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1 | |
359 | #define _bfd_nodynamic_canonicalize_dynamic_symtab \ | |
360 | ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) | |
361 | #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1 | |
362 | #define _bfd_nodynamic_canonicalize_dynamic_reloc \ | |
363 | ((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1) | |
4c3721d5 | 364 | \f |
f1cca647 ILT |
365 | /* Generic routine to determine of the given symbol is a local |
366 | label. */ | |
35a3e78e | 367 | extern boolean bfd_generic_is_local_label_name PARAMS ((bfd *, const char *)); |
f1cca647 | 368 | |
4e98461f SC |
369 | /* Generic minisymbol routines. */ |
370 | extern long _bfd_generic_read_minisymbols | |
371 | PARAMS ((bfd *, boolean, PTR *, unsigned int *)); | |
372 | extern asymbol *_bfd_generic_minisymbol_to_symbol | |
373 | PARAMS ((bfd *, boolean, const PTR, asymbol *)); | |
374 | ||
39f27966 JL |
375 | /* Find the nearest line using .stab/.stabstr sections. */ |
376 | extern boolean _bfd_stab_section_find_nearest_line | |
377 | PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **, | |
378 | const char **, unsigned int *, PTR *)); | |
379 | ||
53d3ce37 TT |
380 | /* Find the nearest line using DWARF 2 debugging information. */ |
381 | extern boolean _bfd_dwarf2_find_nearest_line | |
382 | PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, | |
383 | const char **, unsigned int *)); | |
384 | ||
4c3721d5 ILT |
385 | /* A routine to create entries for a bfd_link_hash_table. */ |
386 | extern struct bfd_hash_entry *_bfd_link_hash_newfunc | |
387 | PARAMS ((struct bfd_hash_entry *entry, | |
388 | struct bfd_hash_table *table, | |
389 | const char *string)); | |
390 | ||
391 | /* Initialize a bfd_link_hash_table. */ | |
392 | extern boolean _bfd_link_hash_table_init | |
393 | PARAMS ((struct bfd_link_hash_table *, bfd *, | |
394 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *, | |
395 | struct bfd_hash_table *, | |
396 | const char *))); | |
397 | ||
398 | /* Generic link hash table creation routine. */ | |
399 | extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create | |
400 | PARAMS ((bfd *)); | |
401 | ||
402 | /* Generic add symbol routine. */ | |
403 | extern boolean _bfd_generic_link_add_symbols | |
404 | PARAMS ((bfd *, struct bfd_link_info *)); | |
405 | ||
326e32d7 ILT |
406 | /* Generic add symbol routine. This version is used by targets for |
407 | which the linker must collect constructors and destructors by name, | |
408 | as the collect2 program does. */ | |
409 | extern boolean _bfd_generic_link_add_symbols_collect | |
410 | PARAMS ((bfd *, struct bfd_link_info *)); | |
411 | ||
4c3721d5 ILT |
412 | /* Generic archive add symbol routine. */ |
413 | extern boolean _bfd_generic_link_add_archive_symbols | |
414 | PARAMS ((bfd *, struct bfd_link_info *, | |
415 | boolean (*checkfn) (bfd *, struct bfd_link_info *, boolean *))); | |
416 | ||
39f27966 JL |
417 | |
418 | ||
4c3721d5 ILT |
419 | /* Forward declaration to avoid prototype errors. */ |
420 | typedef struct bfd_link_hash_entry _bfd_link_hash_entry; | |
421 | ||
422 | /* Generic routine to add a single symbol. */ | |
423 | extern boolean _bfd_generic_link_add_one_symbol | |
424 | PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword, | |
425 | asection *, bfd_vma, const char *, boolean copy, | |
f1cca647 | 426 | boolean constructor, struct bfd_link_hash_entry **)); |
4c3721d5 ILT |
427 | |
428 | /* Generic link routine. */ | |
429 | extern boolean _bfd_generic_final_link | |
430 | PARAMS ((bfd *, struct bfd_link_info *)); | |
431 | ||
4e98461f SC |
432 | extern boolean _bfd_generic_link_split_section |
433 | PARAMS ((bfd *, struct sec *)); | |
434 | ||
f1cca647 ILT |
435 | /* Generic reloc_link_order processing routine. */ |
436 | extern boolean _bfd_generic_reloc_link_order | |
437 | PARAMS ((bfd *, struct bfd_link_info *, asection *, | |
438 | struct bfd_link_order *)); | |
439 | ||
4c3721d5 ILT |
440 | /* Default link order processing routine. */ |
441 | extern boolean _bfd_default_link_order | |
442 | PARAMS ((bfd *, struct bfd_link_info *, asection *, | |
443 | struct bfd_link_order *)); | |
444 | ||
f1cca647 ILT |
445 | /* Count the number of reloc entries in a link order list. */ |
446 | extern unsigned int _bfd_count_link_order_relocs | |
447 | PARAMS ((struct bfd_link_order *)); | |
448 | ||
4c3721d5 ILT |
449 | /* Final link relocation routine. */ |
450 | extern bfd_reloc_status_type _bfd_final_link_relocate | |
4e98461f | 451 | PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, |
4c3721d5 ILT |
452 | bfd_vma address, bfd_vma value, bfd_vma addend)); |
453 | ||
454 | /* Relocate a particular location by a howto and a value. */ | |
455 | extern bfd_reloc_status_type _bfd_relocate_contents | |
4e98461f | 456 | PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); |
e914ed52 | 457 | |
35a3e78e ILT |
458 | /* Link stabs in sections in the first pass. */ |
459 | ||
460 | extern boolean _bfd_link_section_stabs | |
461 | PARAMS ((bfd *, PTR *, asection *, asection *, PTR *)); | |
462 | ||
463 | /* Write out the .stab section when linking stabs in sections. */ | |
464 | ||
465 | extern boolean _bfd_write_section_stabs | |
3cd5cf3d | 466 | PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *)); |
35a3e78e ILT |
467 | |
468 | /* Write out the .stabstr string table when linking stabs in sections. */ | |
469 | ||
470 | extern boolean _bfd_write_stab_strings PARAMS ((bfd *, PTR *)); | |
471 | ||
53d3ce37 TT |
472 | /* Find an offset within a .stab section when linking stabs in |
473 | sections. */ | |
474 | ||
475 | extern bfd_vma _bfd_stab_section_offset | |
476 | PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma)); | |
477 | ||
e914ed52 ILT |
478 | /* Create a string table. */ |
479 | extern struct bfd_strtab_hash *_bfd_stringtab_init PARAMS ((void)); | |
480 | ||
64d5f5d0 ILT |
481 | /* Create an XCOFF .debug section style string table. */ |
482 | extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init PARAMS ((void)); | |
483 | ||
e914ed52 ILT |
484 | /* Free a string table. */ |
485 | extern void _bfd_stringtab_free PARAMS ((struct bfd_strtab_hash *)); | |
486 | ||
487 | /* Get the size of a string table. */ | |
488 | extern bfd_size_type _bfd_stringtab_size PARAMS ((struct bfd_strtab_hash *)); | |
489 | ||
490 | /* Add a string to a string table. */ | |
491 | extern bfd_size_type _bfd_stringtab_add | |
492 | PARAMS ((struct bfd_strtab_hash *, const char *, boolean hash, | |
493 | boolean copy)); | |
494 | ||
495 | /* Write out a string table. */ | |
496 | extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *)); | |
4c3721d5 | 497 | \f |
4e6f9223 SC |
498 | /* Macros to tell if bfds are read or write enabled. |
499 | ||
500 | Note that bfds open for read may be scribbled into if the fd passed | |
501 | to bfd_fdopenr is actually open both for read and write | |
502 | simultaneously. However an output bfd will never be open for | |
503 | read. Therefore sometimes you want to check bfd_read_p or | |
504 | !bfd_read_p, and only sometimes bfd_write_p. | |
505 | */ | |
506 | ||
14e3c2e4 JK |
507 | #define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) |
508 | #define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) | |
509 | ||
c53fac12 | 510 | void bfd_assert PARAMS ((const char*,int)); |
4e6f9223 | 511 | |
4e6f9223 SC |
512 | #define BFD_ASSERT(x) \ |
513 | { if (!(x)) bfd_assert(__FILE__,__LINE__); } | |
514 | ||
515 | #define BFD_FAIL() \ | |
516 | { bfd_assert(__FILE__,__LINE__); } | |
517 | ||
14e3c2e4 | 518 | FILE * bfd_cache_lookup_worker PARAMS ((bfd *)); |
4e6f9223 SC |
519 | |
520 | extern bfd *bfd_last_cache; | |
4e6f9223 | 521 | |
4c3721d5 | 522 | /* List of supported target vectors, and the default vector (if |
f4bd7a8f | 523 | bfd_default_vector[0] is NULL, there is no default). */ |
e914ed52 | 524 | extern const bfd_target * const bfd_target_vector[]; |
50ede03d | 525 | extern const bfd_target *bfd_default_vector[]; |
4c3721d5 | 526 | |
c53fac12 | 527 | /* Functions shared by the ECOFF and MIPS ELF backends, which have no |
4e98461f SC |
528 | other common header files. */ |
529 | ||
530 | #if defined(__STDC__) || defined(ALMOST_STDC) | |
531 | struct ecoff_find_line; | |
532 | #endif | |
533 | ||
c53fac12 | 534 | extern boolean _bfd_ecoff_locate_line |
4e98461f SC |
535 | PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, |
536 | const struct ecoff_debug_swap * const, struct ecoff_find_line *, | |
537 | const char **, const char **, unsigned int *)); | |
c53fac12 ILT |
538 | extern boolean _bfd_ecoff_get_accumulated_pdr PARAMS ((PTR, bfd_byte *)); |
539 | extern boolean _bfd_ecoff_get_accumulated_sym PARAMS ((PTR, bfd_byte *)); | |
540 | extern boolean _bfd_ecoff_get_accumulated_ss PARAMS ((PTR, bfd_byte *)); | |
4e98461f | 541 | |
39f27966 JL |
542 | extern bfd_vma _bfd_get_gp_value PARAMS ((bfd *)); |
543 | extern void _bfd_set_gp_value PARAMS ((bfd *, bfd_vma)); | |
544 | ||
35a3e78e ILT |
545 | /* Function shared by the COFF and ELF SH backends, which have no |
546 | other common header files. */ | |
547 | ||
548 | extern boolean _bfd_sh_align_load_span | |
549 | PARAMS ((bfd *, asection *, bfd_byte *, | |
550 | boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), | |
551 | PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, boolean *)); | |
552 | ||
14e3c2e4 | 553 | /* And more follows */ |
4e6f9223 | 554 |