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