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