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