* value.h (value_contents_equal): New prototype.
[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
AC
3
4 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
5 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6
252b5132
RH
7 Written by Cygnus Support.
8
252b5132
RH
9This file is part of BFD, the Binary File Descriptor library.
10
11This program is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2 of the License, or
14(at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24
25/* Align an address upward to a boundary, expressed as a number of bytes.
26 E.g. align to an 8-byte boundary with argument of 8. Take care never
27 to wrap around if the address is within boundary-1 of the end of the
28 address space. */
dc810e39
AM
29#define BFD_ALIGN(this, boundary) \
30 ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
31 ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
252b5132
RH
32 : ~ (bfd_vma) 0)
33
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
37
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. */
c58b9523 40#define set_tdata(bfd, v) ((bfd)->tdata.any = (v))
252b5132
RH
41
42/* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points
43 to an instance of this structure. */
44
45struct bfd_in_memory
46{
47 /* Size of buffer. */
48 bfd_size_type size;
49 /* Buffer holding contents of BFD. */
50 bfd_byte *buffer;
51};
52
53/* tdata for an archive. For an input archive, cache
54 needs to be free()'d. For an output archive, symdefs do. */
55
56struct artdata {
57 file_ptr first_file_filepos;
58 /* Speed up searching the armap */
59 struct ar_cache *cache;
52b219b5 60 bfd *archive_head; /* Only interesting in output routines */
252b5132 61 carsym *symdefs; /* the symdef entries */
52b219b5 62 symindex symdef_count; /* how many there are */
252b5132
RH
63 char *extended_names; /* clever intel extension */
64 /* when more compilers are standard C, this can be a time_t */
65 long armap_timestamp; /* Timestamp value written into armap.
66 This is used for BSD archives to check
67 that the timestamp is recent enough
68 for the BSD linker to not complain,
69 just before we finish writing an
70 archive. */
71 file_ptr armap_datepos; /* Position within archive to seek to
72 rewrite the date field. */
c58b9523 73 void *tdata; /* Backend specific information. */
252b5132
RH
74};
75
76#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
77
78/* Goes in bfd's arelt_data slot */
79struct areltdata {
52b219b5
AM
80 char * arch_header; /* it's actually a string */
81 unsigned int parsed_size; /* octets of filesize not including ar_hdr */
82 char *filename; /* null-terminated */
252b5132
RH
83};
84
85#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
86
c58b9523
AM
87extern void *bfd_malloc
88 (bfd_size_type);
89extern void *bfd_realloc
90 (void *, bfd_size_type);
91extern void *bfd_zmalloc
92 (bfd_size_type);
252b5132 93
185d09ad 94extern void _bfd_default_error_handler (const char *s, ...);
252b5132
RH
95extern bfd_error_handler_type _bfd_error_handler;
96
97/* These routines allocate and free things on the BFD's objalloc. */
98
c58b9523
AM
99extern void *bfd_alloc
100 (bfd *, bfd_size_type);
101extern void *bfd_zalloc
102 (bfd *, bfd_size_type);
b34976b6 103extern void bfd_release
c58b9523 104 (bfd *, void *);
b34976b6
AM
105
106bfd * _bfd_create_empty_archive_element_shell
c58b9523 107 (bfd *obfd);
b34976b6 108bfd * _bfd_look_for_bfd_in_cache
c58b9523 109 (bfd *, file_ptr);
b34976b6 110bfd_boolean _bfd_add_bfd_to_archive_cache
c58b9523 111 (bfd *, file_ptr, bfd *);
b34976b6 112bfd_boolean _bfd_generic_mkarchive
c58b9523 113 (bfd *abfd);
b34976b6 114const bfd_target *bfd_generic_archive_p
c58b9523 115 (bfd *abfd);
b34976b6 116bfd_boolean bfd_slurp_armap
c58b9523 117 (bfd *abfd);
b34976b6 118bfd_boolean bfd_slurp_bsd_armap_f2
c58b9523 119 (bfd *abfd);
252b5132
RH
120#define bfd_slurp_bsd_armap bfd_slurp_armap
121#define bfd_slurp_coff_armap bfd_slurp_armap
b34976b6 122bfd_boolean _bfd_slurp_extended_name_table
c58b9523 123 (bfd *abfd);
b34976b6 124extern bfd_boolean _bfd_construct_extended_name_table
c58b9523 125 (bfd *, bfd_boolean, char **, bfd_size_type *);
b34976b6 126bfd_boolean _bfd_write_archive_contents
c58b9523 127 (bfd *abfd);
b34976b6 128bfd_boolean _bfd_compute_and_write_armap
c58b9523 129 (bfd *, unsigned int elength);
b34976b6 130bfd *_bfd_get_elt_at_filepos
c58b9523 131 (bfd *archive, file_ptr filepos);
b34976b6 132extern bfd *_bfd_generic_get_elt_at_index
c58b9523 133 (bfd *, symindex);
b34976b6 134bfd * _bfd_new_bfd
c58b9523 135 (void);
b34976b6 136void _bfd_delete_bfd
c58b9523 137 (bfd *);
b34976b6
AM
138
139bfd_boolean bfd_false
c58b9523 140 (bfd *ignore);
b34976b6 141bfd_boolean bfd_true
c58b9523
AM
142 (bfd *ignore);
143void *bfd_nullvoidptr
144 (bfd *ignore);
b34976b6 145int bfd_0
c58b9523 146 (bfd *ignore);
b34976b6 147unsigned int bfd_0u
c58b9523 148 (bfd *ignore);
b34976b6 149long bfd_0l
c58b9523 150 (bfd *ignore);
b34976b6 151long _bfd_n1
c58b9523 152 (bfd *ignore);
b34976b6 153void bfd_void
c58b9523 154 (bfd *ignore);
b34976b6
AM
155
156bfd *_bfd_new_bfd_contained_in
c58b9523 157 (bfd *);
b34976b6 158const bfd_target *_bfd_dummy_target
c58b9523 159 (bfd *abfd);
b34976b6
AM
160
161void bfd_dont_truncate_arname
c58b9523 162 (bfd *abfd, const char *filename, char *hdr);
b34976b6 163void bfd_bsd_truncate_arname
c58b9523 164 (bfd *abfd, const char *filename, char *hdr);
b34976b6 165void bfd_gnu_truncate_arname
c58b9523 166 (bfd *abfd, const char *filename, char *hdr);
b34976b6
AM
167
168bfd_boolean bsd_write_armap
c58b9523
AM
169 (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
170 int stridx);
b34976b6
AM
171
172bfd_boolean coff_write_armap
c58b9523
AM
173 (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count,
174 int stridx);
b34976b6 175
c58b9523
AM
176extern void *_bfd_generic_read_ar_hdr
177 (bfd *);
b34976b6 178
c58b9523
AM
179extern void *_bfd_generic_read_ar_hdr_mag
180 (bfd *, const char *);
b34976b6
AM
181
182bfd * bfd_generic_openr_next_archived_file
c58b9523 183 (bfd *archive, bfd *last_file);
b34976b6
AM
184
185int bfd_generic_stat_arch_elt
c58b9523 186 (bfd *, struct stat *);
252b5132
RH
187
188#define _bfd_read_ar_hdr(abfd) \
189 BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
190\f
191/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
192 BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
193
194#define _bfd_generic_close_and_cleanup bfd_true
195#define _bfd_generic_bfd_free_cached_info bfd_true
196#define _bfd_generic_new_section_hook \
c58b9523 197 ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
b34976b6 198extern bfd_boolean _bfd_generic_get_section_contents
c58b9523 199 (bfd *, asection *, void *, file_ptr, bfd_size_type);
b34976b6 200extern bfd_boolean _bfd_generic_get_section_contents_in_window
c58b9523 201 (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type);
252b5132
RH
202
203/* Generic routines to use for BFD_JUMP_TABLE_COPY. Use
204 BFD_JUMP_TABLE_COPY (_bfd_generic). */
205
206#define _bfd_generic_bfd_copy_private_bfd_data \
c58b9523 207 ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
252b5132 208#define _bfd_generic_bfd_merge_private_bfd_data \
c58b9523 209 ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
252b5132 210#define _bfd_generic_bfd_set_private_flags \
c58b9523 211 ((bfd_boolean (*) (bfd *, flagword)) bfd_true)
252b5132 212#define _bfd_generic_bfd_copy_private_section_data \
c58b9523 213 ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
252b5132 214#define _bfd_generic_bfd_copy_private_symbol_data \
c58b9523 215 ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
80fccad2
BW
216#define _bfd_generic_bfd_copy_private_header_data \
217 ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
252b5132 218#define _bfd_generic_bfd_print_private_bfd_data \
c58b9523 219 ((bfd_boolean (*) (bfd *, void *)) bfd_true)
252b5132
RH
220
221/* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
222 support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */
223
b34976b6 224extern char *_bfd_nocore_core_file_failing_command
c58b9523 225 (bfd *);
b34976b6 226extern int _bfd_nocore_core_file_failing_signal
c58b9523 227 (bfd *);
b34976b6 228extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
c58b9523 229 (bfd *, bfd *);
252b5132
RH
230
231/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
232 file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
233
234#define _bfd_noarchive_slurp_armap bfd_false
235#define _bfd_noarchive_slurp_extended_name_table bfd_false
236#define _bfd_noarchive_construct_extended_name_table \
c58b9523 237 ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \
252b5132
RH
238 bfd_false)
239#define _bfd_noarchive_truncate_arname \
c58b9523 240 ((void (*) (bfd *, const char *, char *)) bfd_void)
252b5132 241#define _bfd_noarchive_write_armap \
c58b9523 242 ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
252b5132
RH
243 bfd_false)
244#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
245#define _bfd_noarchive_openr_next_archived_file \
c58b9523 246 ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
252b5132 247#define _bfd_noarchive_get_elt_at_index \
c58b9523 248 ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr)
252b5132
RH
249#define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt
250#define _bfd_noarchive_update_armap_timestamp bfd_false
251
252/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD style
253 archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd). */
254
255#define _bfd_archive_bsd_slurp_armap bfd_slurp_bsd_armap
256#define _bfd_archive_bsd_slurp_extended_name_table \
257 _bfd_slurp_extended_name_table
b34976b6 258extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
c58b9523 259 (bfd *, char **, bfd_size_type *, const char **);
252b5132
RH
260#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
261#define _bfd_archive_bsd_write_armap bsd_write_armap
262#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
263#define _bfd_archive_bsd_openr_next_archived_file \
264 bfd_generic_openr_next_archived_file
265#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
266#define _bfd_archive_bsd_generic_stat_arch_elt \
267 bfd_generic_stat_arch_elt
b34976b6 268extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp
c58b9523 269 (bfd *);
252b5132
RH
270
271/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style
272 archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */
273
274#define _bfd_archive_coff_slurp_armap bfd_slurp_coff_armap
275#define _bfd_archive_coff_slurp_extended_name_table \
276 _bfd_slurp_extended_name_table
b34976b6 277extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
c58b9523 278 (bfd *, char **, bfd_size_type *, const char **);
252b5132
RH
279#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
280#define _bfd_archive_coff_write_armap coff_write_armap
281#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
282#define _bfd_archive_coff_openr_next_archived_file \
283 bfd_generic_openr_next_archived_file
284#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
285#define _bfd_archive_coff_generic_stat_arch_elt \
286 bfd_generic_stat_arch_elt
287#define _bfd_archive_coff_update_armap_timestamp bfd_true
288
289/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
290 support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
291
292#define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1
6cee3f79 293#define _bfd_nosymbols_canonicalize_symtab \
c58b9523 294 ((long (*) (bfd *, asymbol **)) _bfd_n1)
3f3c5c34 295#define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol
252b5132 296#define _bfd_nosymbols_print_symbol \
c58b9523 297 ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void)
252b5132 298#define _bfd_nosymbols_get_symbol_info \
c58b9523 299 ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void)
252b5132 300#define _bfd_nosymbols_bfd_is_local_label_name \
c58b9523 301 ((bfd_boolean (*) (bfd *, const char *)) bfd_false)
3c9458e9
NC
302#define _bfd_nosymbols_bfd_is_target_special_symbol \
303 ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
252b5132 304#define _bfd_nosymbols_get_lineno \
c58b9523 305 ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr)
252b5132 306#define _bfd_nosymbols_find_nearest_line \
c58b9523
AM
307 ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \
308 const char **, unsigned int *)) \
252b5132
RH
309 bfd_false)
310#define _bfd_nosymbols_bfd_make_debug_symbol \
c58b9523 311 ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr)
252b5132 312#define _bfd_nosymbols_read_minisymbols \
c58b9523 313 ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1)
252b5132 314#define _bfd_nosymbols_minisymbol_to_symbol \
c58b9523 315 ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \
252b5132
RH
316 bfd_nullvoidptr)
317
318/* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc
319 support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */
320
321#define _bfd_norelocs_get_reloc_upper_bound \
c58b9523 322 ((long (*) (bfd *, asection *)) _bfd_n1)
252b5132 323#define _bfd_norelocs_canonicalize_reloc \
c58b9523 324 ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1)
252b5132 325#define _bfd_norelocs_bfd_reloc_type_lookup \
c58b9523 326 ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
252b5132
RH
327
328/* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not
329 be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */
330
331#define _bfd_nowrite_set_arch_mach \
c58b9523 332 ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \
252b5132
RH
333 bfd_false)
334#define _bfd_nowrite_set_section_contents \
0f867abe 335 ((bfd_boolean (*) (bfd *, asection *, const void *, file_ptr, bfd_size_type)) \
252b5132
RH
336 bfd_false)
337
338/* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use
339 BFD_JUMP_TABLE_WRITE (_bfd_generic). */
340
341#define _bfd_generic_set_arch_mach bfd_default_set_arch_mach
b34976b6 342extern bfd_boolean _bfd_generic_set_section_contents
0f867abe 343 (bfd *, asection *, const void *, file_ptr, bfd_size_type);
252b5132
RH
344
345/* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not
346 support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */
347
c58b9523 348#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0)
252b5132 349#define _bfd_nolink_bfd_get_relocated_section_contents \
c58b9523
AM
350 ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \
351 bfd_byte *, bfd_boolean, asymbol **)) \
252b5132
RH
352 bfd_nullvoidptr)
353#define _bfd_nolink_bfd_relax_section \
b34976b6 354 ((bfd_boolean (*) \
c58b9523 355 (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \
252b5132
RH
356 bfd_false)
357#define _bfd_nolink_bfd_gc_sections \
c58b9523 358 ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
252b5132 359 bfd_false)
8550eb6e 360#define _bfd_nolink_bfd_merge_sections \
c58b9523 361 ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \
8550eb6e 362 bfd_false)
72adc230
AM
363#define _bfd_nolink_bfd_is_group_section \
364 ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \
365 bfd_false)
e61463e1 366#define _bfd_nolink_bfd_discard_group \
198beae2 367 ((bfd_boolean (*) (bfd *, struct bfd_section *)) \
e61463e1 368 bfd_false)
252b5132 369#define _bfd_nolink_bfd_link_hash_table_create \
c58b9523 370 ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr)
e2d34d7d 371#define _bfd_nolink_bfd_link_hash_table_free \
c58b9523 372 ((void (*) (struct bfd_link_hash_table *)) bfd_void)
252b5132 373#define _bfd_nolink_bfd_link_add_symbols \
c58b9523 374 ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
2d653fc7 375#define _bfd_nolink_bfd_link_just_syms \
c58b9523 376 ((void (*) (asection *, struct bfd_link_info *)) bfd_void)
252b5132 377#define _bfd_nolink_bfd_final_link \
c58b9523 378 ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false)
252b5132 379#define _bfd_nolink_bfd_link_split_section \
198beae2 380 ((bfd_boolean (*) (bfd *, struct bfd_section *)) bfd_false)
082b7297
L
381#define _bfd_nolink_section_already_linked \
382 ((void (*) (bfd *, struct bfd_section *)) bfd_void)
252b5132
RH
383
384/* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not
385 have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC
386 (_bfd_nodynamic). */
387
388#define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1
389#define _bfd_nodynamic_canonicalize_dynamic_symtab \
c58b9523 390 ((long (*) (bfd *, asymbol **)) _bfd_n1)
4c45e5c9 391#define _bfd_nodynamic_get_synthetic_symtab \
c9727e01 392 ((long (*) (bfd *, long, asymbol **, long, asymbol **, asymbol **)) _bfd_n1)
252b5132
RH
393#define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1
394#define _bfd_nodynamic_canonicalize_dynamic_reloc \
c58b9523 395 ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1)
252b5132
RH
396\f
397/* Generic routine to determine of the given symbol is a local
398 label. */
b34976b6 399extern bfd_boolean bfd_generic_is_local_label_name
c58b9523 400 (bfd *, const char *);
252b5132
RH
401
402/* Generic minisymbol routines. */
403extern long _bfd_generic_read_minisymbols
c58b9523 404 (bfd *, bfd_boolean, void **, unsigned int *);
252b5132 405extern asymbol *_bfd_generic_minisymbol_to_symbol
c58b9523 406 (bfd *, bfd_boolean, const void *, asymbol *);
252b5132
RH
407
408/* Find the nearest line using .stab/.stabstr sections. */
b34976b6 409extern bfd_boolean _bfd_stab_section_find_nearest_line
c58b9523
AM
410 (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *,
411 const char **, const char **, unsigned int *, void **);
252b5132
RH
412
413/* Find the neaderst line using DWARF 1 debugging information. */
b34976b6 414extern bfd_boolean _bfd_dwarf1_find_nearest_line
c58b9523
AM
415 (bfd *, asection *, asymbol **, bfd_vma, const char **,
416 const char **, unsigned int *);
252b5132
RH
417
418/* Find the nearest line using DWARF 2 debugging information. */
b34976b6 419extern bfd_boolean _bfd_dwarf2_find_nearest_line
c58b9523
AM
420 (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
421 unsigned int *, unsigned int, void **);
252b5132 422
73e87d70
AM
423/* Create a new section entry. */
424extern struct bfd_hash_entry *bfd_section_hash_newfunc
c58b9523 425 (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
73e87d70 426
252b5132
RH
427/* A routine to create entries for a bfd_link_hash_table. */
428extern struct bfd_hash_entry *_bfd_link_hash_newfunc
c58b9523
AM
429 (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
430 const char *string);
252b5132
RH
431
432/* Initialize a bfd_link_hash_table. */
b34976b6 433extern bfd_boolean _bfd_link_hash_table_init
c58b9523
AM
434 (struct bfd_link_hash_table *, bfd *,
435 struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
436 struct bfd_hash_table *,
437 const char *));
252b5132
RH
438
439/* Generic link hash table creation routine. */
440extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create
c58b9523 441 (bfd *);
252b5132 442
e2d34d7d
DJ
443/* Generic link hash table destruction routine. */
444extern void _bfd_generic_link_hash_table_free
c58b9523 445 (struct bfd_link_hash_table *);
e2d34d7d 446
252b5132 447/* Generic add symbol routine. */
b34976b6 448extern bfd_boolean _bfd_generic_link_add_symbols
c58b9523 449 (bfd *, struct bfd_link_info *);
252b5132
RH
450
451/* Generic add symbol routine. This version is used by targets for
452 which the linker must collect constructors and destructors by name,
453 as the collect2 program does. */
b34976b6 454extern bfd_boolean _bfd_generic_link_add_symbols_collect
c58b9523 455 (bfd *, struct bfd_link_info *);
252b5132
RH
456
457/* Generic archive add symbol routine. */
b34976b6 458extern bfd_boolean _bfd_generic_link_add_archive_symbols
c58b9523
AM
459 (bfd *, struct bfd_link_info *,
460 bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *));
252b5132 461
252b5132
RH
462/* Forward declaration to avoid prototype errors. */
463typedef struct bfd_link_hash_entry _bfd_link_hash_entry;
464
465/* Generic routine to add a single symbol. */
b34976b6 466extern bfd_boolean _bfd_generic_link_add_one_symbol
c58b9523
AM
467 (struct bfd_link_info *, bfd *, const char *name, flagword,
468 asection *, bfd_vma, const char *, bfd_boolean copy,
469 bfd_boolean constructor, struct bfd_link_hash_entry **);
252b5132 470
2d653fc7
AM
471/* Generic routine to mark section as supplying symbols only. */
472extern void _bfd_generic_link_just_syms
c58b9523 473 (asection *, struct bfd_link_info *);
2d653fc7 474
252b5132 475/* Generic link routine. */
b34976b6 476extern bfd_boolean _bfd_generic_final_link
c58b9523 477 (bfd *, struct bfd_link_info *);
252b5132 478
b34976b6 479extern bfd_boolean _bfd_generic_link_split_section
198beae2 480 (bfd *, struct bfd_section *);
252b5132 481
082b7297
L
482extern void _bfd_generic_section_already_linked
483 (bfd *, struct bfd_section *);
484
252b5132 485/* Generic reloc_link_order processing routine. */
b34976b6 486extern bfd_boolean _bfd_generic_reloc_link_order
c58b9523 487 (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
252b5132
RH
488
489/* Default link order processing routine. */
b34976b6 490extern bfd_boolean _bfd_default_link_order
c58b9523 491 (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *);
252b5132
RH
492
493/* Count the number of reloc entries in a link order list. */
494extern unsigned int _bfd_count_link_order_relocs
c58b9523 495 (struct bfd_link_order *);
252b5132
RH
496
497/* Final link relocation routine. */
498extern bfd_reloc_status_type _bfd_final_link_relocate
c58b9523
AM
499 (reloc_howto_type *, bfd *, asection *, bfd_byte *,
500 bfd_vma, bfd_vma, bfd_vma);
252b5132
RH
501
502/* Relocate a particular location by a howto and a value. */
503extern bfd_reloc_status_type _bfd_relocate_contents
c58b9523 504 (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *);
252b5132
RH
505
506/* Link stabs in sections in the first pass. */
507
b34976b6 508extern bfd_boolean _bfd_link_section_stabs
3722b82f
AM
509 (bfd *, struct stab_info *, asection *, asection *, void **,
510 bfd_size_type *);
252b5132 511
73d074b4 512/* Eliminate stabs for discarded functions and symbols. */
b34976b6 513extern bfd_boolean _bfd_discard_section_stabs
c58b9523 514 (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *);
73d074b4 515
252b5132
RH
516/* Write out the .stab section when linking stabs in sections. */
517
b34976b6 518extern bfd_boolean _bfd_write_section_stabs
3722b82f 519 (bfd *, struct stab_info *, asection *, void **, bfd_byte *);
252b5132
RH
520
521/* Write out the .stabstr string table when linking stabs in sections. */
522
b34976b6 523extern bfd_boolean _bfd_write_stab_strings
3722b82f 524 (bfd *, struct stab_info *);
252b5132
RH
525
526/* Find an offset within a .stab section when linking stabs in
527 sections. */
528
529extern bfd_vma _bfd_stab_section_offset
eea6121a 530 (asection *, void *, bfd_vma);
252b5132 531
57ceae94 532/* Register a SEC_MERGE section as a candidate for merging. */
f5fa8ca2 533
57ceae94 534extern bfd_boolean _bfd_add_merge_section
c58b9523 535 (bfd *, void **, asection *, void **);
f5fa8ca2 536
8550eb6e
JJ
537/* Attempt to merge SEC_MERGE sections. */
538
b34976b6 539extern bfd_boolean _bfd_merge_sections
57ceae94 540 (bfd *, struct bfd_link_info *, void *, void (*) (bfd *, asection *));
8550eb6e 541
f5fa8ca2
JJ
542/* Write out a merged section. */
543
b34976b6 544extern bfd_boolean _bfd_write_merged_section
c58b9523 545 (bfd *, asection *, void *);
f5fa8ca2
JJ
546
547/* Find an offset within a modified SEC_MERGE section. */
548
549extern bfd_vma _bfd_merged_section_offset
753731ee 550 (bfd *, asection **, void *, bfd_vma);
f5fa8ca2 551
252b5132 552/* Create a string table. */
b34976b6 553extern struct bfd_strtab_hash *_bfd_stringtab_init
c58b9523 554 (void);
252b5132
RH
555
556/* Create an XCOFF .debug section style string table. */
b34976b6 557extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
c58b9523 558 (void);
252b5132
RH
559
560/* Free a string table. */
b34976b6 561extern void _bfd_stringtab_free
c58b9523 562 (struct bfd_strtab_hash *);
252b5132
RH
563
564/* Get the size of a string table. */
b34976b6 565extern bfd_size_type _bfd_stringtab_size
c58b9523 566 (struct bfd_strtab_hash *);
252b5132
RH
567
568/* Add a string to a string table. */
569extern bfd_size_type _bfd_stringtab_add
c58b9523 570 (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy);
252b5132
RH
571
572/* Write out a string table. */
b34976b6 573extern bfd_boolean _bfd_stringtab_emit
c58b9523 574 (bfd *, struct bfd_strtab_hash *);
875f7f69
JR
575
576/* Check that endianness of input and output file match. */
b34976b6 577extern bfd_boolean _bfd_generic_verify_endian_match
c58b9523 578 (bfd *, bfd *);
252b5132
RH
579\f
580/* Macros to tell if bfds are read or write enabled.
581
582 Note that bfds open for read may be scribbled into if the fd passed
583 to bfd_fdopenr is actually open both for read and write
584 simultaneously. However an output bfd will never be open for
585 read. Therefore sometimes you want to check bfd_read_p or
586 !bfd_read_p, and only sometimes bfd_write_p.
587*/
588
c58b9523
AM
589#define bfd_read_p(abfd) \
590 ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
591#define bfd_write_p(abfd) \
592 ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
252b5132 593
b34976b6 594void bfd_assert
c58b9523 595 (const char*,int);
252b5132
RH
596
597#define BFD_ASSERT(x) \
f12123c0 598 do { if (!(x)) bfd_assert(__FILE__,__LINE__); } while (0)
252b5132
RH
599
600#define BFD_FAIL() \
f12123c0 601 do { bfd_assert(__FILE__,__LINE__); } while (0)
252b5132 602
b34976b6 603extern void _bfd_abort
c58b9523 604 (const char *, int, const char *) ATTRIBUTE_NORETURN;
c0bed66d 605
a1934524
AM
606/* if gcc >= 2.6, we can give a function name, too */
607#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
c0bed66d
ILT
608#define __PRETTY_FUNCTION__ ((char *) NULL)
609#endif
610
611#undef abort
612#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
613
7c192733
AC
614/* Manipulate a system FILE but using BFD's "file_ptr", rather than
615 the system "off_t" or "off64_t", as the offset. */
616extern file_ptr real_ftell (FILE *file);
617extern int real_fseek (FILE *file, file_ptr offset, int whence);
618
b34976b6 619FILE * bfd_cache_lookup_worker
c58b9523 620 (bfd *);
252b5132
RH
621
622extern bfd *bfd_last_cache;
623
624/* List of supported target vectors, and the default vector (if
625 bfd_default_vector[0] is NULL, there is no default). */
7340082d 626extern const bfd_target * const *bfd_target_vector;
252b5132
RH
627extern const bfd_target *bfd_default_vector[];
628
08f74004
AM
629/* List of associated target vectors. */
630extern const bfd_target * const *bfd_associated_vector;
631
252b5132
RH
632/* Functions shared by the ECOFF and MIPS ELF backends, which have no
633 other common header files. */
634
635#if defined(__STDC__) || defined(ALMOST_STDC)
636struct ecoff_find_line;
637#endif
638
b34976b6 639extern bfd_boolean _bfd_ecoff_locate_line
c58b9523
AM
640 (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
641 const struct ecoff_debug_swap * const, struct ecoff_find_line *,
642 const char **, const char **, unsigned int *);
b34976b6 643extern bfd_boolean _bfd_ecoff_get_accumulated_pdr
c58b9523 644 (void *, bfd_byte *);
b34976b6 645extern bfd_boolean _bfd_ecoff_get_accumulated_sym
c58b9523 646 (void *, bfd_byte *);
b34976b6 647extern bfd_boolean _bfd_ecoff_get_accumulated_ss
c58b9523 648 (void *, bfd_byte *);
b34976b6
AM
649
650extern bfd_vma _bfd_get_gp_value
c58b9523 651 (bfd *);
b34976b6 652extern void _bfd_set_gp_value
c58b9523 653 (bfd *, bfd_vma);
252b5132
RH
654
655/* Function shared by the COFF and ELF SH backends, which have no
656 other common header files. */
657
c58b9523 658#ifndef _bfd_sh_align_load_span
b34976b6 659extern bfd_boolean _bfd_sh_align_load_span
c58b9523
AM
660 (bfd *, asection *, bfd_byte *,
661 bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma),
662 void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *);
663#endif
082b7297
L
664
665/* This is the shape of the elements inside the already_linked hash
666 table. It maps a name onto a list of already_linked elements with
667 the same name. */
668
669struct bfd_section_already_linked_hash_entry
670{
671 struct bfd_hash_entry root;
672 struct bfd_section_already_linked *entry;
673};
674
675struct bfd_section_already_linked
676{
677 struct bfd_section_already_linked *next;
678 asection *sec;
679};
680
681extern struct bfd_section_already_linked_hash_entry *
682 bfd_section_already_linked_table_lookup (const char *);
683extern void bfd_section_already_linked_table_insert
684 (struct bfd_section_already_linked_hash_entry *, asection *);
3d7f7666
L
685extern void bfd_section_already_linked_table_traverse
686 (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *,
687 void *), void *);
688
c0c28ab8
L
689extern bfd_vma read_unsigned_leb128 (bfd *, char *, unsigned int *);
690extern bfd_signed_vma read_signed_leb128 (bfd *, char *, unsigned int *);
691
This page took 0.490299 seconds and 4 git commands to generate.