xref: /dragonfly/contrib/gdb-7/bfd/targets.c (revision ef5ccd6c)
15796c8dcSSimon Schubert /* Generic target-file-type support for the BFD library.
25796c8dcSSimon Schubert    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3*ef5ccd6cSJohn Marino    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
45796c8dcSSimon Schubert    Free Software Foundation, Inc.
55796c8dcSSimon Schubert    Written by Cygnus Support.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    This file is part of BFD, the Binary File Descriptor library.
85796c8dcSSimon Schubert 
95796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
105796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
115796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
125796c8dcSSimon Schubert    (at your option) any later version.
135796c8dcSSimon Schubert 
145796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
155796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
165796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
175796c8dcSSimon Schubert    GNU General Public License for more details.
185796c8dcSSimon Schubert 
195796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
205796c8dcSSimon Schubert    along with this program; if not, write to the Free Software
215796c8dcSSimon Schubert    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
225796c8dcSSimon Schubert    MA 02110-1301, USA.  */
235796c8dcSSimon Schubert 
245796c8dcSSimon Schubert #include "sysdep.h"
255796c8dcSSimon Schubert #include "bfd.h"
265796c8dcSSimon Schubert #include "libbfd.h"
275796c8dcSSimon Schubert #include "fnmatch.h"
285796c8dcSSimon Schubert 
295796c8dcSSimon Schubert /*
305796c8dcSSimon Schubert    It's okay to see some:
315796c8dcSSimon Schubert #if 0
325796c8dcSSimon Schubert    directives in this source file, as targets.c uses them to exclude
335796c8dcSSimon Schubert    certain BFD vectors.  This comment is specially formatted to catch
345796c8dcSSimon Schubert    users who grep for ^#if 0, so please keep it this way!
355796c8dcSSimon Schubert */
365796c8dcSSimon Schubert 
375796c8dcSSimon Schubert /*
385796c8dcSSimon Schubert SECTION
395796c8dcSSimon Schubert 	Targets
405796c8dcSSimon Schubert 
415796c8dcSSimon Schubert DESCRIPTION
425796c8dcSSimon Schubert 	Each port of BFD to a different machine requires the creation
435796c8dcSSimon Schubert 	of a target back end. All the back end provides to the root
445796c8dcSSimon Schubert 	part of BFD is a structure containing pointers to functions
455796c8dcSSimon Schubert 	which perform certain low level operations on files. BFD
465796c8dcSSimon Schubert 	translates the applications's requests through a pointer into
475796c8dcSSimon Schubert 	calls to the back end routines.
485796c8dcSSimon Schubert 
495796c8dcSSimon Schubert 	When a file is opened with <<bfd_openr>>, its format and
505796c8dcSSimon Schubert 	target are unknown. BFD uses various mechanisms to determine
515796c8dcSSimon Schubert 	how to interpret the file. The operations performed are:
525796c8dcSSimon Schubert 
535796c8dcSSimon Schubert 	o Create a BFD by calling the internal routine
545796c8dcSSimon Schubert 	<<_bfd_new_bfd>>, then call <<bfd_find_target>> with the
555796c8dcSSimon Schubert 	target string supplied to <<bfd_openr>> and the new BFD pointer.
565796c8dcSSimon Schubert 
575796c8dcSSimon Schubert 	o If a null target string was provided to <<bfd_find_target>>,
585796c8dcSSimon Schubert 	look up the environment variable <<GNUTARGET>> and use
595796c8dcSSimon Schubert 	that as the target string.
605796c8dcSSimon Schubert 
615796c8dcSSimon Schubert 	o If the target string is still <<NULL>>, or the target string is
625796c8dcSSimon Schubert 	<<default>>, then use the first item in the target vector
635796c8dcSSimon Schubert 	as the target type, and set <<target_defaulted>> in the BFD to
645796c8dcSSimon Schubert 	cause <<bfd_check_format>> to loop through all the targets.
655796c8dcSSimon Schubert 	@xref{bfd_target}.  @xref{Formats}.
665796c8dcSSimon Schubert 
675796c8dcSSimon Schubert 	o Otherwise, inspect the elements in the target vector
685796c8dcSSimon Schubert 	one by one, until a match on target name is found. When found,
695796c8dcSSimon Schubert 	use it.
705796c8dcSSimon Schubert 
715796c8dcSSimon Schubert 	o Otherwise return the error <<bfd_error_invalid_target>> to
725796c8dcSSimon Schubert 	<<bfd_openr>>.
735796c8dcSSimon Schubert 
745796c8dcSSimon Schubert 	o <<bfd_openr>> attempts to open the file using
755796c8dcSSimon Schubert 	<<bfd_open_file>>, and returns the BFD.
765796c8dcSSimon Schubert 
775796c8dcSSimon Schubert 	Once the BFD has been opened and the target selected, the file
785796c8dcSSimon Schubert 	format may be determined. This is done by calling
795796c8dcSSimon Schubert 	<<bfd_check_format>> on the BFD with a suggested format.
805796c8dcSSimon Schubert 	If <<target_defaulted>> has been set, each possible target
815796c8dcSSimon Schubert 	type is tried to see if it recognizes the specified format.
825796c8dcSSimon Schubert 	<<bfd_check_format>> returns <<TRUE>> when the caller guesses right.
835796c8dcSSimon Schubert @menu
845796c8dcSSimon Schubert @* bfd_target::
855796c8dcSSimon Schubert @end menu
865796c8dcSSimon Schubert */
875796c8dcSSimon Schubert 
885796c8dcSSimon Schubert /*
895796c8dcSSimon Schubert 
905796c8dcSSimon Schubert INODE
915796c8dcSSimon Schubert 	bfd_target,  , Targets, Targets
925796c8dcSSimon Schubert DOCDD
935796c8dcSSimon Schubert SUBSECTION
945796c8dcSSimon Schubert 	bfd_target
955796c8dcSSimon Schubert 
965796c8dcSSimon Schubert DESCRIPTION
975796c8dcSSimon Schubert 	This structure contains everything that BFD knows about a
985796c8dcSSimon Schubert 	target. It includes things like its byte order, name, and which
995796c8dcSSimon Schubert 	routines to call to do various operations.
1005796c8dcSSimon Schubert 
1015796c8dcSSimon Schubert 	Every BFD points to a target structure with its <<xvec>>
1025796c8dcSSimon Schubert 	member.
1035796c8dcSSimon Schubert 
1045796c8dcSSimon Schubert 	The macros below are used to dispatch to functions through the
1055796c8dcSSimon Schubert 	<<bfd_target>> vector. They are used in a number of macros further
1065796c8dcSSimon Schubert 	down in @file{bfd.h}, and are also used when calling various
1075796c8dcSSimon Schubert 	routines by hand inside the BFD implementation.  The @var{arglist}
1085796c8dcSSimon Schubert 	argument must be parenthesized; it contains all the arguments
1095796c8dcSSimon Schubert 	to the called function.
1105796c8dcSSimon Schubert 
1115796c8dcSSimon Schubert 	They make the documentation (more) unpleasant to read, so if
1125796c8dcSSimon Schubert 	someone wants to fix this and not break the above, please do.
1135796c8dcSSimon Schubert 
1145796c8dcSSimon Schubert .#define BFD_SEND(bfd, message, arglist) \
1155796c8dcSSimon Schubert .  ((*((bfd)->xvec->message)) arglist)
1165796c8dcSSimon Schubert .
1175796c8dcSSimon Schubert .#ifdef DEBUG_BFD_SEND
1185796c8dcSSimon Schubert .#undef BFD_SEND
1195796c8dcSSimon Schubert .#define BFD_SEND(bfd, message, arglist) \
1205796c8dcSSimon Schubert .  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
1215796c8dcSSimon Schubert .    ((*((bfd)->xvec->message)) arglist) : \
1225796c8dcSSimon Schubert .    (bfd_assert (__FILE__,__LINE__), NULL))
1235796c8dcSSimon Schubert .#endif
1245796c8dcSSimon Schubert 
1255796c8dcSSimon Schubert 	For operations which index on the BFD format:
1265796c8dcSSimon Schubert 
1275796c8dcSSimon Schubert .#define BFD_SEND_FMT(bfd, message, arglist) \
1285796c8dcSSimon Schubert .  (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
1295796c8dcSSimon Schubert .
1305796c8dcSSimon Schubert .#ifdef DEBUG_BFD_SEND
1315796c8dcSSimon Schubert .#undef BFD_SEND_FMT
1325796c8dcSSimon Schubert .#define BFD_SEND_FMT(bfd, message, arglist) \
1335796c8dcSSimon Schubert .  (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
1345796c8dcSSimon Schubert .   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
1355796c8dcSSimon Schubert .   (bfd_assert (__FILE__,__LINE__), NULL))
1365796c8dcSSimon Schubert .#endif
1375796c8dcSSimon Schubert .
1385796c8dcSSimon Schubert 	This is the structure which defines the type of BFD this is.  The
1395796c8dcSSimon Schubert 	<<xvec>> member of the struct <<bfd>> itself points here.  Each
1405796c8dcSSimon Schubert 	module that implements access to a different target under BFD,
1415796c8dcSSimon Schubert 	defines one of these.
1425796c8dcSSimon Schubert 
1435796c8dcSSimon Schubert 	FIXME, these names should be rationalised with the names of
1445796c8dcSSimon Schubert 	the entry points which call them. Too bad we can't have one
1455796c8dcSSimon Schubert 	macro to define them both!
1465796c8dcSSimon Schubert 
1475796c8dcSSimon Schubert .enum bfd_flavour
1485796c8dcSSimon Schubert .{
1495796c8dcSSimon Schubert .  bfd_target_unknown_flavour,
1505796c8dcSSimon Schubert .  bfd_target_aout_flavour,
1515796c8dcSSimon Schubert .  bfd_target_coff_flavour,
1525796c8dcSSimon Schubert .  bfd_target_ecoff_flavour,
1535796c8dcSSimon Schubert .  bfd_target_xcoff_flavour,
1545796c8dcSSimon Schubert .  bfd_target_elf_flavour,
1555796c8dcSSimon Schubert .  bfd_target_ieee_flavour,
1565796c8dcSSimon Schubert .  bfd_target_nlm_flavour,
1575796c8dcSSimon Schubert .  bfd_target_oasys_flavour,
1585796c8dcSSimon Schubert .  bfd_target_tekhex_flavour,
1595796c8dcSSimon Schubert .  bfd_target_srec_flavour,
1605796c8dcSSimon Schubert .  bfd_target_verilog_flavour,
1615796c8dcSSimon Schubert .  bfd_target_ihex_flavour,
1625796c8dcSSimon Schubert .  bfd_target_som_flavour,
1635796c8dcSSimon Schubert .  bfd_target_os9k_flavour,
1645796c8dcSSimon Schubert .  bfd_target_versados_flavour,
1655796c8dcSSimon Schubert .  bfd_target_msdos_flavour,
1665796c8dcSSimon Schubert .  bfd_target_ovax_flavour,
1675796c8dcSSimon Schubert .  bfd_target_evax_flavour,
1685796c8dcSSimon Schubert .  bfd_target_mmo_flavour,
1695796c8dcSSimon Schubert .  bfd_target_mach_o_flavour,
1705796c8dcSSimon Schubert .  bfd_target_pef_flavour,
1715796c8dcSSimon Schubert .  bfd_target_pef_xlib_flavour,
1725796c8dcSSimon Schubert .  bfd_target_sym_flavour
1735796c8dcSSimon Schubert .};
1745796c8dcSSimon Schubert .
1755796c8dcSSimon Schubert .enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
1765796c8dcSSimon Schubert .
1775796c8dcSSimon Schubert .{* Forward declaration.  *}
1785796c8dcSSimon Schubert .typedef struct bfd_link_info _bfd_link_info;
1795796c8dcSSimon Schubert .
180a45ae5f8SJohn Marino .{* Forward declaration.  *}
181a45ae5f8SJohn Marino .typedef struct flag_info flag_info;
182a45ae5f8SJohn Marino .
1835796c8dcSSimon Schubert .typedef struct bfd_target
1845796c8dcSSimon Schubert .{
1855796c8dcSSimon Schubert .  {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc.  *}
1865796c8dcSSimon Schubert .  char *name;
1875796c8dcSSimon Schubert .
1885796c8dcSSimon Schubert . {* The "flavour" of a back end is a general indication about
1895796c8dcSSimon Schubert .    the contents of a file.  *}
1905796c8dcSSimon Schubert .  enum bfd_flavour flavour;
1915796c8dcSSimon Schubert .
1925796c8dcSSimon Schubert .  {* The order of bytes within the data area of a file.  *}
1935796c8dcSSimon Schubert .  enum bfd_endian byteorder;
1945796c8dcSSimon Schubert .
1955796c8dcSSimon Schubert . {* The order of bytes within the header parts of a file.  *}
1965796c8dcSSimon Schubert .  enum bfd_endian header_byteorder;
1975796c8dcSSimon Schubert .
1985796c8dcSSimon Schubert .  {* A mask of all the flags which an executable may have set -
1995796c8dcSSimon Schubert .     from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  *}
2005796c8dcSSimon Schubert .  flagword object_flags;
2015796c8dcSSimon Schubert .
2025796c8dcSSimon Schubert . {* A mask of all the flags which a section may have set - from
2035796c8dcSSimon Schubert .    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  *}
2045796c8dcSSimon Schubert .  flagword section_flags;
2055796c8dcSSimon Schubert .
2065796c8dcSSimon Schubert . {* The character normally found at the front of a symbol.
2075796c8dcSSimon Schubert .    (if any), perhaps `_'.  *}
2085796c8dcSSimon Schubert .  char symbol_leading_char;
2095796c8dcSSimon Schubert .
2105796c8dcSSimon Schubert . {* The pad character for file names within an archive header.  *}
2115796c8dcSSimon Schubert .  char ar_pad_char;
2125796c8dcSSimon Schubert .
2135796c8dcSSimon Schubert .  {* The maximum number of characters in an archive header.  *}
214a45ae5f8SJohn Marino .  unsigned char ar_max_namelen;
215a45ae5f8SJohn Marino .
216a45ae5f8SJohn Marino .  {* How well this target matches, used to select between various
217a45ae5f8SJohn Marino .     possible targets when more than one target matches.  *}
218a45ae5f8SJohn Marino .  unsigned char match_priority;
2195796c8dcSSimon Schubert .
2205796c8dcSSimon Schubert .  {* Entries for byte swapping for data. These are different from the
2215796c8dcSSimon Schubert .     other entry points, since they don't take a BFD as the first argument.
2225796c8dcSSimon Schubert .     Certain other handlers could do the same.  *}
2235796c8dcSSimon Schubert .  bfd_uint64_t   (*bfd_getx64) (const void *);
2245796c8dcSSimon Schubert .  bfd_int64_t    (*bfd_getx_signed_64) (const void *);
2255796c8dcSSimon Schubert .  void           (*bfd_putx64) (bfd_uint64_t, void *);
2265796c8dcSSimon Schubert .  bfd_vma        (*bfd_getx32) (const void *);
2275796c8dcSSimon Schubert .  bfd_signed_vma (*bfd_getx_signed_32) (const void *);
2285796c8dcSSimon Schubert .  void           (*bfd_putx32) (bfd_vma, void *);
2295796c8dcSSimon Schubert .  bfd_vma        (*bfd_getx16) (const void *);
2305796c8dcSSimon Schubert .  bfd_signed_vma (*bfd_getx_signed_16) (const void *);
2315796c8dcSSimon Schubert .  void           (*bfd_putx16) (bfd_vma, void *);
2325796c8dcSSimon Schubert .
2335796c8dcSSimon Schubert .  {* Byte swapping for the headers.  *}
2345796c8dcSSimon Schubert .  bfd_uint64_t   (*bfd_h_getx64) (const void *);
2355796c8dcSSimon Schubert .  bfd_int64_t    (*bfd_h_getx_signed_64) (const void *);
2365796c8dcSSimon Schubert .  void           (*bfd_h_putx64) (bfd_uint64_t, void *);
2375796c8dcSSimon Schubert .  bfd_vma        (*bfd_h_getx32) (const void *);
2385796c8dcSSimon Schubert .  bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
2395796c8dcSSimon Schubert .  void           (*bfd_h_putx32) (bfd_vma, void *);
2405796c8dcSSimon Schubert .  bfd_vma        (*bfd_h_getx16) (const void *);
2415796c8dcSSimon Schubert .  bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
2425796c8dcSSimon Schubert .  void           (*bfd_h_putx16) (bfd_vma, void *);
2435796c8dcSSimon Schubert .
2445796c8dcSSimon Schubert .  {* Format dependent routines: these are vectors of entry points
2455796c8dcSSimon Schubert .     within the target vector structure, one for each format to check.  *}
2465796c8dcSSimon Schubert .
2475796c8dcSSimon Schubert .  {* Check the format of a file being read.  Return a <<bfd_target *>> or zero.  *}
2485796c8dcSSimon Schubert .  const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
2495796c8dcSSimon Schubert .
2505796c8dcSSimon Schubert .  {* Set the format of a file being written.  *}
2515796c8dcSSimon Schubert .  bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
2525796c8dcSSimon Schubert .
2535796c8dcSSimon Schubert .  {* Write cached information into a file being written, at <<bfd_close>>.  *}
2545796c8dcSSimon Schubert .  bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
2555796c8dcSSimon Schubert .
2565796c8dcSSimon Schubert The general target vector.  These vectors are initialized using the
2575796c8dcSSimon Schubert BFD_JUMP_TABLE macros.
2585796c8dcSSimon Schubert .
2595796c8dcSSimon Schubert .  {* Generic entry points.  *}
2605796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_GENERIC(NAME) \
2615796c8dcSSimon Schubert .  NAME##_close_and_cleanup, \
2625796c8dcSSimon Schubert .  NAME##_bfd_free_cached_info, \
2635796c8dcSSimon Schubert .  NAME##_new_section_hook, \
2645796c8dcSSimon Schubert .  NAME##_get_section_contents, \
2655796c8dcSSimon Schubert .  NAME##_get_section_contents_in_window
2665796c8dcSSimon Schubert .
2675796c8dcSSimon Schubert .  {* Called when the BFD is being closed to do any necessary cleanup.  *}
2685796c8dcSSimon Schubert .  bfd_boolean (*_close_and_cleanup) (bfd *);
2695796c8dcSSimon Schubert .  {* Ask the BFD to free all cached information.  *}
2705796c8dcSSimon Schubert .  bfd_boolean (*_bfd_free_cached_info) (bfd *);
2715796c8dcSSimon Schubert .  {* Called when a new section is created.  *}
2725796c8dcSSimon Schubert .  bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
2735796c8dcSSimon Schubert .  {* Read the contents of a section.  *}
2745796c8dcSSimon Schubert .  bfd_boolean (*_bfd_get_section_contents)
2755796c8dcSSimon Schubert .    (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
2765796c8dcSSimon Schubert .  bfd_boolean (*_bfd_get_section_contents_in_window)
2775796c8dcSSimon Schubert .    (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
2785796c8dcSSimon Schubert .
2795796c8dcSSimon Schubert .  {* Entry points to copy private data.  *}
2805796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_COPY(NAME) \
2815796c8dcSSimon Schubert .  NAME##_bfd_copy_private_bfd_data, \
2825796c8dcSSimon Schubert .  NAME##_bfd_merge_private_bfd_data, \
2835796c8dcSSimon Schubert .  _bfd_generic_init_private_section_data, \
2845796c8dcSSimon Schubert .  NAME##_bfd_copy_private_section_data, \
2855796c8dcSSimon Schubert .  NAME##_bfd_copy_private_symbol_data, \
2865796c8dcSSimon Schubert .  NAME##_bfd_copy_private_header_data, \
2875796c8dcSSimon Schubert .  NAME##_bfd_set_private_flags, \
2885796c8dcSSimon Schubert .  NAME##_bfd_print_private_bfd_data
2895796c8dcSSimon Schubert .
2905796c8dcSSimon Schubert .  {* Called to copy BFD general private data from one object file
2915796c8dcSSimon Schubert .     to another.  *}
2925796c8dcSSimon Schubert .  bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
2935796c8dcSSimon Schubert .  {* Called to merge BFD general private data from one object file
2945796c8dcSSimon Schubert .     to a common output file when linking.  *}
2955796c8dcSSimon Schubert .  bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
2965796c8dcSSimon Schubert .  {* Called to initialize BFD private section data from one object file
2975796c8dcSSimon Schubert .     to another.  *}
2985796c8dcSSimon Schubert .#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
2995796c8dcSSimon Schubert .  BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
3005796c8dcSSimon Schubert .  bfd_boolean (*_bfd_init_private_section_data)
3015796c8dcSSimon Schubert .    (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
3025796c8dcSSimon Schubert .  {* Called to copy BFD private section data from one object file
3035796c8dcSSimon Schubert .     to another.  *}
3045796c8dcSSimon Schubert .  bfd_boolean (*_bfd_copy_private_section_data)
3055796c8dcSSimon Schubert .    (bfd *, sec_ptr, bfd *, sec_ptr);
3065796c8dcSSimon Schubert .  {* Called to copy BFD private symbol data from one symbol
3075796c8dcSSimon Schubert .     to another.  *}
3085796c8dcSSimon Schubert .  bfd_boolean (*_bfd_copy_private_symbol_data)
3095796c8dcSSimon Schubert .    (bfd *, asymbol *, bfd *, asymbol *);
3105796c8dcSSimon Schubert .  {* Called to copy BFD private header data from one object file
3115796c8dcSSimon Schubert .     to another.  *}
3125796c8dcSSimon Schubert .  bfd_boolean (*_bfd_copy_private_header_data)
3135796c8dcSSimon Schubert .    (bfd *, bfd *);
3145796c8dcSSimon Schubert .  {* Called to set private backend flags.  *}
3155796c8dcSSimon Schubert .  bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
3165796c8dcSSimon Schubert .
3175796c8dcSSimon Schubert .  {* Called to print private BFD data.  *}
3185796c8dcSSimon Schubert .  bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
3195796c8dcSSimon Schubert .
3205796c8dcSSimon Schubert .  {* Core file entry points.  *}
3215796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_CORE(NAME) \
3225796c8dcSSimon Schubert .  NAME##_core_file_failing_command, \
3235796c8dcSSimon Schubert .  NAME##_core_file_failing_signal, \
324c50c785cSJohn Marino .  NAME##_core_file_matches_executable_p, \
325c50c785cSJohn Marino .  NAME##_core_file_pid
3265796c8dcSSimon Schubert .
3275796c8dcSSimon Schubert .  char *      (*_core_file_failing_command) (bfd *);
3285796c8dcSSimon Schubert .  int         (*_core_file_failing_signal) (bfd *);
3295796c8dcSSimon Schubert .  bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
330c50c785cSJohn Marino .  int         (*_core_file_pid) (bfd *);
3315796c8dcSSimon Schubert .
3325796c8dcSSimon Schubert .  {* Archive entry points.  *}
3335796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
3345796c8dcSSimon Schubert .  NAME##_slurp_armap, \
3355796c8dcSSimon Schubert .  NAME##_slurp_extended_name_table, \
3365796c8dcSSimon Schubert .  NAME##_construct_extended_name_table, \
3375796c8dcSSimon Schubert .  NAME##_truncate_arname, \
3385796c8dcSSimon Schubert .  NAME##_write_armap, \
3395796c8dcSSimon Schubert .  NAME##_read_ar_hdr, \
340cf7f2e2dSJohn Marino .  NAME##_write_ar_hdr, \
3415796c8dcSSimon Schubert .  NAME##_openr_next_archived_file, \
3425796c8dcSSimon Schubert .  NAME##_get_elt_at_index, \
3435796c8dcSSimon Schubert .  NAME##_generic_stat_arch_elt, \
3445796c8dcSSimon Schubert .  NAME##_update_armap_timestamp
3455796c8dcSSimon Schubert .
3465796c8dcSSimon Schubert .  bfd_boolean (*_bfd_slurp_armap) (bfd *);
3475796c8dcSSimon Schubert .  bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
3485796c8dcSSimon Schubert .  bfd_boolean (*_bfd_construct_extended_name_table)
3495796c8dcSSimon Schubert .    (bfd *, char **, bfd_size_type *, const char **);
3505796c8dcSSimon Schubert .  void        (*_bfd_truncate_arname) (bfd *, const char *, char *);
3515796c8dcSSimon Schubert .  bfd_boolean (*write_armap)
3525796c8dcSSimon Schubert .    (bfd *, unsigned int, struct orl *, unsigned int, int);
3535796c8dcSSimon Schubert .  void *      (*_bfd_read_ar_hdr_fn) (bfd *);
354cf7f2e2dSJohn Marino .  bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
3555796c8dcSSimon Schubert .  bfd *       (*openr_next_archived_file) (bfd *, bfd *);
3565796c8dcSSimon Schubert .#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
3575796c8dcSSimon Schubert .  bfd *       (*_bfd_get_elt_at_index) (bfd *, symindex);
3585796c8dcSSimon Schubert .  int         (*_bfd_stat_arch_elt) (bfd *, struct stat *);
3595796c8dcSSimon Schubert .  bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
3605796c8dcSSimon Schubert .
3615796c8dcSSimon Schubert .  {* Entry points used for symbols.  *}
3625796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
3635796c8dcSSimon Schubert .  NAME##_get_symtab_upper_bound, \
3645796c8dcSSimon Schubert .  NAME##_canonicalize_symtab, \
3655796c8dcSSimon Schubert .  NAME##_make_empty_symbol, \
3665796c8dcSSimon Schubert .  NAME##_print_symbol, \
3675796c8dcSSimon Schubert .  NAME##_get_symbol_info, \
3685796c8dcSSimon Schubert .  NAME##_bfd_is_local_label_name, \
3695796c8dcSSimon Schubert .  NAME##_bfd_is_target_special_symbol, \
3705796c8dcSSimon Schubert .  NAME##_get_lineno, \
3715796c8dcSSimon Schubert .  NAME##_find_nearest_line, \
372*ef5ccd6cSJohn Marino .  _bfd_generic_find_nearest_line_discriminator, \
3735796c8dcSSimon Schubert .  _bfd_generic_find_line, \
3745796c8dcSSimon Schubert .  NAME##_find_inliner_info, \
3755796c8dcSSimon Schubert .  NAME##_bfd_make_debug_symbol, \
3765796c8dcSSimon Schubert .  NAME##_read_minisymbols, \
3775796c8dcSSimon Schubert .  NAME##_minisymbol_to_symbol
3785796c8dcSSimon Schubert .
3795796c8dcSSimon Schubert .  long        (*_bfd_get_symtab_upper_bound) (bfd *);
3805796c8dcSSimon Schubert .  long        (*_bfd_canonicalize_symtab)
3815796c8dcSSimon Schubert .    (bfd *, struct bfd_symbol **);
3825796c8dcSSimon Schubert .  struct bfd_symbol *
3835796c8dcSSimon Schubert .              (*_bfd_make_empty_symbol) (bfd *);
3845796c8dcSSimon Schubert .  void        (*_bfd_print_symbol)
3855796c8dcSSimon Schubert .    (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type);
3865796c8dcSSimon Schubert .#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
3875796c8dcSSimon Schubert .  void        (*_bfd_get_symbol_info)
3885796c8dcSSimon Schubert .    (bfd *, struct bfd_symbol *, symbol_info *);
3895796c8dcSSimon Schubert .#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
3905796c8dcSSimon Schubert .  bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
3915796c8dcSSimon Schubert .  bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
3925796c8dcSSimon Schubert .  alent *     (*_get_lineno) (bfd *, struct bfd_symbol *);
3935796c8dcSSimon Schubert .  bfd_boolean (*_bfd_find_nearest_line)
3945796c8dcSSimon Schubert .    (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
3955796c8dcSSimon Schubert .     const char **, const char **, unsigned int *);
396*ef5ccd6cSJohn Marino .  bfd_boolean (*_bfd_find_nearest_line_discriminator)
397*ef5ccd6cSJohn Marino .    (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
398*ef5ccd6cSJohn Marino .     const char **, const char **, unsigned int *, unsigned int *);
3995796c8dcSSimon Schubert .  bfd_boolean (*_bfd_find_line)
4005796c8dcSSimon Schubert .    (bfd *, struct bfd_symbol **, struct bfd_symbol *,
4015796c8dcSSimon Schubert .     const char **, unsigned int *);
4025796c8dcSSimon Schubert .  bfd_boolean (*_bfd_find_inliner_info)
4035796c8dcSSimon Schubert .    (bfd *, const char **, const char **, unsigned int *);
4045796c8dcSSimon Schubert . {* Back-door to allow format-aware applications to create debug symbols
4055796c8dcSSimon Schubert .    while using BFD for everything else.  Currently used by the assembler
4065796c8dcSSimon Schubert .    when creating COFF files.  *}
4075796c8dcSSimon Schubert .  asymbol *   (*_bfd_make_debug_symbol)
4085796c8dcSSimon Schubert .    (bfd *, void *, unsigned long size);
4095796c8dcSSimon Schubert .#define bfd_read_minisymbols(b, d, m, s) \
4105796c8dcSSimon Schubert .  BFD_SEND (b, _read_minisymbols, (b, d, m, s))
4115796c8dcSSimon Schubert .  long        (*_read_minisymbols)
4125796c8dcSSimon Schubert .    (bfd *, bfd_boolean, void **, unsigned int *);
4135796c8dcSSimon Schubert .#define bfd_minisymbol_to_symbol(b, d, m, f) \
4145796c8dcSSimon Schubert .  BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
4155796c8dcSSimon Schubert .  asymbol *   (*_minisymbol_to_symbol)
4165796c8dcSSimon Schubert .    (bfd *, bfd_boolean, const void *, asymbol *);
4175796c8dcSSimon Schubert .
4185796c8dcSSimon Schubert .  {* Routines for relocs.  *}
4195796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_RELOCS(NAME) \
4205796c8dcSSimon Schubert .  NAME##_get_reloc_upper_bound, \
4215796c8dcSSimon Schubert .  NAME##_canonicalize_reloc, \
4225796c8dcSSimon Schubert .  NAME##_bfd_reloc_type_lookup, \
4235796c8dcSSimon Schubert .  NAME##_bfd_reloc_name_lookup
4245796c8dcSSimon Schubert .
4255796c8dcSSimon Schubert .  long        (*_get_reloc_upper_bound) (bfd *, sec_ptr);
4265796c8dcSSimon Schubert .  long        (*_bfd_canonicalize_reloc)
4275796c8dcSSimon Schubert .    (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
4285796c8dcSSimon Schubert .  {* See documentation on reloc types.  *}
4295796c8dcSSimon Schubert .  reloc_howto_type *
4305796c8dcSSimon Schubert .              (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
4315796c8dcSSimon Schubert .  reloc_howto_type *
4325796c8dcSSimon Schubert .              (*reloc_name_lookup) (bfd *, const char *);
4335796c8dcSSimon Schubert .
4345796c8dcSSimon Schubert .
4355796c8dcSSimon Schubert .  {* Routines used when writing an object file.  *}
4365796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_WRITE(NAME) \
4375796c8dcSSimon Schubert .  NAME##_set_arch_mach, \
4385796c8dcSSimon Schubert .  NAME##_set_section_contents
4395796c8dcSSimon Schubert .
4405796c8dcSSimon Schubert .  bfd_boolean (*_bfd_set_arch_mach)
4415796c8dcSSimon Schubert .    (bfd *, enum bfd_architecture, unsigned long);
4425796c8dcSSimon Schubert .  bfd_boolean (*_bfd_set_section_contents)
4435796c8dcSSimon Schubert .    (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
4445796c8dcSSimon Schubert .
4455796c8dcSSimon Schubert .  {* Routines used by the linker.  *}
4465796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_LINK(NAME) \
4475796c8dcSSimon Schubert .  NAME##_sizeof_headers, \
4485796c8dcSSimon Schubert .  NAME##_bfd_get_relocated_section_contents, \
4495796c8dcSSimon Schubert .  NAME##_bfd_relax_section, \
4505796c8dcSSimon Schubert .  NAME##_bfd_link_hash_table_create, \
4515796c8dcSSimon Schubert .  NAME##_bfd_link_hash_table_free, \
4525796c8dcSSimon Schubert .  NAME##_bfd_link_add_symbols, \
4535796c8dcSSimon Schubert .  NAME##_bfd_link_just_syms, \
454cf7f2e2dSJohn Marino .  NAME##_bfd_copy_link_hash_symbol_type, \
4555796c8dcSSimon Schubert .  NAME##_bfd_final_link, \
4565796c8dcSSimon Schubert .  NAME##_bfd_link_split_section, \
4575796c8dcSSimon Schubert .  NAME##_bfd_gc_sections, \
458a45ae5f8SJohn Marino .  NAME##_bfd_lookup_section_flags, \
4595796c8dcSSimon Schubert .  NAME##_bfd_merge_sections, \
4605796c8dcSSimon Schubert .  NAME##_bfd_is_group_section, \
4615796c8dcSSimon Schubert .  NAME##_bfd_discard_group, \
4625796c8dcSSimon Schubert .  NAME##_section_already_linked, \
4635796c8dcSSimon Schubert .  NAME##_bfd_define_common_symbol
4645796c8dcSSimon Schubert .
4655796c8dcSSimon Schubert .  int         (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
4665796c8dcSSimon Schubert .  bfd_byte *  (*_bfd_get_relocated_section_contents)
4675796c8dcSSimon Schubert .    (bfd *, struct bfd_link_info *, struct bfd_link_order *,
4685796c8dcSSimon Schubert .     bfd_byte *, bfd_boolean, struct bfd_symbol **);
4695796c8dcSSimon Schubert .
4705796c8dcSSimon Schubert .  bfd_boolean (*_bfd_relax_section)
4715796c8dcSSimon Schubert .    (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
4725796c8dcSSimon Schubert .
4735796c8dcSSimon Schubert .  {* Create a hash table for the linker.  Different backends store
4745796c8dcSSimon Schubert .     different information in this table.  *}
4755796c8dcSSimon Schubert .  struct bfd_link_hash_table *
4765796c8dcSSimon Schubert .              (*_bfd_link_hash_table_create) (bfd *);
4775796c8dcSSimon Schubert .
4785796c8dcSSimon Schubert .  {* Release the memory associated with the linker hash table.  *}
4795796c8dcSSimon Schubert .  void        (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
4805796c8dcSSimon Schubert .
4815796c8dcSSimon Schubert .  {* Add symbols from this object file into the hash table.  *}
4825796c8dcSSimon Schubert .  bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
4835796c8dcSSimon Schubert .
4845796c8dcSSimon Schubert .  {* Indicate that we are only retrieving symbol values from this section.  *}
4855796c8dcSSimon Schubert .  void        (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
4865796c8dcSSimon Schubert .
487cf7f2e2dSJohn Marino .  {* Copy the symbol type of a linker hash table entry.  *}
488cf7f2e2dSJohn Marino .#define bfd_copy_link_hash_symbol_type(b, t, f) \
489cf7f2e2dSJohn Marino .  BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
490cf7f2e2dSJohn Marino .  void (*_bfd_copy_link_hash_symbol_type)
491cf7f2e2dSJohn Marino .    (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
492cf7f2e2dSJohn Marino .
4935796c8dcSSimon Schubert .  {* Do a link based on the link_order structures attached to each
4945796c8dcSSimon Schubert .     section of the BFD.  *}
4955796c8dcSSimon Schubert .  bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
4965796c8dcSSimon Schubert .
4975796c8dcSSimon Schubert .  {* Should this section be split up into smaller pieces during linking.  *}
4985796c8dcSSimon Schubert .  bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
4995796c8dcSSimon Schubert .
5005796c8dcSSimon Schubert .  {* Remove sections that are not referenced from the output.  *}
5015796c8dcSSimon Schubert .  bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
5025796c8dcSSimon Schubert .
503a45ae5f8SJohn Marino .  {* Sets the bitmask of allowed and disallowed section flags.  *}
504*ef5ccd6cSJohn Marino .  bfd_boolean (*_bfd_lookup_section_flags) (struct bfd_link_info *,
505*ef5ccd6cSJohn Marino .					     struct flag_info *,
506*ef5ccd6cSJohn Marino .					     asection *);
507a45ae5f8SJohn Marino .
5085796c8dcSSimon Schubert .  {* Attempt to merge SEC_MERGE sections.  *}
5095796c8dcSSimon Schubert .  bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
5105796c8dcSSimon Schubert .
5115796c8dcSSimon Schubert .  {* Is this section a member of a group?  *}
5125796c8dcSSimon Schubert .  bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
5135796c8dcSSimon Schubert .
5145796c8dcSSimon Schubert .  {* Discard members of a group.  *}
5155796c8dcSSimon Schubert .  bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
5165796c8dcSSimon Schubert .
5175796c8dcSSimon Schubert .  {* Check if SEC has been already linked during a reloceatable or
5185796c8dcSSimon Schubert .     final link.  *}
519a45ae5f8SJohn Marino .  bfd_boolean (*_section_already_linked) (bfd *, asection *,
5205796c8dcSSimon Schubert .					   struct bfd_link_info *);
5215796c8dcSSimon Schubert .
5225796c8dcSSimon Schubert .  {* Define a common symbol.  *}
5235796c8dcSSimon Schubert .  bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
5245796c8dcSSimon Schubert .					     struct bfd_link_hash_entry *);
5255796c8dcSSimon Schubert .
5265796c8dcSSimon Schubert .  {* Routines to handle dynamic symbols and relocs.  *}
5275796c8dcSSimon Schubert .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
5285796c8dcSSimon Schubert .  NAME##_get_dynamic_symtab_upper_bound, \
5295796c8dcSSimon Schubert .  NAME##_canonicalize_dynamic_symtab, \
5305796c8dcSSimon Schubert .  NAME##_get_synthetic_symtab, \
5315796c8dcSSimon Schubert .  NAME##_get_dynamic_reloc_upper_bound, \
5325796c8dcSSimon Schubert .  NAME##_canonicalize_dynamic_reloc
5335796c8dcSSimon Schubert .
5345796c8dcSSimon Schubert .  {* Get the amount of memory required to hold the dynamic symbols.  *}
5355796c8dcSSimon Schubert .  long        (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
5365796c8dcSSimon Schubert .  {* Read in the dynamic symbols.  *}
5375796c8dcSSimon Schubert .  long        (*_bfd_canonicalize_dynamic_symtab)
5385796c8dcSSimon Schubert .    (bfd *, struct bfd_symbol **);
5395796c8dcSSimon Schubert .  {* Create synthetized symbols.  *}
5405796c8dcSSimon Schubert .  long        (*_bfd_get_synthetic_symtab)
5415796c8dcSSimon Schubert .    (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
5425796c8dcSSimon Schubert .     struct bfd_symbol **);
5435796c8dcSSimon Schubert .  {* Get the amount of memory required to hold the dynamic relocs.  *}
5445796c8dcSSimon Schubert .  long        (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
5455796c8dcSSimon Schubert .  {* Read in the dynamic relocs.  *}
5465796c8dcSSimon Schubert .  long        (*_bfd_canonicalize_dynamic_reloc)
5475796c8dcSSimon Schubert .    (bfd *, arelent **, struct bfd_symbol **);
5485796c8dcSSimon Schubert .
5495796c8dcSSimon Schubert 
5505796c8dcSSimon Schubert A pointer to an alternative bfd_target in case the current one is not
5515796c8dcSSimon Schubert satisfactory.  This can happen when the target cpu supports both big
5525796c8dcSSimon Schubert and little endian code, and target chosen by the linker has the wrong
5535796c8dcSSimon Schubert endianness.  The function open_output() in ld/ldlang.c uses this field
5545796c8dcSSimon Schubert to find an alternative output format that is suitable.
5555796c8dcSSimon Schubert 
5565796c8dcSSimon Schubert .  {* Opposite endian version of this target.  *}
5575796c8dcSSimon Schubert .  const struct bfd_target * alternative_target;
5585796c8dcSSimon Schubert .
5595796c8dcSSimon Schubert 
5605796c8dcSSimon Schubert .  {* Data for use by back-end routines, which isn't
5615796c8dcSSimon Schubert .     generic enough to belong in this structure.  *}
5625796c8dcSSimon Schubert .  const void *backend_data;
5635796c8dcSSimon Schubert .
5645796c8dcSSimon Schubert .} bfd_target;
5655796c8dcSSimon Schubert .
5665796c8dcSSimon Schubert */
5675796c8dcSSimon Schubert 
5685796c8dcSSimon Schubert /* All known xvecs (even those that don't compile on all systems).
5695796c8dcSSimon Schubert    Alphabetized for easy reference.
5705796c8dcSSimon Schubert    They are listed a second time below, since
5715796c8dcSSimon Schubert    we can't intermix extern's and initializers.  */
5725796c8dcSSimon Schubert extern const bfd_target a_out_adobe_vec;
5735796c8dcSSimon Schubert extern const bfd_target aix5coff64_vec;
5745796c8dcSSimon Schubert extern const bfd_target aout0_big_vec;
5755796c8dcSSimon Schubert extern const bfd_target aout_arm_big_vec;
5765796c8dcSSimon Schubert extern const bfd_target aout_arm_little_vec;
5775796c8dcSSimon Schubert extern const bfd_target aout_mips_big_vec;
5785796c8dcSSimon Schubert extern const bfd_target aout_mips_little_vec;
5795796c8dcSSimon Schubert extern const bfd_target apollocoff_vec;
5805796c8dcSSimon Schubert extern const bfd_target arm_epoc_pe_big_vec;
5815796c8dcSSimon Schubert extern const bfd_target arm_epoc_pe_little_vec;
5825796c8dcSSimon Schubert extern const bfd_target arm_epoc_pei_big_vec;
5835796c8dcSSimon Schubert extern const bfd_target arm_epoc_pei_little_vec;
5845796c8dcSSimon Schubert extern const bfd_target arm_wince_pe_big_vec;
5855796c8dcSSimon Schubert extern const bfd_target arm_wince_pe_little_vec;
5865796c8dcSSimon Schubert extern const bfd_target arm_wince_pei_big_vec;
5875796c8dcSSimon Schubert extern const bfd_target arm_wince_pei_little_vec;
5885796c8dcSSimon Schubert extern const bfd_target armcoff_big_vec;
5895796c8dcSSimon Schubert extern const bfd_target armcoff_little_vec;
5905796c8dcSSimon Schubert extern const bfd_target armnetbsd_vec;
5915796c8dcSSimon Schubert extern const bfd_target armpe_big_vec;
5925796c8dcSSimon Schubert extern const bfd_target armpe_little_vec;
5935796c8dcSSimon Schubert extern const bfd_target armpei_big_vec;
5945796c8dcSSimon Schubert extern const bfd_target armpei_little_vec;
5955796c8dcSSimon Schubert extern const bfd_target b_out_vec_big_host;
5965796c8dcSSimon Schubert extern const bfd_target b_out_vec_little_host;
5975796c8dcSSimon Schubert extern const bfd_target bfd_pei_ia64_vec;
5985796c8dcSSimon Schubert extern const bfd_target bfd_elf32_avr_vec;
5995796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bfin_vec;
6005796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bfinfdpic_vec;
6015796c8dcSSimon Schubert extern const bfd_target bfd_elf32_big_generic_vec;
6025796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bigarc_vec;
6035796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bigarm_vec;
604*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_bigarm_nacl_vec;
6055796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bigarm_symbian_vec;
6065796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bigarm_vxworks_vec;
6075796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bigmips_vec;
6085796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bigmips_vxworks_vec;
609*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_bigmoxie_vec;
610*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_bignios2_vec;
6115796c8dcSSimon Schubert extern const bfd_target bfd_elf32_cr16_vec;
6125796c8dcSSimon Schubert extern const bfd_target bfd_elf32_cr16c_vec;
6135796c8dcSSimon Schubert extern const bfd_target bfd_elf32_cris_vec;
6145796c8dcSSimon Schubert extern const bfd_target bfd_elf32_crx_vec;
6155796c8dcSSimon Schubert extern const bfd_target bfd_elf32_d10v_vec;
6165796c8dcSSimon Schubert extern const bfd_target bfd_elf32_d30v_vec;
6175796c8dcSSimon Schubert extern const bfd_target bfd_elf32_dlx_big_vec;
618a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_epiphany_vec;
6195796c8dcSSimon Schubert extern const bfd_target bfd_elf32_fr30_vec;
6205796c8dcSSimon Schubert extern const bfd_target bfd_elf32_frv_vec;
6215796c8dcSSimon Schubert extern const bfd_target bfd_elf32_frvfdpic_vec;
6225796c8dcSSimon Schubert extern const bfd_target bfd_elf32_h8300_vec;
6235796c8dcSSimon Schubert extern const bfd_target bfd_elf32_hppa_linux_vec;
6245796c8dcSSimon Schubert extern const bfd_target bfd_elf32_hppa_nbsd_vec;
6255796c8dcSSimon Schubert extern const bfd_target bfd_elf32_hppa_vec;
6265796c8dcSSimon Schubert extern const bfd_target bfd_elf32_i370_vec;
6275796c8dcSSimon Schubert extern const bfd_target bfd_elf32_i386_freebsd_vec;
628a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_i386_nacl_vec;
629cf7f2e2dSJohn Marino extern const bfd_target bfd_elf32_i386_sol2_vec;
6305796c8dcSSimon Schubert extern const bfd_target bfd_elf32_i386_vxworks_vec;
6315796c8dcSSimon Schubert extern const bfd_target bfd_elf32_i386_vec;
6325796c8dcSSimon Schubert extern const bfd_target bfd_elf32_i860_little_vec;
6335796c8dcSSimon Schubert extern const bfd_target bfd_elf32_i860_vec;
6345796c8dcSSimon Schubert extern const bfd_target bfd_elf32_i960_vec;
6355796c8dcSSimon Schubert extern const bfd_target bfd_elf32_ia64_big_vec;
6365796c8dcSSimon Schubert extern const bfd_target bfd_elf32_ia64_hpux_big_vec;
6375796c8dcSSimon Schubert extern const bfd_target bfd_elf32_ip2k_vec;
6385796c8dcSSimon Schubert extern const bfd_target bfd_elf32_iq2000_vec;
6395796c8dcSSimon Schubert extern const bfd_target bfd_elf32_lm32_vec;
6405796c8dcSSimon Schubert extern const bfd_target bfd_elf32_lm32fdpic_vec;
6415796c8dcSSimon Schubert extern const bfd_target bfd_elf32_little_generic_vec;
6425796c8dcSSimon Schubert extern const bfd_target bfd_elf32_littlearc_vec;
6435796c8dcSSimon Schubert extern const bfd_target bfd_elf32_littlearm_vec;
644*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_littlearm_nacl_vec;
6455796c8dcSSimon Schubert extern const bfd_target bfd_elf32_littlearm_symbian_vec;
6465796c8dcSSimon Schubert extern const bfd_target bfd_elf32_littlearm_vxworks_vec;
6475796c8dcSSimon Schubert extern const bfd_target bfd_elf32_littlemips_vec;
6485796c8dcSSimon Schubert extern const bfd_target bfd_elf32_littlemips_vxworks_vec;
649*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_littlemoxie_vec;
650*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_littlenios2_vec;
6515796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m32c_vec;
6525796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m32r_vec;
6535796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m32rle_vec;
6545796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m32rlin_vec;
6555796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m32rlelin_vec;
6565796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m68hc11_vec;
6575796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m68hc12_vec;
6585796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m68k_vec;
6595796c8dcSSimon Schubert extern const bfd_target bfd_elf32_m88k_vec;
6605796c8dcSSimon Schubert extern const bfd_target bfd_elf32_mcore_big_vec;
6615796c8dcSSimon Schubert extern const bfd_target bfd_elf32_mcore_little_vec;
6625796c8dcSSimon Schubert extern const bfd_target bfd_elf32_mep_vec;
6635796c8dcSSimon Schubert extern const bfd_target bfd_elf32_mep_little_vec;
664*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_metag_vec;
665*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_microblazeel_vec;
6665796c8dcSSimon Schubert extern const bfd_target bfd_elf32_microblaze_vec;
6675796c8dcSSimon Schubert extern const bfd_target bfd_elf32_mn10200_vec;
6685796c8dcSSimon Schubert extern const bfd_target bfd_elf32_mn10300_vec;
6695796c8dcSSimon Schubert extern const bfd_target bfd_elf32_mt_vec;
6705796c8dcSSimon Schubert extern const bfd_target bfd_elf32_msp430_vec;
6715796c8dcSSimon Schubert extern const bfd_target bfd_elf32_nbigmips_vec;
6725796c8dcSSimon Schubert extern const bfd_target bfd_elf32_nlittlemips_vec;
6735796c8dcSSimon Schubert extern const bfd_target bfd_elf32_ntradbigmips_vec;
6745796c8dcSSimon Schubert extern const bfd_target bfd_elf32_ntradlittlemips_vec;
675c50c785cSJohn Marino extern const bfd_target bfd_elf32_ntradbigmips_freebsd_vec;
676c50c785cSJohn Marino extern const bfd_target bfd_elf32_ntradlittlemips_freebsd_vec;
6775796c8dcSSimon Schubert extern const bfd_target bfd_elf32_openrisc_vec;
6785796c8dcSSimon Schubert extern const bfd_target bfd_elf32_or32_big_vec;
6795796c8dcSSimon Schubert extern const bfd_target bfd_elf32_pj_vec;
6805796c8dcSSimon Schubert extern const bfd_target bfd_elf32_pjl_vec;
6815796c8dcSSimon Schubert extern const bfd_target bfd_elf32_powerpc_vec;
6825796c8dcSSimon Schubert extern const bfd_target bfd_elf32_powerpcle_vec;
683a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_powerpc_freebsd_vec;
6845796c8dcSSimon Schubert extern const bfd_target bfd_elf32_powerpc_vxworks_vec;
685a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_rl78_vec;
686cf7f2e2dSJohn Marino extern const bfd_target bfd_elf32_rx_le_vec;
687cf7f2e2dSJohn Marino extern const bfd_target bfd_elf32_rx_be_vec;
688a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_rx_be_ns_vec;
6895796c8dcSSimon Schubert extern const bfd_target bfd_elf32_s390_vec;
6905796c8dcSSimon Schubert extern const bfd_target bfd_elf32_bigscore_vec;
6915796c8dcSSimon Schubert extern const bfd_target bfd_elf32_littlescore_vec;
6925796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sh64_vec;
6935796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sh64l_vec;
6945796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sh64lin_vec;
6955796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sh64blin_vec;
6965796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sh64lnbsd_vec;
6975796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sh64nbsd_vec;
6985796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sh_vec;
699cf7f2e2dSJohn Marino extern const bfd_target bfd_elf32_shbfd_vec;
7005796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shblin_vec;
701cf7f2e2dSJohn Marino extern const bfd_target bfd_elf32_shfd_vec;
7025796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shl_vec;
7035796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shl_symbian_vec;
7045796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shlin_vec;
7055796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shlnbsd_vec;
7065796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shlvxworks_vec;
7075796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shnbsd_vec;
7085796c8dcSSimon Schubert extern const bfd_target bfd_elf32_shvxworks_vec;
7095796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sparc_vec;
710c50c785cSJohn Marino extern const bfd_target bfd_elf32_sparc_sol2_vec;
7115796c8dcSSimon Schubert extern const bfd_target bfd_elf32_sparc_vxworks_vec;
7125796c8dcSSimon Schubert extern const bfd_target bfd_elf32_spu_vec;
713cf7f2e2dSJohn Marino extern const bfd_target bfd_elf32_tic6x_be_vec;
714cf7f2e2dSJohn Marino extern const bfd_target bfd_elf32_tic6x_le_vec;
715a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_tic6x_elf_be_vec;
716a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_tic6x_elf_le_vec;
717a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_tic6x_linux_be_vec;
718a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_tic6x_linux_le_vec;
719*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_tilegx_be_vec;
720*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_tilegx_le_vec;
721a45ae5f8SJohn Marino extern const bfd_target bfd_elf32_tilepro_vec;
7225796c8dcSSimon Schubert extern const bfd_target bfd_elf32_tradbigmips_vec;
7235796c8dcSSimon Schubert extern const bfd_target bfd_elf32_tradlittlemips_vec;
724c50c785cSJohn Marino extern const bfd_target bfd_elf32_tradbigmips_freebsd_vec;
725c50c785cSJohn Marino extern const bfd_target bfd_elf32_tradlittlemips_freebsd_vec;
7265796c8dcSSimon Schubert extern const bfd_target bfd_elf32_us_cris_vec;
7275796c8dcSSimon Schubert extern const bfd_target bfd_elf32_v850_vec;
728*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_v850_rh850_vec;
7295796c8dcSSimon Schubert extern const bfd_target bfd_elf32_vax_vec;
7305796c8dcSSimon Schubert extern const bfd_target bfd_elf32_xc16x_vec;
731*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_xgate_vec;
7325796c8dcSSimon Schubert extern const bfd_target bfd_elf32_xstormy16_vec;
7335796c8dcSSimon Schubert extern const bfd_target bfd_elf32_xtensa_be_vec;
7345796c8dcSSimon Schubert extern const bfd_target bfd_elf32_xtensa_le_vec;
7355796c8dcSSimon Schubert extern const bfd_target bfd_elf64_alpha_freebsd_vec;
7365796c8dcSSimon Schubert extern const bfd_target bfd_elf64_alpha_vec;
7375796c8dcSSimon Schubert extern const bfd_target bfd_elf64_big_generic_vec;
7385796c8dcSSimon Schubert extern const bfd_target bfd_elf64_bigmips_vec;
739*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf64_bigaarch64_vec;
7405796c8dcSSimon Schubert extern const bfd_target bfd_elf64_hppa_linux_vec;
7415796c8dcSSimon Schubert extern const bfd_target bfd_elf64_hppa_vec;
7425796c8dcSSimon Schubert extern const bfd_target bfd_elf64_ia64_big_vec;
7435796c8dcSSimon Schubert extern const bfd_target bfd_elf64_ia64_hpux_big_vec;
7445796c8dcSSimon Schubert extern const bfd_target bfd_elf64_ia64_little_vec;
7455796c8dcSSimon Schubert extern const bfd_target bfd_elf64_ia64_vms_vec;
7465796c8dcSSimon Schubert extern const bfd_target bfd_elf64_little_generic_vec;
7475796c8dcSSimon Schubert extern const bfd_target bfd_elf64_littlemips_vec;
748*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf64_littleaarch64_vec;
7495796c8dcSSimon Schubert extern const bfd_target bfd_elf64_mmix_vec;
7505796c8dcSSimon Schubert extern const bfd_target bfd_elf64_powerpc_vec;
7515796c8dcSSimon Schubert extern const bfd_target bfd_elf64_powerpcle_vec;
752a45ae5f8SJohn Marino extern const bfd_target bfd_elf64_powerpc_freebsd_vec;
7535796c8dcSSimon Schubert extern const bfd_target bfd_elf64_s390_vec;
7545796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sh64_vec;
7555796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sh64l_vec;
7565796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sh64lin_vec;
7575796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sh64blin_vec;
7585796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sh64lnbsd_vec;
7595796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sh64nbsd_vec;
7605796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sparc_vec;
7615796c8dcSSimon Schubert extern const bfd_target bfd_elf64_sparc_freebsd_vec;
762c50c785cSJohn Marino extern const bfd_target bfd_elf64_sparc_sol2_vec;
763*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf64_tilegx_be_vec;
764*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf64_tilegx_le_vec;
7655796c8dcSSimon Schubert extern const bfd_target bfd_elf64_tradbigmips_vec;
7665796c8dcSSimon Schubert extern const bfd_target bfd_elf64_tradlittlemips_vec;
767c50c785cSJohn Marino extern const bfd_target bfd_elf64_tradbigmips_freebsd_vec;
768c50c785cSJohn Marino extern const bfd_target bfd_elf64_tradlittlemips_freebsd_vec;
7695796c8dcSSimon Schubert extern const bfd_target bfd_elf64_x86_64_freebsd_vec;
770*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf64_x86_64_nacl_vec;
771cf7f2e2dSJohn Marino extern const bfd_target bfd_elf64_x86_64_sol2_vec;
7725796c8dcSSimon Schubert extern const bfd_target bfd_elf64_x86_64_vec;
773*ef5ccd6cSJohn Marino extern const bfd_target bfd_elf32_x86_64_nacl_vec;
774c50c785cSJohn Marino extern const bfd_target bfd_elf32_x86_64_vec;
7755796c8dcSSimon Schubert extern const bfd_target bfd_elf64_l1om_freebsd_vec;
7765796c8dcSSimon Schubert extern const bfd_target bfd_elf64_l1om_vec;
777a45ae5f8SJohn Marino extern const bfd_target bfd_elf64_k1om_freebsd_vec;
778a45ae5f8SJohn Marino extern const bfd_target bfd_elf64_k1om_vec;
7795796c8dcSSimon Schubert extern const bfd_target bfd_mmo_vec;
7805796c8dcSSimon Schubert extern const bfd_target bfd_powerpc_pe_vec;
7815796c8dcSSimon Schubert extern const bfd_target bfd_powerpc_pei_vec;
7825796c8dcSSimon Schubert extern const bfd_target bfd_powerpcle_pe_vec;
7835796c8dcSSimon Schubert extern const bfd_target bfd_powerpcle_pei_vec;
7845796c8dcSSimon Schubert extern const bfd_target cris_aout_vec;
7855796c8dcSSimon Schubert extern const bfd_target demo_64_vec;
7865796c8dcSSimon Schubert extern const bfd_target ecoff_big_vec;
7875796c8dcSSimon Schubert extern const bfd_target ecoff_biglittle_vec;
7885796c8dcSSimon Schubert extern const bfd_target ecoff_little_vec;
7895796c8dcSSimon Schubert extern const bfd_target ecoffalpha_little_vec;
7905796c8dcSSimon Schubert extern const bfd_target go32coff_vec;
7915796c8dcSSimon Schubert extern const bfd_target go32stubbedcoff_vec;
7925796c8dcSSimon Schubert extern const bfd_target h8300coff_vec;
7935796c8dcSSimon Schubert extern const bfd_target h8500coff_vec;
7945796c8dcSSimon Schubert extern const bfd_target host_aout_vec;
7955796c8dcSSimon Schubert extern const bfd_target hp300bsd_vec;
7965796c8dcSSimon Schubert extern const bfd_target hp300hpux_vec;
7975796c8dcSSimon Schubert extern const bfd_target i386aout_vec;
7985796c8dcSSimon Schubert extern const bfd_target i386bsd_vec;
7995796c8dcSSimon Schubert extern const bfd_target i386coff_vec;
8005796c8dcSSimon Schubert extern const bfd_target i386dynix_vec;
8015796c8dcSSimon Schubert extern const bfd_target i386freebsd_vec;
8025796c8dcSSimon Schubert extern const bfd_target i386linux_vec;
8035796c8dcSSimon Schubert extern const bfd_target i386lynx_aout_vec;
8045796c8dcSSimon Schubert extern const bfd_target i386lynx_coff_vec;
8055796c8dcSSimon Schubert extern const bfd_target i386mach3_vec;
8065796c8dcSSimon Schubert extern const bfd_target i386msdos_vec;
8075796c8dcSSimon Schubert extern const bfd_target i386netbsd_vec;
8085796c8dcSSimon Schubert extern const bfd_target i386os9k_vec;
8095796c8dcSSimon Schubert extern const bfd_target i386pe_vec;
8105796c8dcSSimon Schubert extern const bfd_target i386pei_vec;
8115796c8dcSSimon Schubert extern const bfd_target i860coff_vec;
8125796c8dcSSimon Schubert extern const bfd_target icoff_big_vec;
8135796c8dcSSimon Schubert extern const bfd_target icoff_little_vec;
8145796c8dcSSimon Schubert extern const bfd_target ieee_vec;
8155796c8dcSSimon Schubert extern const bfd_target m68k4knetbsd_vec;
8165796c8dcSSimon Schubert extern const bfd_target m68kaux_coff_vec;
8175796c8dcSSimon Schubert extern const bfd_target m68kcoff_vec;
8185796c8dcSSimon Schubert extern const bfd_target m68kcoffun_vec;
8195796c8dcSSimon Schubert extern const bfd_target m68klinux_vec;
8205796c8dcSSimon Schubert extern const bfd_target m68knetbsd_vec;
8215796c8dcSSimon Schubert extern const bfd_target m68ksysvcoff_vec;
8225796c8dcSSimon Schubert extern const bfd_target m88kbcs_vec;
8235796c8dcSSimon Schubert extern const bfd_target m88kmach3_vec;
8245796c8dcSSimon Schubert extern const bfd_target m88kopenbsd_vec;
8255796c8dcSSimon Schubert extern const bfd_target mach_o_be_vec;
8265796c8dcSSimon Schubert extern const bfd_target mach_o_le_vec;
8275796c8dcSSimon Schubert extern const bfd_target mach_o_fat_vec;
8285796c8dcSSimon Schubert extern const bfd_target mach_o_i386_vec;
829cf7f2e2dSJohn Marino extern const bfd_target mach_o_x86_64_vec;
8305796c8dcSSimon Schubert extern const bfd_target mcore_pe_big_vec;
8315796c8dcSSimon Schubert extern const bfd_target mcore_pe_little_vec;
8325796c8dcSSimon Schubert extern const bfd_target mcore_pei_big_vec;
8335796c8dcSSimon Schubert extern const bfd_target mcore_pei_little_vec;
8345796c8dcSSimon Schubert extern const bfd_target mipslpe_vec;
8355796c8dcSSimon Schubert extern const bfd_target mipslpei_vec;
8365796c8dcSSimon Schubert extern const bfd_target newsos3_vec;
8375796c8dcSSimon Schubert extern const bfd_target nlm32_alpha_vec;
8385796c8dcSSimon Schubert extern const bfd_target nlm32_i386_vec;
8395796c8dcSSimon Schubert extern const bfd_target nlm32_powerpc_vec;
8405796c8dcSSimon Schubert extern const bfd_target nlm32_sparc_vec;
8415796c8dcSSimon Schubert extern const bfd_target oasys_vec;
8425796c8dcSSimon Schubert extern const bfd_target or32coff_big_vec;
8435796c8dcSSimon Schubert extern const bfd_target pc532machaout_vec;
8445796c8dcSSimon Schubert extern const bfd_target pc532netbsd_vec;
8455796c8dcSSimon Schubert extern const bfd_target pdp11_aout_vec;
8465796c8dcSSimon Schubert extern const bfd_target pef_vec;
8475796c8dcSSimon Schubert extern const bfd_target pef_xlib_vec;
8485796c8dcSSimon Schubert extern const bfd_target plugin_vec;
8495796c8dcSSimon Schubert extern const bfd_target pmac_xcoff_vec;
8505796c8dcSSimon Schubert extern const bfd_target ppcboot_vec;
8515796c8dcSSimon Schubert extern const bfd_target riscix_vec;
8525796c8dcSSimon Schubert extern const bfd_target rs6000coff64_vec;
8535796c8dcSSimon Schubert extern const bfd_target rs6000coff_vec;
8545796c8dcSSimon Schubert extern const bfd_target shcoff_small_vec;
8555796c8dcSSimon Schubert extern const bfd_target shcoff_vec;
8565796c8dcSSimon Schubert extern const bfd_target shlcoff_small_vec;
8575796c8dcSSimon Schubert extern const bfd_target shlcoff_vec;
8585796c8dcSSimon Schubert extern const bfd_target shlpe_vec;
8595796c8dcSSimon Schubert extern const bfd_target shlpei_vec;
8605796c8dcSSimon Schubert extern const bfd_target som_vec;
8615796c8dcSSimon Schubert extern const bfd_target sparccoff_vec;
8625796c8dcSSimon Schubert extern const bfd_target sparcle_aout_vec;
8635796c8dcSSimon Schubert extern const bfd_target sparclinux_vec;
8645796c8dcSSimon Schubert extern const bfd_target sparclynx_aout_vec;
8655796c8dcSSimon Schubert extern const bfd_target sparclynx_coff_vec;
8665796c8dcSSimon Schubert extern const bfd_target sparcnetbsd_vec;
8675796c8dcSSimon Schubert extern const bfd_target sunos_big_vec;
8685796c8dcSSimon Schubert extern const bfd_target sym_vec;
8695796c8dcSSimon Schubert extern const bfd_target tic30_aout_vec;
8705796c8dcSSimon Schubert extern const bfd_target tic30_coff_vec;
8715796c8dcSSimon Schubert extern const bfd_target tic4x_coff0_beh_vec;
8725796c8dcSSimon Schubert extern const bfd_target tic4x_coff0_vec;
8735796c8dcSSimon Schubert extern const bfd_target tic4x_coff1_beh_vec;
8745796c8dcSSimon Schubert extern const bfd_target tic4x_coff1_vec;
8755796c8dcSSimon Schubert extern const bfd_target tic4x_coff2_beh_vec;
8765796c8dcSSimon Schubert extern const bfd_target tic4x_coff2_vec;
8775796c8dcSSimon Schubert extern const bfd_target tic54x_coff0_beh_vec;
8785796c8dcSSimon Schubert extern const bfd_target tic54x_coff0_vec;
8795796c8dcSSimon Schubert extern const bfd_target tic54x_coff1_beh_vec;
8805796c8dcSSimon Schubert extern const bfd_target tic54x_coff1_vec;
8815796c8dcSSimon Schubert extern const bfd_target tic54x_coff2_beh_vec;
8825796c8dcSSimon Schubert extern const bfd_target tic54x_coff2_vec;
8835796c8dcSSimon Schubert extern const bfd_target tic80coff_vec;
8845796c8dcSSimon Schubert extern const bfd_target vaxbsd_vec;
8855796c8dcSSimon Schubert extern const bfd_target vaxnetbsd_vec;
8865796c8dcSSimon Schubert extern const bfd_target vax1knetbsd_vec;
8875796c8dcSSimon Schubert extern const bfd_target versados_vec;
8885796c8dcSSimon Schubert extern const bfd_target vms_alpha_vec;
889cf7f2e2dSJohn Marino extern const bfd_target vms_lib_txt_vec;
8905796c8dcSSimon Schubert extern const bfd_target w65_vec;
8915796c8dcSSimon Schubert extern const bfd_target we32kcoff_vec;
8925796c8dcSSimon Schubert extern const bfd_target x86_64pe_vec;
8935796c8dcSSimon Schubert extern const bfd_target x86_64pei_vec;
8945796c8dcSSimon Schubert extern const bfd_target x86_64coff_vec;
8955796c8dcSSimon Schubert extern const bfd_target z80coff_vec;
8965796c8dcSSimon Schubert extern const bfd_target z8kcoff_vec;
8975796c8dcSSimon Schubert 
8985796c8dcSSimon Schubert /* These are always included.  */
8995796c8dcSSimon Schubert extern const bfd_target srec_vec;
9005796c8dcSSimon Schubert extern const bfd_target verilog_vec;
9015796c8dcSSimon Schubert extern const bfd_target symbolsrec_vec;
9025796c8dcSSimon Schubert extern const bfd_target tekhex_vec;
9035796c8dcSSimon Schubert extern const bfd_target binary_vec;
9045796c8dcSSimon Schubert extern const bfd_target ihex_vec;
9055796c8dcSSimon Schubert 
9065796c8dcSSimon Schubert /* All of the xvecs for core files.  */
9075796c8dcSSimon Schubert extern const bfd_target aix386_core_vec;
9085796c8dcSSimon Schubert extern const bfd_target cisco_core_big_vec;
9095796c8dcSSimon Schubert extern const bfd_target cisco_core_little_vec;
9105796c8dcSSimon Schubert extern const bfd_target hppabsd_core_vec;
9115796c8dcSSimon Schubert extern const bfd_target hpux_core_vec;
9125796c8dcSSimon Schubert extern const bfd_target irix_core_vec;
9135796c8dcSSimon Schubert extern const bfd_target netbsd_core_vec;
9145796c8dcSSimon Schubert extern const bfd_target osf_core_vec;
9155796c8dcSSimon Schubert extern const bfd_target ptrace_core_vec;
9165796c8dcSSimon Schubert extern const bfd_target sco5_core_vec;
9175796c8dcSSimon Schubert extern const bfd_target trad_core_vec;
9185796c8dcSSimon Schubert 
9195796c8dcSSimon Schubert extern const bfd_target bfd_elf32_am33lin_vec;
9205796c8dcSSimon Schubert static const bfd_target * const _bfd_target_vector[] =
9215796c8dcSSimon Schubert {
9225796c8dcSSimon Schubert #ifdef SELECT_VECS
9235796c8dcSSimon Schubert 
9245796c8dcSSimon Schubert 	SELECT_VECS,
9255796c8dcSSimon Schubert 
9265796c8dcSSimon Schubert #else /* not SELECT_VECS */
9275796c8dcSSimon Schubert 
9285796c8dcSSimon Schubert #ifdef DEFAULT_VECTOR
9295796c8dcSSimon Schubert 	&DEFAULT_VECTOR,
9305796c8dcSSimon Schubert #endif
9315796c8dcSSimon Schubert 	/* This list is alphabetized to make it easy to compare
9325796c8dcSSimon Schubert 	   with other vector lists -- the decls above and
9335796c8dcSSimon Schubert 	   the case statement in configure.in.
9345796c8dcSSimon Schubert 	   Vectors that don't compile on all systems, or aren't finished,
9355796c8dcSSimon Schubert 	   should have an entry here with #if 0 around it, to show that
9365796c8dcSSimon Schubert 	   it wasn't omitted by mistake.  */
9375796c8dcSSimon Schubert 	&a_out_adobe_vec,
9385796c8dcSSimon Schubert #ifdef BFD64
9395796c8dcSSimon Schubert 	&aix5coff64_vec,
9405796c8dcSSimon Schubert #endif
9415796c8dcSSimon Schubert 	&aout0_big_vec,
9425796c8dcSSimon Schubert #if 0
9435796c8dcSSimon Schubert 	/* We have no way of distinguishing these from other a.out variants.  */
9445796c8dcSSimon Schubert 	&aout_arm_big_vec,
9455796c8dcSSimon Schubert 	&aout_arm_little_vec,
9465796c8dcSSimon Schubert 	/* No one seems to use this.  */
9475796c8dcSSimon Schubert 	&aout_mips_big_vec,
9485796c8dcSSimon Schubert #endif
9495796c8dcSSimon Schubert 	&aout_mips_little_vec,
9505796c8dcSSimon Schubert #if 0
9515796c8dcSSimon Schubert 	&apollocoff_vec,
9525796c8dcSSimon Schubert #endif
9535796c8dcSSimon Schubert 	&arm_epoc_pe_big_vec,
9545796c8dcSSimon Schubert 	&arm_epoc_pe_little_vec,
9555796c8dcSSimon Schubert 	&arm_epoc_pei_big_vec,
9565796c8dcSSimon Schubert 	&arm_epoc_pei_little_vec,
9575796c8dcSSimon Schubert 	&arm_wince_pe_big_vec,
9585796c8dcSSimon Schubert 	&arm_wince_pe_little_vec,
9595796c8dcSSimon Schubert 	&arm_wince_pei_big_vec,
9605796c8dcSSimon Schubert 	&arm_wince_pei_little_vec,
9615796c8dcSSimon Schubert 	&armcoff_big_vec,
9625796c8dcSSimon Schubert 	&armcoff_little_vec,
9635796c8dcSSimon Schubert 	&armnetbsd_vec,
9645796c8dcSSimon Schubert 	&armpe_big_vec,
9655796c8dcSSimon Schubert 	&armpe_little_vec,
9665796c8dcSSimon Schubert 	&armpei_big_vec,
9675796c8dcSSimon Schubert 	&armpei_little_vec,
9685796c8dcSSimon Schubert 	&b_out_vec_big_host,
9695796c8dcSSimon Schubert 	&b_out_vec_little_host,
9705796c8dcSSimon Schubert #ifdef BFD64
9715796c8dcSSimon Schubert 	&bfd_pei_ia64_vec,
9725796c8dcSSimon Schubert #endif
9735796c8dcSSimon Schubert 	&bfd_elf32_avr_vec,
9745796c8dcSSimon Schubert 	&bfd_elf32_bfin_vec,
9755796c8dcSSimon Schubert 	&bfd_elf32_bfinfdpic_vec,
9765796c8dcSSimon Schubert 
9775796c8dcSSimon Schubert 	/* This, and other vectors, may not be used in any *.mt configuration.
9785796c8dcSSimon Schubert 	   But that does not mean they are unnecessary.  If configured with
9795796c8dcSSimon Schubert 	   --enable-targets=all, objdump or gdb should be able to examine
9805796c8dcSSimon Schubert 	   the file even if we don't recognize the machine type.  */
9815796c8dcSSimon Schubert 	&bfd_elf32_big_generic_vec,
9825796c8dcSSimon Schubert 	&bfd_elf32_bigarc_vec,
9835796c8dcSSimon Schubert 	&bfd_elf32_bigarm_vec,
9845796c8dcSSimon Schubert 	&bfd_elf32_bigarm_symbian_vec,
9855796c8dcSSimon Schubert 	&bfd_elf32_bigarm_vxworks_vec,
9865796c8dcSSimon Schubert 	&bfd_elf32_bigmips_vec,
9875796c8dcSSimon Schubert 	&bfd_elf32_bigmips_vxworks_vec,
988*ef5ccd6cSJohn Marino  	&bfd_elf32_bigmoxie_vec,
989*ef5ccd6cSJohn Marino  	&bfd_elf32_bignios2_vec,
9905796c8dcSSimon Schubert 	&bfd_elf32_cr16_vec,
9915796c8dcSSimon Schubert 	&bfd_elf32_cr16c_vec,
9925796c8dcSSimon Schubert 	&bfd_elf32_cris_vec,
9935796c8dcSSimon Schubert 	&bfd_elf32_crx_vec,
9945796c8dcSSimon Schubert 	&bfd_elf32_d10v_vec,
9955796c8dcSSimon Schubert 	&bfd_elf32_d30v_vec,
9965796c8dcSSimon Schubert 	&bfd_elf32_dlx_big_vec,
997a45ae5f8SJohn Marino 	&bfd_elf32_epiphany_vec,
9985796c8dcSSimon Schubert 	&bfd_elf32_fr30_vec,
9995796c8dcSSimon Schubert 	&bfd_elf32_frv_vec,
10005796c8dcSSimon Schubert 	&bfd_elf32_frvfdpic_vec,
10015796c8dcSSimon Schubert 	&bfd_elf32_h8300_vec,
10025796c8dcSSimon Schubert 	&bfd_elf32_hppa_linux_vec,
10035796c8dcSSimon Schubert 	&bfd_elf32_hppa_nbsd_vec,
10045796c8dcSSimon Schubert 	&bfd_elf32_hppa_vec,
10055796c8dcSSimon Schubert 	&bfd_elf32_i370_vec,
10065796c8dcSSimon Schubert 	&bfd_elf32_i386_freebsd_vec,
1007a45ae5f8SJohn Marino 	&bfd_elf32_i386_nacl_vec,
1008cf7f2e2dSJohn Marino 	&bfd_elf32_i386_sol2_vec,
10095796c8dcSSimon Schubert 	&bfd_elf32_i386_vxworks_vec,
10105796c8dcSSimon Schubert 	&bfd_elf32_i386_vec,
10115796c8dcSSimon Schubert 	&bfd_elf32_i860_little_vec,
10125796c8dcSSimon Schubert 	&bfd_elf32_i860_vec,
10135796c8dcSSimon Schubert 	&bfd_elf32_i960_vec,
10145796c8dcSSimon Schubert #if 0
10155796c8dcSSimon Schubert 	&bfd_elf32_ia64_big_vec,
10165796c8dcSSimon Schubert #endif
10175796c8dcSSimon Schubert #ifdef BFD64
10185796c8dcSSimon Schubert 	&bfd_elf32_ia64_hpux_big_vec,
10195796c8dcSSimon Schubert #endif
10205796c8dcSSimon Schubert 	&bfd_elf32_ip2k_vec,
10215796c8dcSSimon Schubert 	&bfd_elf32_iq2000_vec,
10225796c8dcSSimon Schubert 	&bfd_elf32_lm32_vec,
10235796c8dcSSimon Schubert 	&bfd_elf32_little_generic_vec,
10245796c8dcSSimon Schubert 	&bfd_elf32_littlearc_vec,
10255796c8dcSSimon Schubert 	&bfd_elf32_littlearm_vec,
10265796c8dcSSimon Schubert 	&bfd_elf32_littlearm_symbian_vec,
10275796c8dcSSimon Schubert 	&bfd_elf32_littlearm_vxworks_vec,
10285796c8dcSSimon Schubert 	&bfd_elf32_littlemips_vec,
10295796c8dcSSimon Schubert 	&bfd_elf32_littlemips_vxworks_vec,
1030*ef5ccd6cSJohn Marino  	&bfd_elf32_littlemoxie_vec,
1031*ef5ccd6cSJohn Marino  	&bfd_elf32_littlenios2_vec,
10325796c8dcSSimon Schubert 	&bfd_elf32_m32c_vec,
10335796c8dcSSimon Schubert 	&bfd_elf32_m32r_vec,
10345796c8dcSSimon Schubert         &bfd_elf32_m32rle_vec,
10355796c8dcSSimon Schubert         &bfd_elf32_m32rlin_vec,
10365796c8dcSSimon Schubert         &bfd_elf32_m32rlelin_vec,
10375796c8dcSSimon Schubert 	&bfd_elf32_m68hc11_vec,
10385796c8dcSSimon Schubert 	&bfd_elf32_m68hc12_vec,
10395796c8dcSSimon Schubert 	&bfd_elf32_m68k_vec,
10405796c8dcSSimon Schubert 	&bfd_elf32_m88k_vec,
10415796c8dcSSimon Schubert 	&bfd_elf32_mcore_big_vec,
10425796c8dcSSimon Schubert 	&bfd_elf32_mcore_little_vec,
10435796c8dcSSimon Schubert 	&bfd_elf32_mep_vec,
1044*ef5ccd6cSJohn Marino 	&bfd_elf32_metag_vec,
10455796c8dcSSimon Schubert 	&bfd_elf32_microblaze_vec,
10465796c8dcSSimon Schubert 	&bfd_elf32_mn10200_vec,
10475796c8dcSSimon Schubert 	&bfd_elf32_mn10300_vec,
10485796c8dcSSimon Schubert 	&bfd_elf32_mt_vec,
10495796c8dcSSimon Schubert 	&bfd_elf32_msp430_vec,
10505796c8dcSSimon Schubert #ifdef BFD64
10515796c8dcSSimon Schubert 	&bfd_elf32_nbigmips_vec,
10525796c8dcSSimon Schubert 	&bfd_elf32_nlittlemips_vec,
10535796c8dcSSimon Schubert 	&bfd_elf32_ntradbigmips_vec,
10545796c8dcSSimon Schubert 	&bfd_elf32_ntradlittlemips_vec,
1055c50c785cSJohn Marino 	&bfd_elf32_ntradbigmips_freebsd_vec,
1056c50c785cSJohn Marino 	&bfd_elf32_ntradlittlemips_freebsd_vec,
10575796c8dcSSimon Schubert #endif
10585796c8dcSSimon Schubert 	&bfd_elf32_openrisc_vec,
10595796c8dcSSimon Schubert 	&bfd_elf32_or32_big_vec,
10605796c8dcSSimon Schubert 	&bfd_elf32_pj_vec,
10615796c8dcSSimon Schubert 	&bfd_elf32_pjl_vec,
10625796c8dcSSimon Schubert 	&bfd_elf32_powerpc_vec,
10635796c8dcSSimon Schubert 	&bfd_elf32_powerpc_vxworks_vec,
10645796c8dcSSimon Schubert 	&bfd_elf32_powerpcle_vec,
1065a45ae5f8SJohn Marino 	&bfd_elf32_powerpc_freebsd_vec,
1066a45ae5f8SJohn Marino 	&bfd_elf32_rl78_vec,
1067cf7f2e2dSJohn Marino 	&bfd_elf32_rx_be_vec,
1068a45ae5f8SJohn Marino 	&bfd_elf32_rx_be_ns_vec,
1069cf7f2e2dSJohn Marino 	&bfd_elf32_rx_le_vec,
10705796c8dcSSimon Schubert 	&bfd_elf32_s390_vec,
10715796c8dcSSimon Schubert #ifdef BFD64
10725796c8dcSSimon Schubert 	&bfd_elf32_bigscore_vec,
10735796c8dcSSimon Schubert 	&bfd_elf32_littlescore_vec,
10745796c8dcSSimon Schubert #endif
10755796c8dcSSimon Schubert         &bfd_elf32_sh_vec,
1076cf7f2e2dSJohn Marino         &bfd_elf32_shbfd_vec,
10775796c8dcSSimon Schubert         &bfd_elf32_shblin_vec,
1078cf7f2e2dSJohn Marino         &bfd_elf32_shfd_vec,
10795796c8dcSSimon Schubert         &bfd_elf32_shl_vec,
10805796c8dcSSimon Schubert         &bfd_elf32_shl_symbian_vec,
10815796c8dcSSimon Schubert         &bfd_elf32_shlin_vec,
10825796c8dcSSimon Schubert 	&bfd_elf32_shlnbsd_vec,
10835796c8dcSSimon Schubert 	&bfd_elf32_shlvxworks_vec,
10845796c8dcSSimon Schubert 	&bfd_elf32_shnbsd_vec,
10855796c8dcSSimon Schubert 	&bfd_elf32_shvxworks_vec,
10865796c8dcSSimon Schubert #ifdef BFD64
10875796c8dcSSimon Schubert 	&bfd_elf32_sh64_vec,
10885796c8dcSSimon Schubert 	&bfd_elf32_sh64l_vec,
10895796c8dcSSimon Schubert 	&bfd_elf32_sh64lnbsd_vec,
10905796c8dcSSimon Schubert 	&bfd_elf32_sh64nbsd_vec,
10915796c8dcSSimon Schubert 	&bfd_elf32_sh64lin_vec,
10925796c8dcSSimon Schubert 	&bfd_elf32_sh64blin_vec,
10935796c8dcSSimon Schubert #endif
10945796c8dcSSimon Schubert 	&bfd_elf32_sparc_vec,
1095c50c785cSJohn Marino 	&bfd_elf32_sparc_sol2_vec,
10965796c8dcSSimon Schubert 	&bfd_elf32_sparc_vxworks_vec,
10975796c8dcSSimon Schubert 	&bfd_elf32_spu_vec,
1098cf7f2e2dSJohn Marino 	&bfd_elf32_tic6x_be_vec,
1099cf7f2e2dSJohn Marino 	&bfd_elf32_tic6x_le_vec,
1100*ef5ccd6cSJohn Marino 	&bfd_elf32_tilegx_be_vec,
1101*ef5ccd6cSJohn Marino 	&bfd_elf32_tilegx_le_vec,
1102a45ae5f8SJohn Marino 	&bfd_elf32_tilepro_vec,
11035796c8dcSSimon Schubert 	&bfd_elf32_tradbigmips_vec,
11045796c8dcSSimon Schubert 	&bfd_elf32_tradlittlemips_vec,
1105c50c785cSJohn Marino 	&bfd_elf32_tradbigmips_freebsd_vec,
1106c50c785cSJohn Marino 	&bfd_elf32_tradlittlemips_freebsd_vec,
11075796c8dcSSimon Schubert 	&bfd_elf32_us_cris_vec,
11085796c8dcSSimon Schubert 	&bfd_elf32_v850_vec,
1109*ef5ccd6cSJohn Marino 	&bfd_elf32_v850_rh850_vec,
11105796c8dcSSimon Schubert 	&bfd_elf32_vax_vec,
11115796c8dcSSimon Schubert 	&bfd_elf32_xc16x_vec,
1112*ef5ccd6cSJohn Marino 	&bfd_elf32_xgate_vec,
11135796c8dcSSimon Schubert 	&bfd_elf32_xstormy16_vec,
11145796c8dcSSimon Schubert 	&bfd_elf32_xtensa_be_vec,
11155796c8dcSSimon Schubert 	&bfd_elf32_xtensa_le_vec,
11165796c8dcSSimon Schubert #ifdef BFD64
11175796c8dcSSimon Schubert 	&bfd_elf64_alpha_freebsd_vec,
11185796c8dcSSimon Schubert 	&bfd_elf64_alpha_vec,
11195796c8dcSSimon Schubert 	&bfd_elf64_big_generic_vec,
11205796c8dcSSimon Schubert 	&bfd_elf64_bigmips_vec,
1121*ef5ccd6cSJohn Marino 	&bfd_elf64_bigaarch64_vec,
11225796c8dcSSimon Schubert 	&bfd_elf64_hppa_linux_vec,
11235796c8dcSSimon Schubert 	&bfd_elf64_hppa_vec,
11245796c8dcSSimon Schubert 	&bfd_elf64_ia64_big_vec,
11255796c8dcSSimon Schubert 	&bfd_elf64_ia64_hpux_big_vec,
11265796c8dcSSimon Schubert 	&bfd_elf64_ia64_little_vec,
11275796c8dcSSimon Schubert 	&bfd_elf64_ia64_vms_vec,
11285796c8dcSSimon Schubert 	&bfd_elf64_little_generic_vec,
11295796c8dcSSimon Schubert 	&bfd_elf64_littlemips_vec,
1130*ef5ccd6cSJohn Marino 	&bfd_elf64_littleaarch64_vec,
11315796c8dcSSimon Schubert 	&bfd_elf64_mmix_vec,
11325796c8dcSSimon Schubert 	&bfd_elf64_powerpc_vec,
11335796c8dcSSimon Schubert 	&bfd_elf64_powerpcle_vec,
1134a45ae5f8SJohn Marino 	&bfd_elf64_powerpc_freebsd_vec,
11355796c8dcSSimon Schubert 	&bfd_elf64_s390_vec,
11365796c8dcSSimon Schubert 	&bfd_elf64_sh64_vec,
11375796c8dcSSimon Schubert 	&bfd_elf64_sh64l_vec,
11385796c8dcSSimon Schubert 	&bfd_elf64_sh64lnbsd_vec,
11395796c8dcSSimon Schubert 	&bfd_elf64_sh64nbsd_vec,
11405796c8dcSSimon Schubert 	&bfd_elf64_sh64lin_vec,
11415796c8dcSSimon Schubert 	&bfd_elf64_sh64blin_vec,
11425796c8dcSSimon Schubert 	&bfd_elf64_sparc_vec,
11435796c8dcSSimon Schubert 	&bfd_elf64_sparc_freebsd_vec,
1144c50c785cSJohn Marino 	&bfd_elf64_sparc_sol2_vec,
1145*ef5ccd6cSJohn Marino 	&bfd_elf64_tilegx_be_vec,
1146*ef5ccd6cSJohn Marino 	&bfd_elf64_tilegx_le_vec,
11475796c8dcSSimon Schubert 	&bfd_elf64_tradbigmips_vec,
11485796c8dcSSimon Schubert 	&bfd_elf64_tradlittlemips_vec,
1149c50c785cSJohn Marino 	&bfd_elf64_tradbigmips_freebsd_vec,
1150c50c785cSJohn Marino 	&bfd_elf64_tradlittlemips_freebsd_vec,
11515796c8dcSSimon Schubert 	&bfd_elf64_x86_64_freebsd_vec,
1152*ef5ccd6cSJohn Marino 	&bfd_elf64_x86_64_nacl_vec,
1153cf7f2e2dSJohn Marino 	&bfd_elf64_x86_64_sol2_vec,
11545796c8dcSSimon Schubert 	&bfd_elf64_x86_64_vec,
1155*ef5ccd6cSJohn Marino 	&bfd_elf32_x86_64_nacl_vec,
1156c50c785cSJohn Marino 	&bfd_elf32_x86_64_vec,
11575796c8dcSSimon Schubert 	&bfd_elf64_l1om_freebsd_vec,
11585796c8dcSSimon Schubert 	&bfd_elf64_l1om_vec,
1159a45ae5f8SJohn Marino 	&bfd_elf64_k1om_freebsd_vec,
1160a45ae5f8SJohn Marino 	&bfd_elf64_k1om_vec,
11615796c8dcSSimon Schubert 	&bfd_mmo_vec,
11625796c8dcSSimon Schubert #endif
11635796c8dcSSimon Schubert 	&bfd_powerpc_pe_vec,
11645796c8dcSSimon Schubert 	&bfd_powerpc_pei_vec,
11655796c8dcSSimon Schubert 	&bfd_powerpcle_pe_vec,
11665796c8dcSSimon Schubert 	&bfd_powerpcle_pei_vec,
11675796c8dcSSimon Schubert 	&cris_aout_vec,
11685796c8dcSSimon Schubert #ifdef BFD64
11695796c8dcSSimon Schubert 	&demo_64_vec,	/* Only compiled if host has long-long support.  */
11705796c8dcSSimon Schubert #endif
11715796c8dcSSimon Schubert 	&ecoff_big_vec,
11725796c8dcSSimon Schubert 	&ecoff_biglittle_vec,
11735796c8dcSSimon Schubert 	&ecoff_little_vec,
11745796c8dcSSimon Schubert #ifdef BFD64
11755796c8dcSSimon Schubert 	&ecoffalpha_little_vec,
11765796c8dcSSimon Schubert #endif
11775796c8dcSSimon Schubert 	&go32coff_vec,
11785796c8dcSSimon Schubert 	&go32stubbedcoff_vec,
11795796c8dcSSimon Schubert 	&h8300coff_vec,
11805796c8dcSSimon Schubert 	&h8500coff_vec,
11815796c8dcSSimon Schubert #if 0
11825796c8dcSSimon Schubert 	/* Since a.out files lack decent magic numbers, no way to recognize
11835796c8dcSSimon Schubert 	   which kind of a.out file it is.  */
11845796c8dcSSimon Schubert 	&host_aout_vec,
11855796c8dcSSimon Schubert 	/* Clashes with sunos_big_vec magic no.  */
11865796c8dcSSimon Schubert 	&hp300bsd_vec,
11875796c8dcSSimon Schubert #endif
11885796c8dcSSimon Schubert 	&hp300hpux_vec,
11895796c8dcSSimon Schubert 	&i386aout_vec,
11905796c8dcSSimon Schubert 	&i386bsd_vec,
11915796c8dcSSimon Schubert 	&i386coff_vec,
11925796c8dcSSimon Schubert #if 0
11935796c8dcSSimon Schubert 	&i386dynix_vec,
11945796c8dcSSimon Schubert #endif
11955796c8dcSSimon Schubert 	&i386freebsd_vec,
11965796c8dcSSimon Schubert #if 0
11975796c8dcSSimon Schubert 	/* Since a.out files lack decent magic numbers, no way to recognize
11985796c8dcSSimon Schubert 	   which kind of a.out file it is.  */
11995796c8dcSSimon Schubert 	&i386linux_vec,
12005796c8dcSSimon Schubert #endif
12015796c8dcSSimon Schubert 	&i386lynx_aout_vec,
12025796c8dcSSimon Schubert 	&i386lynx_coff_vec,
12035796c8dcSSimon Schubert #if 0
12045796c8dcSSimon Schubert 	/* No distinguishing features for Mach 3 executables.  */
12055796c8dcSSimon Schubert 	&i386mach3_vec,
12065796c8dcSSimon Schubert #endif
12075796c8dcSSimon Schubert 	&i386msdos_vec,
12085796c8dcSSimon Schubert 	&i386netbsd_vec,
12095796c8dcSSimon Schubert 	&i386os9k_vec,
12105796c8dcSSimon Schubert 	&i386pe_vec,
12115796c8dcSSimon Schubert 	&i386pei_vec,
12125796c8dcSSimon Schubert #ifdef BFD64
12135796c8dcSSimon Schubert 	&x86_64coff_vec,
12145796c8dcSSimon Schubert 	&x86_64pe_vec,
12155796c8dcSSimon Schubert 	&x86_64pei_vec,
12165796c8dcSSimon Schubert #endif
12175796c8dcSSimon Schubert 	&i860coff_vec,
12185796c8dcSSimon Schubert 	&icoff_big_vec,
12195796c8dcSSimon Schubert 	&icoff_little_vec,
12205796c8dcSSimon Schubert 	&ieee_vec,
12215796c8dcSSimon Schubert #if 0
12225796c8dcSSimon Schubert 	&m68k4knetbsd_vec,
12235796c8dcSSimon Schubert 	&m68kaux_coff_vec,
12245796c8dcSSimon Schubert #endif
12255796c8dcSSimon Schubert 	&m68kcoff_vec,
12265796c8dcSSimon Schubert 	&m68kcoffun_vec,
12275796c8dcSSimon Schubert #if 0
12285796c8dcSSimon Schubert 	/* Since a.out files lack decent magic numbers, no way to recognize
12295796c8dcSSimon Schubert 	   which kind of a.out file it is.  */
12305796c8dcSSimon Schubert 	&m68klinux_vec,
12315796c8dcSSimon Schubert #endif
12325796c8dcSSimon Schubert 	&m68knetbsd_vec,
12335796c8dcSSimon Schubert 	&m68ksysvcoff_vec,
12345796c8dcSSimon Schubert 	&m88kbcs_vec,
12355796c8dcSSimon Schubert 	&m88kmach3_vec,
12365796c8dcSSimon Schubert 	&m88kopenbsd_vec,
12375796c8dcSSimon Schubert 	&mach_o_be_vec,
12385796c8dcSSimon Schubert 	&mach_o_le_vec,
12395796c8dcSSimon Schubert 	&mach_o_fat_vec,
12405796c8dcSSimon Schubert 	&mach_o_i386_vec,
1241cf7f2e2dSJohn Marino #ifdef BFD64
1242cf7f2e2dSJohn Marino 	&mach_o_x86_64_vec,
1243cf7f2e2dSJohn Marino #endif
12445796c8dcSSimon Schubert 	&mcore_pe_big_vec,
12455796c8dcSSimon Schubert 	&mcore_pe_little_vec,
12465796c8dcSSimon Schubert 	&mcore_pei_big_vec,
12475796c8dcSSimon Schubert 	&mcore_pei_little_vec,
12485796c8dcSSimon Schubert 	&mipslpe_vec,
12495796c8dcSSimon Schubert 	&mipslpei_vec,
12505796c8dcSSimon Schubert 	&newsos3_vec,
12515796c8dcSSimon Schubert #ifdef BFD64
12525796c8dcSSimon Schubert 	&nlm32_alpha_vec,
12535796c8dcSSimon Schubert #endif
12545796c8dcSSimon Schubert 	&nlm32_i386_vec,
12555796c8dcSSimon Schubert 	&nlm32_powerpc_vec,
12565796c8dcSSimon Schubert 	&nlm32_sparc_vec,
12575796c8dcSSimon Schubert #if 0
12585796c8dcSSimon Schubert 	/* We have no oasys tools anymore, so we can't test any of this
12595796c8dcSSimon Schubert 	   anymore. If you want to test the stuff yourself, go ahead...
12605796c8dcSSimon Schubert 	   steve@cygnus.com
12615796c8dcSSimon Schubert 	   Worse, since there is no magic number for archives, there
12625796c8dcSSimon Schubert 	   can be annoying target mis-matches.  */
12635796c8dcSSimon Schubert 	&oasys_vec,
12645796c8dcSSimon Schubert #endif
12655796c8dcSSimon Schubert 	/* Entry for the OpenRISC family.  */
12665796c8dcSSimon Schubert 	&or32coff_big_vec,
12675796c8dcSSimon Schubert 
12685796c8dcSSimon Schubert 	&pc532machaout_vec,
12695796c8dcSSimon Schubert 	&pc532netbsd_vec,
12705796c8dcSSimon Schubert 	&pdp11_aout_vec,
12715796c8dcSSimon Schubert 	&pef_vec,
12725796c8dcSSimon Schubert 	&pef_xlib_vec,
12735796c8dcSSimon Schubert #if BFD_SUPPORTS_PLUGINS
12745796c8dcSSimon Schubert 	&plugin_vec,
12755796c8dcSSimon Schubert #endif
12765796c8dcSSimon Schubert #if 0
12775796c8dcSSimon Schubert 	/* This has the same magic number as RS/6000.  */
12785796c8dcSSimon Schubert 	&pmac_xcoff_vec,
12795796c8dcSSimon Schubert #endif
12805796c8dcSSimon Schubert 	&ppcboot_vec,
12815796c8dcSSimon Schubert #if 0
12825796c8dcSSimon Schubert 	/* We have no way of distinguishing these from other a.out variants.  */
12835796c8dcSSimon Schubert 	&riscix_vec,
12845796c8dcSSimon Schubert #endif
12855796c8dcSSimon Schubert #ifdef BFD64
12865796c8dcSSimon Schubert 	&rs6000coff64_vec,
12875796c8dcSSimon Schubert #endif
12885796c8dcSSimon Schubert 	&rs6000coff_vec,
12895796c8dcSSimon Schubert 	&shcoff_small_vec,
12905796c8dcSSimon Schubert 	&shcoff_vec,
12915796c8dcSSimon Schubert 	&shlcoff_small_vec,
12925796c8dcSSimon Schubert 	&shlcoff_vec,
12935796c8dcSSimon Schubert 	&shlpe_vec,
12945796c8dcSSimon Schubert 	&shlpei_vec,
12955796c8dcSSimon Schubert 	&som_vec,
12965796c8dcSSimon Schubert 	&sparccoff_vec,
12975796c8dcSSimon Schubert 	&sparcle_aout_vec,
12985796c8dcSSimon Schubert 	&sparclinux_vec,
12995796c8dcSSimon Schubert 	&sparclynx_aout_vec,
13005796c8dcSSimon Schubert 	&sparclynx_coff_vec,
13015796c8dcSSimon Schubert 	&sparcnetbsd_vec,
13025796c8dcSSimon Schubert 	&sunos_big_vec,
13035796c8dcSSimon Schubert 	&sym_vec,
13045796c8dcSSimon Schubert 	&tic30_aout_vec,
13055796c8dcSSimon Schubert 	&tic30_coff_vec,
13065796c8dcSSimon Schubert 	&tic54x_coff0_beh_vec,
13075796c8dcSSimon Schubert 	&tic54x_coff0_vec,
13085796c8dcSSimon Schubert 	&tic54x_coff1_beh_vec,
13095796c8dcSSimon Schubert 	&tic54x_coff1_vec,
13105796c8dcSSimon Schubert 	&tic54x_coff2_beh_vec,
13115796c8dcSSimon Schubert 	&tic54x_coff2_vec,
13125796c8dcSSimon Schubert 	&tic80coff_vec,
13135796c8dcSSimon Schubert 	&vaxbsd_vec,
13145796c8dcSSimon Schubert 	&vaxnetbsd_vec,
13155796c8dcSSimon Schubert 	&vax1knetbsd_vec,
13165796c8dcSSimon Schubert 	&versados_vec,
13175796c8dcSSimon Schubert #ifdef BFD64
13185796c8dcSSimon Schubert 	&vms_alpha_vec,
13195796c8dcSSimon Schubert #endif
1320cf7f2e2dSJohn Marino         &vms_lib_txt_vec,
13215796c8dcSSimon Schubert 	&w65_vec,
13225796c8dcSSimon Schubert 	&we32kcoff_vec,
13235796c8dcSSimon Schubert 	&z80coff_vec,
13245796c8dcSSimon Schubert 	&z8kcoff_vec,
13255796c8dcSSimon Schubert 	&bfd_elf32_am33lin_vec,
13265796c8dcSSimon Schubert #endif /* not SELECT_VECS */
13275796c8dcSSimon Schubert 
13285796c8dcSSimon Schubert /* Always support S-records, for convenience.  */
13295796c8dcSSimon Schubert 	&srec_vec,
13305796c8dcSSimon Schubert 	&symbolsrec_vec,
13315796c8dcSSimon Schubert /* And verilog.  */
13325796c8dcSSimon Schubert 	&verilog_vec,
13335796c8dcSSimon Schubert /* And tekhex */
13345796c8dcSSimon Schubert 	&tekhex_vec,
13355796c8dcSSimon Schubert /* Likewise for binary output.  */
13365796c8dcSSimon Schubert 	&binary_vec,
13375796c8dcSSimon Schubert /* Likewise for ihex.  */
13385796c8dcSSimon Schubert 	&ihex_vec,
13395796c8dcSSimon Schubert 
13405796c8dcSSimon Schubert /* Add any required traditional-core-file-handler.  */
13415796c8dcSSimon Schubert 
13425796c8dcSSimon Schubert #ifdef AIX386_CORE
13435796c8dcSSimon Schubert 	&aix386_core_vec,
13445796c8dcSSimon Schubert #endif
13455796c8dcSSimon Schubert #if 0
13465796c8dcSSimon Schubert 	/* We don't include cisco_core_*_vec.  Although it has a magic number,
13475796c8dcSSimon Schubert 	   the magic number isn't at the beginning of the file, and thus
13485796c8dcSSimon Schubert 	   might spuriously match other kinds of files.  */
13495796c8dcSSimon Schubert 	&cisco_core_big_vec,
13505796c8dcSSimon Schubert 	&cisco_core_little_vec,
13515796c8dcSSimon Schubert #endif
13525796c8dcSSimon Schubert #ifdef HPPABSD_CORE
13535796c8dcSSimon Schubert 	&hppabsd_core_vec,
13545796c8dcSSimon Schubert #endif
13555796c8dcSSimon Schubert #ifdef HPUX_CORE
13565796c8dcSSimon Schubert 	&hpux_core_vec,
13575796c8dcSSimon Schubert #endif
13585796c8dcSSimon Schubert #ifdef IRIX_CORE
13595796c8dcSSimon Schubert 	&irix_core_vec,
13605796c8dcSSimon Schubert #endif
13615796c8dcSSimon Schubert #ifdef NETBSD_CORE
13625796c8dcSSimon Schubert 	&netbsd_core_vec,
13635796c8dcSSimon Schubert #endif
13645796c8dcSSimon Schubert #ifdef OSF_CORE
13655796c8dcSSimon Schubert 	&osf_core_vec,
13665796c8dcSSimon Schubert #endif
13675796c8dcSSimon Schubert #ifdef PTRACE_CORE
13685796c8dcSSimon Schubert 	&ptrace_core_vec,
13695796c8dcSSimon Schubert #endif
13705796c8dcSSimon Schubert #ifdef SCO5_CORE
13715796c8dcSSimon Schubert 	&sco5_core_vec,
13725796c8dcSSimon Schubert #endif
13735796c8dcSSimon Schubert #ifdef TRAD_CORE
13745796c8dcSSimon Schubert 	&trad_core_vec,
13755796c8dcSSimon Schubert #endif
13765796c8dcSSimon Schubert 
13775796c8dcSSimon Schubert 	NULL /* end of list marker */
13785796c8dcSSimon Schubert };
13795796c8dcSSimon Schubert const bfd_target * const *bfd_target_vector = _bfd_target_vector;
13805796c8dcSSimon Schubert 
13815796c8dcSSimon Schubert /* bfd_default_vector[0] contains either the address of the default vector,
13825796c8dcSSimon Schubert    if there is one, or zero if there isn't.  */
13835796c8dcSSimon Schubert 
13845796c8dcSSimon Schubert const bfd_target *bfd_default_vector[] = {
13855796c8dcSSimon Schubert #ifdef DEFAULT_VECTOR
13865796c8dcSSimon Schubert 	&DEFAULT_VECTOR,
13875796c8dcSSimon Schubert #endif
13885796c8dcSSimon Schubert 	NULL
13895796c8dcSSimon Schubert };
13905796c8dcSSimon Schubert 
13915796c8dcSSimon Schubert /* bfd_associated_vector[] contains the associated target vectors used
13925796c8dcSSimon Schubert    to reduce the ambiguity in bfd_check_format_matches.  */
13935796c8dcSSimon Schubert 
13945796c8dcSSimon Schubert static const bfd_target *_bfd_associated_vector[] = {
13955796c8dcSSimon Schubert #ifdef ASSOCIATED_VECS
13965796c8dcSSimon Schubert 	ASSOCIATED_VECS,
13975796c8dcSSimon Schubert #endif
13985796c8dcSSimon Schubert 	NULL
13995796c8dcSSimon Schubert };
14005796c8dcSSimon Schubert const bfd_target * const *bfd_associated_vector = _bfd_associated_vector;
14015796c8dcSSimon Schubert 
14025796c8dcSSimon Schubert /* When there is an ambiguous match, bfd_check_format_matches puts the
14035796c8dcSSimon Schubert    names of the matching targets in an array.  This variable is the maximum
14045796c8dcSSimon Schubert    number of entries that the array could possibly need.  */
14055796c8dcSSimon Schubert const size_t _bfd_target_vector_entries = sizeof (_bfd_target_vector)/sizeof (*_bfd_target_vector);
14065796c8dcSSimon Schubert 
14075796c8dcSSimon Schubert /* This array maps configuration triplets onto BFD vectors.  */
14085796c8dcSSimon Schubert 
14095796c8dcSSimon Schubert struct targmatch
14105796c8dcSSimon Schubert {
14115796c8dcSSimon Schubert   /* The configuration triplet.  */
14125796c8dcSSimon Schubert   const char *triplet;
14135796c8dcSSimon Schubert   /* The BFD vector.  If this is NULL, then the vector is found by
14145796c8dcSSimon Schubert      searching forward for the next structure with a non NULL vector
14155796c8dcSSimon Schubert      field.  */
14165796c8dcSSimon Schubert   const bfd_target *vector;
14175796c8dcSSimon Schubert };
14185796c8dcSSimon Schubert 
14195796c8dcSSimon Schubert /* targmatch.h is built by Makefile out of config.bfd.  */
14205796c8dcSSimon Schubert static const struct targmatch bfd_target_match[] = {
14215796c8dcSSimon Schubert #include "targmatch.h"
14225796c8dcSSimon Schubert   { NULL, NULL }
14235796c8dcSSimon Schubert };
14245796c8dcSSimon Schubert 
14255796c8dcSSimon Schubert /* Find a target vector, given a name or configuration triplet.  */
14265796c8dcSSimon Schubert 
14275796c8dcSSimon Schubert static const bfd_target *
find_target(const char * name)14285796c8dcSSimon Schubert find_target (const char *name)
14295796c8dcSSimon Schubert {
14305796c8dcSSimon Schubert   const bfd_target * const *target;
14315796c8dcSSimon Schubert   const struct targmatch *match;
14325796c8dcSSimon Schubert 
14335796c8dcSSimon Schubert   for (target = &bfd_target_vector[0]; *target != NULL; target++)
14345796c8dcSSimon Schubert     if (strcmp (name, (*target)->name) == 0)
14355796c8dcSSimon Schubert       return *target;
14365796c8dcSSimon Schubert 
14375796c8dcSSimon Schubert   /* If we couldn't match on the exact name, try matching on the
14385796c8dcSSimon Schubert      configuration triplet.  FIXME: We should run the triplet through
14395796c8dcSSimon Schubert      config.sub first, but that is hard.  */
14405796c8dcSSimon Schubert   for (match = &bfd_target_match[0]; match->triplet != NULL; match++)
14415796c8dcSSimon Schubert     {
14425796c8dcSSimon Schubert       if (fnmatch (match->triplet, name, 0) == 0)
14435796c8dcSSimon Schubert 	{
14445796c8dcSSimon Schubert 	  while (match->vector == NULL)
14455796c8dcSSimon Schubert 	    ++match;
14465796c8dcSSimon Schubert 	  return match->vector;
14475796c8dcSSimon Schubert 	}
14485796c8dcSSimon Schubert     }
14495796c8dcSSimon Schubert 
14505796c8dcSSimon Schubert   bfd_set_error (bfd_error_invalid_target);
14515796c8dcSSimon Schubert   return NULL;
14525796c8dcSSimon Schubert }
14535796c8dcSSimon Schubert 
14545796c8dcSSimon Schubert /*
14555796c8dcSSimon Schubert FUNCTION
14565796c8dcSSimon Schubert 	bfd_set_default_target
14575796c8dcSSimon Schubert 
14585796c8dcSSimon Schubert SYNOPSIS
14595796c8dcSSimon Schubert 	bfd_boolean bfd_set_default_target (const char *name);
14605796c8dcSSimon Schubert 
14615796c8dcSSimon Schubert DESCRIPTION
14625796c8dcSSimon Schubert 	Set the default target vector to use when recognizing a BFD.
14635796c8dcSSimon Schubert 	This takes the name of the target, which may be a BFD target
14645796c8dcSSimon Schubert 	name or a configuration triplet.
14655796c8dcSSimon Schubert */
14665796c8dcSSimon Schubert 
14675796c8dcSSimon Schubert bfd_boolean
bfd_set_default_target(const char * name)14685796c8dcSSimon Schubert bfd_set_default_target (const char *name)
14695796c8dcSSimon Schubert {
14705796c8dcSSimon Schubert   const bfd_target *target;
14715796c8dcSSimon Schubert 
14725796c8dcSSimon Schubert   if (bfd_default_vector[0] != NULL
14735796c8dcSSimon Schubert       && strcmp (name, bfd_default_vector[0]->name) == 0)
14745796c8dcSSimon Schubert     return TRUE;
14755796c8dcSSimon Schubert 
14765796c8dcSSimon Schubert   target = find_target (name);
14775796c8dcSSimon Schubert   if (target == NULL)
14785796c8dcSSimon Schubert     return FALSE;
14795796c8dcSSimon Schubert 
14805796c8dcSSimon Schubert   bfd_default_vector[0] = target;
14815796c8dcSSimon Schubert   return TRUE;
14825796c8dcSSimon Schubert }
14835796c8dcSSimon Schubert 
14845796c8dcSSimon Schubert /*
14855796c8dcSSimon Schubert FUNCTION
14865796c8dcSSimon Schubert 	bfd_find_target
14875796c8dcSSimon Schubert 
14885796c8dcSSimon Schubert SYNOPSIS
14895796c8dcSSimon Schubert 	const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
14905796c8dcSSimon Schubert 
14915796c8dcSSimon Schubert DESCRIPTION
14925796c8dcSSimon Schubert 	Return a pointer to the transfer vector for the object target
14935796c8dcSSimon Schubert 	named @var{target_name}.  If @var{target_name} is <<NULL>>,
14945796c8dcSSimon Schubert 	choose the one in the environment variable <<GNUTARGET>>; if
14955796c8dcSSimon Schubert 	that is null or not defined, then choose the first entry in the
14965796c8dcSSimon Schubert 	target list.  Passing in the string "default" or setting the
14975796c8dcSSimon Schubert 	environment variable to "default" will cause the first entry in
14985796c8dcSSimon Schubert 	the target list to be returned, and "target_defaulted" will be
14995796c8dcSSimon Schubert 	set in the BFD if @var{abfd} isn't <<NULL>>.  This causes
15005796c8dcSSimon Schubert 	<<bfd_check_format>> to loop over all the targets to find the
15015796c8dcSSimon Schubert 	one that matches the file being read.
15025796c8dcSSimon Schubert */
15035796c8dcSSimon Schubert 
15045796c8dcSSimon Schubert const bfd_target *
bfd_find_target(const char * target_name,bfd * abfd)15055796c8dcSSimon Schubert bfd_find_target (const char *target_name, bfd *abfd)
15065796c8dcSSimon Schubert {
15075796c8dcSSimon Schubert   const char *targname;
15085796c8dcSSimon Schubert   const bfd_target *target;
15095796c8dcSSimon Schubert 
15105796c8dcSSimon Schubert   if (target_name != NULL)
15115796c8dcSSimon Schubert     targname = target_name;
15125796c8dcSSimon Schubert   else
15135796c8dcSSimon Schubert     targname = getenv ("GNUTARGET");
15145796c8dcSSimon Schubert 
15155796c8dcSSimon Schubert   /* This is safe; the vector cannot be null.  */
15165796c8dcSSimon Schubert   if (targname == NULL || strcmp (targname, "default") == 0)
15175796c8dcSSimon Schubert     {
15185796c8dcSSimon Schubert       if (bfd_default_vector[0] != NULL)
15195796c8dcSSimon Schubert 	target = bfd_default_vector[0];
15205796c8dcSSimon Schubert       else
15215796c8dcSSimon Schubert 	target = bfd_target_vector[0];
15225796c8dcSSimon Schubert       if (abfd)
15235796c8dcSSimon Schubert 	{
15245796c8dcSSimon Schubert 	  abfd->xvec = target;
15255796c8dcSSimon Schubert 	  abfd->target_defaulted = TRUE;
15265796c8dcSSimon Schubert 	}
15275796c8dcSSimon Schubert       return target;
15285796c8dcSSimon Schubert     }
15295796c8dcSSimon Schubert 
15305796c8dcSSimon Schubert   if (abfd)
15315796c8dcSSimon Schubert     abfd->target_defaulted = FALSE;
15325796c8dcSSimon Schubert 
15335796c8dcSSimon Schubert   target = find_target (targname);
15345796c8dcSSimon Schubert   if (target == NULL)
15355796c8dcSSimon Schubert     return NULL;
15365796c8dcSSimon Schubert 
15375796c8dcSSimon Schubert   if (abfd)
15385796c8dcSSimon Schubert     abfd->xvec = target;
15395796c8dcSSimon Schubert   return target;
15405796c8dcSSimon Schubert }
15415796c8dcSSimon Schubert 
1542cf7f2e2dSJohn Marino /* Helper function for bfd_get_target_info to determine the target's
1543cf7f2e2dSJohn Marino    architecture.  This method handles bfd internal target names as
1544cf7f2e2dSJohn Marino    tuples and triplets.  */
1545cf7f2e2dSJohn Marino static bfd_boolean
_bfd_find_arch_match(const char * tname,const char ** arch,const char ** def_target_arch)1546cf7f2e2dSJohn Marino _bfd_find_arch_match (const char *tname, const char **arch,
1547cf7f2e2dSJohn Marino 		      const char **def_target_arch)
1548cf7f2e2dSJohn Marino {
1549cf7f2e2dSJohn Marino   if (!arch)
1550cf7f2e2dSJohn Marino     return FALSE;
1551cf7f2e2dSJohn Marino 
1552cf7f2e2dSJohn Marino   while (*arch != NULL)
1553cf7f2e2dSJohn Marino     {
1554cf7f2e2dSJohn Marino       const char *in_a = strstr (*arch, tname);
1555cf7f2e2dSJohn Marino       char end_ch = (in_a ? in_a[strlen (tname)] : 0);
1556cf7f2e2dSJohn Marino 
1557cf7f2e2dSJohn Marino       if (in_a && (in_a == *arch || in_a[-1] == ':')
1558cf7f2e2dSJohn Marino           && end_ch == 0)
1559cf7f2e2dSJohn Marino         {
1560cf7f2e2dSJohn Marino           *def_target_arch = *arch;
1561cf7f2e2dSJohn Marino           return TRUE;
1562cf7f2e2dSJohn Marino         }
1563cf7f2e2dSJohn Marino       arch++;
1564cf7f2e2dSJohn Marino     }
1565cf7f2e2dSJohn Marino   return FALSE;
1566cf7f2e2dSJohn Marino }
1567cf7f2e2dSJohn Marino 
1568cf7f2e2dSJohn Marino /*
1569cf7f2e2dSJohn Marino FUNCTION
1570cf7f2e2dSJohn Marino 	bfd_get_target_info
1571cf7f2e2dSJohn Marino SYNOPSIS
1572cf7f2e2dSJohn Marino 	const bfd_target *bfd_get_target_info (const char *target_name,
1573cf7f2e2dSJohn Marino 					       bfd *abfd,
1574cf7f2e2dSJohn Marino 				 	       bfd_boolean *is_bigendian,
1575cf7f2e2dSJohn Marino 					       int *underscoring,
1576cf7f2e2dSJohn Marino 					       const char **def_target_arch);
1577cf7f2e2dSJohn Marino DESCRIPTION
1578cf7f2e2dSJohn Marino         Return a pointer to the transfer vector for the object target
1579cf7f2e2dSJohn Marino         named @var{target_name}.  If @var{target_name} is <<NULL>>,
1580cf7f2e2dSJohn Marino         choose the one in the environment variable <<GNUTARGET>>; if
1581cf7f2e2dSJohn Marino         that is null or not defined, then choose the first entry in the
1582cf7f2e2dSJohn Marino         target list.  Passing in the string "default" or setting the
1583cf7f2e2dSJohn Marino         environment variable to "default" will cause the first entry in
1584cf7f2e2dSJohn Marino         the target list to be returned, and "target_defaulted" will be
1585cf7f2e2dSJohn Marino         set in the BFD if @var{abfd} isn't <<NULL>>.  This causes
1586cf7f2e2dSJohn Marino         <<bfd_check_format>> to loop over all the targets to find the
1587cf7f2e2dSJohn Marino         one that matches the file being read.
1588cf7f2e2dSJohn Marino 	If @var{is_bigendian} is not <<NULL>>, then set this value to target's
1589cf7f2e2dSJohn Marino 	endian mode. True for big-endian, FALSE for little-endian or for
1590cf7f2e2dSJohn Marino 	invalid target.
1591cf7f2e2dSJohn Marino 	If @var{underscoring} is not <<NULL>>, then set this value to target's
1592cf7f2e2dSJohn Marino 	underscoring mode. Zero for none-underscoring, -1 for invalid target,
1593cf7f2e2dSJohn Marino 	else the value of target vector's symbol underscoring.
1594cf7f2e2dSJohn Marino 	If @var{def_target_arch} is not <<NULL>>, then set it to the architecture
1595cf7f2e2dSJohn Marino 	string specified by the target_name.
1596cf7f2e2dSJohn Marino */
1597cf7f2e2dSJohn Marino const bfd_target *
bfd_get_target_info(const char * target_name,bfd * abfd,bfd_boolean * is_bigendian,int * underscoring,const char ** def_target_arch)1598cf7f2e2dSJohn Marino bfd_get_target_info (const char *target_name, bfd *abfd,
1599cf7f2e2dSJohn Marino 		     bfd_boolean *is_bigendian,
1600cf7f2e2dSJohn Marino 		     int *underscoring, const char **def_target_arch)
1601cf7f2e2dSJohn Marino {
1602cf7f2e2dSJohn Marino   const bfd_target *target_vec;
1603cf7f2e2dSJohn Marino 
1604cf7f2e2dSJohn Marino   if (is_bigendian)
1605cf7f2e2dSJohn Marino     *is_bigendian = FALSE;
1606cf7f2e2dSJohn Marino   if (underscoring)
1607cf7f2e2dSJohn Marino     *underscoring = -1;
1608cf7f2e2dSJohn Marino   if (def_target_arch)
1609cf7f2e2dSJohn Marino     *def_target_arch = NULL;
1610cf7f2e2dSJohn Marino   target_vec = bfd_find_target (target_name, abfd);
1611cf7f2e2dSJohn Marino   if (! target_vec)
1612cf7f2e2dSJohn Marino     return NULL;
1613cf7f2e2dSJohn Marino   if (is_bigendian)
1614cf7f2e2dSJohn Marino     *is_bigendian = ((target_vec->byteorder == BFD_ENDIAN_BIG) ? TRUE
1615cf7f2e2dSJohn Marino 							       : FALSE);
1616cf7f2e2dSJohn Marino   if (underscoring)
1617cf7f2e2dSJohn Marino     *underscoring = ((int) target_vec->symbol_leading_char) & 0xff;
1618cf7f2e2dSJohn Marino 
1619cf7f2e2dSJohn Marino   if (def_target_arch)
1620cf7f2e2dSJohn Marino     {
1621cf7f2e2dSJohn Marino       const char *tname = target_vec->name;
1622cf7f2e2dSJohn Marino       const char **arches = bfd_arch_list ();
1623cf7f2e2dSJohn Marino 
1624cf7f2e2dSJohn Marino       if (arches && tname)
1625cf7f2e2dSJohn Marino         {
1626cf7f2e2dSJohn Marino           char *hyp = strchr (tname, '-');
1627cf7f2e2dSJohn Marino 
1628cf7f2e2dSJohn Marino           if (hyp != NULL)
1629cf7f2e2dSJohn Marino             {
1630cf7f2e2dSJohn Marino               tname = ++hyp;
1631cf7f2e2dSJohn Marino 
1632cf7f2e2dSJohn Marino 	      /* Make sure we detect architecture names
1633cf7f2e2dSJohn Marino 		 for triplets like "pe-arm-wince-little".  */
1634cf7f2e2dSJohn Marino 	      if (!_bfd_find_arch_match (tname, arches, def_target_arch))
1635cf7f2e2dSJohn Marino 		{
1636cf7f2e2dSJohn Marino 		  char new_tname[50];
1637cf7f2e2dSJohn Marino 
1638cf7f2e2dSJohn Marino 		  strcpy (new_tname, hyp);
1639cf7f2e2dSJohn Marino 		  while ((hyp = strrchr (new_tname, '-')) != NULL)
1640cf7f2e2dSJohn Marino 		    {
1641cf7f2e2dSJohn Marino 		      *hyp = 0;
1642cf7f2e2dSJohn Marino 		      if (_bfd_find_arch_match (new_tname, arches,
1643cf7f2e2dSJohn Marino 			  			def_target_arch))
1644cf7f2e2dSJohn Marino 			break;
1645cf7f2e2dSJohn Marino 		    }
1646cf7f2e2dSJohn Marino 		}
1647cf7f2e2dSJohn Marino 	    }
1648cf7f2e2dSJohn Marino 	  else
1649cf7f2e2dSJohn Marino 	    _bfd_find_arch_match (tname, arches, def_target_arch);
1650cf7f2e2dSJohn Marino 	}
1651cf7f2e2dSJohn Marino 
1652cf7f2e2dSJohn Marino       if (arches)
1653cf7f2e2dSJohn Marino         free (arches);
1654cf7f2e2dSJohn Marino     }
1655cf7f2e2dSJohn Marino   return target_vec;
1656cf7f2e2dSJohn Marino }
1657cf7f2e2dSJohn Marino 
16585796c8dcSSimon Schubert /*
16595796c8dcSSimon Schubert FUNCTION
16605796c8dcSSimon Schubert 	bfd_target_list
16615796c8dcSSimon Schubert 
16625796c8dcSSimon Schubert SYNOPSIS
16635796c8dcSSimon Schubert 	const char ** bfd_target_list (void);
16645796c8dcSSimon Schubert 
16655796c8dcSSimon Schubert DESCRIPTION
16665796c8dcSSimon Schubert 	Return a freshly malloced NULL-terminated
16675796c8dcSSimon Schubert 	vector of the names of all the valid BFD targets. Do not
16685796c8dcSSimon Schubert 	modify the names.
16695796c8dcSSimon Schubert 
16705796c8dcSSimon Schubert */
16715796c8dcSSimon Schubert 
16725796c8dcSSimon Schubert const char **
bfd_target_list(void)16735796c8dcSSimon Schubert bfd_target_list (void)
16745796c8dcSSimon Schubert {
16755796c8dcSSimon Schubert   int vec_length = 0;
16765796c8dcSSimon Schubert   bfd_size_type amt;
16775796c8dcSSimon Schubert   const bfd_target * const *target;
16785796c8dcSSimon Schubert   const  char **name_list, **name_ptr;
16795796c8dcSSimon Schubert 
16805796c8dcSSimon Schubert   for (target = &bfd_target_vector[0]; *target != NULL; target++)
16815796c8dcSSimon Schubert     vec_length++;
16825796c8dcSSimon Schubert 
16835796c8dcSSimon Schubert   amt = (vec_length + 1) * sizeof (char **);
16845796c8dcSSimon Schubert   name_ptr = name_list = (const  char **) bfd_malloc (amt);
16855796c8dcSSimon Schubert 
16865796c8dcSSimon Schubert   if (name_list == NULL)
16875796c8dcSSimon Schubert     return NULL;
16885796c8dcSSimon Schubert 
16895796c8dcSSimon Schubert   for (target = &bfd_target_vector[0]; *target != NULL; target++)
16905796c8dcSSimon Schubert     if (target == &bfd_target_vector[0]
16915796c8dcSSimon Schubert 	|| *target != bfd_target_vector[0])
16925796c8dcSSimon Schubert       *name_ptr++ = (*target)->name;
16935796c8dcSSimon Schubert 
16945796c8dcSSimon Schubert   *name_ptr = NULL;
16955796c8dcSSimon Schubert   return name_list;
16965796c8dcSSimon Schubert }
16975796c8dcSSimon Schubert 
16985796c8dcSSimon Schubert /*
16995796c8dcSSimon Schubert FUNCTION
17005796c8dcSSimon Schubert 	bfd_seach_for_target
17015796c8dcSSimon Schubert 
17025796c8dcSSimon Schubert SYNOPSIS
17035796c8dcSSimon Schubert 	const bfd_target *bfd_search_for_target
17045796c8dcSSimon Schubert 	  (int (*search_func) (const bfd_target *, void *),
17055796c8dcSSimon Schubert 	   void *);
17065796c8dcSSimon Schubert 
17075796c8dcSSimon Schubert DESCRIPTION
17085796c8dcSSimon Schubert 	Return a pointer to the first transfer vector in the list of
17095796c8dcSSimon Schubert 	transfer vectors maintained by BFD that produces a non-zero
17105796c8dcSSimon Schubert 	result when passed to the function @var{search_func}.  The
17115796c8dcSSimon Schubert 	parameter @var{data} is passed, unexamined, to the search
17125796c8dcSSimon Schubert 	function.
17135796c8dcSSimon Schubert */
17145796c8dcSSimon Schubert 
17155796c8dcSSimon Schubert const bfd_target *
bfd_search_for_target(int (* search_func)(const bfd_target *,void *),void * data)17165796c8dcSSimon Schubert bfd_search_for_target (int (*search_func) (const bfd_target *, void *),
17175796c8dcSSimon Schubert 		       void *data)
17185796c8dcSSimon Schubert {
17195796c8dcSSimon Schubert   const bfd_target * const *target;
17205796c8dcSSimon Schubert 
17215796c8dcSSimon Schubert   for (target = bfd_target_vector; *target != NULL; target ++)
17225796c8dcSSimon Schubert     if (search_func (*target, data))
17235796c8dcSSimon Schubert       return *target;
17245796c8dcSSimon Schubert 
17255796c8dcSSimon Schubert   return NULL;
17265796c8dcSSimon Schubert }
1727