1 /* libbfd.h -- Declarations used by bfd library *implementation*.
2 (This include file is not for users of the library.)
4 Copyright (C) 1990-2018 Free Software Foundation, Inc.
6 Written by Cygnus Support.
8 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
34 /* If you want to read and write large blocks, you might want to do it
35 in quanta of this amount */
36 #define DEFAULT_BUFFERSIZE 8192
38 /* Set a tdata field. Can't use the other macros for this, since they
39 do casts, and casting to the left of assignment isn't portable. */
40 #define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
42 /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
43 to an instance of this structure. */
49 /* Buffer holding contents of BFD. */
53 struct section_hash_entry
55 struct bfd_hash_entry root
;
59 /* Unique section id. */
60 extern unsigned int _bfd_section_id
;
62 /* tdata for an archive. For an input archive, cache
63 needs to be free()'d. For an output archive, symdefs do. */
67 file_ptr first_file_filepos
;
68 /* Speed up searching the armap */
70 bfd
*archive_head
; /* Only interesting in output routines. */
71 carsym
*symdefs
; /* The symdef entries. */
72 symindex symdef_count
; /* How many there are. */
73 char *extended_names
; /* Clever intel extension. */
74 bfd_size_type extended_names_size
; /* Size of extended names. */
75 /* When more compilers are standard C, this can be a time_t. */
76 long armap_timestamp
; /* Timestamp value written into armap.
77 This is used for BSD archives to check
78 that the timestamp is recent enough
79 for the BSD linker to not complain,
80 just before we finish writing an
82 file_ptr armap_datepos
; /* Position within archive to seek to
83 rewrite the date field. */
84 void *tdata
; /* Backend specific information. */
87 #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
89 /* Goes in bfd's arelt_data slot */
92 char * arch_header
; /* It's actually a string. */
93 bfd_size_type parsed_size
; /* Octets of filesize not including ar_hdr. */
94 bfd_size_type extra_size
; /* BSD4.4: extra bytes after the header. */
95 char *filename
; /* Null-terminated. */
96 file_ptr origin
; /* For element of a thin archive. */
97 void *parent_cache
; /* Where and how to find this member. */
101 #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
103 extern void *bfd_malloc
105 extern void *bfd_realloc
106 (void *, bfd_size_type
);
107 extern void *bfd_realloc_or_free
108 (void *, bfd_size_type
);
109 extern void *bfd_zmalloc
111 extern void *bfd_malloc2
112 (bfd_size_type
, bfd_size_type
);
113 extern void *bfd_realloc2
114 (void *, bfd_size_type
, bfd_size_type
);
115 extern void *bfd_zmalloc2
116 (bfd_size_type
, bfd_size_type
);
118 extern void _bfd_error_handler (const char *s
, ...) ATTRIBUTE_PRINTF_1
;
120 /* These routines allocate and free things on the BFD's objalloc. */
122 extern void *bfd_alloc2
123 (bfd
*, bfd_size_type
, bfd_size_type
);
124 extern void *bfd_zalloc2
125 (bfd
*, bfd_size_type
, bfd_size_type
);
126 extern void bfd_release
129 bfd
* _bfd_create_empty_archive_element_shell
131 bfd
* _bfd_look_for_bfd_in_cache
133 bfd_boolean _bfd_add_bfd_to_archive_cache
134 (bfd
*, file_ptr
, bfd
*);
135 bfd_boolean _bfd_generic_mkarchive
137 char *_bfd_append_relative_path
139 const bfd_target
*bfd_generic_archive_p
141 bfd_boolean bfd_slurp_armap
143 #define bfd_slurp_bsd_armap bfd_slurp_armap
144 #define bfd_slurp_coff_armap bfd_slurp_armap
145 bfd_boolean _bfd_archive_64_bit_slurp_armap
147 bfd_boolean _bfd_archive_64_bit_write_armap
148 (bfd
*, unsigned int, struct orl
*, unsigned int, int);
149 #define _bfd_archive_64_bit_slurp_extended_name_table \
150 _bfd_slurp_extended_name_table
151 #define _bfd_archive_64_bit_construct_extended_name_table \
152 _bfd_archive_coff_construct_extended_name_table
153 #define _bfd_archive_64_bit_truncate_arname \
154 bfd_dont_truncate_arname
155 #define _bfd_archive_64_bit_read_ar_hdr \
156 _bfd_generic_read_ar_hdr
157 #define _bfd_archive_64_bit_write_ar_hdr \
158 _bfd_generic_write_ar_hdr
159 #define _bfd_archive_64_bit_openr_next_archived_file \
160 bfd_generic_openr_next_archived_file
161 #define _bfd_archive_64_bit_get_elt_at_index \
162 _bfd_generic_get_elt_at_index
163 #define _bfd_archive_64_bit_generic_stat_arch_elt \
164 bfd_generic_stat_arch_elt
165 #define _bfd_archive_64_bit_update_armap_timestamp _bfd_bool_bfd_true
167 bfd_boolean _bfd_slurp_extended_name_table
169 extern bfd_boolean _bfd_construct_extended_name_table
170 (bfd
*, bfd_boolean
, char **, bfd_size_type
*);
171 bfd_boolean _bfd_write_archive_contents
173 bfd_boolean _bfd_compute_and_write_armap
174 (bfd
*, unsigned int);
175 bfd
*_bfd_get_elt_at_filepos
177 extern bfd
*_bfd_generic_get_elt_at_index
181 bfd_boolean _bfd_free_cached_info
184 extern bfd_boolean _bfd_bool_bfd_false
186 extern bfd_boolean _bfd_bool_bfd_asymbol_false
188 extern bfd_boolean _bfd_bool_bfd_false_error
190 extern bfd_boolean _bfd_bool_bfd_link_false_error
191 (bfd
*, struct bfd_link_info
*);
192 extern bfd_boolean _bfd_bool_bfd_true
194 extern bfd_boolean _bfd_bool_bfd_link_true
195 (bfd
*, struct bfd_link_info
*);
196 extern bfd_boolean _bfd_bool_bfd_bfd_true
198 extern bfd_boolean _bfd_bool_bfd_uint_true
199 (bfd
*, unsigned int);
200 extern bfd_boolean _bfd_bool_bfd_asection_bfd_asection_true
201 (bfd
*, asection
*, bfd
*, asection
*);
202 extern bfd_boolean _bfd_bool_bfd_asymbol_bfd_asymbol_true
203 (bfd
*, asymbol
*, bfd
*, asymbol
*);
204 extern bfd_boolean _bfd_bool_bfd_ptr_true
206 extern void *_bfd_ptr_bfd_null_error
208 extern int _bfd_int_bfd_0
210 extern unsigned int _bfd_uint_bfd_0
212 extern long _bfd_long_bfd_0
214 extern long _bfd_long_bfd_n1_error
216 extern void _bfd_void_bfd
218 extern void _bfd_void_bfd_link
219 (bfd
*, struct bfd_link_info
*);
220 extern void _bfd_void_bfd_asection
223 bfd
*_bfd_new_bfd_contained_in
225 const bfd_target
*_bfd_dummy_target
228 void bfd_dont_truncate_arname
229 (bfd
*, const char *, char *);
230 void bfd_bsd_truncate_arname
231 (bfd
*, const char *, char *);
232 void bfd_gnu_truncate_arname
233 (bfd
*, const char *, char *);
235 bfd_boolean _bfd_bsd_write_armap
236 (bfd
*, unsigned int, struct orl
*, unsigned int, int);
238 bfd_boolean _bfd_coff_write_armap
239 (bfd
*, unsigned int, struct orl
*, unsigned int, int);
241 extern void *_bfd_generic_read_ar_hdr
243 extern void _bfd_ar_spacepad
244 (char *, size_t, const char *, long);
245 extern bfd_boolean _bfd_ar_sizepad
246 (char *, size_t, bfd_size_type
);
248 extern void *_bfd_generic_read_ar_hdr_mag
249 (bfd
*, const char *);
251 extern bfd_boolean _bfd_generic_write_ar_hdr
254 extern bfd_boolean _bfd_bsd44_write_ar_hdr
257 bfd
* bfd_generic_openr_next_archived_file
260 int bfd_generic_stat_arch_elt
261 (bfd
*, struct stat
*);
263 #define _bfd_read_ar_hdr(abfd) \
264 BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
265 #define _bfd_write_ar_hdr(archive, abfd) \
266 BFD_SEND (abfd, _bfd_write_ar_hdr_fn, (archive, abfd))
268 /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
269 BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
271 #define _bfd_generic_close_and_cleanup _bfd_archive_close_and_cleanup
272 extern bfd_boolean _bfd_archive_close_and_cleanup
274 #define _bfd_generic_bfd_free_cached_info _bfd_bool_bfd_true
275 extern bfd_boolean _bfd_generic_new_section_hook
277 extern bfd_boolean _bfd_generic_get_section_contents
278 (bfd
*, asection
*, void *, file_ptr
, bfd_size_type
);
279 extern bfd_boolean _bfd_generic_get_section_contents_in_window
280 (bfd
*, asection
*, bfd_window
*, file_ptr
, bfd_size_type
);
282 /* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
283 BFD_JUMP_TABLE_COPY (_bfd_generic). */
285 #define _bfd_generic_bfd_copy_private_bfd_data _bfd_bool_bfd_bfd_true
286 #define _bfd_generic_bfd_merge_private_bfd_data \
287 _bfd_bool_bfd_link_true
288 #define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true
289 #define _bfd_generic_bfd_copy_private_section_data \
290 _bfd_bool_bfd_asection_bfd_asection_true
291 #define _bfd_generic_bfd_copy_private_symbol_data \
292 _bfd_bool_bfd_asymbol_bfd_asymbol_true
293 #define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true
294 #define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true
296 extern bfd_boolean _bfd_generic_init_private_section_data
297 (bfd
*, asection
*, bfd
*, asection
*, struct bfd_link_info
*);
299 /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
300 support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
302 extern char *_bfd_nocore_core_file_failing_command
304 extern int _bfd_nocore_core_file_failing_signal
306 extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
308 extern int _bfd_nocore_core_file_pid
311 /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
312 file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
314 #define _bfd_noarchive_slurp_armap _bfd_bool_bfd_false_error
315 #define _bfd_noarchive_slurp_extended_name_table _bfd_bool_bfd_false_error
316 extern bfd_boolean _bfd_noarchive_construct_extended_name_table
317 (bfd
*, char **, bfd_size_type
*, const char **);
318 extern void _bfd_noarchive_truncate_arname
319 (bfd
*, const char *, char *);
320 extern bfd_boolean _bfd_noarchive_write_armap
321 (bfd
*, unsigned int, struct orl
*, unsigned int, int);
322 #define _bfd_noarchive_read_ar_hdr _bfd_ptr_bfd_null_error
323 extern bfd_boolean _bfd_noarchive_write_ar_hdr
326 _bfd_noarchive_openr_next_archived_file
328 extern bfd
* _bfd_noarchive_get_elt_at_index
330 #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
331 #define _bfd_noarchive_update_armap_timestamp _bfd_bool_bfd_false_error
333 /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
334 archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */
336 #define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
337 #define _bfd_archive_bsd_slurp_extended_name_table \
338 _bfd_slurp_extended_name_table
339 extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
340 (bfd
*, char **, bfd_size_type
*, const char **);
341 #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
342 #define _bfd_archive_bsd_write_armap _bfd_bsd_write_armap
343 #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
344 #define _bfd_archive_bsd_write_ar_hdr _bfd_generic_write_ar_hdr
345 #define _bfd_archive_bsd_openr_next_archived_file \
346 bfd_generic_openr_next_archived_file
347 #define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
348 #define _bfd_archive_bsd_generic_stat_arch_elt \
349 bfd_generic_stat_arch_elt
350 extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp
353 /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
354 archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
356 #define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
357 #define _bfd_archive_coff_slurp_extended_name_table \
358 _bfd_slurp_extended_name_table
359 extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
360 (bfd
*, char **, bfd_size_type
*, const char **);
361 #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
362 #define _bfd_archive_coff_write_armap _bfd_coff_write_armap
363 #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
364 #define _bfd_archive_coff_write_ar_hdr _bfd_generic_write_ar_hdr
365 #define _bfd_archive_coff_openr_next_archived_file \
366 bfd_generic_openr_next_archived_file
367 #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
368 #define _bfd_archive_coff_generic_stat_arch_elt \
369 bfd_generic_stat_arch_elt
370 #define _bfd_archive_coff_update_armap_timestamp _bfd_bool_bfd_true
372 /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style
373 archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44). */
375 #define _bfd_archive_bsd44_slurp_armap bfd_slurp_bsd_armap
376 #define _bfd_archive_bsd44_slurp_extended_name_table \
377 _bfd_slurp_extended_name_table
378 extern bfd_boolean _bfd_archive_bsd44_construct_extended_name_table
379 (bfd
*, char **, bfd_size_type
*, const char **);
380 #define _bfd_archive_bsd44_truncate_arname bfd_bsd_truncate_arname
381 #define _bfd_archive_bsd44_write_armap _bfd_bsd_write_armap
382 #define _bfd_archive_bsd44_read_ar_hdr _bfd_generic_read_ar_hdr
383 #define _bfd_archive_bsd44_write_ar_hdr _bfd_bsd44_write_ar_hdr
384 #define _bfd_archive_bsd44_openr_next_archived_file \
385 bfd_generic_openr_next_archived_file
386 #define _bfd_archive_bsd44_get_elt_at_index _bfd_generic_get_elt_at_index
387 #define _bfd_archive_bsd44_generic_stat_arch_elt \
388 bfd_generic_stat_arch_elt
389 #define _bfd_archive_bsd44_update_armap_timestamp \
390 _bfd_archive_bsd_update_armap_timestamp
392 /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get VMS style
393 archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_vms_lib). Some of them
396 extern bfd_boolean
_bfd_vms_lib_write_archive_contents (bfd
*);
397 #define _bfd_vms_lib_slurp_armap _bfd_noarchive_slurp_armap
398 #define _bfd_vms_lib_slurp_extended_name_table \
399 _bfd_noarchive_slurp_extended_name_table
400 #define _bfd_vms_lib_construct_extended_name_table \
401 _bfd_noarchive_construct_extended_name_table
402 #define _bfd_vms_lib_truncate_arname _bfd_noarchive_truncate_arname
403 #define _bfd_vms_lib_write_armap _bfd_noarchive_write_armap
404 #define _bfd_vms_lib_read_ar_hdr _bfd_noarchive_read_ar_hdr
405 #define _bfd_vms_lib_write_ar_hdr _bfd_noarchive_write_ar_hdr
406 extern bfd
*_bfd_vms_lib_openr_next_archived_file (bfd
*, bfd
*);
407 extern bfd
*_bfd_vms_lib_get_elt_at_index (bfd
*, symindex
);
408 extern int _bfd_vms_lib_generic_stat_arch_elt (bfd
*, struct stat
*);
409 #define _bfd_vms_lib_update_armap_timestamp _bfd_bool_bfd_true
411 /* Extra routines for VMS style archives. */
413 extern symindex
_bfd_vms_lib_find_symbol (bfd
*, const char *);
414 extern bfd
*_bfd_vms_lib_get_imagelib_file (bfd
*);
415 extern const bfd_target
*_bfd_vms_lib_alpha_archive_p (bfd
*);
416 extern const bfd_target
*_bfd_vms_lib_ia64_archive_p (bfd
*);
417 extern bfd_boolean
_bfd_vms_lib_alpha_mkarchive (bfd
*);
418 extern bfd_boolean
_bfd_vms_lib_ia64_mkarchive (bfd
*);
420 /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
421 support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
423 #define _bfd_nosymbols_get_symtab_upper_bound _bfd_long_bfd_n1_error
424 extern long _bfd_nosymbols_canonicalize_symtab
426 #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
427 extern void _bfd_nosymbols_print_symbol
428 (bfd
*, void *, asymbol
*, bfd_print_symbol_type
);
429 extern void _bfd_nosymbols_get_symbol_info
430 (bfd
*, asymbol
*, symbol_info
*);
431 extern const char * _bfd_nosymbols_get_symbol_version_string
432 (bfd
*, asymbol
*, bfd_boolean
*);
433 extern bfd_boolean _bfd_nosymbols_bfd_is_local_label_name
434 (bfd
*, const char *);
435 #define _bfd_nosymbols_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
436 extern alent
*_bfd_nosymbols_get_lineno
438 extern bfd_boolean _bfd_nosymbols_find_nearest_line
439 (bfd
*, asymbol
**, asection
*, bfd_vma
,
440 const char **, const char **, unsigned int *, unsigned int *);
441 extern bfd_boolean _bfd_nosymbols_find_line
442 (bfd
*, asymbol
**, asymbol
*, const char **, unsigned int *);
443 extern bfd_boolean _bfd_nosymbols_find_inliner_info
444 (bfd
*, const char **, const char **, unsigned int *);
445 extern asymbol
*_bfd_nosymbols_bfd_make_debug_symbol
446 (bfd
*, void *, unsigned long);
447 extern long _bfd_nosymbols_read_minisymbols
448 (bfd
*, bfd_boolean
, void **, unsigned int *);
449 extern asymbol
*_bfd_nosymbols_minisymbol_to_symbol
450 (bfd
*, bfd_boolean
, const void *, asymbol
*);
452 /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
453 support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
455 extern long _bfd_norelocs_get_reloc_upper_bound (bfd
*, asection
*);
456 extern long _bfd_norelocs_canonicalize_reloc (bfd
*, asection
*,
457 arelent
**, asymbol
**);
458 extern void _bfd_norelocs_set_reloc (bfd
*, asection
*,
459 arelent
**, unsigned int);
460 extern reloc_howto_type
*_bfd_norelocs_bfd_reloc_type_lookup
461 (bfd
*, bfd_reloc_code_real_type
);
462 extern reloc_howto_type
*_bfd_norelocs_bfd_reloc_name_lookup
463 (bfd
*, const char *);
465 /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
466 be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
468 extern bfd_boolean _bfd_nowrite_set_arch_mach
469 (bfd
*, enum bfd_architecture
, unsigned long);
470 extern bfd_boolean _bfd_nowrite_set_section_contents
471 (bfd
*, asection
*, const void *, file_ptr
, bfd_size_type
);
473 /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use
474 BFD_JUMP_TABLE_WRITE (_bfd_generic). */
476 #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
477 extern bfd_boolean _bfd_generic_set_section_contents
478 (bfd
*, asection
*, const void *, file_ptr
, bfd_size_type
);
480 /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
481 support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
483 extern int _bfd_nolink_sizeof_headers
484 (bfd
*, struct bfd_link_info
*);
485 extern bfd_byte
*_bfd_nolink_bfd_get_relocated_section_contents
486 (bfd
*, struct bfd_link_info
*, struct bfd_link_order
*,
487 bfd_byte
*, bfd_boolean
, asymbol
**);
488 extern bfd_boolean _bfd_nolink_bfd_relax_section
489 (bfd
*, asection
*, struct bfd_link_info
*, bfd_boolean
*);
490 #define _bfd_nolink_bfd_gc_sections _bfd_bool_bfd_link_false_error
491 extern bfd_boolean _bfd_nolink_bfd_lookup_section_flags
492 (struct bfd_link_info
*, struct flag_info
*, asection
*);
493 #define _bfd_nolink_bfd_merge_sections _bfd_bool_bfd_link_false_error
494 extern bfd_boolean _bfd_nolink_bfd_is_group_section
495 (bfd
*, const asection
*);
496 extern bfd_boolean _bfd_nolink_bfd_discard_group
498 extern struct bfd_link_hash_table
*_bfd_nolink_bfd_link_hash_table_create
500 #define _bfd_nolink_bfd_link_add_symbols _bfd_bool_bfd_link_false_error
501 extern void _bfd_nolink_bfd_link_just_syms
502 (asection
*, struct bfd_link_info
*);
503 extern void _bfd_nolink_bfd_copy_link_hash_symbol_type
504 (bfd
*, struct bfd_link_hash_entry
*, struct bfd_link_hash_entry
*);
505 #define _bfd_nolink_bfd_final_link _bfd_bool_bfd_link_false_error
506 extern bfd_boolean _bfd_nolink_bfd_link_split_section
507 (bfd
*, struct bfd_section
*);
508 extern bfd_boolean _bfd_nolink_section_already_linked
509 (bfd
*, asection
*, struct bfd_link_info
*);
510 extern bfd_boolean _bfd_nolink_bfd_define_common_symbol
511 (bfd
*, struct bfd_link_info
*, struct bfd_link_hash_entry
*);
512 extern struct bfd_link_hash_entry
*_bfd_nolink_bfd_define_start_stop
513 (struct bfd_link_info
*, const char *, asection
*);
514 #define _bfd_nolink_bfd_link_check_relocs \
515 _bfd_generic_link_check_relocs
517 /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
518 have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
521 #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_long_bfd_n1_error
522 #define _bfd_nodynamic_canonicalize_dynamic_symtab \
523 _bfd_nosymbols_canonicalize_symtab
524 extern long _bfd_nodynamic_get_synthetic_symtab
525 (bfd
*, long, asymbol
**, long, asymbol
**, asymbol
**);
526 #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_long_bfd_n1_error
527 extern long _bfd_nodynamic_canonicalize_dynamic_reloc
528 (bfd
*, arelent
**, asymbol
**);
530 /* Generic routine to determine of the given symbol is a local
532 extern bfd_boolean bfd_generic_is_local_label_name
533 (bfd
*, const char *);
535 /* Generic minisymbol routines. */
536 extern long _bfd_generic_read_minisymbols
537 (bfd
*, bfd_boolean
, void **, unsigned int *);
538 extern asymbol
*_bfd_generic_minisymbol_to_symbol
539 (bfd
*, bfd_boolean
, const void *, asymbol
*);
541 /* Find the nearest line using .stab/.stabstr sections. */
542 extern bfd_boolean _bfd_stab_section_find_nearest_line
543 (bfd
*, asymbol
**, asection
*, bfd_vma
, bfd_boolean
*,
544 const char **, const char **, unsigned int *, void **);
546 /* Find the nearest line using DWARF 1 debugging information. */
547 extern bfd_boolean _bfd_dwarf1_find_nearest_line
548 (bfd
*, asymbol
**, asection
*, bfd_vma
,
549 const char **, const char **, unsigned int *);
551 struct dwarf_debug_section
553 const char * uncompressed_name
;
554 const char * compressed_name
;
557 /* Map of uncompressed DWARF debug section name to compressed one. It
558 is terminated by NULL uncompressed_name. */
560 extern const struct dwarf_debug_section dwarf_debug_sections
[];
562 /* Find the nearest line using DWARF 2 debugging information. */
563 extern bfd_boolean _bfd_dwarf2_find_nearest_line
564 (bfd
*, asymbol
**, asymbol
*, asection
*, bfd_vma
,
565 const char **, const char **, unsigned int *, unsigned int *,
566 const struct dwarf_debug_section
*, unsigned int, void **);
568 /* Find the bias between DWARF addresses and real addresses. */
569 extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias
570 (asymbol
**, void **);
572 /* Find inliner info after calling bfd_find_nearest_line. */
573 extern bfd_boolean _bfd_dwarf2_find_inliner_info
574 (bfd
*, const char **, const char **, unsigned int *, void **);
576 /* Read DWARF 2 debugging information. */
577 extern bfd_boolean _bfd_dwarf2_slurp_debug_info
578 (bfd
*, bfd
*, const struct dwarf_debug_section
*, asymbol
**, void **,
581 /* Clean up the data used to handle DWARF 2 debugging information. */
582 extern void _bfd_dwarf2_cleanup_debug_info
585 /* Create a new section entry. */
586 extern struct bfd_hash_entry
*bfd_section_hash_newfunc
587 (struct bfd_hash_entry
*, struct bfd_hash_table
*, const char *);
589 /* A routine to create entries for a bfd_link_hash_table. */
590 extern struct bfd_hash_entry
*_bfd_link_hash_newfunc
591 (struct bfd_hash_entry
*entry
, struct bfd_hash_table
*table
,
594 /* Initialize a bfd_link_hash_table. */
595 extern bfd_boolean _bfd_link_hash_table_init
596 (struct bfd_link_hash_table
*, bfd
*,
597 struct bfd_hash_entry
*(*) (struct bfd_hash_entry
*,
598 struct bfd_hash_table
*,
602 /* Generic link hash table creation routine. */
603 extern struct bfd_link_hash_table
*_bfd_generic_link_hash_table_create
606 /* Generic link hash table destruction routine. */
607 extern void _bfd_generic_link_hash_table_free
610 /* Generic add symbol routine. */
611 extern bfd_boolean _bfd_generic_link_add_symbols
612 (bfd
*, struct bfd_link_info
*);
614 /* Generic archive add symbol routine. */
615 extern bfd_boolean _bfd_generic_link_add_archive_symbols
616 (bfd
*, struct bfd_link_info
*,
617 bfd_boolean (*) (bfd
*, struct bfd_link_info
*,
618 struct bfd_link_hash_entry
*, const char *,
621 /* Forward declaration to avoid prototype errors. */
622 typedef struct bfd_link_hash_entry _bfd_link_hash_entry
;
624 /* Generic routine to add a single symbol. */
625 extern bfd_boolean _bfd_generic_link_add_one_symbol
626 (struct bfd_link_info
*, bfd
*, const char *name
, flagword
,
627 asection
*, bfd_vma
, const char *, bfd_boolean copy
,
628 bfd_boolean constructor
, struct bfd_link_hash_entry
**);
630 /* Generic routine to mark section as supplying symbols only. */
631 extern void _bfd_generic_link_just_syms
632 (asection
*, struct bfd_link_info
*);
634 /* Generic routine that does nothing. */
635 extern void _bfd_generic_copy_link_hash_symbol_type
636 (bfd
*, struct bfd_link_hash_entry
*, struct bfd_link_hash_entry
*);
638 /* Generic link routine. */
639 extern bfd_boolean _bfd_generic_final_link
640 (bfd
*, struct bfd_link_info
*);
642 extern bfd_boolean _bfd_generic_link_split_section
643 (bfd
*, struct bfd_section
*);
645 extern bfd_boolean _bfd_generic_section_already_linked
646 (bfd
*, asection
*, struct bfd_link_info
*);
648 /* Generic reloc_link_order processing routine. */
649 extern bfd_boolean _bfd_generic_reloc_link_order
650 (bfd
*, struct bfd_link_info
*, asection
*, struct bfd_link_order
*);
652 /* Default link order processing routine. */
653 extern bfd_boolean _bfd_default_link_order
654 (bfd
*, struct bfd_link_info
*, asection
*, struct bfd_link_order
*);
656 /* Count the number of reloc entries in a link order list. */
657 extern unsigned int _bfd_count_link_order_relocs
658 (struct bfd_link_order
*);
660 /* Final link relocation routine. */
661 extern bfd_reloc_status_type _bfd_final_link_relocate
662 (reloc_howto_type
*, bfd
*, asection
*, bfd_byte
*,
663 bfd_vma
, bfd_vma
, bfd_vma
);
665 /* Relocate a particular location by a howto and a value. */
666 extern bfd_reloc_status_type _bfd_relocate_contents
667 (reloc_howto_type
*, bfd
*, bfd_vma
, bfd_byte
*);
669 /* Clear a given location using a given howto. */
670 extern void _bfd_clear_contents (reloc_howto_type
*howto
, bfd
*input_bfd
,
671 asection
*input_section
, bfd_byte
*location
);
673 /* Link stabs in sections in the first pass. */
675 extern bfd_boolean _bfd_link_section_stabs
676 (bfd
*, struct stab_info
*, asection
*, asection
*, void **,
679 /* Eliminate stabs for discarded functions and symbols. */
680 extern bfd_boolean _bfd_discard_section_stabs
681 (bfd
*, asection
*, void *, bfd_boolean (*) (bfd_vma
, void *), void *);
683 /* Write out the .stab section when linking stabs in sections. */
685 extern bfd_boolean _bfd_write_section_stabs
686 (bfd
*, struct stab_info
*, asection
*, void **, bfd_byte
*);
688 /* Write out the .stabstr string table when linking stabs in sections. */
690 extern bfd_boolean _bfd_write_stab_strings
691 (bfd
*, struct stab_info
*);
693 /* Find an offset within a .stab section when linking stabs in
696 extern bfd_vma _bfd_stab_section_offset
697 (asection
*, void *, bfd_vma
);
699 /* Register a SEC_MERGE section as a candidate for merging. */
701 extern bfd_boolean _bfd_add_merge_section
702 (bfd
*, void **, asection
*, void **);
704 /* Attempt to merge SEC_MERGE sections. */
706 extern bfd_boolean _bfd_merge_sections
707 (bfd
*, struct bfd_link_info
*, void *, void (*) (bfd
*, asection
*));
709 /* Write out a merged section. */
711 extern bfd_boolean _bfd_write_merged_section
712 (bfd
*, asection
*, void *);
714 /* Find an offset within a modified SEC_MERGE section. */
716 extern bfd_vma _bfd_merged_section_offset
717 (bfd
*, asection
**, void *, bfd_vma
);
719 /* Tidy up when done. */
721 extern void _bfd_merge_sections_free (void *);
723 /* Create a string table. */
724 extern struct bfd_strtab_hash
*_bfd_stringtab_init
727 /* Create an XCOFF .debug section style string table. */
728 extern struct bfd_strtab_hash
*_bfd_xcoff_stringtab_init
731 /* Free a string table. */
732 extern void _bfd_stringtab_free
733 (struct bfd_strtab_hash
*);
735 /* Get the size of a string table. */
736 extern bfd_size_type _bfd_stringtab_size
737 (struct bfd_strtab_hash
*);
739 /* Add a string to a string table. */
740 extern bfd_size_type _bfd_stringtab_add
741 (struct bfd_strtab_hash
*, const char *, bfd_boolean hash
, bfd_boolean copy
);
743 /* Write out a string table. */
744 extern bfd_boolean _bfd_stringtab_emit
745 (bfd
*, struct bfd_strtab_hash
*);
747 /* Macros to tell if bfds are read or write enabled.
749 Note that bfds open for read may be scribbled into if the fd passed
750 to bfd_fdopenr is actually open both for read and write
751 simultaneously. However an output bfd will never be open for
752 read. Therefore sometimes you want to check bfd_read_p or
753 !bfd_read_p, and only sometimes bfd_write_p.
756 #define bfd_read_p(abfd) \
757 ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
758 #define bfd_write_p(abfd) \
759 ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
764 #define BFD_ASSERT(x) \
765 do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
768 do { bfd_assert(__FILE__,__LINE__); } while (0)
770 extern void _bfd_abort
771 (const char *, int, const char *) ATTRIBUTE_NORETURN
;
773 /* if gcc >= 2.6, we can give a function name, too */
774 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
775 #define __PRETTY_FUNCTION__ ((char *) NULL)
779 #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
781 /* Manipulate a system FILE but using BFD's "file_ptr", rather than
782 the system "off_t" or "off64_t", as the offset. */
783 extern file_ptr
_bfd_real_ftell (FILE *file
);
784 extern int _bfd_real_fseek (FILE *file
, file_ptr offset
, int whence
);
785 extern FILE *_bfd_real_fopen (const char *filename
, const char *modes
);
787 /* List of supported target vectors, and the default vector (if
788 bfd_default_vector[0] is NULL, there is no default). */
789 extern const bfd_target
* const *bfd_target_vector
;
790 extern const bfd_target
*bfd_default_vector
[];
792 /* List of associated target vectors. */
793 extern const bfd_target
* const *bfd_associated_vector
;
795 /* Functions shared by the ECOFF and MIPS ELF backends, which have no
796 other common header files. */
798 #if defined(__STDC__) || defined(ALMOST_STDC)
799 struct ecoff_find_line
;
802 extern bfd_boolean _bfd_ecoff_locate_line
803 (bfd
*, asection
*, bfd_vma
, struct ecoff_debug_info
* const,
804 const struct ecoff_debug_swap
* const, struct ecoff_find_line
*,
805 const char **, const char **, unsigned int *);
806 extern bfd_boolean _bfd_ecoff_get_accumulated_pdr
807 (void *, bfd_byte
*);
808 extern bfd_boolean _bfd_ecoff_get_accumulated_sym
809 (void *, bfd_byte
*);
810 extern bfd_boolean _bfd_ecoff_get_accumulated_ss
811 (void *, bfd_byte
*);
813 extern bfd_vma _bfd_get_gp_value
815 extern void _bfd_set_gp_value
818 /* Function shared by the COFF and ELF SH backends, which have no
819 other common header files. */
821 #ifndef _bfd_sh_align_load_span
822 extern bfd_boolean _bfd_sh_align_load_span
823 (bfd
*, asection
*, bfd_byte
*,
824 bfd_boolean (*) (bfd
*, asection
*, void *, bfd_byte
*, bfd_vma
),
825 void *, bfd_vma
**, bfd_vma
*, bfd_vma
, bfd_vma
, bfd_boolean
*);
828 /* This is the shape of the elements inside the already_linked hash
829 table. It maps a name onto a list of already_linked elements with
832 struct bfd_section_already_linked_hash_entry
834 struct bfd_hash_entry root
;
835 struct bfd_section_already_linked
*entry
;
838 struct bfd_section_already_linked
840 struct bfd_section_already_linked
*next
;
844 extern struct bfd_section_already_linked_hash_entry
*
845 bfd_section_already_linked_table_lookup (const char *);
846 extern bfd_boolean bfd_section_already_linked_table_insert
847 (struct bfd_section_already_linked_hash_entry
*, asection
*);
848 extern void bfd_section_already_linked_table_traverse
849 (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry
*,
852 extern bfd_vma
_bfd_read_unsigned_leb128 (bfd
*, bfd_byte
*, unsigned int *);
853 extern bfd_signed_vma
_bfd_read_signed_leb128 (bfd
*, bfd_byte
*, unsigned int *);
854 extern bfd_vma
_bfd_safe_read_leb128 (bfd
*, bfd_byte
*, unsigned int *,
855 bfd_boolean
, const bfd_byte
* const);