Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /* libbfd.h -- Declarations used by bfd library *implementation*. |
2 | (This include file is not for users of the library.) | |
7c192733 | 3 | |
219d1afa | 4 | Copyright (C) 1990-2018 Free Software Foundation, Inc. |
7c192733 | 5 | |
252b5132 RH |
6 | Written by Cygnus Support. |
7 | ||
cd123cb7 NC |
8 | This file is part of BFD, the Binary File Descriptor library. |
9 | ||
10 | This program is free software; you can redistribute it and/or modify | |
11 | it under the terms of the GNU General Public License as published by | |
12 | the Free Software Foundation; either version 3 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | This program is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU General Public License | |
21 | along with this program; if not, write to the Free Software | |
22 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
23 | MA 02110-1301, USA. */ | |
252b5132 | 24 | |
0b439543 AM |
25 | #ifndef _LIBBFD_H |
26 | #define _LIBBFD_H 1 | |
27 | ||
8722de9c AM |
28 | #ifndef ATTRIBUTE_HIDDEN |
29 | #if HAVE_HIDDEN | |
30 | #define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden"))) | |
31 | #else | |
32 | #define ATTRIBUTE_HIDDEN | |
33 | #endif | |
34 | #endif | |
35 | ||
109f7096 BE |
36 | #include "hashtab.h" |
37 | ||
55172d69 PA |
38 | #ifdef __cplusplus |
39 | extern "C" { | |
40 | #endif | |
41 | ||
252b5132 RH |
42 | /* If you want to read and write large blocks, you might want to do it |
43 | in quanta of this amount */ | |
44 | #define DEFAULT_BUFFERSIZE 8192 | |
45 | ||
46 | /* Set a tdata field. Can't use the other macros for this, since they | |
47 | do casts, and casting to the left of assignment isn't portable. */ | |
c58b9523 | 48 | #define set_tdata(bfd, v) ((bfd)->tdata.any = (v)) |
252b5132 RH |
49 | |
50 | /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points | |
51 | to an instance of this structure. */ | |
52 | ||
53 | struct bfd_in_memory | |
54 | { | |
55 | /* Size of buffer. */ | |
56 | bfd_size_type size; | |
57 | /* Buffer holding contents of BFD. */ | |
58 | bfd_byte *buffer; | |
59 | }; | |
60 | ||
66eb6687 AM |
61 | struct section_hash_entry |
62 | { | |
63 | struct bfd_hash_entry root; | |
64 | asection section; | |
65 | }; | |
66 | ||
7cf7fcc8 | 67 | /* Unique section id. */ |
8722de9c | 68 | extern unsigned int _bfd_section_id ATTRIBUTE_HIDDEN; |
7cf7fcc8 | 69 | |
252b5132 RH |
70 | /* tdata for an archive. For an input archive, cache |
71 | needs to be free()'d. For an output archive, symdefs do. */ | |
72 | ||
f1bb16f8 NC |
73 | struct artdata |
74 | { | |
252b5132 RH |
75 | file_ptr first_file_filepos; |
76 | /* Speed up searching the armap */ | |
109f7096 | 77 | htab_t cache; |
f1bb16f8 NC |
78 | bfd *archive_head; /* Only interesting in output routines. */ |
79 | carsym *symdefs; /* The symdef entries. */ | |
80 | symindex symdef_count; /* How many there are. */ | |
81 | char *extended_names; /* Clever intel extension. */ | |
82 | bfd_size_type extended_names_size; /* Size of extended names. */ | |
83 | /* When more compilers are standard C, this can be a time_t. */ | |
252b5132 RH |
84 | long armap_timestamp; /* Timestamp value written into armap. |
85 | This is used for BSD archives to check | |
86 | that the timestamp is recent enough | |
87 | for the BSD linker to not complain, | |
88 | just before we finish writing an | |
89 | archive. */ | |
90 | file_ptr armap_datepos; /* Position within archive to seek to | |
91 | rewrite the date field. */ | |
c58b9523 | 92 | void *tdata; /* Backend specific information. */ |
252b5132 RH |
93 | }; |
94 | ||
95 | #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) | |
96 | ||
97 | /* Goes in bfd's arelt_data slot */ | |
f1bb16f8 NC |
98 | struct areltdata |
99 | { | |
100 | char * arch_header; /* It's actually a string. */ | |
101 | bfd_size_type parsed_size; /* Octets of filesize not including ar_hdr. */ | |
102 | bfd_size_type extra_size; /* BSD4.4: extra bytes after the header. */ | |
103 | char *filename; /* Null-terminated. */ | |
104 | file_ptr origin; /* For element of a thin archive. */ | |
eeb1f9ae AM |
105 | void *parent_cache; /* Where and how to find this member. */ |
106 | file_ptr key; | |
252b5132 RH |
107 | }; |
108 | ||
109 | #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) | |
110 | ||
c58b9523 | 111 | extern void *bfd_malloc |
8722de9c | 112 | (bfd_size_type) ATTRIBUTE_HIDDEN; |
c58b9523 | 113 | extern void *bfd_realloc |
8722de9c | 114 | (void *, bfd_size_type) ATTRIBUTE_HIDDEN; |
515ef31d | 115 | extern void *bfd_realloc_or_free |
8722de9c | 116 | (void *, bfd_size_type) ATTRIBUTE_HIDDEN; |
c58b9523 | 117 | extern void *bfd_zmalloc |
8722de9c | 118 | (bfd_size_type) ATTRIBUTE_HIDDEN; |
d0fb9a8d | 119 | extern void *bfd_malloc2 |
8722de9c | 120 | (bfd_size_type, bfd_size_type) ATTRIBUTE_HIDDEN; |
d0fb9a8d | 121 | extern void *bfd_realloc2 |
8722de9c | 122 | (void *, bfd_size_type, bfd_size_type) ATTRIBUTE_HIDDEN; |
d0fb9a8d | 123 | extern void *bfd_zmalloc2 |
8722de9c | 124 | (bfd_size_type, bfd_size_type) ATTRIBUTE_HIDDEN; |
252b5132 | 125 | |
252b5132 RH |
126 | /* These routines allocate and free things on the BFD's objalloc. */ |
127 | ||
d0fb9a8d | 128 | extern void *bfd_alloc2 |
8722de9c | 129 | (bfd *, bfd_size_type, bfd_size_type) ATTRIBUTE_HIDDEN; |
d0fb9a8d | 130 | extern void *bfd_zalloc2 |
8722de9c | 131 | (bfd *, bfd_size_type, bfd_size_type) ATTRIBUTE_HIDDEN; |
b34976b6 | 132 | extern void bfd_release |
8722de9c AM |
133 | (bfd *, void *) ATTRIBUTE_HIDDEN; |
134 | ||
135 | extern bfd * _bfd_create_empty_archive_element_shell | |
136 | (bfd *) ATTRIBUTE_HIDDEN; | |
137 | extern bfd * _bfd_look_for_bfd_in_cache | |
138 | (bfd *, file_ptr) ATTRIBUTE_HIDDEN; | |
139 | extern bfd_boolean _bfd_add_bfd_to_archive_cache | |
140 | (bfd *, file_ptr, bfd *) ATTRIBUTE_HIDDEN; | |
141 | extern bfd_boolean _bfd_generic_mkarchive | |
142 | (bfd *) ATTRIBUTE_HIDDEN; | |
143 | extern char *_bfd_append_relative_path | |
144 | (bfd *, char *) ATTRIBUTE_HIDDEN; | |
145 | extern const bfd_target *bfd_generic_archive_p | |
146 | (bfd *) ATTRIBUTE_HIDDEN; | |
147 | extern bfd_boolean bfd_slurp_armap | |
148 | (bfd *) ATTRIBUTE_HIDDEN; | |
252b5132 RH |
149 | #define bfd_slurp_bsd_armap bfd_slurp_armap |
150 | #define bfd_slurp_coff_armap bfd_slurp_armap | |
8722de9c AM |
151 | extern bfd_boolean _bfd_archive_64_bit_slurp_armap |
152 | (bfd *) ATTRIBUTE_HIDDEN; | |
153 | extern bfd_boolean _bfd_archive_64_bit_write_armap | |
154 | (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; | |
e6cc316a L |
155 | #define _bfd_archive_64_bit_slurp_extended_name_table \ |
156 | _bfd_slurp_extended_name_table | |
157 | #define _bfd_archive_64_bit_construct_extended_name_table \ | |
158 | _bfd_archive_coff_construct_extended_name_table | |
159 | #define _bfd_archive_64_bit_truncate_arname \ | |
160 | bfd_dont_truncate_arname | |
161 | #define _bfd_archive_64_bit_read_ar_hdr \ | |
162 | _bfd_generic_read_ar_hdr | |
163 | #define _bfd_archive_64_bit_write_ar_hdr \ | |
164 | _bfd_generic_write_ar_hdr | |
165 | #define _bfd_archive_64_bit_openr_next_archived_file \ | |
166 | bfd_generic_openr_next_archived_file | |
167 | #define _bfd_archive_64_bit_get_elt_at_index \ | |
168 | _bfd_generic_get_elt_at_index | |
169 | #define _bfd_archive_64_bit_generic_stat_arch_elt \ | |
170 | bfd_generic_stat_arch_elt | |
d00dd7dc | 171 | #define _bfd_archive_64_bit_update_armap_timestamp _bfd_bool_bfd_true |
e6cc316a | 172 | |
8722de9c AM |
173 | extern bfd_boolean _bfd_slurp_extended_name_table |
174 | (bfd *) ATTRIBUTE_HIDDEN; | |
b34976b6 | 175 | extern bfd_boolean _bfd_construct_extended_name_table |
8722de9c AM |
176 | (bfd *, bfd_boolean, char **, bfd_size_type *) ATTRIBUTE_HIDDEN; |
177 | extern bfd_boolean _bfd_write_archive_contents | |
178 | (bfd *) ATTRIBUTE_HIDDEN; | |
179 | extern bfd_boolean _bfd_compute_and_write_armap | |
180 | (bfd *, unsigned int) ATTRIBUTE_HIDDEN; | |
181 | extern bfd *_bfd_get_elt_at_filepos | |
182 | (bfd *, file_ptr) ATTRIBUTE_HIDDEN; | |
b34976b6 | 183 | extern bfd *_bfd_generic_get_elt_at_index |
8722de9c AM |
184 | (bfd *, symindex) ATTRIBUTE_HIDDEN; |
185 | extern bfd * _bfd_new_bfd | |
186 | (void) ATTRIBUTE_HIDDEN; | |
187 | extern bfd_boolean _bfd_free_cached_info | |
188 | (bfd *) ATTRIBUTE_HIDDEN; | |
b34976b6 | 189 | |
d00dd7dc | 190 | extern bfd_boolean _bfd_bool_bfd_false |
8722de9c | 191 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 192 | extern bfd_boolean _bfd_bool_bfd_asymbol_false |
8722de9c | 193 | (bfd *, asymbol *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 194 | extern bfd_boolean _bfd_bool_bfd_false_error |
8722de9c | 195 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 196 | extern bfd_boolean _bfd_bool_bfd_link_false_error |
8722de9c | 197 | (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 198 | extern bfd_boolean _bfd_bool_bfd_true |
8722de9c | 199 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 200 | extern bfd_boolean _bfd_bool_bfd_link_true |
8722de9c | 201 | (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 202 | extern bfd_boolean _bfd_bool_bfd_bfd_true |
8722de9c | 203 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 204 | extern bfd_boolean _bfd_bool_bfd_uint_true |
8722de9c | 205 | (bfd *, unsigned int) ATTRIBUTE_HIDDEN; |
d00dd7dc | 206 | extern bfd_boolean _bfd_bool_bfd_asection_bfd_asection_true |
8722de9c | 207 | (bfd *, asection *, bfd *, asection *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 208 | extern bfd_boolean _bfd_bool_bfd_asymbol_bfd_asymbol_true |
8722de9c | 209 | (bfd *, asymbol *, bfd *, asymbol *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 210 | extern bfd_boolean _bfd_bool_bfd_ptr_true |
8722de9c | 211 | (bfd *, void *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 212 | extern void *_bfd_ptr_bfd_null_error |
8722de9c | 213 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 214 | extern int _bfd_int_bfd_0 |
8722de9c | 215 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 216 | extern unsigned int _bfd_uint_bfd_0 |
8722de9c | 217 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 218 | extern long _bfd_long_bfd_0 |
8722de9c | 219 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 220 | extern long _bfd_long_bfd_n1_error |
8722de9c | 221 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 222 | extern void _bfd_void_bfd |
8722de9c | 223 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 224 | extern void _bfd_void_bfd_link |
8722de9c | 225 | (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 226 | extern void _bfd_void_bfd_asection |
8722de9c | 227 | (bfd *, asection *) ATTRIBUTE_HIDDEN; |
b34976b6 | 228 | |
8722de9c AM |
229 | extern bfd *_bfd_new_bfd_contained_in |
230 | (bfd *) ATTRIBUTE_HIDDEN; | |
231 | extern const bfd_target *_bfd_dummy_target | |
232 | (bfd *) ATTRIBUTE_HIDDEN; | |
b34976b6 | 233 | |
8722de9c AM |
234 | extern void bfd_dont_truncate_arname |
235 | (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; | |
236 | extern void bfd_bsd_truncate_arname | |
237 | (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; | |
238 | extern void bfd_gnu_truncate_arname | |
239 | (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; | |
b34976b6 | 240 | |
8722de9c AM |
241 | extern bfd_boolean _bfd_bsd_write_armap |
242 | (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; | |
b34976b6 | 243 | |
8722de9c AM |
244 | extern bfd_boolean _bfd_coff_write_armap |
245 | (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; | |
b34976b6 | 246 | |
c58b9523 | 247 | extern void *_bfd_generic_read_ar_hdr |
8722de9c | 248 | (bfd *) ATTRIBUTE_HIDDEN; |
390c0e42 | 249 | extern void _bfd_ar_spacepad |
8722de9c | 250 | (char *, size_t, const char *, long) ATTRIBUTE_HIDDEN; |
f1bb16f8 | 251 | extern bfd_boolean _bfd_ar_sizepad |
8722de9c | 252 | (char *, size_t, bfd_size_type) ATTRIBUTE_HIDDEN; |
b34976b6 | 253 | |
c58b9523 | 254 | extern void *_bfd_generic_read_ar_hdr_mag |
8722de9c | 255 | (bfd *, const char *) ATTRIBUTE_HIDDEN; |
b34976b6 | 256 | |
8f95b6e4 | 257 | extern bfd_boolean _bfd_generic_write_ar_hdr |
8722de9c | 258 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; |
8f95b6e4 TG |
259 | |
260 | extern bfd_boolean _bfd_bsd44_write_ar_hdr | |
8722de9c | 261 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; |
8f95b6e4 | 262 | |
8722de9c AM |
263 | extern bfd * bfd_generic_openr_next_archived_file |
264 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; | |
b34976b6 | 265 | |
8722de9c AM |
266 | extern int bfd_generic_stat_arch_elt |
267 | (bfd *, struct stat *) ATTRIBUTE_HIDDEN; | |
252b5132 RH |
268 | |
269 | #define _bfd_read_ar_hdr(abfd) \ | |
07d6d2b8 AM |
270 | BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd)) |
271 | #define _bfd_write_ar_hdr(archive, abfd) \ | |
272 | BFD_SEND (abfd, _bfd_write_ar_hdr_fn, (archive, abfd)) | |
252b5132 RH |
273 | \f |
274 | /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use | |
275 | BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ | |
276 | ||
eeb1f9ae AM |
277 | #define _bfd_generic_close_and_cleanup _bfd_archive_close_and_cleanup |
278 | extern bfd_boolean _bfd_archive_close_and_cleanup | |
8722de9c | 279 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 280 | #define _bfd_generic_bfd_free_cached_info _bfd_bool_bfd_true |
f592407e | 281 | extern bfd_boolean _bfd_generic_new_section_hook |
8722de9c | 282 | (bfd *, asection *) ATTRIBUTE_HIDDEN; |
b34976b6 | 283 | extern bfd_boolean _bfd_generic_get_section_contents |
8722de9c | 284 | (bfd *, asection *, void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN; |
b34976b6 | 285 | extern bfd_boolean _bfd_generic_get_section_contents_in_window |
8722de9c | 286 | (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN; |
252b5132 RH |
287 | |
288 | /* Generic routines to use for BFD_JUMP_TABLE_COPY. Use | |
289 | BFD_JUMP_TABLE_COPY (_bfd_generic). */ | |
290 | ||
d00dd7dc | 291 | #define _bfd_generic_bfd_copy_private_bfd_data _bfd_bool_bfd_bfd_true |
252b5132 | 292 | #define _bfd_generic_bfd_merge_private_bfd_data \ |
d00dd7dc AM |
293 | _bfd_bool_bfd_link_true |
294 | #define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true | |
252b5132 | 295 | #define _bfd_generic_bfd_copy_private_section_data \ |
d00dd7dc | 296 | _bfd_bool_bfd_asection_bfd_asection_true |
252b5132 | 297 | #define _bfd_generic_bfd_copy_private_symbol_data \ |
d00dd7dc AM |
298 | _bfd_bool_bfd_asymbol_bfd_asymbol_true |
299 | #define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true | |
300 | #define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true | |
252b5132 | 301 | |
ccd2ec6a | 302 | extern bfd_boolean _bfd_generic_init_private_section_data |
8722de9c AM |
303 | (bfd *, asection *, bfd *, asection *, struct bfd_link_info *) |
304 | ATTRIBUTE_HIDDEN; | |
ccd2ec6a | 305 | |
252b5132 RH |
306 | /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file |
307 | support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ | |
308 | ||
b34976b6 | 309 | extern char *_bfd_nocore_core_file_failing_command |
8722de9c | 310 | (bfd *) ATTRIBUTE_HIDDEN; |
b34976b6 | 311 | extern int _bfd_nocore_core_file_failing_signal |
8722de9c | 312 | (bfd *) ATTRIBUTE_HIDDEN; |
b34976b6 | 313 | extern bfd_boolean _bfd_nocore_core_file_matches_executable_p |
8722de9c | 314 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; |
261b8d08 | 315 | extern int _bfd_nocore_core_file_pid |
8722de9c | 316 | (bfd *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
317 | |
318 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive | |
319 | file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ | |
320 | ||
d00dd7dc AM |
321 | #define _bfd_noarchive_slurp_armap _bfd_bool_bfd_false_error |
322 | #define _bfd_noarchive_slurp_extended_name_table _bfd_bool_bfd_false_error | |
323 | extern bfd_boolean _bfd_noarchive_construct_extended_name_table | |
8722de9c | 324 | (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; |
d00dd7dc | 325 | extern void _bfd_noarchive_truncate_arname |
8722de9c | 326 | (bfd *, const char *, char *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 327 | extern bfd_boolean _bfd_noarchive_write_armap |
8722de9c | 328 | (bfd *, unsigned int, struct orl *, unsigned int, int) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
329 | #define _bfd_noarchive_read_ar_hdr _bfd_ptr_bfd_null_error |
330 | extern bfd_boolean _bfd_noarchive_write_ar_hdr | |
8722de9c | 331 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
332 | extern bfd * |
333 | _bfd_noarchive_openr_next_archived_file | |
8722de9c | 334 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 335 | extern bfd * _bfd_noarchive_get_elt_at_index |
8722de9c | 336 | (bfd *, symindex) ATTRIBUTE_HIDDEN; |
252b5132 | 337 | #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt |
d00dd7dc | 338 | #define _bfd_noarchive_update_armap_timestamp _bfd_bool_bfd_false_error |
252b5132 RH |
339 | |
340 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style | |
341 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */ | |
342 | ||
343 | #define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap | |
344 | #define _bfd_archive_bsd_slurp_extended_name_table \ | |
345 | _bfd_slurp_extended_name_table | |
b34976b6 | 346 | extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table |
8722de9c | 347 | (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; |
252b5132 | 348 | #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname |
7ec22e0f | 349 | #define _bfd_archive_bsd_write_armap _bfd_bsd_write_armap |
252b5132 | 350 | #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr |
8f95b6e4 | 351 | #define _bfd_archive_bsd_write_ar_hdr _bfd_generic_write_ar_hdr |
252b5132 RH |
352 | #define _bfd_archive_bsd_openr_next_archived_file \ |
353 | bfd_generic_openr_next_archived_file | |
354 | #define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index | |
355 | #define _bfd_archive_bsd_generic_stat_arch_elt \ | |
356 | bfd_generic_stat_arch_elt | |
b34976b6 | 357 | extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp |
8722de9c | 358 | (bfd *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
359 | |
360 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style | |
361 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */ | |
362 | ||
363 | #define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap | |
364 | #define _bfd_archive_coff_slurp_extended_name_table \ | |
365 | _bfd_slurp_extended_name_table | |
b34976b6 | 366 | extern bfd_boolean _bfd_archive_coff_construct_extended_name_table |
8722de9c | 367 | (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; |
252b5132 | 368 | #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname |
7ec22e0f | 369 | #define _bfd_archive_coff_write_armap _bfd_coff_write_armap |
252b5132 | 370 | #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr |
8f95b6e4 | 371 | #define _bfd_archive_coff_write_ar_hdr _bfd_generic_write_ar_hdr |
252b5132 RH |
372 | #define _bfd_archive_coff_openr_next_archived_file \ |
373 | bfd_generic_openr_next_archived_file | |
374 | #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index | |
375 | #define _bfd_archive_coff_generic_stat_arch_elt \ | |
376 | bfd_generic_stat_arch_elt | |
d00dd7dc | 377 | #define _bfd_archive_coff_update_armap_timestamp _bfd_bool_bfd_true |
252b5132 | 378 | |
8f95b6e4 TG |
379 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style |
380 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44). */ | |
381 | ||
382 | #define _bfd_archive_bsd44_slurp_armap bfd_slurp_bsd_armap | |
383 | #define _bfd_archive_bsd44_slurp_extended_name_table \ | |
384 | _bfd_slurp_extended_name_table | |
385 | extern bfd_boolean _bfd_archive_bsd44_construct_extended_name_table | |
8722de9c | 386 | (bfd *, char **, bfd_size_type *, const char **) ATTRIBUTE_HIDDEN; |
8f95b6e4 | 387 | #define _bfd_archive_bsd44_truncate_arname bfd_bsd_truncate_arname |
7ec22e0f | 388 | #define _bfd_archive_bsd44_write_armap _bfd_bsd_write_armap |
8f95b6e4 TG |
389 | #define _bfd_archive_bsd44_read_ar_hdr _bfd_generic_read_ar_hdr |
390 | #define _bfd_archive_bsd44_write_ar_hdr _bfd_bsd44_write_ar_hdr | |
391 | #define _bfd_archive_bsd44_openr_next_archived_file \ | |
392 | bfd_generic_openr_next_archived_file | |
393 | #define _bfd_archive_bsd44_get_elt_at_index _bfd_generic_get_elt_at_index | |
394 | #define _bfd_archive_bsd44_generic_stat_arch_elt \ | |
395 | bfd_generic_stat_arch_elt | |
396 | #define _bfd_archive_bsd44_update_armap_timestamp \ | |
397 | _bfd_archive_bsd_update_armap_timestamp | |
398 | ||
4b544b64 TG |
399 | /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get VMS style |
400 | archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_vms_lib). Some of them | |
f0d19df9 | 401 | are irrelevant. */ |
4b544b64 | 402 | |
8722de9c AM |
403 | extern bfd_boolean _bfd_vms_lib_write_archive_contents |
404 | (bfd *) ATTRIBUTE_HIDDEN; | |
f0d19df9 AM |
405 | #define _bfd_vms_lib_slurp_armap _bfd_noarchive_slurp_armap |
406 | #define _bfd_vms_lib_slurp_extended_name_table \ | |
407 | _bfd_noarchive_slurp_extended_name_table | |
408 | #define _bfd_vms_lib_construct_extended_name_table \ | |
409 | _bfd_noarchive_construct_extended_name_table | |
410 | #define _bfd_vms_lib_truncate_arname _bfd_noarchive_truncate_arname | |
411 | #define _bfd_vms_lib_write_armap _bfd_noarchive_write_armap | |
412 | #define _bfd_vms_lib_read_ar_hdr _bfd_noarchive_read_ar_hdr | |
413 | #define _bfd_vms_lib_write_ar_hdr _bfd_noarchive_write_ar_hdr | |
8722de9c AM |
414 | extern bfd *_bfd_vms_lib_openr_next_archived_file |
415 | (bfd *, bfd *) ATTRIBUTE_HIDDEN; | |
416 | extern bfd *_bfd_vms_lib_get_elt_at_index | |
417 | (bfd *, symindex) ATTRIBUTE_HIDDEN; | |
418 | extern int _bfd_vms_lib_generic_stat_arch_elt | |
419 | (bfd *, struct stat *) ATTRIBUTE_HIDDEN; | |
d00dd7dc | 420 | #define _bfd_vms_lib_update_armap_timestamp _bfd_bool_bfd_true |
4b544b64 TG |
421 | |
422 | /* Extra routines for VMS style archives. */ | |
423 | ||
8722de9c AM |
424 | extern symindex _bfd_vms_lib_find_symbol |
425 | (bfd *, const char *) ATTRIBUTE_HIDDEN; | |
426 | extern bfd *_bfd_vms_lib_get_imagelib_file | |
427 | (bfd *) ATTRIBUTE_HIDDEN; | |
428 | extern const bfd_target *_bfd_vms_lib_alpha_archive_p | |
429 | (bfd *) ATTRIBUTE_HIDDEN; | |
430 | extern const bfd_target *_bfd_vms_lib_ia64_archive_p | |
431 | (bfd *) ATTRIBUTE_HIDDEN; | |
432 | extern bfd_boolean _bfd_vms_lib_alpha_mkarchive | |
433 | (bfd *) ATTRIBUTE_HIDDEN; | |
434 | extern bfd_boolean _bfd_vms_lib_ia64_mkarchive | |
435 | (bfd *) ATTRIBUTE_HIDDEN; | |
4b544b64 | 436 | |
252b5132 RH |
437 | /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol |
438 | support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ | |
439 | ||
d00dd7dc AM |
440 | #define _bfd_nosymbols_get_symtab_upper_bound _bfd_long_bfd_n1_error |
441 | extern long _bfd_nosymbols_canonicalize_symtab | |
8722de9c | 442 | (bfd *, asymbol **) ATTRIBUTE_HIDDEN; |
3f3c5c34 | 443 | #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol |
d00dd7dc | 444 | extern void _bfd_nosymbols_print_symbol |
8722de9c | 445 | (bfd *, void *, asymbol *, bfd_print_symbol_type) ATTRIBUTE_HIDDEN; |
d00dd7dc | 446 | extern void _bfd_nosymbols_get_symbol_info |
8722de9c | 447 | (bfd *, asymbol *, symbol_info *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 448 | extern const char * _bfd_nosymbols_get_symbol_version_string |
8722de9c | 449 | (bfd *, asymbol *, bfd_boolean *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 450 | extern bfd_boolean _bfd_nosymbols_bfd_is_local_label_name |
8722de9c | 451 | (bfd *, const char *) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
452 | #define _bfd_nosymbols_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false |
453 | extern alent *_bfd_nosymbols_get_lineno | |
8722de9c | 454 | (bfd *, asymbol *) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
455 | extern bfd_boolean _bfd_nosymbols_find_nearest_line |
456 | (bfd *, asymbol **, asection *, bfd_vma, | |
8722de9c AM |
457 | const char **, const char **, unsigned int *, unsigned int *) |
458 | ATTRIBUTE_HIDDEN; | |
d00dd7dc | 459 | extern bfd_boolean _bfd_nosymbols_find_line |
8722de9c AM |
460 | (bfd *, asymbol **, asymbol *, const char **, unsigned int *) |
461 | ATTRIBUTE_HIDDEN; | |
d00dd7dc | 462 | extern bfd_boolean _bfd_nosymbols_find_inliner_info |
8722de9c | 463 | (bfd *, const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 464 | extern asymbol *_bfd_nosymbols_bfd_make_debug_symbol |
8722de9c | 465 | (bfd *, void *, unsigned long) ATTRIBUTE_HIDDEN; |
d00dd7dc | 466 | extern long _bfd_nosymbols_read_minisymbols |
8722de9c | 467 | (bfd *, bfd_boolean, void **, unsigned int *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 468 | extern asymbol *_bfd_nosymbols_minisymbol_to_symbol |
8722de9c | 469 | (bfd *, bfd_boolean, const void *, asymbol *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
470 | |
471 | /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc | |
472 | support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ | |
473 | ||
8722de9c AM |
474 | extern long _bfd_norelocs_get_reloc_upper_bound |
475 | (bfd *, asection *) ATTRIBUTE_HIDDEN; | |
476 | extern long _bfd_norelocs_canonicalize_reloc | |
477 | (bfd *, asection *, arelent **, asymbol **) ATTRIBUTE_HIDDEN; | |
478 | extern void _bfd_norelocs_set_reloc | |
479 | (bfd *, asection *, arelent **, unsigned int) ATTRIBUTE_HIDDEN; | |
d00dd7dc | 480 | extern reloc_howto_type *_bfd_norelocs_bfd_reloc_type_lookup |
8722de9c | 481 | (bfd *, bfd_reloc_code_real_type) ATTRIBUTE_HIDDEN; |
d00dd7dc | 482 | extern reloc_howto_type *_bfd_norelocs_bfd_reloc_name_lookup |
8722de9c | 483 | (bfd *, const char *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
484 | |
485 | /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not | |
486 | be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ | |
487 | ||
d00dd7dc | 488 | extern bfd_boolean _bfd_nowrite_set_arch_mach |
8722de9c | 489 | (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_HIDDEN; |
d00dd7dc | 490 | extern bfd_boolean _bfd_nowrite_set_section_contents |
8722de9c | 491 | (bfd *, asection *, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN; |
252b5132 RH |
492 | |
493 | /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use | |
494 | BFD_JUMP_TABLE_WRITE (_bfd_generic). */ | |
495 | ||
496 | #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach | |
b34976b6 | 497 | extern bfd_boolean _bfd_generic_set_section_contents |
8722de9c | 498 | (bfd *, asection *, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN; |
252b5132 RH |
499 | |
500 | /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not | |
501 | support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ | |
502 | ||
d00dd7dc | 503 | extern int _bfd_nolink_sizeof_headers |
8722de9c | 504 | (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
505 | extern bfd_byte *_bfd_nolink_bfd_get_relocated_section_contents |
506 | (bfd *, struct bfd_link_info *, struct bfd_link_order *, | |
8722de9c | 507 | bfd_byte *, bfd_boolean, asymbol **) ATTRIBUTE_HIDDEN; |
d00dd7dc | 508 | extern bfd_boolean _bfd_nolink_bfd_relax_section |
8722de9c | 509 | (bfd *, asection *, struct bfd_link_info *, bfd_boolean *) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
510 | #define _bfd_nolink_bfd_gc_sections _bfd_bool_bfd_link_false_error |
511 | extern bfd_boolean _bfd_nolink_bfd_lookup_section_flags | |
8722de9c | 512 | (struct bfd_link_info *, struct flag_info *, asection *) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
513 | #define _bfd_nolink_bfd_merge_sections _bfd_bool_bfd_link_false_error |
514 | extern bfd_boolean _bfd_nolink_bfd_is_group_section | |
8722de9c | 515 | (bfd *, const asection *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 516 | extern bfd_boolean _bfd_nolink_bfd_discard_group |
8722de9c | 517 | (bfd *, asection *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 518 | extern struct bfd_link_hash_table *_bfd_nolink_bfd_link_hash_table_create |
8722de9c | 519 | (bfd *) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
520 | #define _bfd_nolink_bfd_link_add_symbols _bfd_bool_bfd_link_false_error |
521 | extern void _bfd_nolink_bfd_link_just_syms | |
8722de9c | 522 | (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 523 | extern void _bfd_nolink_bfd_copy_link_hash_symbol_type |
8722de9c AM |
524 | (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *) |
525 | ATTRIBUTE_HIDDEN; | |
d00dd7dc AM |
526 | #define _bfd_nolink_bfd_final_link _bfd_bool_bfd_link_false_error |
527 | extern bfd_boolean _bfd_nolink_bfd_link_split_section | |
8722de9c | 528 | (bfd *, struct bfd_section *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 529 | extern bfd_boolean _bfd_nolink_section_already_linked |
8722de9c | 530 | (bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
d00dd7dc | 531 | extern bfd_boolean _bfd_nolink_bfd_define_common_symbol |
8722de9c AM |
532 | (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *) |
533 | ATTRIBUTE_HIDDEN; | |
34a87bb0 L |
534 | #define _bfd_nolink_bfd_link_hide_symbol \ |
535 | _bfd_generic_link_hide_symbol | |
d00dd7dc | 536 | extern struct bfd_link_hash_entry *_bfd_nolink_bfd_define_start_stop |
8722de9c | 537 | (struct bfd_link_info *, const char *, asection *) ATTRIBUTE_HIDDEN; |
4f3b23b3 NC |
538 | #define _bfd_nolink_bfd_link_check_relocs \ |
539 | _bfd_generic_link_check_relocs | |
252b5132 RH |
540 | |
541 | /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not | |
542 | have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC | |
543 | (_bfd_nodynamic). */ | |
544 | ||
d00dd7dc | 545 | #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_long_bfd_n1_error |
252b5132 | 546 | #define _bfd_nodynamic_canonicalize_dynamic_symtab \ |
d00dd7dc AM |
547 | _bfd_nosymbols_canonicalize_symtab |
548 | extern long _bfd_nodynamic_get_synthetic_symtab | |
8722de9c | 549 | (bfd *, long, asymbol **, long, asymbol **, asymbol **) ATTRIBUTE_HIDDEN; |
d00dd7dc AM |
550 | #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_long_bfd_n1_error |
551 | extern long _bfd_nodynamic_canonicalize_dynamic_reloc | |
8722de9c | 552 | (bfd *, arelent **, asymbol **) ATTRIBUTE_HIDDEN; |
252b5132 RH |
553 | \f |
554 | /* Generic routine to determine of the given symbol is a local | |
555 | label. */ | |
b34976b6 | 556 | extern bfd_boolean bfd_generic_is_local_label_name |
8722de9c | 557 | (bfd *, const char *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
558 | |
559 | /* Generic minisymbol routines. */ | |
560 | extern long _bfd_generic_read_minisymbols | |
8722de9c | 561 | (bfd *, bfd_boolean, void **, unsigned int *) ATTRIBUTE_HIDDEN; |
252b5132 | 562 | extern asymbol *_bfd_generic_minisymbol_to_symbol |
8722de9c | 563 | (bfd *, bfd_boolean, const void *, asymbol *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
564 | |
565 | /* Find the nearest line using .stab/.stabstr sections. */ | |
b34976b6 | 566 | extern bfd_boolean _bfd_stab_section_find_nearest_line |
c58b9523 | 567 | (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, |
8722de9c | 568 | const char **, const char **, unsigned int *, void **) ATTRIBUTE_HIDDEN; |
252b5132 | 569 | |
2db3311b | 570 | /* Find the nearest line using DWARF 1 debugging information. */ |
b34976b6 | 571 | extern bfd_boolean _bfd_dwarf1_find_nearest_line |
fb167eb2 | 572 | (bfd *, asymbol **, asection *, bfd_vma, |
8722de9c | 573 | const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; |
252b5132 | 574 | |
fc28f9aa TG |
575 | struct dwarf_debug_section |
576 | { | |
68d20676 NC |
577 | const char * uncompressed_name; |
578 | const char * compressed_name; | |
fc28f9aa TG |
579 | }; |
580 | ||
581 | /* Map of uncompressed DWARF debug section name to compressed one. It | |
582 | is terminated by NULL uncompressed_name. */ | |
583 | ||
8722de9c | 584 | extern const struct dwarf_debug_section dwarf_debug_sections[] ATTRIBUTE_HIDDEN; |
fc28f9aa | 585 | |
252b5132 | 586 | /* Find the nearest line using DWARF 2 debugging information. */ |
b34976b6 | 587 | extern bfd_boolean _bfd_dwarf2_find_nearest_line |
fb167eb2 AM |
588 | (bfd *, asymbol **, asymbol *, asection *, bfd_vma, |
589 | const char **, const char **, unsigned int *, unsigned int *, | |
8722de9c | 590 | const struct dwarf_debug_section *, unsigned int, void **) ATTRIBUTE_HIDDEN; |
9b8d1a36 | 591 | |
425bd9e1 NC |
592 | /* Find the bias between DWARF addresses and real addresses. */ |
593 | extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias | |
8722de9c | 594 | (asymbol **, void **) ATTRIBUTE_HIDDEN; |
1b786873 | 595 | |
4ab527b0 FF |
596 | /* Find inliner info after calling bfd_find_nearest_line. */ |
597 | extern bfd_boolean _bfd_dwarf2_find_inliner_info | |
8722de9c AM |
598 | (bfd *, const char **, const char **, unsigned int *, void **) |
599 | ATTRIBUTE_HIDDEN; | |
d9071b0c | 600 | |
2ca7691a TG |
601 | /* Read DWARF 2 debugging information. */ |
602 | extern bfd_boolean _bfd_dwarf2_slurp_debug_info | |
93ee1e36 | 603 | (bfd *, bfd *, const struct dwarf_debug_section *, asymbol **, void **, |
8722de9c | 604 | bfd_boolean) ATTRIBUTE_HIDDEN; |
2ca7691a | 605 | |
d9071b0c TG |
606 | /* Clean up the data used to handle DWARF 2 debugging information. */ |
607 | extern void _bfd_dwarf2_cleanup_debug_info | |
8722de9c | 608 | (bfd *, void **) ATTRIBUTE_HIDDEN; |
d9071b0c | 609 | |
73e87d70 AM |
610 | /* Create a new section entry. */ |
611 | extern struct bfd_hash_entry *bfd_section_hash_newfunc | |
8722de9c AM |
612 | (struct bfd_hash_entry *, struct bfd_hash_table *, const char *) |
613 | ATTRIBUTE_HIDDEN; | |
73e87d70 | 614 | |
252b5132 RH |
615 | /* A routine to create entries for a bfd_link_hash_table. */ |
616 | extern struct bfd_hash_entry *_bfd_link_hash_newfunc | |
c58b9523 | 617 | (struct bfd_hash_entry *entry, struct bfd_hash_table *table, |
8722de9c | 618 | const char *string) ATTRIBUTE_HIDDEN; |
252b5132 RH |
619 | |
620 | /* Initialize a bfd_link_hash_table. */ | |
b34976b6 | 621 | extern bfd_boolean _bfd_link_hash_table_init |
c58b9523 AM |
622 | (struct bfd_link_hash_table *, bfd *, |
623 | struct bfd_hash_entry *(*) (struct bfd_hash_entry *, | |
624 | struct bfd_hash_table *, | |
66eb6687 | 625 | const char *), |
8722de9c | 626 | unsigned int) ATTRIBUTE_HIDDEN; |
252b5132 RH |
627 | |
628 | /* Generic link hash table creation routine. */ | |
629 | extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create | |
8722de9c | 630 | (bfd *) ATTRIBUTE_HIDDEN; |
252b5132 | 631 | |
e2d34d7d DJ |
632 | /* Generic link hash table destruction routine. */ |
633 | extern void _bfd_generic_link_hash_table_free | |
8722de9c | 634 | (bfd *) ATTRIBUTE_HIDDEN; |
e2d34d7d | 635 | |
252b5132 | 636 | /* Generic add symbol routine. */ |
b34976b6 | 637 | extern bfd_boolean _bfd_generic_link_add_symbols |
8722de9c | 638 | (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
252b5132 | 639 | |
252b5132 | 640 | /* Generic archive add symbol routine. */ |
b34976b6 | 641 | extern bfd_boolean _bfd_generic_link_add_archive_symbols |
c58b9523 | 642 | (bfd *, struct bfd_link_info *, |
13e570f8 AM |
643 | bfd_boolean (*) (bfd *, struct bfd_link_info *, |
644 | struct bfd_link_hash_entry *, const char *, | |
8722de9c | 645 | bfd_boolean *)) ATTRIBUTE_HIDDEN; |
252b5132 | 646 | |
252b5132 RH |
647 | /* Forward declaration to avoid prototype errors. */ |
648 | typedef struct bfd_link_hash_entry _bfd_link_hash_entry; | |
649 | ||
650 | /* Generic routine to add a single symbol. */ | |
b34976b6 | 651 | extern bfd_boolean _bfd_generic_link_add_one_symbol |
c58b9523 AM |
652 | (struct bfd_link_info *, bfd *, const char *name, flagword, |
653 | asection *, bfd_vma, const char *, bfd_boolean copy, | |
8722de9c | 654 | bfd_boolean constructor, struct bfd_link_hash_entry **) ATTRIBUTE_HIDDEN; |
252b5132 | 655 | |
2d653fc7 AM |
656 | /* Generic routine to mark section as supplying symbols only. */ |
657 | extern void _bfd_generic_link_just_syms | |
8722de9c | 658 | (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
2d653fc7 | 659 | |
1338dd10 PB |
660 | /* Generic routine that does nothing. */ |
661 | extern void _bfd_generic_copy_link_hash_symbol_type | |
8722de9c AM |
662 | (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *) |
663 | ATTRIBUTE_HIDDEN; | |
1338dd10 | 664 | |
252b5132 | 665 | /* Generic link routine. */ |
b34976b6 | 666 | extern bfd_boolean _bfd_generic_final_link |
8722de9c | 667 | (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
252b5132 | 668 | |
b34976b6 | 669 | extern bfd_boolean _bfd_generic_link_split_section |
8722de9c | 670 | (bfd *, struct bfd_section *) ATTRIBUTE_HIDDEN; |
252b5132 | 671 | |
43e1669b | 672 | extern bfd_boolean _bfd_generic_section_already_linked |
8722de9c | 673 | (bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN; |
082b7297 | 674 | |
252b5132 | 675 | /* Generic reloc_link_order processing routine. */ |
b34976b6 | 676 | extern bfd_boolean _bfd_generic_reloc_link_order |
8722de9c AM |
677 | (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *) |
678 | ATTRIBUTE_HIDDEN; | |
252b5132 RH |
679 | |
680 | /* Default link order processing routine. */ | |
b34976b6 | 681 | extern bfd_boolean _bfd_default_link_order |
8722de9c AM |
682 | (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *) |
683 | ATTRIBUTE_HIDDEN; | |
252b5132 RH |
684 | |
685 | /* Count the number of reloc entries in a link order list. */ | |
686 | extern unsigned int _bfd_count_link_order_relocs | |
8722de9c | 687 | (struct bfd_link_order *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
688 | |
689 | /* Final link relocation routine. */ | |
690 | extern bfd_reloc_status_type _bfd_final_link_relocate | |
c58b9523 | 691 | (reloc_howto_type *, bfd *, asection *, bfd_byte *, |
8722de9c | 692 | bfd_vma, bfd_vma, bfd_vma) ATTRIBUTE_HIDDEN; |
252b5132 RH |
693 | |
694 | /* Relocate a particular location by a howto and a value. */ | |
695 | extern bfd_reloc_status_type _bfd_relocate_contents | |
8722de9c | 696 | (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN; |
252b5132 | 697 | |
b1e24c02 | 698 | /* Clear a given location using a given howto. */ |
8722de9c AM |
699 | extern void _bfd_clear_contents |
700 | (reloc_howto_type *, bfd *, asection *, bfd_byte *) ATTRIBUTE_HIDDEN; | |
b1e24c02 | 701 | |
252b5132 RH |
702 | /* Link stabs in sections in the first pass. */ |
703 | ||
b34976b6 | 704 | extern bfd_boolean _bfd_link_section_stabs |
3722b82f | 705 | (bfd *, struct stab_info *, asection *, asection *, void **, |
8722de9c | 706 | bfd_size_type *) ATTRIBUTE_HIDDEN; |
252b5132 | 707 | |
73d074b4 | 708 | /* Eliminate stabs for discarded functions and symbols. */ |
b34976b6 | 709 | extern bfd_boolean _bfd_discard_section_stabs |
8722de9c AM |
710 | (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *) |
711 | ATTRIBUTE_HIDDEN; | |
73d074b4 | 712 | |
252b5132 RH |
713 | /* Write out the .stab section when linking stabs in sections. */ |
714 | ||
b34976b6 | 715 | extern bfd_boolean _bfd_write_section_stabs |
8722de9c AM |
716 | (bfd *, struct stab_info *, asection *, void **, bfd_byte *) |
717 | ATTRIBUTE_HIDDEN; | |
252b5132 RH |
718 | |
719 | /* Write out the .stabstr string table when linking stabs in sections. */ | |
720 | ||
b34976b6 | 721 | extern bfd_boolean _bfd_write_stab_strings |
8722de9c | 722 | (bfd *, struct stab_info *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
723 | |
724 | /* Find an offset within a .stab section when linking stabs in | |
725 | sections. */ | |
726 | ||
727 | extern bfd_vma _bfd_stab_section_offset | |
8722de9c | 728 | (asection *, void *, bfd_vma) ATTRIBUTE_HIDDEN; |
252b5132 | 729 | |
57ceae94 | 730 | /* Register a SEC_MERGE section as a candidate for merging. */ |
f5fa8ca2 | 731 | |
57ceae94 | 732 | extern bfd_boolean _bfd_add_merge_section |
8722de9c | 733 | (bfd *, void **, asection *, void **) ATTRIBUTE_HIDDEN; |
f5fa8ca2 | 734 | |
8550eb6e JJ |
735 | /* Attempt to merge SEC_MERGE sections. */ |
736 | ||
b34976b6 | 737 | extern bfd_boolean _bfd_merge_sections |
8722de9c AM |
738 | (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *)) |
739 | ATTRIBUTE_HIDDEN; | |
8550eb6e | 740 | |
f5fa8ca2 JJ |
741 | /* Write out a merged section. */ |
742 | ||
b34976b6 | 743 | extern bfd_boolean _bfd_write_merged_section |
8722de9c | 744 | (bfd *, asection *, void *) ATTRIBUTE_HIDDEN; |
f5fa8ca2 JJ |
745 | |
746 | /* Find an offset within a modified SEC_MERGE section. */ | |
747 | ||
748 | extern bfd_vma _bfd_merged_section_offset | |
8722de9c | 749 | (bfd *, asection **, void *, bfd_vma) ATTRIBUTE_HIDDEN; |
f5fa8ca2 | 750 | |
9f7c3e5e AM |
751 | /* Tidy up when done. */ |
752 | ||
8722de9c | 753 | extern void _bfd_merge_sections_free (void *) ATTRIBUTE_HIDDEN; |
9f7c3e5e | 754 | |
252b5132 | 755 | /* Create a string table. */ |
b34976b6 | 756 | extern struct bfd_strtab_hash *_bfd_stringtab_init |
8722de9c | 757 | (void) ATTRIBUTE_HIDDEN; |
252b5132 RH |
758 | |
759 | /* Create an XCOFF .debug section style string table. */ | |
b34976b6 | 760 | extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init |
8722de9c | 761 | (void) ATTRIBUTE_HIDDEN; |
252b5132 RH |
762 | |
763 | /* Free a string table. */ | |
b34976b6 | 764 | extern void _bfd_stringtab_free |
8722de9c | 765 | (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
766 | |
767 | /* Get the size of a string table. */ | |
b34976b6 | 768 | extern bfd_size_type _bfd_stringtab_size |
8722de9c | 769 | (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
770 | |
771 | /* Add a string to a string table. */ | |
772 | extern bfd_size_type _bfd_stringtab_add | |
8722de9c AM |
773 | (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy) |
774 | ATTRIBUTE_HIDDEN; | |
252b5132 RH |
775 | |
776 | /* Write out a string table. */ | |
b34976b6 | 777 | extern bfd_boolean _bfd_stringtab_emit |
8722de9c | 778 | (bfd *, struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN; |
252b5132 RH |
779 | \f |
780 | /* Macros to tell if bfds are read or write enabled. | |
781 | ||
782 | Note that bfds open for read may be scribbled into if the fd passed | |
783 | to bfd_fdopenr is actually open both for read and write | |
784 | simultaneously. However an output bfd will never be open for | |
785 | read. Therefore sometimes you want to check bfd_read_p or | |
786 | !bfd_read_p, and only sometimes bfd_write_p. | |
787 | */ | |
788 | ||
c58b9523 AM |
789 | #define bfd_read_p(abfd) \ |
790 | ((abfd)->direction == read_direction || (abfd)->direction == both_direction) | |
791 | #define bfd_write_p(abfd) \ | |
792 | ((abfd)->direction == write_direction || (abfd)->direction == both_direction) | |
252b5132 | 793 | |
8722de9c AM |
794 | extern void bfd_assert |
795 | (const char*,int) ATTRIBUTE_HIDDEN; | |
252b5132 RH |
796 | |
797 | #define BFD_ASSERT(x) \ | |
f12123c0 | 798 | do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0) |
252b5132 RH |
799 | |
800 | #define BFD_FAIL() \ | |
f12123c0 | 801 | do { bfd_assert(__FILE__,__LINE__); } while (0) |
252b5132 | 802 | |
b34976b6 | 803 | extern void _bfd_abort |
8722de9c | 804 | (const char *, int, const char *) ATTRIBUTE_NORETURN ATTRIBUTE_HIDDEN; |
c0bed66d | 805 | |
a1934524 AM |
806 | /* if gcc >= 2.6, we can give a function name, too */ |
807 | #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) | |
c0bed66d ILT |
808 | #define __PRETTY_FUNCTION__ ((char *) NULL) |
809 | #endif | |
810 | ||
811 | #undef abort | |
812 | #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) | |
813 | ||
7c192733 AC |
814 | /* Manipulate a system FILE but using BFD's "file_ptr", rather than |
815 | the system "off_t" or "off64_t", as the offset. */ | |
8722de9c AM |
816 | extern file_ptr _bfd_real_ftell |
817 | (FILE *) ATTRIBUTE_HIDDEN; | |
818 | extern int _bfd_real_fseek | |
819 | (FILE *, file_ptr, int) ATTRIBUTE_HIDDEN; | |
820 | extern FILE *_bfd_real_fopen | |
821 | (const char *, const char *) ATTRIBUTE_HIDDEN; | |
7c192733 | 822 | |
252b5132 RH |
823 | /* List of supported target vectors, and the default vector (if |
824 | bfd_default_vector[0] is NULL, there is no default). */ | |
8722de9c AM |
825 | extern const bfd_target * const *bfd_target_vector ATTRIBUTE_HIDDEN; |
826 | extern const bfd_target *bfd_default_vector[] ATTRIBUTE_HIDDEN; | |
252b5132 | 827 | |
08f74004 | 828 | /* List of associated target vectors. */ |
8722de9c | 829 | extern const bfd_target * const *bfd_associated_vector ATTRIBUTE_HIDDEN; |
08f74004 | 830 | |
252b5132 RH |
831 | /* Functions shared by the ECOFF and MIPS ELF backends, which have no |
832 | other common header files. */ | |
833 | ||
834 | #if defined(__STDC__) || defined(ALMOST_STDC) | |
835 | struct ecoff_find_line; | |
836 | #endif | |
837 | ||
b34976b6 | 838 | extern bfd_boolean _bfd_ecoff_locate_line |
c58b9523 AM |
839 | (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, |
840 | const struct ecoff_debug_swap * const, struct ecoff_find_line *, | |
8722de9c | 841 | const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; |
b34976b6 | 842 | extern bfd_boolean _bfd_ecoff_get_accumulated_pdr |
8722de9c | 843 | (void *, bfd_byte *) ATTRIBUTE_HIDDEN; |
b34976b6 | 844 | extern bfd_boolean _bfd_ecoff_get_accumulated_sym |
8722de9c | 845 | (void *, bfd_byte *) ATTRIBUTE_HIDDEN; |
b34976b6 | 846 | extern bfd_boolean _bfd_ecoff_get_accumulated_ss |
8722de9c | 847 | (void *, bfd_byte *) ATTRIBUTE_HIDDEN; |
b34976b6 AM |
848 | |
849 | extern bfd_vma _bfd_get_gp_value | |
8722de9c | 850 | (bfd *) ATTRIBUTE_HIDDEN; |
b34976b6 | 851 | extern void _bfd_set_gp_value |
8722de9c | 852 | (bfd *, bfd_vma) ATTRIBUTE_HIDDEN; |
252b5132 RH |
853 | |
854 | /* Function shared by the COFF and ELF SH backends, which have no | |
855 | other common header files. */ | |
856 | ||
c58b9523 | 857 | #ifndef _bfd_sh_align_load_span |
b34976b6 | 858 | extern bfd_boolean _bfd_sh_align_load_span |
c58b9523 AM |
859 | (bfd *, asection *, bfd_byte *, |
860 | bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma), | |
8722de9c | 861 | void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *) ATTRIBUTE_HIDDEN; |
c58b9523 | 862 | #endif |
082b7297 L |
863 | |
864 | /* This is the shape of the elements inside the already_linked hash | |
865 | table. It maps a name onto a list of already_linked elements with | |
866 | the same name. */ | |
867 | ||
868 | struct bfd_section_already_linked_hash_entry | |
869 | { | |
870 | struct bfd_hash_entry root; | |
871 | struct bfd_section_already_linked *entry; | |
872 | }; | |
873 | ||
874 | struct bfd_section_already_linked | |
875 | { | |
876 | struct bfd_section_already_linked *next; | |
c77ec726 | 877 | asection *sec; |
082b7297 L |
878 | }; |
879 | ||
880 | extern struct bfd_section_already_linked_hash_entry * | |
8722de9c | 881 | bfd_section_already_linked_table_lookup (const char *) ATTRIBUTE_HIDDEN; |
a6626e8c | 882 | extern bfd_boolean bfd_section_already_linked_table_insert |
8722de9c AM |
883 | (struct bfd_section_already_linked_hash_entry *, asection *) |
884 | ATTRIBUTE_HIDDEN; | |
3d7f7666 L |
885 | extern void bfd_section_already_linked_table_traverse |
886 | (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *, | |
8722de9c AM |
887 | void *), void *) ATTRIBUTE_HIDDEN; |
888 | ||
889 | extern bfd_vma _bfd_read_unsigned_leb128 | |
890 | (bfd *, bfd_byte *, unsigned int *) ATTRIBUTE_HIDDEN; | |
891 | extern bfd_signed_vma _bfd_read_signed_leb128 | |
892 | (bfd *, bfd_byte *, unsigned int *) ATTRIBUTE_HIDDEN; | |
893 | extern bfd_vma _bfd_safe_read_leb128 | |
894 | (bfd *, bfd_byte *, unsigned int *, bfd_boolean, const bfd_byte * const) | |
895 | ATTRIBUTE_HIDDEN; |