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