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