Back to index

cell-binutils  2.17cvs20070401
targets.c
Go to the documentation of this file.
00001 /* Generic target-file-type support for the BFD library.
00002    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
00003    2000, 2001, 2002, 2003, 2004, 2005, 2006
00004    Free Software Foundation, Inc.
00005    Written by Cygnus Support.
00006 
00007    This file is part of BFD, the Binary File Descriptor library.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 2 of the License, or
00012    (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program; if not, write to the Free Software
00021    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00022 
00023 #include "bfd.h"
00024 #include "sysdep.h"
00025 #include "libbfd.h"
00026 #include "fnmatch.h"
00027 
00028 /*
00029    It's okay to see some:
00030 #if 0
00031    directives in this source file, as targets.c uses them to exclude
00032    certain BFD vectors.  This comment is specially formatted to catch
00033    users who grep for ^#if 0, so please keep it this way!
00034 */
00035 
00036 /*
00037 SECTION
00038        Targets
00039 
00040 DESCRIPTION
00041        Each port of BFD to a different machine requires the creation
00042        of a target back end. All the back end provides to the root
00043        part of BFD is a structure containing pointers to functions
00044        which perform certain low level operations on files. BFD
00045        translates the applications's requests through a pointer into
00046        calls to the back end routines.
00047 
00048        When a file is opened with <<bfd_openr>>, its format and
00049        target are unknown. BFD uses various mechanisms to determine
00050        how to interpret the file. The operations performed are:
00051 
00052        o Create a BFD by calling the internal routine
00053        <<_bfd_new_bfd>>, then call <<bfd_find_target>> with the
00054        target string supplied to <<bfd_openr>> and the new BFD pointer.
00055 
00056        o If a null target string was provided to <<bfd_find_target>>,
00057        look up the environment variable <<GNUTARGET>> and use
00058        that as the target string.
00059 
00060        o If the target string is still <<NULL>>, or the target string is
00061        <<default>>, then use the first item in the target vector
00062        as the target type, and set <<target_defaulted>> in the BFD to
00063        cause <<bfd_check_format>> to loop through all the targets.
00064        @xref{bfd_target}.  @xref{Formats}.
00065 
00066        o Otherwise, inspect the elements in the target vector
00067        one by one, until a match on target name is found. When found,
00068        use it.
00069 
00070        o Otherwise return the error <<bfd_error_invalid_target>> to
00071        <<bfd_openr>>.
00072 
00073        o <<bfd_openr>> attempts to open the file using
00074        <<bfd_open_file>>, and returns the BFD.
00075 
00076        Once the BFD has been opened and the target selected, the file
00077        format may be determined. This is done by calling
00078        <<bfd_check_format>> on the BFD with a suggested format.
00079        If <<target_defaulted>> has been set, each possible target
00080        type is tried to see if it recognizes the specified format.
00081        <<bfd_check_format>> returns <<TRUE>> when the caller guesses right.
00082 @menu
00083 @* bfd_target::
00084 @end menu
00085 */
00086 
00087 /*
00088 
00089 INODE
00090        bfd_target,  , Targets, Targets
00091 DOCDD
00092 SUBSECTION
00093        bfd_target
00094 
00095 DESCRIPTION
00096        This structure contains everything that BFD knows about a
00097        target. It includes things like its byte order, name, and which
00098        routines to call to do various operations.
00099 
00100        Every BFD points to a target structure with its <<xvec>>
00101        member.
00102 
00103        The macros below are used to dispatch to functions through the
00104        <<bfd_target>> vector. They are used in a number of macros further
00105        down in @file{bfd.h}, and are also used when calling various
00106        routines by hand inside the BFD implementation.  The @var{arglist}
00107        argument must be parenthesized; it contains all the arguments
00108        to the called function.
00109 
00110        They make the documentation (more) unpleasant to read, so if
00111        someone wants to fix this and not break the above, please do.
00112 
00113 .#define BFD_SEND(bfd, message, arglist) \
00114 .  ((*((bfd)->xvec->message)) arglist)
00115 .
00116 .#ifdef DEBUG_BFD_SEND
00117 .#undef BFD_SEND
00118 .#define BFD_SEND(bfd, message, arglist) \
00119 .  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
00120 .    ((*((bfd)->xvec->message)) arglist) : \
00121 .    (bfd_assert (__FILE__,__LINE__), NULL))
00122 .#endif
00123 
00124        For operations which index on the BFD format:
00125 
00126 .#define BFD_SEND_FMT(bfd, message, arglist) \
00127 .  (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
00128 .
00129 .#ifdef DEBUG_BFD_SEND
00130 .#undef BFD_SEND_FMT
00131 .#define BFD_SEND_FMT(bfd, message, arglist) \
00132 .  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
00133 .   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
00134 .   (bfd_assert (__FILE__,__LINE__), NULL))
00135 .#endif
00136 .
00137        This is the structure which defines the type of BFD this is.  The
00138        <<xvec>> member of the struct <<bfd>> itself points here.  Each
00139        module that implements access to a different target under BFD,
00140        defines one of these.
00141 
00142        FIXME, these names should be rationalised with the names of
00143        the entry points which call them. Too bad we can't have one
00144        macro to define them both!
00145 
00146 .enum bfd_flavour
00147 .{
00148 .  bfd_target_unknown_flavour,
00149 .  bfd_target_aout_flavour,
00150 .  bfd_target_coff_flavour,
00151 .  bfd_target_ecoff_flavour,
00152 .  bfd_target_xcoff_flavour,
00153 .  bfd_target_elf_flavour,
00154 .  bfd_target_ieee_flavour,
00155 .  bfd_target_nlm_flavour,
00156 .  bfd_target_oasys_flavour,
00157 .  bfd_target_tekhex_flavour,
00158 .  bfd_target_srec_flavour,
00159 .  bfd_target_ihex_flavour,
00160 .  bfd_target_som_flavour,
00161 .  bfd_target_os9k_flavour,
00162 .  bfd_target_versados_flavour,
00163 .  bfd_target_msdos_flavour,
00164 .  bfd_target_ovax_flavour,
00165 .  bfd_target_evax_flavour,
00166 .  bfd_target_mmo_flavour,
00167 .  bfd_target_mach_o_flavour,
00168 .  bfd_target_pef_flavour,
00169 .  bfd_target_pef_xlib_flavour,
00170 .  bfd_target_sym_flavour
00171 .};
00172 .
00173 .enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
00174 .
00175 .{* Forward declaration.  *}
00176 .typedef struct bfd_link_info _bfd_link_info;
00177 .
00178 .typedef struct bfd_target
00179 .{
00180 .  {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  *}
00181 .  char *name;
00182 .
00183 . {* The "flavour" of a back end is a general indication about
00184 .    the contents of a file.  *}
00185 .  enum bfd_flavour flavour;
00186 .
00187 .  {* The order of bytes within the data area of a file.  *}
00188 .  enum bfd_endian byteorder;
00189 .
00190 . {* The order of bytes within the header parts of a file.  *}
00191 .  enum bfd_endian header_byteorder;
00192 .
00193 .  {* A mask of all the flags which an executable may have set -
00194 .     from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  *}
00195 .  flagword object_flags;
00196 .
00197 . {* A mask of all the flags which a section may have set - from
00198 .    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  *}
00199 .  flagword section_flags;
00200 .
00201 . {* The character normally found at the front of a symbol.
00202 .    (if any), perhaps `_'.  *}
00203 .  char symbol_leading_char;
00204 .
00205 . {* The pad character for file names within an archive header.  *}
00206 .  char ar_pad_char;
00207 .
00208 .  {* The maximum number of characters in an archive header.  *}
00209 .  unsigned short ar_max_namelen;
00210 .
00211 .  {* Entries for byte swapping for data. These are different from the
00212 .     other entry points, since they don't take a BFD as the first argument.
00213 .     Certain other handlers could do the same.  *}
00214 .  bfd_uint64_t   (*bfd_getx64) (const void *);
00215 .  bfd_int64_t    (*bfd_getx_signed_64) (const void *);
00216 .  void           (*bfd_putx64) (bfd_uint64_t, void *);
00217 .  bfd_vma        (*bfd_getx32) (const void *);
00218 .  bfd_signed_vma (*bfd_getx_signed_32) (const void *);
00219 .  void           (*bfd_putx32) (bfd_vma, void *);
00220 .  bfd_vma        (*bfd_getx16) (const void *);
00221 .  bfd_signed_vma (*bfd_getx_signed_16) (const void *);
00222 .  void           (*bfd_putx16) (bfd_vma, void *);
00223 .
00224 .  {* Byte swapping for the headers.  *}
00225 .  bfd_uint64_t   (*bfd_h_getx64) (const void *);
00226 .  bfd_int64_t    (*bfd_h_getx_signed_64) (const void *);
00227 .  void           (*bfd_h_putx64) (bfd_uint64_t, void *);
00228 .  bfd_vma        (*bfd_h_getx32) (const void *);
00229 .  bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
00230 .  void           (*bfd_h_putx32) (bfd_vma, void *);
00231 .  bfd_vma        (*bfd_h_getx16) (const void *);
00232 .  bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
00233 .  void           (*bfd_h_putx16) (bfd_vma, void *);
00234 .
00235 .  {* Format dependent routines: these are vectors of entry points
00236 .     within the target vector structure, one for each format to check.  *}
00237 .
00238 .  {* Check the format of a file being read.  Return a <<bfd_target *>> or zero.  *}
00239 .  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
00240 .
00241 .  {* Set the format of a file being written.  *}
00242 .  bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
00243 .
00244 .  {* Write cached information into a file being written, at <<bfd_close>>.  *}
00245 .  bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
00246 .
00247 The general target vector.  These vectors are initialized using the
00248 BFD_JUMP_TABLE macros.
00249 .
00250 .  {* Generic entry points.  *}
00251 .#define BFD_JUMP_TABLE_GENERIC(NAME) \
00252 .  NAME##_close_and_cleanup, \
00253 .  NAME##_bfd_free_cached_info, \
00254 .  NAME##_new_section_hook, \
00255 .  NAME##_get_section_contents, \
00256 .  NAME##_get_section_contents_in_window
00257 .
00258 .  {* Called when the BFD is being closed to do any necessary cleanup.  *}
00259 .  bfd_boolean (*_close_and_cleanup) (bfd *);
00260 .  {* Ask the BFD to free all cached information.  *}
00261 .  bfd_boolean (*_bfd_free_cached_info) (bfd *);
00262 .  {* Called when a new section is created.  *}
00263 .  bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
00264 .  {* Read the contents of a section.  *}
00265 .  bfd_boolean (*_bfd_get_section_contents)
00266 .    (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
00267 .  bfd_boolean (*_bfd_get_section_contents_in_window)
00268 .    (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
00269 .
00270 .  {* Entry points to copy private data.  *}
00271 .#define BFD_JUMP_TABLE_COPY(NAME) \
00272 .  NAME##_bfd_copy_private_bfd_data, \
00273 .  NAME##_bfd_merge_private_bfd_data, \
00274 .  _bfd_generic_init_private_section_data, \
00275 .  NAME##_bfd_copy_private_section_data, \
00276 .  NAME##_bfd_copy_private_symbol_data, \
00277 .  NAME##_bfd_copy_private_header_data, \
00278 .  NAME##_bfd_set_private_flags, \
00279 .  NAME##_bfd_print_private_bfd_data
00280 .
00281 .  {* Called to copy BFD general private data from one object file
00282 .     to another.  *}
00283 .  bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
00284 .  {* Called to merge BFD general private data from one object file
00285 .     to a common output file when linking.  *}
00286 .  bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
00287 .  {* Called to initialize BFD private section data from one object file
00288 .     to another.  *}
00289 .#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
00290 .  BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
00291 .  bfd_boolean (*_bfd_init_private_section_data)
00292 .    (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
00293 .  {* Called to copy BFD private section data from one object file
00294 .     to another.  *}
00295 .  bfd_boolean (*_bfd_copy_private_section_data)
00296 .    (bfd *, sec_ptr, bfd *, sec_ptr);
00297 .  {* Called to copy BFD private symbol data from one symbol
00298 .     to another.  *}
00299 .  bfd_boolean (*_bfd_copy_private_symbol_data)
00300 .    (bfd *, asymbol *, bfd *, asymbol *);
00301 .  {* Called to copy BFD private header data from one object file
00302 .     to another.  *}
00303 .  bfd_boolean (*_bfd_copy_private_header_data)
00304 .    (bfd *, bfd *);
00305 .  {* Called to set private backend flags.  *}
00306 .  bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
00307 .
00308 .  {* Called to print private BFD data.  *}
00309 .  bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
00310 .
00311 .  {* Core file entry points.  *}
00312 .#define BFD_JUMP_TABLE_CORE(NAME) \
00313 .  NAME##_core_file_failing_command, \
00314 .  NAME##_core_file_failing_signal, \
00315 .  NAME##_core_file_matches_executable_p
00316 .
00317 .  char *      (*_core_file_failing_command) (bfd *);
00318 .  int         (*_core_file_failing_signal) (bfd *);
00319 .  bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
00320 .
00321 .  {* Archive entry points.  *}
00322 .#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
00323 .  NAME##_slurp_armap, \
00324 .  NAME##_slurp_extended_name_table, \
00325 .  NAME##_construct_extended_name_table, \
00326 .  NAME##_truncate_arname, \
00327 .  NAME##_write_armap, \
00328 .  NAME##_read_ar_hdr, \
00329 .  NAME##_openr_next_archived_file, \
00330 .  NAME##_get_elt_at_index, \
00331 .  NAME##_generic_stat_arch_elt, \
00332 .  NAME##_update_armap_timestamp
00333 .
00334 .  bfd_boolean (*_bfd_slurp_armap) (bfd *);
00335 .  bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
00336 .  bfd_boolean (*_bfd_construct_extended_name_table)
00337 .    (bfd *, char **, bfd_size_type *, const char **);
00338 .  void        (*_bfd_truncate_arname) (bfd *, const char *, char *);
00339 .  bfd_boolean (*write_armap)
00340 .    (bfd *, unsigned int, struct orl *, unsigned int, int);
00341 .  void *      (*_bfd_read_ar_hdr_fn) (bfd *);
00342 .  bfd *       (*openr_next_archived_file) (bfd *, bfd *);
00343 .#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
00344 .  bfd *       (*_bfd_get_elt_at_index) (bfd *, symindex);
00345 .  int         (*_bfd_stat_arch_elt) (bfd *, struct stat *);
00346 .  bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
00347 .
00348 .  {* Entry points used for symbols.  *}
00349 .#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
00350 .  NAME##_get_symtab_upper_bound, \
00351 .  NAME##_canonicalize_symtab, \
00352 .  NAME##_make_empty_symbol, \
00353 .  NAME##_print_symbol, \
00354 .  NAME##_get_symbol_info, \
00355 .  NAME##_bfd_is_local_label_name, \
00356 .  NAME##_bfd_is_target_special_symbol, \
00357 .  NAME##_get_lineno, \
00358 .  NAME##_find_nearest_line, \
00359 .  _bfd_generic_find_line, \
00360 .  NAME##_find_inliner_info, \
00361 .  NAME##_bfd_make_debug_symbol, \
00362 .  NAME##_read_minisymbols, \
00363 .  NAME##_minisymbol_to_symbol
00364 .
00365 .  long        (*_bfd_get_symtab_upper_bound) (bfd *);
00366 .  long        (*_bfd_canonicalize_symtab)
00367 .    (bfd *, struct bfd_symbol **);
00368 .  struct bfd_symbol *
00369 .              (*_bfd_make_empty_symbol) (bfd *);
00370 .  void        (*_bfd_print_symbol)
00371 .    (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type);
00372 .#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
00373 .  void        (*_bfd_get_symbol_info)
00374 .    (bfd *, struct bfd_symbol *, symbol_info *);
00375 .#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
00376 .  bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
00377 .  bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
00378 .  alent *     (*_get_lineno) (bfd *, struct bfd_symbol *);
00379 .  bfd_boolean (*_bfd_find_nearest_line)
00380 .    (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
00381 .     const char **, const char **, unsigned int *);
00382 .  bfd_boolean (*_bfd_find_line)
00383 .    (bfd *, struct bfd_symbol **, struct bfd_symbol *,
00384 .     const char **, unsigned int *);
00385 .  bfd_boolean (*_bfd_find_inliner_info)
00386 .    (bfd *, const char **, const char **, unsigned int *);
00387 . {* Back-door to allow format-aware applications to create debug symbols
00388 .    while using BFD for everything else.  Currently used by the assembler
00389 .    when creating COFF files.  *}
00390 .  asymbol *   (*_bfd_make_debug_symbol)
00391 .    (bfd *, void *, unsigned long size);
00392 .#define bfd_read_minisymbols(b, d, m, s) \
00393 .  BFD_SEND (b, _read_minisymbols, (b, d, m, s))
00394 .  long        (*_read_minisymbols)
00395 .    (bfd *, bfd_boolean, void **, unsigned int *);
00396 .#define bfd_minisymbol_to_symbol(b, d, m, f) \
00397 .  BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
00398 .  asymbol *   (*_minisymbol_to_symbol)
00399 .    (bfd *, bfd_boolean, const void *, asymbol *);
00400 .
00401 .  {* Routines for relocs.  *}
00402 .#define BFD_JUMP_TABLE_RELOCS(NAME) \
00403 .  NAME##_get_reloc_upper_bound, \
00404 .  NAME##_canonicalize_reloc, \
00405 .  NAME##_bfd_reloc_type_lookup, \
00406 .  NAME##_bfd_reloc_name_lookup
00407 .
00408 .  long        (*_get_reloc_upper_bound) (bfd *, sec_ptr);
00409 .  long        (*_bfd_canonicalize_reloc)
00410 .    (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
00411 .  {* See documentation on reloc types.  *}
00412 .  reloc_howto_type *
00413 .              (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
00414 .  reloc_howto_type *
00415 .              (*reloc_name_lookup) (bfd *, const char *);
00416 .
00417 .
00418 .  {* Routines used when writing an object file.  *}
00419 .#define BFD_JUMP_TABLE_WRITE(NAME) \
00420 .  NAME##_set_arch_mach, \
00421 .  NAME##_set_section_contents
00422 .
00423 .  bfd_boolean (*_bfd_set_arch_mach)
00424 .    (bfd *, enum bfd_architecture, unsigned long);
00425 .  bfd_boolean (*_bfd_set_section_contents)
00426 .    (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
00427 .
00428 .  {* Routines used by the linker.  *}
00429 .#define BFD_JUMP_TABLE_LINK(NAME) \
00430 .  NAME##_sizeof_headers, \
00431 .  NAME##_bfd_get_relocated_section_contents, \
00432 .  NAME##_bfd_relax_section, \
00433 .  NAME##_bfd_link_hash_table_create, \
00434 .  NAME##_bfd_link_hash_table_free, \
00435 .  NAME##_bfd_link_add_symbols, \
00436 .  NAME##_bfd_link_just_syms, \
00437 .  NAME##_bfd_final_link, \
00438 .  NAME##_bfd_link_split_section, \
00439 .  NAME##_bfd_gc_sections, \
00440 .  NAME##_bfd_merge_sections, \
00441 .  NAME##_bfd_is_group_section, \
00442 .  NAME##_bfd_discard_group, \
00443 .  NAME##_section_already_linked \
00444 .
00445 .  int         (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
00446 .  bfd_byte *  (*_bfd_get_relocated_section_contents)
00447 .    (bfd *, struct bfd_link_info *, struct bfd_link_order *,
00448 .     bfd_byte *, bfd_boolean, struct bfd_symbol **);
00449 .
00450 .  bfd_boolean (*_bfd_relax_section)
00451 .    (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
00452 .
00453 .  {* Create a hash table for the linker.  Different backends store
00454 .     different information in this table.  *}
00455 .  struct bfd_link_hash_table *
00456 .              (*_bfd_link_hash_table_create) (bfd *);
00457 .
00458 .  {* Release the memory associated with the linker hash table.  *}
00459 .  void        (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
00460 .
00461 .  {* Add symbols from this object file into the hash table.  *}
00462 .  bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
00463 .
00464 .  {* Indicate that we are only retrieving symbol values from this section.  *}
00465 .  void        (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
00466 .
00467 .  {* Do a link based on the link_order structures attached to each
00468 .     section of the BFD.  *}
00469 .  bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
00470 .
00471 .  {* Should this section be split up into smaller pieces during linking.  *}
00472 .  bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
00473 .
00474 .  {* Remove sections that are not referenced from the output.  *}
00475 .  bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
00476 .
00477 .  {* Attempt to merge SEC_MERGE sections.  *}
00478 .  bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
00479 .
00480 .  {* Is this section a member of a group?  *}
00481 .  bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
00482 .
00483 .  {* Discard members of a group.  *}
00484 .  bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
00485 .
00486 .  {* Check if SEC has been already linked during a reloceatable or
00487 .     final link.  *}
00488 .  void (*_section_already_linked) (bfd *, struct bfd_section *,
00489 .                               struct bfd_link_info *);
00490 .
00491 .  {* Routines to handle dynamic symbols and relocs.  *}
00492 .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
00493 .  NAME##_get_dynamic_symtab_upper_bound, \
00494 .  NAME##_canonicalize_dynamic_symtab, \
00495 .  NAME##_get_synthetic_symtab, \
00496 .  NAME##_get_dynamic_reloc_upper_bound, \
00497 .  NAME##_canonicalize_dynamic_reloc
00498 .
00499 .  {* Get the amount of memory required to hold the dynamic symbols.  *}
00500 .  long        (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
00501 .  {* Read in the dynamic symbols.  *}
00502 .  long        (*_bfd_canonicalize_dynamic_symtab)
00503 .    (bfd *, struct bfd_symbol **);
00504 .  {* Create synthetized symbols.  *}
00505 .  long        (*_bfd_get_synthetic_symtab)
00506 .    (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
00507 .     struct bfd_symbol **);
00508 .  {* Get the amount of memory required to hold the dynamic relocs.  *}
00509 .  long        (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
00510 .  {* Read in the dynamic relocs.  *}
00511 .  long        (*_bfd_canonicalize_dynamic_reloc)
00512 .    (bfd *, arelent **, struct bfd_symbol **);
00513 .
00514 
00515 A pointer to an alternative bfd_target in case the current one is not
00516 satisfactory.  This can happen when the target cpu supports both big
00517 and little endian code, and target chosen by the linker has the wrong
00518 endianness.  The function open_output() in ld/ldlang.c uses this field
00519 to find an alternative output format that is suitable.
00520 
00521 .  {* Opposite endian version of this target.  *}
00522 .  const struct bfd_target * alternative_target;
00523 .
00524 
00525 .  {* Data for use by back-end routines, which isn't
00526 .     generic enough to belong in this structure.  *}
00527 .  const void *backend_data;
00528 .
00529 .} bfd_target;
00530 .
00531 */
00532 
00533 /* All known xvecs (even those that don't compile on all systems).
00534    Alphabetized for easy reference.
00535    They are listed a second time below, since
00536    we can't intermix extern's and initializers.  */
00537 extern const bfd_target a_out_adobe_vec;
00538 extern const bfd_target aix5coff64_vec;
00539 extern const bfd_target aout0_big_vec;
00540 extern const bfd_target aout_arm_big_vec;
00541 extern const bfd_target aout_arm_little_vec;
00542 extern const bfd_target aout_mips_big_vec;
00543 extern const bfd_target aout_mips_little_vec;
00544 extern const bfd_target apollocoff_vec;
00545 extern const bfd_target arm_epoc_pe_big_vec;
00546 extern const bfd_target arm_epoc_pe_little_vec;
00547 extern const bfd_target arm_epoc_pei_big_vec;
00548 extern const bfd_target arm_epoc_pei_little_vec;
00549 extern const bfd_target arm_wince_pe_big_vec;
00550 extern const bfd_target arm_wince_pe_little_vec;
00551 extern const bfd_target arm_wince_pei_big_vec;
00552 extern const bfd_target arm_wince_pei_little_vec;
00553 extern const bfd_target armcoff_big_vec;
00554 extern const bfd_target armcoff_little_vec;
00555 extern const bfd_target armnetbsd_vec;
00556 extern const bfd_target armpe_big_vec;
00557 extern const bfd_target armpe_little_vec;
00558 extern const bfd_target armpei_big_vec;
00559 extern const bfd_target armpei_little_vec;
00560 extern const bfd_target b_out_vec_big_host;
00561 extern const bfd_target b_out_vec_little_host;
00562 extern const bfd_target bfd_efi_app_ia32_vec;
00563 extern const bfd_target bfd_efi_app_x86_64_vec;
00564 extern const bfd_target bfd_efi_app_ia64_vec;
00565 extern const bfd_target bfd_elf32_avr_vec;
00566 extern const bfd_target bfd_elf32_bfin_vec;
00567 extern const bfd_target bfd_elf32_bfinfdpic_vec;
00568 extern const bfd_target bfd_elf32_big_generic_vec;
00569 extern const bfd_target bfd_elf32_bigarc_vec;
00570 extern const bfd_target bfd_elf32_bigarm_vec;
00571 extern const bfd_target bfd_elf32_bigarm_symbian_vec;
00572 extern const bfd_target bfd_elf32_bigarm_vxworks_vec;
00573 extern const bfd_target bfd_elf32_bigmips_vec;
00574 extern const bfd_target bfd_elf32_bigmips_vxworks_vec;
00575 extern const bfd_target bfd_elf32_cr16c_vec;
00576 extern const bfd_target bfd_elf32_cris_vec;
00577 extern const bfd_target bfd_elf32_crx_vec;
00578 extern const bfd_target bfd_elf32_d10v_vec;
00579 extern const bfd_target bfd_elf32_d30v_vec;
00580 extern const bfd_target bfd_elf32_dlx_big_vec;
00581 extern const bfd_target bfd_elf32_fr30_vec;
00582 extern const bfd_target bfd_elf32_frv_vec;
00583 extern const bfd_target bfd_elf32_frvfdpic_vec;
00584 extern const bfd_target bfd_elf32_h8300_vec;
00585 extern const bfd_target bfd_elf32_hppa_linux_vec;
00586 extern const bfd_target bfd_elf32_hppa_nbsd_vec;
00587 extern const bfd_target bfd_elf32_hppa_vec;
00588 extern const bfd_target bfd_elf32_i370_vec;
00589 extern const bfd_target bfd_elf32_i386_freebsd_vec;
00590 extern const bfd_target bfd_elf32_i386_vxworks_vec;
00591 extern const bfd_target bfd_elf32_i386_vec;
00592 extern const bfd_target bfd_elf32_i860_little_vec;
00593 extern const bfd_target bfd_elf32_i860_vec;
00594 extern const bfd_target bfd_elf32_i960_vec;
00595 extern const bfd_target bfd_elf32_ia64_big_vec;
00596 extern const bfd_target bfd_elf32_ia64_hpux_big_vec;
00597 extern const bfd_target bfd_elf32_ip2k_vec;
00598 extern const bfd_target bfd_elf32_iq2000_vec;
00599 extern const bfd_target bfd_elf32_little_generic_vec;
00600 extern const bfd_target bfd_elf32_littlearc_vec;
00601 extern const bfd_target bfd_elf32_littlearm_vec;
00602 extern const bfd_target bfd_elf32_littlearm_symbian_vec;
00603 extern const bfd_target bfd_elf32_littlearm_vxworks_vec;
00604 extern const bfd_target bfd_elf32_littlemips_vec;
00605 extern const bfd_target bfd_elf32_littlemips_vxworks_vec;
00606 extern const bfd_target bfd_elf32_m32c_vec;
00607 extern const bfd_target bfd_elf32_m32r_vec;
00608 extern const bfd_target bfd_elf32_m32rle_vec;
00609 extern const bfd_target bfd_elf32_m32rlin_vec;
00610 extern const bfd_target bfd_elf32_m32rlelin_vec;
00611 extern const bfd_target bfd_elf32_m68hc11_vec;
00612 extern const bfd_target bfd_elf32_m68hc12_vec;
00613 extern const bfd_target bfd_elf32_m68k_vec;
00614 extern const bfd_target bfd_elf32_m88k_vec;
00615 extern const bfd_target bfd_elf32_mcore_big_vec;
00616 extern const bfd_target bfd_elf32_mcore_little_vec;
00617 extern const bfd_target bfd_elf32_mep_vec;
00618 extern const bfd_target bfd_elf32_mep_little_vec;
00619 extern const bfd_target bfd_elf32_mn10200_vec;
00620 extern const bfd_target bfd_elf32_mn10300_vec;
00621 extern const bfd_target bfd_elf32_mt_vec;
00622 extern const bfd_target bfd_elf32_msp430_vec;
00623 extern const bfd_target bfd_elf32_nbigmips_vec;
00624 extern const bfd_target bfd_elf32_nlittlemips_vec;
00625 extern const bfd_target bfd_elf32_ntradbigmips_vec;
00626 extern const bfd_target bfd_elf32_ntradlittlemips_vec;
00627 extern const bfd_target bfd_elf32_openrisc_vec;
00628 extern const bfd_target bfd_elf32_or32_big_vec;
00629 extern const bfd_target bfd_elf32_pj_vec;
00630 extern const bfd_target bfd_elf32_pjl_vec;
00631 extern const bfd_target bfd_elf32_powerpc_vec;
00632 extern const bfd_target bfd_elf32_powerpcle_vec;
00633 extern const bfd_target bfd_elf32_powerpc_vxworks_vec;
00634 extern const bfd_target bfd_elf32_s390_vec;
00635 extern const bfd_target bfd_elf32_bigscore_vec;
00636 extern const bfd_target bfd_elf32_littlescore_vec;
00637 extern const bfd_target bfd_elf32_sh64_vec;
00638 extern const bfd_target bfd_elf32_sh64l_vec;
00639 extern const bfd_target bfd_elf32_sh64lin_vec;
00640 extern const bfd_target bfd_elf32_sh64blin_vec;
00641 extern const bfd_target bfd_elf32_sh64lnbsd_vec;
00642 extern const bfd_target bfd_elf32_sh64nbsd_vec;
00643 extern const bfd_target bfd_elf32_sh_vec;
00644 extern const bfd_target bfd_elf32_shblin_vec;
00645 extern const bfd_target bfd_elf32_shl_vec;
00646 extern const bfd_target bfd_elf32_shl_symbian_vec;
00647 extern const bfd_target bfd_elf32_shlin_vec;
00648 extern const bfd_target bfd_elf32_shlnbsd_vec;
00649 extern const bfd_target bfd_elf32_shlvxworks_vec;
00650 extern const bfd_target bfd_elf32_shnbsd_vec;
00651 extern const bfd_target bfd_elf32_shvxworks_vec;
00652 extern const bfd_target bfd_elf32_sparc_vec;
00653 extern const bfd_target bfd_elf32_sparc_vxworks_vec;
00654 extern const bfd_target bfd_elf32_spu_vec;
00655 extern const bfd_target bfd_elf32_tradbigmips_vec;
00656 extern const bfd_target bfd_elf32_tradlittlemips_vec;
00657 extern const bfd_target bfd_elf32_us_cris_vec;
00658 extern const bfd_target bfd_elf32_v850_vec;
00659 extern const bfd_target bfd_elf32_vax_vec;
00660 extern const bfd_target bfd_elf32_xc16x_vec;
00661 extern const bfd_target bfd_elf32_xstormy16_vec;
00662 extern const bfd_target bfd_elf32_xtensa_be_vec;
00663 extern const bfd_target bfd_elf32_xtensa_le_vec;
00664 extern const bfd_target bfd_elf64_alpha_freebsd_vec;
00665 extern const bfd_target bfd_elf64_alpha_vec;
00666 extern const bfd_target bfd_elf64_big_generic_vec;
00667 extern const bfd_target bfd_elf64_bigmips_vec;
00668 extern const bfd_target bfd_elf64_hppa_linux_vec;
00669 extern const bfd_target bfd_elf64_hppa_vec;
00670 extern const bfd_target bfd_elf64_ia64_big_vec;
00671 extern const bfd_target bfd_elf64_ia64_hpux_big_vec;
00672 extern const bfd_target bfd_elf64_ia64_little_vec;
00673 extern const bfd_target bfd_elf64_little_generic_vec;
00674 extern const bfd_target bfd_elf64_littlemips_vec;
00675 extern const bfd_target bfd_elf64_mmix_vec;
00676 extern const bfd_target bfd_elf64_powerpc_vec;
00677 extern const bfd_target bfd_elf64_powerpcle_vec;
00678 extern const bfd_target bfd_elf64_s390_vec;
00679 extern const bfd_target bfd_elf64_sh64_vec;
00680 extern const bfd_target bfd_elf64_sh64l_vec;
00681 extern const bfd_target bfd_elf64_sh64lin_vec;
00682 extern const bfd_target bfd_elf64_sh64blin_vec;
00683 extern const bfd_target bfd_elf64_sh64lnbsd_vec;
00684 extern const bfd_target bfd_elf64_sh64nbsd_vec;
00685 extern const bfd_target bfd_elf64_sparc_vec;
00686 extern const bfd_target bfd_elf64_sparc_freebsd_vec;
00687 extern const bfd_target bfd_elf64_tradbigmips_vec;
00688 extern const bfd_target bfd_elf64_tradlittlemips_vec;
00689 extern const bfd_target bfd_elf64_x86_64_freebsd_vec;
00690 extern const bfd_target bfd_elf64_x86_64_vec;
00691 extern const bfd_target bfd_mmo_vec;
00692 extern const bfd_target bfd_powerpc_pe_vec;
00693 extern const bfd_target bfd_powerpc_pei_vec;
00694 extern const bfd_target bfd_powerpcle_pe_vec;
00695 extern const bfd_target bfd_powerpcle_pei_vec;
00696 extern const bfd_target cris_aout_vec;
00697 extern const bfd_target demo_64_vec;
00698 extern const bfd_target ecoff_big_vec;
00699 extern const bfd_target ecoff_biglittle_vec;
00700 extern const bfd_target ecoff_little_vec;
00701 extern const bfd_target ecoffalpha_little_vec;
00702 extern const bfd_target go32coff_vec;
00703 extern const bfd_target go32stubbedcoff_vec;
00704 extern const bfd_target h8300coff_vec;
00705 extern const bfd_target h8500coff_vec;
00706 extern const bfd_target host_aout_vec;
00707 extern const bfd_target hp300bsd_vec;
00708 extern const bfd_target hp300hpux_vec;
00709 extern const bfd_target i386aout_vec;
00710 extern const bfd_target i386bsd_vec;
00711 extern const bfd_target i386coff_vec;
00712 extern const bfd_target i386dynix_vec;
00713 extern const bfd_target i386freebsd_vec;
00714 extern const bfd_target i386linux_vec;
00715 extern const bfd_target i386lynx_aout_vec;
00716 extern const bfd_target i386lynx_coff_vec;
00717 extern const bfd_target i386mach3_vec;
00718 extern const bfd_target i386msdos_vec;
00719 extern const bfd_target i386netbsd_vec;
00720 extern const bfd_target i386os9k_vec;
00721 extern const bfd_target i386pe_vec;
00722 extern const bfd_target i386pei_vec;
00723 extern const bfd_target i860coff_vec;
00724 extern const bfd_target icoff_big_vec;
00725 extern const bfd_target icoff_little_vec;
00726 extern const bfd_target ieee_vec;
00727 extern const bfd_target m68k4knetbsd_vec;
00728 extern const bfd_target m68kaux_coff_vec;
00729 extern const bfd_target m68kcoff_vec;
00730 extern const bfd_target m68kcoffun_vec;
00731 extern const bfd_target m68klinux_vec;
00732 extern const bfd_target m68knetbsd_vec;
00733 extern const bfd_target m68ksysvcoff_vec;
00734 extern const bfd_target m88kbcs_vec;
00735 extern const bfd_target m88kmach3_vec;
00736 extern const bfd_target m88kopenbsd_vec;
00737 extern const bfd_target mach_o_be_vec;
00738 extern const bfd_target mach_o_le_vec;
00739 extern const bfd_target mach_o_fat_vec;
00740 extern const bfd_target maxqcoff_vec;
00741 extern const bfd_target mcore_pe_big_vec;
00742 extern const bfd_target mcore_pe_little_vec;
00743 extern const bfd_target mcore_pei_big_vec;
00744 extern const bfd_target mcore_pei_little_vec;
00745 extern const bfd_target mipslpe_vec;
00746 extern const bfd_target mipslpei_vec;
00747 extern const bfd_target newsos3_vec;
00748 extern const bfd_target nlm32_alpha_vec;
00749 extern const bfd_target nlm32_i386_vec;
00750 extern const bfd_target nlm32_powerpc_vec;
00751 extern const bfd_target nlm32_sparc_vec;
00752 extern const bfd_target oasys_vec;
00753 extern const bfd_target or32coff_big_vec;
00754 extern const bfd_target pc532machaout_vec;
00755 extern const bfd_target pc532netbsd_vec;
00756 extern const bfd_target pdp11_aout_vec;
00757 extern const bfd_target pef_vec;
00758 extern const bfd_target pef_xlib_vec;
00759 extern const bfd_target pmac_xcoff_vec;
00760 extern const bfd_target ppcboot_vec;
00761 extern const bfd_target riscix_vec;
00762 extern const bfd_target rs6000coff64_vec;
00763 extern const bfd_target rs6000coff_vec;
00764 extern const bfd_target shcoff_small_vec;
00765 extern const bfd_target shcoff_vec;
00766 extern const bfd_target shlcoff_small_vec;
00767 extern const bfd_target shlcoff_vec;
00768 extern const bfd_target shlpe_vec;
00769 extern const bfd_target shlpei_vec;
00770 extern const bfd_target som_vec;
00771 extern const bfd_target sparccoff_vec;
00772 extern const bfd_target sparcle_aout_vec;
00773 extern const bfd_target sparclinux_vec;
00774 extern const bfd_target sparclynx_aout_vec;
00775 extern const bfd_target sparclynx_coff_vec;
00776 extern const bfd_target sparcnetbsd_vec;
00777 extern const bfd_target sunos_big_vec;
00778 extern const bfd_target sym_vec;
00779 extern const bfd_target tic30_aout_vec;
00780 extern const bfd_target tic30_coff_vec;
00781 extern const bfd_target tic4x_coff0_beh_vec;
00782 extern const bfd_target tic4x_coff0_vec;
00783 extern const bfd_target tic4x_coff1_beh_vec;
00784 extern const bfd_target tic4x_coff1_vec;
00785 extern const bfd_target tic4x_coff2_beh_vec;
00786 extern const bfd_target tic4x_coff2_vec;
00787 extern const bfd_target tic54x_coff0_beh_vec;
00788 extern const bfd_target tic54x_coff0_vec;
00789 extern const bfd_target tic54x_coff1_beh_vec;
00790 extern const bfd_target tic54x_coff1_vec;
00791 extern const bfd_target tic54x_coff2_beh_vec;
00792 extern const bfd_target tic54x_coff2_vec;
00793 extern const bfd_target tic80coff_vec;
00794 extern const bfd_target vaxbsd_vec;
00795 extern const bfd_target vaxnetbsd_vec;
00796 extern const bfd_target vax1knetbsd_vec;
00797 extern const bfd_target versados_vec;
00798 extern const bfd_target vms_alpha_vec;
00799 extern const bfd_target vms_vax_vec;
00800 extern const bfd_target w65_vec;
00801 extern const bfd_target we32kcoff_vec;
00802 extern const bfd_target x86_64pe_vec;
00803 extern const bfd_target x86_64pei_vec;
00804 extern const bfd_target x86_64coff_vec;
00805 extern const bfd_target z80coff_vec;
00806 extern const bfd_target z8kcoff_vec;
00807 
00808 /* These are always included.  */
00809 extern const bfd_target srec_vec;
00810 extern const bfd_target symbolsrec_vec;
00811 extern const bfd_target tekhex_vec;
00812 extern const bfd_target binary_vec;
00813 extern const bfd_target ihex_vec;
00814 
00815 /* All of the xvecs for core files.  */
00816 extern const bfd_target aix386_core_vec;
00817 extern const bfd_target cisco_core_big_vec;
00818 extern const bfd_target cisco_core_little_vec;
00819 extern const bfd_target hppabsd_core_vec;
00820 extern const bfd_target hpux_core_vec;
00821 extern const bfd_target irix_core_vec;
00822 extern const bfd_target netbsd_core_vec;
00823 extern const bfd_target osf_core_vec;
00824 extern const bfd_target ptrace_core_vec;
00825 extern const bfd_target sco5_core_vec;
00826 extern const bfd_target trad_core_vec;
00827 
00828 extern const bfd_target bfd_elf32_am33lin_vec;
00829 static const bfd_target * const _bfd_target_vector[] =
00830 {
00831 #ifdef SELECT_VECS
00832 
00833        SELECT_VECS,
00834 
00835 #else /* not SELECT_VECS */
00836 
00837 #ifdef DEFAULT_VECTOR
00838        &DEFAULT_VECTOR,
00839 #endif
00840        /* This list is alphabetized to make it easy to compare
00841           with other vector lists -- the decls above and
00842           the case statement in configure.in.
00843           Vectors that don't compile on all systems, or aren't finished,
00844           should have an entry here with #if 0 around it, to show that
00845           it wasn't omitted by mistake.  */
00846        &a_out_adobe_vec,
00847 #ifdef BFD64
00848        &aix5coff64_vec,
00849 #endif
00850        &aout0_big_vec,
00851 #if 0
00852        /* We have no way of distinguishing these from other a.out variants.  */
00853        &aout_arm_big_vec,
00854        &aout_arm_little_vec,
00855        /* No one seems to use this.  */
00856        &aout_mips_big_vec,
00857 #endif
00858        &aout_mips_little_vec,
00859 #if 0
00860        &apollocoff_vec,
00861 #endif
00862        &arm_epoc_pe_big_vec,
00863        &arm_epoc_pe_little_vec,
00864        &arm_epoc_pei_big_vec,
00865        &arm_epoc_pei_little_vec,
00866        &arm_wince_pe_big_vec,
00867        &arm_wince_pe_little_vec,
00868        &arm_wince_pei_big_vec,
00869        &arm_wince_pei_little_vec,
00870        &armcoff_big_vec,
00871        &armcoff_little_vec,
00872        &armnetbsd_vec,
00873        &armpe_big_vec,
00874        &armpe_little_vec,
00875        &armpei_big_vec,
00876        &armpei_little_vec,
00877        &b_out_vec_big_host,
00878        &b_out_vec_little_host,
00879        &bfd_efi_app_ia32_vec,
00880 #ifdef BFD64
00881        &bfd_efi_app_x86_64_vec,
00882        &bfd_efi_app_ia64_vec,
00883 #endif
00884        &bfd_elf32_avr_vec,
00885        &bfd_elf32_bfin_vec,
00886        &bfd_elf32_bfinfdpic_vec,
00887 
00888        /* This, and other vectors, may not be used in any *.mt configuration.
00889           But that does not mean they are unnecessary.  If configured with
00890           --enable-targets=all, objdump or gdb should be able to examine
00891           the file even if we don't recognize the machine type.  */
00892        &bfd_elf32_big_generic_vec,
00893        &bfd_elf32_bigarc_vec,
00894        &bfd_elf32_bigarm_vec,
00895        &bfd_elf32_bigarm_symbian_vec,
00896        &bfd_elf32_bigarm_vxworks_vec,
00897        &bfd_elf32_bigmips_vec,
00898        &bfd_elf32_bigmips_vxworks_vec,
00899        &bfd_elf32_cr16c_vec,
00900        &bfd_elf32_cris_vec,
00901        &bfd_elf32_crx_vec,
00902        &bfd_elf32_d10v_vec,
00903        &bfd_elf32_d30v_vec,
00904        &bfd_elf32_dlx_big_vec,
00905        &bfd_elf32_fr30_vec,
00906        &bfd_elf32_frv_vec,
00907        &bfd_elf32_frvfdpic_vec,
00908        &bfd_elf32_h8300_vec,
00909        &bfd_elf32_hppa_linux_vec,
00910        &bfd_elf32_hppa_nbsd_vec,
00911        &bfd_elf32_hppa_vec,
00912        &bfd_elf32_i370_vec,
00913        &bfd_elf32_i386_freebsd_vec,
00914        &bfd_elf32_i386_vxworks_vec,
00915        &bfd_elf32_i386_vec,
00916        &bfd_elf32_i860_little_vec,
00917        &bfd_elf32_i860_vec,
00918        &bfd_elf32_i960_vec,
00919 #if 0
00920        &bfd_elf32_ia64_big_vec,
00921 #endif
00922 #ifdef BFD64
00923        &bfd_elf32_ia64_hpux_big_vec,
00924 #endif
00925        &bfd_elf32_ip2k_vec,
00926        &bfd_elf32_iq2000_vec,
00927        &bfd_elf32_little_generic_vec,
00928        &bfd_elf32_littlearc_vec,
00929        &bfd_elf32_littlearm_vec,
00930        &bfd_elf32_littlearm_symbian_vec,
00931        &bfd_elf32_littlearm_vxworks_vec,
00932        &bfd_elf32_littlemips_vec,
00933        &bfd_elf32_littlemips_vxworks_vec,
00934        &bfd_elf32_m32c_vec,
00935        &bfd_elf32_m32r_vec,
00936         &bfd_elf32_m32rle_vec,
00937         &bfd_elf32_m32rlin_vec,
00938         &bfd_elf32_m32rlelin_vec,
00939        &bfd_elf32_m68hc11_vec,
00940        &bfd_elf32_m68hc12_vec,
00941        &bfd_elf32_m68k_vec,
00942        &bfd_elf32_m88k_vec,
00943        &bfd_elf32_mcore_big_vec,
00944        &bfd_elf32_mcore_little_vec,
00945        &bfd_elf32_mep_vec,
00946        &bfd_elf32_mn10200_vec,
00947        &bfd_elf32_mn10300_vec,
00948        &bfd_elf32_mt_vec,
00949        &bfd_elf32_msp430_vec,
00950 #ifdef BFD64
00951        &bfd_elf32_nbigmips_vec,
00952        &bfd_elf32_nlittlemips_vec,
00953        &bfd_elf32_ntradbigmips_vec,
00954        &bfd_elf32_ntradlittlemips_vec,
00955 #endif
00956        &bfd_elf32_openrisc_vec,
00957        &bfd_elf32_or32_big_vec,
00958        &bfd_elf32_pj_vec,
00959        &bfd_elf32_pjl_vec,
00960        &bfd_elf32_powerpc_vec,
00961        &bfd_elf32_powerpc_vxworks_vec,
00962        &bfd_elf32_powerpcle_vec,
00963        &bfd_elf32_s390_vec,
00964        &bfd_elf32_bigscore_vec,
00965        &bfd_elf32_littlescore_vec, 
00966         &bfd_elf32_sh_vec,
00967         &bfd_elf32_shblin_vec,
00968         &bfd_elf32_shl_vec,
00969         &bfd_elf32_shl_symbian_vec,
00970         &bfd_elf32_shlin_vec,
00971        &bfd_elf32_shlnbsd_vec,
00972        &bfd_elf32_shlvxworks_vec,
00973        &bfd_elf32_shnbsd_vec,
00974        &bfd_elf32_shvxworks_vec,
00975 #ifdef BFD64
00976        &bfd_elf32_sh64_vec,
00977        &bfd_elf32_sh64l_vec,
00978        &bfd_elf32_sh64lnbsd_vec,
00979        &bfd_elf32_sh64nbsd_vec,
00980        &bfd_elf32_sh64lin_vec,
00981        &bfd_elf32_sh64blin_vec,
00982 #endif
00983        &bfd_elf32_sparc_vec,
00984        &bfd_elf32_sparc_vxworks_vec,
00985        &bfd_elf32_spu_vec,
00986        &bfd_elf32_tradbigmips_vec,
00987        &bfd_elf32_tradlittlemips_vec,
00988        &bfd_elf32_us_cris_vec,
00989        &bfd_elf32_v850_vec,
00990        &bfd_elf32_vax_vec,
00991        &bfd_elf32_xc16x_vec,
00992        &bfd_elf32_xstormy16_vec,
00993        &bfd_elf32_xtensa_be_vec,
00994        &bfd_elf32_xtensa_le_vec,
00995 #ifdef BFD64
00996        &bfd_elf64_alpha_freebsd_vec,
00997        &bfd_elf64_alpha_vec,
00998        &bfd_elf64_big_generic_vec,
00999        &bfd_elf64_bigmips_vec,
01000        &bfd_elf64_hppa_linux_vec,
01001        &bfd_elf64_hppa_vec,
01002        &bfd_elf64_ia64_big_vec,
01003        &bfd_elf64_ia64_hpux_big_vec,
01004        &bfd_elf64_ia64_little_vec,
01005        &bfd_elf64_little_generic_vec,
01006        &bfd_elf64_littlemips_vec,
01007        &bfd_elf64_mmix_vec,
01008        &bfd_elf64_powerpc_vec,
01009        &bfd_elf64_powerpcle_vec,
01010        &bfd_elf64_s390_vec,
01011        &bfd_elf64_sh64_vec,
01012        &bfd_elf64_sh64l_vec,
01013        &bfd_elf64_sh64lnbsd_vec,
01014        &bfd_elf64_sh64nbsd_vec,
01015        &bfd_elf64_sh64lin_vec,
01016        &bfd_elf64_sh64blin_vec,
01017        &bfd_elf64_sparc_vec,
01018        &bfd_elf64_sparc_freebsd_vec,
01019        &bfd_elf64_tradbigmips_vec,
01020        &bfd_elf64_tradlittlemips_vec,
01021        &bfd_elf64_x86_64_freebsd_vec,
01022        &bfd_elf64_x86_64_vec,
01023        &bfd_mmo_vec,
01024 #endif
01025        &bfd_powerpc_pe_vec,
01026        &bfd_powerpc_pei_vec,
01027        &bfd_powerpcle_pe_vec,
01028        &bfd_powerpcle_pei_vec,
01029        &cris_aout_vec,
01030 #ifdef BFD64
01031        &demo_64_vec, /* Only compiled if host has long-long support.  */
01032 #endif
01033        &ecoff_big_vec,
01034        &ecoff_biglittle_vec,
01035        &ecoff_little_vec,
01036 #ifdef BFD64
01037        &ecoffalpha_little_vec,
01038 #endif
01039        &go32coff_vec,
01040        &go32stubbedcoff_vec,
01041        &h8300coff_vec,
01042        &h8500coff_vec,
01043 #if 0
01044        /* Since a.out files lack decent magic numbers, no way to recognize
01045           which kind of a.out file it is.  */
01046        &host_aout_vec,
01047        /* Clashes with sunos_big_vec magic no.  */
01048        &hp300bsd_vec,
01049 #endif
01050        &hp300hpux_vec,
01051        &i386aout_vec,
01052        &i386bsd_vec,
01053        &i386coff_vec,
01054 #if 0
01055        &i386dynix_vec,
01056 #endif
01057        &i386freebsd_vec,
01058 #if 0
01059        /* Since a.out files lack decent magic numbers, no way to recognize
01060           which kind of a.out file it is.  */
01061        &i386linux_vec,
01062 #endif
01063        &i386lynx_aout_vec,
01064        &i386lynx_coff_vec,
01065 #if 0
01066        /* No distinguishing features for Mach 3 executables.  */
01067        &i386mach3_vec,
01068 #endif
01069        &i386msdos_vec,
01070        &i386netbsd_vec,
01071        &i386os9k_vec,
01072        &i386pe_vec,
01073        &i386pei_vec,
01074 #ifdef BFD64
01075        &x86_64coff_vec,
01076        &x86_64pe_vec,
01077        &x86_64pei_vec,
01078 #endif
01079        &i860coff_vec,
01080        &icoff_big_vec,
01081        &icoff_little_vec,
01082        &ieee_vec,
01083 #if 0
01084        &m68k4knetbsd_vec,
01085        &m68kaux_coff_vec,
01086 #endif
01087        &m68kcoff_vec,
01088        &m68kcoffun_vec,
01089 #if 0
01090        /* Since a.out files lack decent magic numbers, no way to recognize
01091           which kind of a.out file it is.  */
01092        &m68klinux_vec,
01093 #endif
01094        &m68knetbsd_vec,
01095        &m68ksysvcoff_vec,
01096        &m88kbcs_vec,
01097        &m88kmach3_vec,
01098        &m88kopenbsd_vec,
01099        &mach_o_be_vec,
01100        &mach_o_le_vec,
01101        &mach_o_fat_vec,
01102        &maxqcoff_vec,
01103        &mcore_pe_big_vec,
01104        &mcore_pe_little_vec,
01105        &mcore_pei_big_vec,
01106        &mcore_pei_little_vec,
01107        &mipslpe_vec,
01108        &mipslpei_vec,
01109        &newsos3_vec,
01110 #ifdef BFD64
01111        &nlm32_alpha_vec,
01112 #endif
01113        &nlm32_i386_vec,
01114        &nlm32_powerpc_vec,
01115        &nlm32_sparc_vec,
01116 #if 0
01117        /* We have no oasys tools anymore, so we can't test any of this
01118           anymore. If you want to test the stuff yourself, go ahead...
01119           steve@cygnus.com
01120           Worse, since there is no magic number for archives, there
01121           can be annoying target mis-matches.  */
01122        &oasys_vec,
01123 #endif
01124        /* Entry for the OpenRISC family.  */
01125        &or32coff_big_vec,
01126 
01127        &pc532machaout_vec,
01128        &pc532netbsd_vec,
01129        &pdp11_aout_vec,
01130        &pef_vec,
01131        &pef_xlib_vec,
01132 #if 0
01133        /* This has the same magic number as RS/6000.  */
01134        &pmac_xcoff_vec,
01135 #endif
01136        &ppcboot_vec,
01137 #if 0
01138        /* We have no way of distinguishing these from other a.out variants.  */
01139        &riscix_vec,
01140 #endif
01141 #ifdef BFD64
01142        &rs6000coff64_vec,
01143 #endif
01144        &rs6000coff_vec,
01145        &shcoff_small_vec,
01146        &shcoff_vec,
01147        &shlcoff_small_vec,
01148        &shlcoff_vec,
01149        &shlpe_vec,
01150        &shlpei_vec,
01151 #if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
01152        &som_vec,
01153 #endif
01154        &sparccoff_vec,
01155        &sparcle_aout_vec,
01156        &sparclinux_vec,
01157        &sparclynx_aout_vec,
01158        &sparclynx_coff_vec,
01159        &sparcnetbsd_vec,
01160        &sunos_big_vec,
01161        &sym_vec,
01162        &tic30_aout_vec,
01163        &tic30_coff_vec,
01164        &tic54x_coff0_beh_vec,
01165        &tic54x_coff0_vec,
01166        &tic54x_coff1_beh_vec,
01167        &tic54x_coff1_vec,
01168        &tic54x_coff2_beh_vec,
01169        &tic54x_coff2_vec,
01170        &tic80coff_vec,
01171        &vaxbsd_vec,
01172        &vaxnetbsd_vec,
01173        &vax1knetbsd_vec,
01174        &versados_vec,
01175 #ifdef BFD64
01176        &vms_alpha_vec,
01177 #endif
01178        &vms_vax_vec,
01179        &w65_vec,
01180        &we32kcoff_vec,
01181        &z80coff_vec,
01182        &z8kcoff_vec,
01183        &bfd_elf32_am33lin_vec,
01184 #endif /* not SELECT_VECS */
01185 
01186 /* Always support S-records, for convenience.  */
01187        &srec_vec,
01188        &symbolsrec_vec,
01189 /* And tekhex */
01190        &tekhex_vec,
01191 /* Likewise for binary output.  */
01192        &binary_vec,
01193 /* Likewise for ihex.  */
01194        &ihex_vec,
01195 
01196 /* Add any required traditional-core-file-handler.  */
01197 
01198 #ifdef AIX386_CORE
01199        &aix386_core_vec,
01200 #endif
01201 #if 0
01202        /* We don't include cisco_core_*_vec.  Although it has a magic number,
01203           the magic number isn't at the beginning of the file, and thus
01204           might spuriously match other kinds of files.  */
01205        &cisco_core_big_vec,
01206        &cisco_core_little_vec,
01207 #endif
01208 #ifdef HPPABSD_CORE
01209        &hppabsd_core_vec,
01210 #endif
01211 #ifdef HPUX_CORE
01212        &hpux_core_vec,
01213 #endif
01214 #ifdef IRIX_CORE
01215        &irix_core_vec,
01216 #endif
01217 #ifdef NETBSD_CORE
01218        &netbsd_core_vec,
01219 #endif
01220 #ifdef OSF_CORE
01221        &osf_core_vec,
01222 #endif
01223 #ifdef PTRACE_CORE
01224        &ptrace_core_vec,
01225 #endif
01226 #ifdef SCO5_CORE
01227        &sco5_core_vec,
01228 #endif
01229 #ifdef TRAD_CORE
01230        &trad_core_vec,
01231 #endif
01232 
01233        NULL /* end of list marker */
01234 };
01235 const bfd_target * const *bfd_target_vector = _bfd_target_vector;
01236 
01237 /* bfd_default_vector[0] contains either the address of the default vector,
01238    if there is one, or zero if there isn't.  */
01239 
01240 const bfd_target *bfd_default_vector[] = {
01241 #ifdef DEFAULT_VECTOR
01242        &DEFAULT_VECTOR,
01243 #endif
01244        NULL
01245 };
01246 
01247 /* bfd_associated_vector[] contains the associated target vectors used
01248    to reduce the ambiguity in bfd_check_format_matches.  */
01249 
01250 static const bfd_target *_bfd_associated_vector[] = {
01251 #ifdef ASSOCIATED_VECS
01252        ASSOCIATED_VECS,
01253 #endif
01254        NULL
01255 };
01256 const bfd_target * const *bfd_associated_vector = _bfd_associated_vector;
01257 
01258 /* When there is an ambiguous match, bfd_check_format_matches puts the
01259    names of the matching targets in an array.  This variable is the maximum
01260    number of entries that the array could possibly need.  */
01261 const size_t _bfd_target_vector_entries = sizeof (_bfd_target_vector)/sizeof (*_bfd_target_vector);
01262 
01263 /* This array maps configuration triplets onto BFD vectors.  */
01264 
01265 struct targmatch
01266 {
01267   /* The configuration triplet.  */
01268   const char *triplet;
01269   /* The BFD vector.  If this is NULL, then the vector is found by
01270      searching forward for the next structure with a non NULL vector
01271      field.  */
01272   const bfd_target *vector;
01273 };
01274 
01275 /* targmatch.h is built by Makefile out of config.bfd.  */
01276 static const struct targmatch bfd_target_match[] = {
01277 #include "targmatch.h"
01278   { NULL, NULL }
01279 };
01280 
01281 /* Find a target vector, given a name or configuration triplet.  */
01282 
01283 static const bfd_target *
01284 find_target (const char *name)
01285 {
01286   const bfd_target * const *target;
01287   const struct targmatch *match;
01288 
01289   for (target = &bfd_target_vector[0]; *target != NULL; target++)
01290     if (strcmp (name, (*target)->name) == 0)
01291       return *target;
01292 
01293   /* If we couldn't match on the exact name, try matching on the
01294      configuration triplet.  FIXME: We should run the triplet through
01295      config.sub first, but that is hard.  */
01296   for (match = &bfd_target_match[0]; match->triplet != NULL; match++)
01297     {
01298       if (fnmatch (match->triplet, name, 0) == 0)
01299        {
01300          while (match->vector == NULL)
01301            ++match;
01302          return match->vector;
01303        }
01304     }
01305 
01306   bfd_set_error (bfd_error_invalid_target);
01307   return NULL;
01308 }
01309 
01310 /*
01311 FUNCTION
01312        bfd_set_default_target
01313 
01314 SYNOPSIS
01315        bfd_boolean bfd_set_default_target (const char *name);
01316 
01317 DESCRIPTION
01318        Set the default target vector to use when recognizing a BFD.
01319        This takes the name of the target, which may be a BFD target
01320        name or a configuration triplet.
01321 */
01322 
01323 bfd_boolean
01324 bfd_set_default_target (const char *name)
01325 {
01326   const bfd_target *target;
01327 
01328   if (bfd_default_vector[0] != NULL
01329       && strcmp (name, bfd_default_vector[0]->name) == 0)
01330     return TRUE;
01331 
01332   target = find_target (name);
01333   if (target == NULL)
01334     return FALSE;
01335 
01336   bfd_default_vector[0] = target;
01337   return TRUE;
01338 }
01339 
01340 /*
01341 FUNCTION
01342        bfd_find_target
01343 
01344 SYNOPSIS
01345        const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
01346 
01347 DESCRIPTION
01348        Return a pointer to the transfer vector for the object target
01349        named @var{target_name}.  If @var{target_name} is <<NULL>>,
01350        choose the one in the environment variable <<GNUTARGET>>; if
01351        that is null or not defined, then choose the first entry in the
01352        target list.  Passing in the string "default" or setting the
01353        environment variable to "default" will cause the first entry in
01354        the target list to be returned, and "target_defaulted" will be
01355        set in the BFD if @var{abfd} isn't <<NULL>>.  This causes
01356        <<bfd_check_format>> to loop over all the targets to find the
01357        one that matches the file being read.
01358 */
01359 
01360 const bfd_target *
01361 bfd_find_target (const char *target_name, bfd *abfd)
01362 {
01363   const char *targname;
01364   const bfd_target *target;
01365 
01366   if (target_name != NULL)
01367     targname = target_name;
01368   else
01369     targname = getenv ("GNUTARGET");
01370 
01371   /* This is safe; the vector cannot be null.  */
01372   if (targname == NULL || strcmp (targname, "default") == 0)
01373     {
01374       if (bfd_default_vector[0] != NULL)
01375        target = bfd_default_vector[0];
01376       else
01377        target = bfd_target_vector[0];
01378       if (abfd)
01379        {
01380          abfd->xvec = target;
01381          abfd->target_defaulted = TRUE;
01382        }
01383       return target;
01384     }
01385 
01386   if (abfd)
01387     abfd->target_defaulted = FALSE;
01388 
01389   target = find_target (targname);
01390   if (target == NULL)
01391     return NULL;
01392 
01393   if (abfd)
01394     abfd->xvec = target;
01395   return target;
01396 }
01397 
01398 /*
01399 FUNCTION
01400        bfd_target_list
01401 
01402 SYNOPSIS
01403        const char ** bfd_target_list (void);
01404 
01405 DESCRIPTION
01406        Return a freshly malloced NULL-terminated
01407        vector of the names of all the valid BFD targets. Do not
01408        modify the names.
01409 
01410 */
01411 
01412 const char **
01413 bfd_target_list (void)
01414 {
01415   int vec_length = 0;
01416   bfd_size_type amt;
01417 #if defined (HOST_HPPAHPUX) && ! defined (__STDC__)
01418   /* The native compiler on the HP9000/700 has a bug which causes it
01419      to loop endlessly when compiling this file.  This avoids it.  */
01420   volatile
01421 #endif
01422   const bfd_target * const *target;
01423   const  char **name_list, **name_ptr;
01424 
01425   for (target = &bfd_target_vector[0]; *target != NULL; target++)
01426     vec_length++;
01427 
01428   amt = (vec_length + 1) * sizeof (char **);
01429   name_ptr = name_list = bfd_malloc (amt);
01430 
01431   if (name_list == NULL)
01432     return NULL;
01433 
01434   for (target = &bfd_target_vector[0]; *target != NULL; target++)
01435     if (target == &bfd_target_vector[0]
01436        || *target != bfd_target_vector[0])
01437       *name_ptr++ = (*target)->name;
01438 
01439   *name_ptr = NULL;
01440   return name_list;
01441 }
01442 
01443 /*
01444 FUNCTION
01445        bfd_seach_for_target
01446 
01447 SYNOPSIS
01448        const bfd_target *bfd_search_for_target
01449          (int (*search_func) (const bfd_target *, void *),
01450           void *);
01451 
01452 DESCRIPTION
01453        Return a pointer to the first transfer vector in the list of
01454        transfer vectors maintained by BFD that produces a non-zero
01455        result when passed to the function @var{search_func}.  The
01456        parameter @var{data} is passed, unexamined, to the search
01457        function.
01458 */
01459 
01460 const bfd_target *
01461 bfd_search_for_target (int (*search_func) (const bfd_target *, void *),
01462                      void *data)
01463 {
01464   const bfd_target * const *target;
01465 
01466   for (target = bfd_target_vector; *target != NULL; target ++)
01467     if (search_func (*target, data))
01468       return *target;
01469 
01470   return NULL;
01471 }