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@subsection BFD assert handler 423If BFD finds an internal inconsistency, the bfd assert 424handler is called with information on the BFD version, BFD 425source file and line. If this happens, most programs linked 426against BFD are expected to want to exit with an error, or mark 427the current BFD operation as failed, so it is recommended to 428override the default handler, which just calls 429_bfd_error_handler and continues. 430 431 432@example 433 434typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, 435 const char *bfd_version, 436 const char *bfd_file, 437 int bfd_line); 438 439@end example 440@findex bfd_set_assert_handler 441@subsubsection @code{bfd_set_assert_handler} 442@strong{Synopsis} 443@example 444bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type); 445@end example 446@strong{Description}@* 447Set the BFD assert handler function. Returns the previous 448function. 449 450@findex bfd_get_assert_handler 451@subsubsection @code{bfd_get_assert_handler} 452@strong{Synopsis} 453@example 454bfd_assert_handler_type bfd_get_assert_handler (void); 455@end example 456@strong{Description}@* 457Return the BFD assert handler function. 458 459@section Miscellaneous 460 461 462@subsection Miscellaneous functions 463 464 465@findex bfd_get_reloc_upper_bound 466@subsubsection @code{bfd_get_reloc_upper_bound} 467@strong{Synopsis} 468@example 469long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); 470@end example 471@strong{Description}@* 472Return the number of bytes required to store the 473relocation information associated with section @var{sect} 474attached to bfd @var{abfd}. If an error occurs, return -1. 475 476@findex bfd_canonicalize_reloc 477@subsubsection @code{bfd_canonicalize_reloc} 478@strong{Synopsis} 479@example 480long bfd_canonicalize_reloc 481 (bfd *abfd, asection *sec, arelent **loc, asymbol **syms); 482@end example 483@strong{Description}@* 484Call the back end associated with the open BFD 485@var{abfd} and translate the external form of the relocation 486information attached to @var{sec} into the internal canonical 487form. Place the table into memory at @var{loc}, which has 488been preallocated, usually by a call to 489@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or 490-1 on error. 491 492The @var{syms} table is also needed for horrible internal magic 493reasons. 494 495@findex bfd_set_reloc 496@subsubsection @code{bfd_set_reloc} 497@strong{Synopsis} 498@example 499void bfd_set_reloc 500 (bfd *abfd, asection *sec, arelent **rel, unsigned int count); 501@end example 502@strong{Description}@* 503Set the relocation pointer and count within 504section @var{sec} to the values @var{rel} and @var{count}. 505The argument @var{abfd} is ignored. 506 507@findex bfd_set_file_flags 508@subsubsection @code{bfd_set_file_flags} 509@strong{Synopsis} 510@example 511bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags); 512@end example 513@strong{Description}@* 514Set the flag word in the BFD @var{abfd} to the value @var{flags}. 515 516Possible errors are: 517@itemize @bullet 518 519@item 520@code{bfd_error_wrong_format} - The target bfd was not of object format. 521@item 522@code{bfd_error_invalid_operation} - The target bfd was open for reading. 523@item 524@code{bfd_error_invalid_operation} - 525The flag word contained a bit which was not applicable to the 526type of file. E.g., an attempt was made to set the @code{D_PAGED} bit 527on a BFD format which does not support demand paging. 528@end itemize 529 530@findex bfd_get_arch_size 531@subsubsection @code{bfd_get_arch_size} 532@strong{Synopsis} 533@example 534int bfd_get_arch_size (bfd *abfd); 535@end example 536@strong{Description}@* 537Returns the architecture address size, in bits, as determined 538by the object file's format. For ELF, this information is 539included in the header. 540 541@strong{Returns}@* 542Returns the arch size in bits if known, @code{-1} otherwise. 543 544@findex bfd_get_sign_extend_vma 545@subsubsection @code{bfd_get_sign_extend_vma} 546@strong{Synopsis} 547@example 548int bfd_get_sign_extend_vma (bfd *abfd); 549@end example 550@strong{Description}@* 551Indicates if the target architecture "naturally" sign extends 552an address. Some architectures implicitly sign extend address 553values when they are converted to types larger than the size 554of an address. For instance, bfd_get_start_address() will 555return an address sign extended to fill a bfd_vma when this is 556the case. 557 558@strong{Returns}@* 559Returns @code{1} if the target architecture is known to sign 560extend addresses, @code{0} if the target architecture is known to 561not sign extend addresses, and @code{-1} otherwise. 562 563@findex bfd_set_start_address 564@subsubsection @code{bfd_set_start_address} 565@strong{Synopsis} 566@example 567bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma); 568@end example 569@strong{Description}@* 570Make @var{vma} the entry point of output BFD @var{abfd}. 571 572@strong{Returns}@* 573Returns @code{TRUE} on success, @code{FALSE} otherwise. 574 575@findex bfd_get_gp_size 576@subsubsection @code{bfd_get_gp_size} 577@strong{Synopsis} 578@example 579unsigned int bfd_get_gp_size (bfd *abfd); 580@end example 581@strong{Description}@* 582Return the maximum size of objects to be optimized using the GP 583register under MIPS ECOFF. This is typically set by the @code{-G} 584argument to the compiler, assembler or linker. 585 586@findex bfd_set_gp_size 587@subsubsection @code{bfd_set_gp_size} 588@strong{Synopsis} 589@example 590void bfd_set_gp_size (bfd *abfd, unsigned int i); 591@end example 592@strong{Description}@* 593Set the maximum size of objects to be optimized using the GP 594register under ECOFF or MIPS ELF. This is typically set by 595the @code{-G} argument to the compiler, assembler or linker. 596 597@findex bfd_scan_vma 598@subsubsection @code{bfd_scan_vma} 599@strong{Synopsis} 600@example 601bfd_vma bfd_scan_vma (const char *string, const char **end, int base); 602@end example 603@strong{Description}@* 604Convert, like @code{strtoul}, a numerical expression 605@var{string} into a @code{bfd_vma} integer, and return that integer. 606(Though without as many bells and whistles as @code{strtoul}.) 607The expression is assumed to be unsigned (i.e., positive). 608If given a @var{base}, it is used as the base for conversion. 609A base of 0 causes the function to interpret the string 610in hex if a leading "0x" or "0X" is found, otherwise 611in octal if a leading zero is found, otherwise in decimal. 612 613If the value would overflow, the maximum @code{bfd_vma} value is 614returned. 615 616@findex bfd_copy_private_header_data 617@subsubsection @code{bfd_copy_private_header_data} 618@strong{Synopsis} 619@example 620bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); 621@end example 622@strong{Description}@* 623Copy private BFD header information from the BFD @var{ibfd} to the 624the BFD @var{obfd}. This copies information that may require 625sections to exist, but does not require symbol tables. Return 626@code{true} on success, @code{false} on error. 627Possible error returns are: 628 629@itemize @bullet 630 631@item 632@code{bfd_error_no_memory} - 633Not enough memory exists to create private data for @var{obfd}. 634@end itemize 635@example 636#define bfd_copy_private_header_data(ibfd, obfd) \ 637 BFD_SEND (obfd, _bfd_copy_private_header_data, \ 638 (ibfd, obfd)) 639@end example 640 641@findex bfd_copy_private_bfd_data 642@subsubsection @code{bfd_copy_private_bfd_data} 643@strong{Synopsis} 644@example 645bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); 646@end example 647@strong{Description}@* 648Copy private BFD information from the BFD @var{ibfd} to the 649the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error. 650Possible error returns are: 651 652@itemize @bullet 653 654@item 655@code{bfd_error_no_memory} - 656Not enough memory exists to create private data for @var{obfd}. 657@end itemize 658@example 659#define bfd_copy_private_bfd_data(ibfd, obfd) \ 660 BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ 661 (ibfd, obfd)) 662@end example 663 664@findex bfd_merge_private_bfd_data 665@subsubsection @code{bfd_merge_private_bfd_data} 666@strong{Synopsis} 667@example 668bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd); 669@end example 670@strong{Description}@* 671Merge private BFD information from the BFD @var{ibfd} to the 672the output file BFD @var{obfd} when linking. Return @code{TRUE} 673on success, @code{FALSE} on error. Possible error returns are: 674 675@itemize @bullet 676 677@item 678@code{bfd_error_no_memory} - 679Not enough memory exists to create private data for @var{obfd}. 680@end itemize 681@example 682#define bfd_merge_private_bfd_data(ibfd, obfd) \ 683 BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ 684 (ibfd, obfd)) 685@end example 686 687@findex bfd_set_private_flags 688@subsubsection @code{bfd_set_private_flags} 689@strong{Synopsis} 690@example 691bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); 692@end example 693@strong{Description}@* 694Set private BFD flag information in the BFD @var{abfd}. 695Return @code{TRUE} on success, @code{FALSE} on error. Possible error 696returns are: 697 698@itemize @bullet 699 700@item 701@code{bfd_error_no_memory} - 702Not enough memory exists to create private data for @var{obfd}. 703@end itemize 704@example 705#define bfd_set_private_flags(abfd, flags) \ 706 BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) 707@end example 708 709@findex Other functions 710@subsubsection @code{Other functions} 711@strong{Description}@* 712The following functions exist but have not yet been documented. 713@example 714#define bfd_sizeof_headers(abfd, info) \ 715 BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) 716 717#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ 718 BFD_SEND (abfd, _bfd_find_nearest_line, \ 719 (abfd, sec, syms, off, file, func, line)) 720 721#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ 722 line, disc) \ 723 BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \ 724 (abfd, sec, syms, off, file, func, line, disc)) 725 726#define bfd_find_line(abfd, syms, sym, file, line) \ 727 BFD_SEND (abfd, _bfd_find_line, \ 728 (abfd, syms, sym, file, line)) 729 730#define bfd_find_inliner_info(abfd, file, func, line) \ 731 BFD_SEND (abfd, _bfd_find_inliner_info, \ 732 (abfd, file, func, line)) 733 734#define bfd_debug_info_start(abfd) \ 735 BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) 736 737#define bfd_debug_info_end(abfd) \ 738 BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) 739 740#define bfd_debug_info_accumulate(abfd, section) \ 741 BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) 742 743#define bfd_stat_arch_elt(abfd, stat) \ 744 BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) 745 746#define bfd_update_armap_timestamp(abfd) \ 747 BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) 748 749#define bfd_set_arch_mach(abfd, arch, mach)\ 750 BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) 751 752#define bfd_relax_section(abfd, section, link_info, again) \ 753 BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) 754 755#define bfd_gc_sections(abfd, link_info) \ 756 BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info)) 757 758#define bfd_lookup_section_flags(link_info, flag_info, section) \ 759 BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section)) 760 761#define bfd_merge_sections(abfd, link_info) \ 762 BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) 763 764#define bfd_is_group_section(abfd, sec) \ 765 BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) 766 767#define bfd_discard_group(abfd, sec) \ 768 BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) 769 770#define bfd_link_hash_table_create(abfd) \ 771 BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) 772 773#define bfd_link_hash_table_free(abfd, hash) \ 774 BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) 775 776#define bfd_link_add_symbols(abfd, info) \ 777 BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) 778 779#define bfd_link_just_syms(abfd, sec, info) \ 780 BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) 781 782#define bfd_final_link(abfd, info) \ 783 BFD_SEND (abfd, _bfd_final_link, (abfd, info)) 784 785#define bfd_free_cached_info(abfd) \ 786 BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) 787 788#define bfd_get_dynamic_symtab_upper_bound(abfd) \ 789 BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) 790 791#define bfd_print_private_bfd_data(abfd, file)\ 792 BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) 793 794#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ 795 BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) 796 797#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ 798 BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ 799 dyncount, dynsyms, ret)) 800 801#define bfd_get_dynamic_reloc_upper_bound(abfd) \ 802 BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) 803 804#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ 805 BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) 806 807extern bfd_byte *bfd_get_relocated_section_contents 808 (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, 809 bfd_boolean, asymbol **); 810 811@end example 812 813@findex bfd_alt_mach_code 814@subsubsection @code{bfd_alt_mach_code} 815@strong{Synopsis} 816@example 817bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative); 818@end example 819@strong{Description}@* 820When more than one machine code number is available for the 821same machine type, this function can be used to switch between 822the preferred one (alternative == 0) and any others. Currently, 823only ELF supports this feature, with up to two alternate 824machine codes. 825 826 827@example 828struct bfd_preserve 829@{ 830 void *marker; 831 void *tdata; 832 flagword flags; 833 const struct bfd_arch_info *arch_info; 834 struct bfd_section *sections; 835 struct bfd_section *section_last; 836 unsigned int section_count; 837 struct bfd_hash_table section_htab; 838@}; 839 840@end example 841@findex bfd_preserve_save 842@subsubsection @code{bfd_preserve_save} 843@strong{Synopsis} 844@example 845bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *); 846@end example 847@strong{Description}@* 848When testing an object for compatibility with a particular 849target back-end, the back-end object_p function needs to set 850up certain fields in the bfd on successfully recognizing the 851object. This typically happens in a piecemeal fashion, with 852failures possible at many points. On failure, the bfd is 853supposed to be restored to its initial state, which is 854virtually impossible. However, restoring a subset of the bfd 855state works in practice. This function stores the subset and 856reinitializes the bfd. 857 858@findex bfd_preserve_restore 859@subsubsection @code{bfd_preserve_restore} 860@strong{Synopsis} 861@example 862void bfd_preserve_restore (bfd *, struct bfd_preserve *); 863@end example 864@strong{Description}@* 865This function restores bfd state saved by bfd_preserve_save. 866If MARKER is non-NULL in struct bfd_preserve then that block 867and all subsequently bfd_alloc'd memory is freed. 868 869@findex bfd_preserve_finish 870@subsubsection @code{bfd_preserve_finish} 871@strong{Synopsis} 872@example 873void bfd_preserve_finish (bfd *, struct bfd_preserve *); 874@end example 875@strong{Description}@* 876This function should be called when the bfd state saved by 877bfd_preserve_save is no longer needed. ie. when the back-end 878object_p function returns with success. 879 880@findex bfd_emul_get_maxpagesize 881@subsubsection @code{bfd_emul_get_maxpagesize} 882@strong{Synopsis} 883@example 884bfd_vma bfd_emul_get_maxpagesize (const char *); 885@end example 886@strong{Description}@* 887Returns the maximum page size, in bytes, as determined by 888emulation. 889 890@strong{Returns}@* 891Returns the maximum page size in bytes for ELF, 0 otherwise. 892 893@findex bfd_emul_set_maxpagesize 894@subsubsection @code{bfd_emul_set_maxpagesize} 895@strong{Synopsis} 896@example 897void bfd_emul_set_maxpagesize (const char *, bfd_vma); 898@end example 899@strong{Description}@* 900For ELF, set the maximum page size for the emulation. It is 901a no-op for other formats. 902 903@findex bfd_emul_get_commonpagesize 904@subsubsection @code{bfd_emul_get_commonpagesize} 905@strong{Synopsis} 906@example 907bfd_vma bfd_emul_get_commonpagesize (const char *); 908@end example 909@strong{Description}@* 910Returns the common page size, in bytes, as determined by 911emulation. 912 913@strong{Returns}@* 914Returns the common page size in bytes for ELF, 0 otherwise. 915 916@findex bfd_emul_set_commonpagesize 917@subsubsection @code{bfd_emul_set_commonpagesize} 918@strong{Synopsis} 919@example 920void bfd_emul_set_commonpagesize (const char *, bfd_vma); 921@end example 922@strong{Description}@* 923For ELF, set the common page size for the emulation. It is 924a no-op for other formats. 925 926@findex bfd_demangle 927@subsubsection @code{bfd_demangle} 928@strong{Synopsis} 929@example 930char *bfd_demangle (bfd *, const char *, int); 931@end example 932@strong{Description}@* 933Wrapper around cplus_demangle. Strips leading underscores and 934other such chars that would otherwise confuse the demangler. 935If passed a g++ v3 ABI mangled name, returns a buffer allocated 936with malloc holding the demangled name. Returns NULL otherwise 937and on memory alloc failure. 938 939