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