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