1@section @code{typedef bfd}
2A BFD has type @code{bfd}; objects of this type are the
3cornerstone of any application using BFD. Using BFD
4consists of making references though the BFD and to data in the BFD.
5
6Here is the structure that defines the type @code{bfd}.  It
7contains the major data about the file and pointers
8to the rest of the data.
9
10
11@example
12
13enum bfd_direction
14  @{
15    no_direction = 0,
16    read_direction = 1,
17    write_direction = 2,
18    both_direction = 3
19  @};
20
21struct bfd
22@{
23  /* A unique identifier of the BFD  */
24  unsigned int id;
25
26  /* The filename the application opened the BFD with.  */
27  const char *filename;
28
29  /* A pointer to the target jump table.  */
30  const struct bfd_target *xvec;
31
32  /* The IOSTREAM, and corresponding IO vector that provide access
33     to the file backing the BFD.  */
34  void *iostream;
35  const struct bfd_iovec *iovec;
36
37  /* The caching routines use these to maintain a
38     least-recently-used list of BFDs.  */
39  struct bfd *lru_prev, *lru_next;
40
41  /* When a file is closed by the caching routines, BFD retains
42     state information on the file here...  */
43  ufile_ptr where;
44
45  /* File modified time, if mtime_set is TRUE.  */
46  long mtime;
47
48  /* Reserved for an unimplemented file locking extension.  */
49  int ifd;
50
51  /* The format which belongs to the BFD. (object, core, etc.)  */
52  bfd_format format;
53
54  /* The direction with which the BFD was opened.  */
55  enum bfd_direction direction;
56
57  /* Format_specific flags.  */
58  flagword flags;
59
60  /* Values that may appear in the flags field of a BFD.  These also
61     appear in the object_flags field of the bfd_target structure, where
62     they indicate the set of flags used by that backend (not all flags
63     are meaningful for all object file formats) (FIXME: at the moment,
64     the object_flags values have mostly just been copied from backend
65     to another, and are not necessarily correct).  */
66
67#define BFD_NO_FLAGS   0x00
68
69  /* BFD contains relocation entries.  */
70#define HAS_RELOC      0x01
71
72  /* BFD is directly executable.  */
73#define EXEC_P         0x02
74
75  /* BFD has line number information (basically used for F_LNNO in a
76     COFF header).  */
77#define HAS_LINENO     0x04
78
79  /* BFD has debugging information.  */
80#define HAS_DEBUG      0x08
81
82  /* BFD has symbols.  */
83#define HAS_SYMS       0x10
84
85  /* BFD has local symbols (basically used for F_LSYMS in a COFF
86     header).  */
87#define HAS_LOCALS     0x20
88
89  /* BFD is a dynamic object.  */
90#define DYNAMIC        0x40
91
92  /* Text section is write protected (if D_PAGED is not set, this is
93     like an a.out NMAGIC file) (the linker sets this by default, but
94     clears it for -r or -N).  */
95#define WP_TEXT        0x80
96
97  /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
98     linker sets this by default, but clears it for -r or -n or -N).  */
99#define D_PAGED        0x100
100
101  /* BFD is relaxable (this means that bfd_relax_section may be able to
102     do something) (sometimes bfd_relax_section can do something even if
103     this is not set).  */
104#define BFD_IS_RELAXABLE 0x200
105
106  /* This may be set before writing out a BFD to request using a
107     traditional format.  For example, this is used to request that when
108     writing out an a.out object the symbols not be hashed to eliminate
109     duplicates.  */
110#define BFD_TRADITIONAL_FORMAT 0x400
111
112  /* This flag indicates that the BFD contents are actually cached
113     in memory.  If this is set, iostream points to a bfd_in_memory
114     struct.  */
115#define BFD_IN_MEMORY 0x800
116
117  /* The sections in this BFD specify a memory page.  */
118#define HAS_LOAD_PAGE 0x1000
119
120  /* This BFD has been created by the linker and doesn't correspond
121     to any input file.  */
122#define BFD_LINKER_CREATED 0x2000
123
124  /* This may be set before writing out a BFD to request that it
125     be written using values for UIDs, GIDs, timestamps, etc. that
126     will be consistent from run to run.  */
127#define BFD_DETERMINISTIC_OUTPUT 0x4000
128
129  /* Compress sections in this BFD.  */
130#define BFD_COMPRESS 0x8000
131
132  /* Decompress sections in this BFD.  */
133#define BFD_DECOMPRESS 0x10000
134
135  /* BFD is a dummy, for plugins.  */
136#define BFD_PLUGIN 0x20000
137
138  /* Flags bits to be saved in bfd_preserve_save.  */
139#define BFD_FLAGS_SAVED \
140  (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN)
141
142  /* Flags bits which are for BFD use only.  */
143#define BFD_FLAGS_FOR_BFD_USE_MASK \
144  (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \
145   | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT)
146
147  /* Currently my_archive is tested before adding origin to
148     anything. I believe that this can become always an add of
149     origin, with origin set to 0 for non archive files.  */
150  ufile_ptr origin;
151
152  /* The origin in the archive of the proxy entry.  This will
153     normally be the same as origin, except for thin archives,
154     when it will contain the current offset of the proxy in the
155     thin archive rather than the offset of the bfd in its actual
156     container.  */
157  ufile_ptr proxy_origin;
158
159  /* A hash table for section names.  */
160  struct bfd_hash_table section_htab;
161
162  /* Pointer to linked list of sections.  */
163  struct bfd_section *sections;
164
165  /* The last section on the section list.  */
166  struct bfd_section *section_last;
167
168  /* The number of sections.  */
169  unsigned int section_count;
170
171  /* Stuff only useful for object files:
172     The start address.  */
173  bfd_vma start_address;
174
175  /* Used for input and output.  */
176  unsigned int symcount;
177
178  /* Symbol table for output BFD (with symcount entries).
179     Also used by the linker to cache input BFD symbols.  */
180  struct bfd_symbol  **outsymbols;
181
182  /* Used for slurped dynamic symbol tables.  */
183  unsigned int dynsymcount;
184
185  /* Pointer to structure which contains architecture information.  */
186  const struct bfd_arch_info *arch_info;
187
188  /* Stuff only useful for archives.  */
189  void *arelt_data;
190  struct bfd *my_archive;      /* The containing archive BFD.  */
191  struct bfd *archive_next;    /* The next BFD in the archive.  */
192  struct bfd *archive_head;    /* The first BFD in the archive.  */
193  struct bfd *nested_archives; /* List of nested archive in a flattened
194                                  thin archive.  */
195
196  /* A chain of BFD structures involved in a link.  */
197  struct bfd *link_next;
198
199  /* A field used by _bfd_generic_link_add_archive_symbols.  This will
200     be used only for archive elements.  */
201  int archive_pass;
202
203  /* Used by the back end to hold private data.  */
204  union
205    @{
206      struct aout_data_struct *aout_data;
207      struct artdata *aout_ar_data;
208      struct _oasys_data *oasys_obj_data;
209      struct _oasys_ar_data *oasys_ar_data;
210      struct coff_tdata *coff_obj_data;
211      struct pe_tdata *pe_obj_data;
212      struct xcoff_tdata *xcoff_obj_data;
213      struct ecoff_tdata *ecoff_obj_data;
214      struct ieee_data_struct *ieee_data;
215      struct ieee_ar_data_struct *ieee_ar_data;
216      struct srec_data_struct *srec_data;
217      struct verilog_data_struct *verilog_data;
218      struct ihex_data_struct *ihex_data;
219      struct tekhex_data_struct *tekhex_data;
220      struct elf_obj_tdata *elf_obj_data;
221      struct nlm_obj_tdata *nlm_obj_data;
222      struct bout_data_struct *bout_data;
223      struct mmo_data_struct *mmo_data;
224      struct sun_core_struct *sun_core_data;
225      struct sco5_core_struct *sco5_core_data;
226      struct trad_core_struct *trad_core_data;
227      struct som_data_struct *som_data;
228      struct hpux_core_struct *hpux_core_data;
229      struct hppabsd_core_struct *hppabsd_core_data;
230      struct sgi_core_struct *sgi_core_data;
231      struct lynx_core_struct *lynx_core_data;
232      struct osf_core_struct *osf_core_data;
233      struct cisco_core_struct *cisco_core_data;
234      struct versados_data_struct *versados_data;
235      struct netbsd_core_struct *netbsd_core_data;
236      struct mach_o_data_struct *mach_o_data;
237      struct mach_o_fat_data_struct *mach_o_fat_data;
238      struct plugin_data_struct *plugin_data;
239      struct bfd_pef_data_struct *pef_data;
240      struct bfd_pef_xlib_data_struct *pef_xlib_data;
241      struct bfd_sym_data_struct *sym_data;
242      void *any;
243    @}
244  tdata;
245
246  /* Used by the application to hold private data.  */
247  void *usrdata;
248
249  /* Where all the allocated stuff under this BFD goes.  This is a
250     struct objalloc *, but we use void * to avoid requiring the inclusion
251     of objalloc.h.  */
252  void *memory;
253
254  /* Is the file descriptor being cached?  That is, can it be closed as
255     needed, and re-opened when accessed later?  */
256  unsigned int cacheable : 1;
257
258  /* Marks whether there was a default target specified when the
259     BFD was opened. This is used to select which matching algorithm
260     to use to choose the back end.  */
261  unsigned int target_defaulted : 1;
262
263  /* ... and here: (``once'' means at least once).  */
264  unsigned int opened_once : 1;
265
266  /* Set if we have a locally maintained mtime value, rather than
267     getting it from the file each time.  */
268  unsigned int mtime_set : 1;
269
270  /* Flag set if symbols from this BFD should not be exported.  */
271  unsigned int no_export : 1;
272
273  /* Remember when output has begun, to stop strange things
274     from happening.  */
275  unsigned int output_has_begun : 1;
276
277  /* Have archive map.  */
278  unsigned int has_armap : 1;
279
280  /* Set if this is a thin archive.  */
281  unsigned int is_thin_archive : 1;
282
283  /* Set if only required symbols should be added in the link hash table for
284     this object.  Used by VMS linkers.  */
285  unsigned int selective_search : 1;
286@};
287
288@end example
289@section Error reporting
290Most BFD functions return nonzero on success (check their
291individual documentation for precise semantics).  On an error,
292they call @code{bfd_set_error} to set an error condition that callers
293can check by calling @code{bfd_get_error}.
294If that returns @code{bfd_error_system_call}, then check
295@code{errno}.
296
297The easiest way to report a BFD error to the user is to
298use @code{bfd_perror}.
299
300@subsection Type @code{bfd_error_type}
301The values returned by @code{bfd_get_error} are defined by the
302enumerated type @code{bfd_error_type}.
303
304
305@example
306
307typedef enum bfd_error
308@{
309  bfd_error_no_error = 0,
310  bfd_error_system_call,
311  bfd_error_invalid_target,
312  bfd_error_wrong_format,
313  bfd_error_wrong_object_format,
314  bfd_error_invalid_operation,
315  bfd_error_no_memory,
316  bfd_error_no_symbols,
317  bfd_error_no_armap,
318  bfd_error_no_more_archived_files,
319  bfd_error_malformed_archive,
320  bfd_error_file_not_recognized,
321  bfd_error_file_ambiguously_recognized,
322  bfd_error_no_contents,
323  bfd_error_nonrepresentable_section,
324  bfd_error_no_debug_section,
325  bfd_error_bad_value,
326  bfd_error_file_truncated,
327  bfd_error_file_too_big,
328  bfd_error_on_input,
329  bfd_error_invalid_error_code
330@}
331bfd_error_type;
332
333@end example
334@findex bfd_get_error
335@subsubsection @code{bfd_get_error}
336@strong{Synopsis}
337@example
338bfd_error_type bfd_get_error (void);
339@end example
340@strong{Description}@*
341Return the current BFD error condition.
342
343@findex bfd_set_error
344@subsubsection @code{bfd_set_error}
345@strong{Synopsis}
346@example
347void bfd_set_error (bfd_error_type error_tag, ...);
348@end example
349@strong{Description}@*
350Set the BFD error condition to be @var{error_tag}.
351If @var{error_tag} is bfd_error_on_input, then this function
352takes two more parameters, the input bfd where the error
353occurred, and the bfd_error_type error.
354
355@findex bfd_errmsg
356@subsubsection @code{bfd_errmsg}
357@strong{Synopsis}
358@example
359const char *bfd_errmsg (bfd_error_type error_tag);
360@end example
361@strong{Description}@*
362Return a string describing the error @var{error_tag}, or
363the system error if @var{error_tag} is @code{bfd_error_system_call}.
364
365@findex bfd_perror
366@subsubsection @code{bfd_perror}
367@strong{Synopsis}
368@example
369void bfd_perror (const char *message);
370@end example
371@strong{Description}@*
372Print to the standard error stream a string describing the
373last BFD error that occurred, or the last system error if
374the last BFD error was a system call failure.  If @var{message}
375is non-NULL and non-empty, the error string printed is preceded
376by @var{message}, a colon, and a space.  It is followed by a newline.
377
378@subsection BFD error handler
379Some BFD functions want to print messages describing the
380problem.  They call a BFD error handler function.  This
381function may be overridden by the program.
382
383The BFD error handler acts like printf.
384
385
386@example
387
388typedef void (*bfd_error_handler_type) (const char *, ...);
389
390@end example
391@findex bfd_set_error_handler
392@subsubsection @code{bfd_set_error_handler}
393@strong{Synopsis}
394@example
395bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
396@end example
397@strong{Description}@*
398Set the BFD error handler function.  Returns the previous
399function.
400
401@findex bfd_set_error_program_name
402@subsubsection @code{bfd_set_error_program_name}
403@strong{Synopsis}
404@example
405void bfd_set_error_program_name (const char *);
406@end example
407@strong{Description}@*
408Set the program name to use when printing a BFD error.  This
409is printed before the error message followed by a colon and
410space.  The string must not be changed after it is passed to
411this function.
412
413@findex bfd_get_error_handler
414@subsubsection @code{bfd_get_error_handler}
415@strong{Synopsis}
416@example
417bfd_error_handler_type bfd_get_error_handler (void);
418@end example
419@strong{Description}@*
420Return the BFD error handler function.
421
422@section Miscellaneous
423
424
425@subsection Miscellaneous functions
426
427
428@findex bfd_get_reloc_upper_bound
429@subsubsection @code{bfd_get_reloc_upper_bound}
430@strong{Synopsis}
431@example
432long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
433@end example
434@strong{Description}@*
435Return the number of bytes required to store the
436relocation information associated with section @var{sect}
437attached to bfd @var{abfd}.  If an error occurs, return -1.
438
439@findex bfd_canonicalize_reloc
440@subsubsection @code{bfd_canonicalize_reloc}
441@strong{Synopsis}
442@example
443long bfd_canonicalize_reloc
444   (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
445@end example
446@strong{Description}@*
447Call the back end associated with the open BFD
448@var{abfd} and translate the external form of the relocation
449information attached to @var{sec} into the internal canonical
450form.  Place the table into memory at @var{loc}, which has
451been preallocated, usually by a call to
452@code{bfd_get_reloc_upper_bound}.  Returns the number of relocs, or
453-1 on error.
454
455The @var{syms} table is also needed for horrible internal magic
456reasons.
457
458@findex bfd_set_reloc
459@subsubsection @code{bfd_set_reloc}
460@strong{Synopsis}
461@example
462void bfd_set_reloc
463   (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
464@end example
465@strong{Description}@*
466Set the relocation pointer and count within
467section @var{sec} to the values @var{rel} and @var{count}.
468The argument @var{abfd} is ignored.
469
470@findex bfd_set_file_flags
471@subsubsection @code{bfd_set_file_flags}
472@strong{Synopsis}
473@example
474bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
475@end example
476@strong{Description}@*
477Set the flag word in the BFD @var{abfd} to the value @var{flags}.
478
479Possible errors are:
480@itemize @bullet
481
482@item
483@code{bfd_error_wrong_format} - The target bfd was not of object format.
484@item
485@code{bfd_error_invalid_operation} - The target bfd was open for reading.
486@item
487@code{bfd_error_invalid_operation} -
488The flag word contained a bit which was not applicable to the
489type of file.  E.g., an attempt was made to set the @code{D_PAGED} bit
490on a BFD format which does not support demand paging.
491@end itemize
492
493@findex bfd_get_arch_size
494@subsubsection @code{bfd_get_arch_size}
495@strong{Synopsis}
496@example
497int bfd_get_arch_size (bfd *abfd);
498@end example
499@strong{Description}@*
500Returns the architecture address size, in bits, as determined
501by the object file's format.  For ELF, this information is
502included in the header.
503
504@strong{Returns}@*
505Returns the arch size in bits if known, @code{-1} otherwise.
506
507@findex bfd_get_sign_extend_vma
508@subsubsection @code{bfd_get_sign_extend_vma}
509@strong{Synopsis}
510@example
511int bfd_get_sign_extend_vma (bfd *abfd);
512@end example
513@strong{Description}@*
514Indicates if the target architecture "naturally" sign extends
515an address.  Some architectures implicitly sign extend address
516values when they are converted to types larger than the size
517of an address.  For instance, bfd_get_start_address() will
518return an address sign extended to fill a bfd_vma when this is
519the case.
520
521@strong{Returns}@*
522Returns @code{1} if the target architecture is known to sign
523extend addresses, @code{0} if the target architecture is known to
524not sign extend addresses, and @code{-1} otherwise.
525
526@findex bfd_set_start_address
527@subsubsection @code{bfd_set_start_address}
528@strong{Synopsis}
529@example
530bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
531@end example
532@strong{Description}@*
533Make @var{vma} the entry point of output BFD @var{abfd}.
534
535@strong{Returns}@*
536Returns @code{TRUE} on success, @code{FALSE} otherwise.
537
538@findex bfd_get_gp_size
539@subsubsection @code{bfd_get_gp_size}
540@strong{Synopsis}
541@example
542unsigned int bfd_get_gp_size (bfd *abfd);
543@end example
544@strong{Description}@*
545Return the maximum size of objects to be optimized using the GP
546register under MIPS ECOFF.  This is typically set by the @code{-G}
547argument to the compiler, assembler or linker.
548
549@findex bfd_set_gp_size
550@subsubsection @code{bfd_set_gp_size}
551@strong{Synopsis}
552@example
553void bfd_set_gp_size (bfd *abfd, unsigned int i);
554@end example
555@strong{Description}@*
556Set the maximum size of objects to be optimized using the GP
557register under ECOFF or MIPS ELF.  This is typically set by
558the @code{-G} argument to the compiler, assembler or linker.
559
560@findex bfd_scan_vma
561@subsubsection @code{bfd_scan_vma}
562@strong{Synopsis}
563@example
564bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
565@end example
566@strong{Description}@*
567Convert, like @code{strtoul}, a numerical expression
568@var{string} into a @code{bfd_vma} integer, and return that integer.
569(Though without as many bells and whistles as @code{strtoul}.)
570The expression is assumed to be unsigned (i.e., positive).
571If given a @var{base}, it is used as the base for conversion.
572A base of 0 causes the function to interpret the string
573in hex if a leading "0x" or "0X" is found, otherwise
574in octal if a leading zero is found, otherwise in decimal.
575
576If the value would overflow, the maximum @code{bfd_vma} value is
577returned.
578
579@findex bfd_copy_private_header_data
580@subsubsection @code{bfd_copy_private_header_data}
581@strong{Synopsis}
582@example
583bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
584@end example
585@strong{Description}@*
586Copy private BFD header information from the BFD @var{ibfd} to the
587the BFD @var{obfd}.  This copies information that may require
588sections to exist, but does not require symbol tables.  Return
589@code{true} on success, @code{false} on error.
590Possible error returns are:
591
592@itemize @bullet
593
594@item
595@code{bfd_error_no_memory} -
596Not enough memory exists to create private data for @var{obfd}.
597@end itemize
598@example
599#define bfd_copy_private_header_data(ibfd, obfd) \
600     BFD_SEND (obfd, _bfd_copy_private_header_data, \
601               (ibfd, obfd))
602@end example
603
604@findex bfd_copy_private_bfd_data
605@subsubsection @code{bfd_copy_private_bfd_data}
606@strong{Synopsis}
607@example
608bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
609@end example
610@strong{Description}@*
611Copy private BFD information from the BFD @var{ibfd} to the
612the BFD @var{obfd}.  Return @code{TRUE} on success, @code{FALSE} on error.
613Possible error returns are:
614
615@itemize @bullet
616
617@item
618@code{bfd_error_no_memory} -
619Not enough memory exists to create private data for @var{obfd}.
620@end itemize
621@example
622#define bfd_copy_private_bfd_data(ibfd, obfd) \
623     BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
624               (ibfd, obfd))
625@end example
626
627@findex bfd_merge_private_bfd_data
628@subsubsection @code{bfd_merge_private_bfd_data}
629@strong{Synopsis}
630@example
631bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
632@end example
633@strong{Description}@*
634Merge private BFD information from the BFD @var{ibfd} to the
635the output file BFD @var{obfd} when linking.  Return @code{TRUE}
636on success, @code{FALSE} on error.  Possible error returns are:
637
638@itemize @bullet
639
640@item
641@code{bfd_error_no_memory} -
642Not enough memory exists to create private data for @var{obfd}.
643@end itemize
644@example
645#define bfd_merge_private_bfd_data(ibfd, obfd) \
646     BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
647               (ibfd, obfd))
648@end example
649
650@findex bfd_set_private_flags
651@subsubsection @code{bfd_set_private_flags}
652@strong{Synopsis}
653@example
654bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
655@end example
656@strong{Description}@*
657Set private BFD flag information in the BFD @var{abfd}.
658Return @code{TRUE} on success, @code{FALSE} on error.  Possible error
659returns are:
660
661@itemize @bullet
662
663@item
664@code{bfd_error_no_memory} -
665Not enough memory exists to create private data for @var{obfd}.
666@end itemize
667@example
668#define bfd_set_private_flags(abfd, flags) \
669     BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
670@end example
671
672@findex Other functions
673@subsubsection @code{Other functions}
674@strong{Description}@*
675The following functions exist but have not yet been documented.
676@example
677#define bfd_sizeof_headers(abfd, info) \
678       BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
679
680#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
681       BFD_SEND (abfd, _bfd_find_nearest_line, \
682                 (abfd, sec, syms, off, file, func, line))
683
684#define bfd_find_line(abfd, syms, sym, file, line) \
685       BFD_SEND (abfd, _bfd_find_line, \
686                 (abfd, syms, sym, file, line))
687
688#define bfd_find_inliner_info(abfd, file, func, line) \
689       BFD_SEND (abfd, _bfd_find_inliner_info, \
690                 (abfd, file, func, line))
691
692#define bfd_debug_info_start(abfd) \
693       BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
694
695#define bfd_debug_info_end(abfd) \
696       BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
697
698#define bfd_debug_info_accumulate(abfd, section) \
699       BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
700
701#define bfd_stat_arch_elt(abfd, stat) \
702       BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
703
704#define bfd_update_armap_timestamp(abfd) \
705       BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
706
707#define bfd_set_arch_mach(abfd, arch, mach)\
708       BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
709
710#define bfd_relax_section(abfd, section, link_info, again) \
711       BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
712
713#define bfd_gc_sections(abfd, link_info) \
714       BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
715
716#define bfd_merge_sections(abfd, link_info) \
717       BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
718
719#define bfd_is_group_section(abfd, sec) \
720       BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
721
722#define bfd_discard_group(abfd, sec) \
723       BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
724
725#define bfd_link_hash_table_create(abfd) \
726       BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
727
728#define bfd_link_hash_table_free(abfd, hash) \
729       BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
730
731#define bfd_link_add_symbols(abfd, info) \
732       BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
733
734#define bfd_link_just_syms(abfd, sec, info) \
735       BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
736
737#define bfd_final_link(abfd, info) \
738       BFD_SEND (abfd, _bfd_final_link, (abfd, info))
739
740#define bfd_free_cached_info(abfd) \
741       BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
742
743#define bfd_get_dynamic_symtab_upper_bound(abfd) \
744       BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
745
746#define bfd_print_private_bfd_data(abfd, file)\
747       BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
748
749#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
750       BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
751
752#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
753       BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
754                                                   dyncount, dynsyms, ret))
755
756#define bfd_get_dynamic_reloc_upper_bound(abfd) \
757       BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
758
759#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
760       BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
761
762extern bfd_byte *bfd_get_relocated_section_contents
763  (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
764   bfd_boolean, asymbol **);
765
766@end example
767
768@findex bfd_alt_mach_code
769@subsubsection @code{bfd_alt_mach_code}
770@strong{Synopsis}
771@example
772bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
773@end example
774@strong{Description}@*
775When more than one machine code number is available for the
776same machine type, this function can be used to switch between
777the preferred one (alternative == 0) and any others.  Currently,
778only ELF supports this feature, with up to two alternate
779machine codes.
780
781
782@example
783struct bfd_preserve
784@{
785  void *marker;
786  void *tdata;
787  flagword flags;
788  const struct bfd_arch_info *arch_info;
789  struct bfd_section *sections;
790  struct bfd_section *section_last;
791  unsigned int section_count;
792  struct bfd_hash_table section_htab;
793@};
794
795@end example
796@findex bfd_preserve_save
797@subsubsection @code{bfd_preserve_save}
798@strong{Synopsis}
799@example
800bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
801@end example
802@strong{Description}@*
803When testing an object for compatibility with a particular
804target back-end, the back-end object_p function needs to set
805up certain fields in the bfd on successfully recognizing the
806object.  This typically happens in a piecemeal fashion, with
807failures possible at many points.  On failure, the bfd is
808supposed to be restored to its initial state, which is
809virtually impossible.  However, restoring a subset of the bfd
810state works in practice.  This function stores the subset and
811reinitializes the bfd.
812
813@findex bfd_preserve_restore
814@subsubsection @code{bfd_preserve_restore}
815@strong{Synopsis}
816@example
817void bfd_preserve_restore (bfd *, struct bfd_preserve *);
818@end example
819@strong{Description}@*
820This function restores bfd state saved by bfd_preserve_save.
821If MARKER is non-NULL in struct bfd_preserve then that block
822and all subsequently bfd_alloc'd memory is freed.
823
824@findex bfd_preserve_finish
825@subsubsection @code{bfd_preserve_finish}
826@strong{Synopsis}
827@example
828void bfd_preserve_finish (bfd *, struct bfd_preserve *);
829@end example
830@strong{Description}@*
831This function should be called when the bfd state saved by
832bfd_preserve_save is no longer needed.  ie. when the back-end
833object_p function returns with success.
834
835@findex bfd_emul_get_maxpagesize
836@subsubsection @code{bfd_emul_get_maxpagesize}
837@strong{Synopsis}
838@example
839bfd_vma bfd_emul_get_maxpagesize (const char *);
840@end example
841@strong{Description}@*
842Returns the maximum page size, in bytes, as determined by
843emulation.
844
845@strong{Returns}@*
846Returns the maximum page size in bytes for ELF, 0 otherwise.
847
848@findex bfd_emul_set_maxpagesize
849@subsubsection @code{bfd_emul_set_maxpagesize}
850@strong{Synopsis}
851@example
852void bfd_emul_set_maxpagesize (const char *, bfd_vma);
853@end example
854@strong{Description}@*
855For ELF, set the maximum page size for the emulation.  It is
856a no-op for other formats.
857
858@findex bfd_emul_get_commonpagesize
859@subsubsection @code{bfd_emul_get_commonpagesize}
860@strong{Synopsis}
861@example
862bfd_vma bfd_emul_get_commonpagesize (const char *);
863@end example
864@strong{Description}@*
865Returns the common page size, in bytes, as determined by
866emulation.
867
868@strong{Returns}@*
869Returns the common page size in bytes for ELF, 0 otherwise.
870
871@findex bfd_emul_set_commonpagesize
872@subsubsection @code{bfd_emul_set_commonpagesize}
873@strong{Synopsis}
874@example
875void bfd_emul_set_commonpagesize (const char *, bfd_vma);
876@end example
877@strong{Description}@*
878For ELF, set the common page size for the emulation.  It is
879a no-op for other formats.
880
881@findex bfd_demangle
882@subsubsection @code{bfd_demangle}
883@strong{Synopsis}
884@example
885char *bfd_demangle (bfd *, const char *, int);
886@end example
887@strong{Description}@*
888Wrapper around cplus_demangle.  Strips leading underscores and
889other such chars that would otherwise confuse the demangler.
890If passed a g++ v3 ABI mangled name, returns a buffer allocated
891with malloc holding the demangled name.  Returns NULL otherwise
892and on memory alloc failure.
893
894