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