133965Sjdp/* Generic target-file-type support for the BFD library. 278828Sobrien Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3218822Sdim 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 438889Sjdp Free Software Foundation, Inc. 533965Sjdp Written by Cygnus Support. 633965Sjdp 7130561Sobrien This file is part of BFD, the Binary File Descriptor library. 833965Sjdp 9130561Sobrien This program is free software; you can redistribute it and/or modify 10130561Sobrien it under the terms of the GNU General Public License as published by 11130561Sobrien the Free Software Foundation; either version 2 of the License, or 12130561Sobrien (at your option) any later version. 1333965Sjdp 14130561Sobrien This program is distributed in the hope that it will be useful, 15130561Sobrien but WITHOUT ANY WARRANTY; without even the implied warranty of 16130561Sobrien MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17130561Sobrien GNU General Public License for more details. 1833965Sjdp 19130561Sobrien You should have received a copy of the GNU General Public License 20130561Sobrien along with this program; if not, write to the Free Software 21218822Sdim Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2233965Sjdp 23218822Sdim#include "sysdep.h" 2433965Sjdp#include "bfd.h" 2533965Sjdp#include "libbfd.h" 2633965Sjdp#include "fnmatch.h" 2733965Sjdp 2833965Sjdp/* 29218822Sdim It's okay to see some: 30218822Sdim#if 0 31218822Sdim directives in this source file, as targets.c uses them to exclude 32218822Sdim certain BFD vectors. This comment is specially formatted to catch 33218822Sdim users who grep for ^#if 0, so please keep it this way! 34218822Sdim*/ 35218822Sdim 36218822Sdim/* 3777298SobrienSECTION 3833965Sjdp Targets 3933965Sjdp 4033965SjdpDESCRIPTION 41130561Sobrien Each port of BFD to a different machine requires the creation 4233965Sjdp of a target back end. All the back end provides to the root 4333965Sjdp part of BFD is a structure containing pointers to functions 4433965Sjdp which perform certain low level operations on files. BFD 4533965Sjdp translates the applications's requests through a pointer into 4677298Sobrien calls to the back end routines. 4733965Sjdp 4833965Sjdp When a file is opened with <<bfd_openr>>, its format and 4933965Sjdp target are unknown. BFD uses various mechanisms to determine 5033965Sjdp how to interpret the file. The operations performed are: 5133965Sjdp 5233965Sjdp o Create a BFD by calling the internal routine 5333965Sjdp <<_bfd_new_bfd>>, then call <<bfd_find_target>> with the 5477298Sobrien target string supplied to <<bfd_openr>> and the new BFD pointer. 5533965Sjdp 5633965Sjdp o If a null target string was provided to <<bfd_find_target>>, 5733965Sjdp look up the environment variable <<GNUTARGET>> and use 5877298Sobrien that as the target string. 5933965Sjdp 6033965Sjdp o If the target string is still <<NULL>>, or the target string is 6133965Sjdp <<default>>, then use the first item in the target vector 6233965Sjdp as the target type, and set <<target_defaulted>> in the BFD to 6333965Sjdp cause <<bfd_check_format>> to loop through all the targets. 6433965Sjdp @xref{bfd_target}. @xref{Formats}. 6533965Sjdp 6633965Sjdp o Otherwise, inspect the elements in the target vector 6733965Sjdp one by one, until a match on target name is found. When found, 6877298Sobrien use it. 6933965Sjdp 7033965Sjdp o Otherwise return the error <<bfd_error_invalid_target>> to 7133965Sjdp <<bfd_openr>>. 7233965Sjdp 7333965Sjdp o <<bfd_openr>> attempts to open the file using 7433965Sjdp <<bfd_open_file>>, and returns the BFD. 7533965Sjdp 7633965Sjdp Once the BFD has been opened and the target selected, the file 7733965Sjdp format may be determined. This is done by calling 7877298Sobrien <<bfd_check_format>> on the BFD with a suggested format. 7933965Sjdp If <<target_defaulted>> has been set, each possible target 8033965Sjdp type is tried to see if it recognizes the specified format. 81130561Sobrien <<bfd_check_format>> returns <<TRUE>> when the caller guesses right. 8233965Sjdp@menu 8333965Sjdp@* bfd_target:: 8433965Sjdp@end menu 8533965Sjdp*/ 8633965Sjdp 8733965Sjdp/* 8833965Sjdp 8933965SjdpINODE 9033965Sjdp bfd_target, , Targets, Targets 9133965SjdpDOCDD 9233965SjdpSUBSECTION 9333965Sjdp bfd_target 9433965Sjdp 9533965SjdpDESCRIPTION 9633965Sjdp This structure contains everything that BFD knows about a 9733965Sjdp target. It includes things like its byte order, name, and which 9877298Sobrien routines to call to do various operations. 9933965Sjdp 10033965Sjdp Every BFD points to a target structure with its <<xvec>> 10177298Sobrien member. 10233965Sjdp 10333965Sjdp The macros below are used to dispatch to functions through the 10433965Sjdp <<bfd_target>> vector. They are used in a number of macros further 10533965Sjdp down in @file{bfd.h}, and are also used when calling various 10633965Sjdp routines by hand inside the BFD implementation. The @var{arglist} 10733965Sjdp argument must be parenthesized; it contains all the arguments 10877298Sobrien to the called function. 10933965Sjdp 11033965Sjdp They make the documentation (more) unpleasant to read, so if 11133965Sjdp someone wants to fix this and not break the above, please do. 11233965Sjdp 11333965Sjdp.#define BFD_SEND(bfd, message, arglist) \ 114130561Sobrien. ((*((bfd)->xvec->message)) arglist) 11533965Sjdp. 11633965Sjdp.#ifdef DEBUG_BFD_SEND 11733965Sjdp.#undef BFD_SEND 11833965Sjdp.#define BFD_SEND(bfd, message, arglist) \ 11933965Sjdp. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ 12033965Sjdp. ((*((bfd)->xvec->message)) arglist) : \ 12133965Sjdp. (bfd_assert (__FILE__,__LINE__), NULL)) 12233965Sjdp.#endif 12333965Sjdp 12433965Sjdp For operations which index on the BFD format: 12533965Sjdp 12633965Sjdp.#define BFD_SEND_FMT(bfd, message, arglist) \ 127130561Sobrien. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) 12833965Sjdp. 12933965Sjdp.#ifdef DEBUG_BFD_SEND 13033965Sjdp.#undef BFD_SEND_FMT 13133965Sjdp.#define BFD_SEND_FMT(bfd, message, arglist) \ 13233965Sjdp. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ 13377298Sobrien. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \ 13433965Sjdp. (bfd_assert (__FILE__,__LINE__), NULL)) 13533965Sjdp.#endif 13691041Sobrien. 13733965Sjdp This is the structure which defines the type of BFD this is. The 13833965Sjdp <<xvec>> member of the struct <<bfd>> itself points here. Each 13933965Sjdp module that implements access to a different target under BFD, 14033965Sjdp defines one of these. 14133965Sjdp 14233965Sjdp FIXME, these names should be rationalised with the names of 14333965Sjdp the entry points which call them. Too bad we can't have one 14477298Sobrien macro to define them both! 14533965Sjdp 14691041Sobrien.enum bfd_flavour 14791041Sobrien.{ 14833965Sjdp. bfd_target_unknown_flavour, 14933965Sjdp. bfd_target_aout_flavour, 15033965Sjdp. bfd_target_coff_flavour, 15133965Sjdp. bfd_target_ecoff_flavour, 15277298Sobrien. bfd_target_xcoff_flavour, 15333965Sjdp. bfd_target_elf_flavour, 15433965Sjdp. bfd_target_ieee_flavour, 15533965Sjdp. bfd_target_nlm_flavour, 15633965Sjdp. bfd_target_oasys_flavour, 15733965Sjdp. bfd_target_tekhex_flavour, 15833965Sjdp. bfd_target_srec_flavour, 15933965Sjdp. bfd_target_ihex_flavour, 16033965Sjdp. bfd_target_som_flavour, 16133965Sjdp. bfd_target_os9k_flavour, 16233965Sjdp. bfd_target_versados_flavour, 16333965Sjdp. bfd_target_msdos_flavour, 16460484Sobrien. bfd_target_ovax_flavour, 16589857Sobrien. bfd_target_evax_flavour, 166130561Sobrien. bfd_target_mmo_flavour, 167130561Sobrien. bfd_target_mach_o_flavour, 168130561Sobrien. bfd_target_pef_flavour, 169130561Sobrien. bfd_target_pef_xlib_flavour, 170130561Sobrien. bfd_target_sym_flavour 17133965Sjdp.}; 17233965Sjdp. 17333965Sjdp.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; 17433965Sjdp. 17533965Sjdp.{* Forward declaration. *} 17633965Sjdp.typedef struct bfd_link_info _bfd_link_info; 17733965Sjdp. 17833965Sjdp.typedef struct bfd_target 17933965Sjdp.{ 18091041Sobrien. {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. *} 18133965Sjdp. char *name; 18291041Sobrien. 18391041Sobrien. {* The "flavour" of a back end is a general indication about 18491041Sobrien. the contents of a file. *} 18533965Sjdp. enum bfd_flavour flavour; 18691041Sobrien. 18791041Sobrien. {* The order of bytes within the data area of a file. *} 18833965Sjdp. enum bfd_endian byteorder; 18991041Sobrien. 19091041Sobrien. {* The order of bytes within the header parts of a file. *} 19133965Sjdp. enum bfd_endian header_byteorder; 19291041Sobrien. 19391041Sobrien. {* A mask of all the flags which an executable may have set - 19491041Sobrien. from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>. *} 19577298Sobrien. flagword object_flags; 19691041Sobrien. 19791041Sobrien. {* A mask of all the flags which a section may have set - from 19891041Sobrien. the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>. *} 19933965Sjdp. flagword section_flags; 20091041Sobrien. 20191041Sobrien. {* The character normally found at the front of a symbol. 20291041Sobrien. (if any), perhaps `_'. *} 20333965Sjdp. char symbol_leading_char; 20491041Sobrien. 20591041Sobrien. {* The pad character for file names within an archive header. *} 20677298Sobrien. char ar_pad_char; 20791041Sobrien. 20891041Sobrien. {* The maximum number of characters in an archive header. *} 20933965Sjdp. unsigned short ar_max_namelen; 21091041Sobrien. 21191041Sobrien. {* Entries for byte swapping for data. These are different from the 212218822Sdim. other entry points, since they don't take a BFD as the first argument. 21391041Sobrien. Certain other handlers could do the same. *} 214130561Sobrien. bfd_uint64_t (*bfd_getx64) (const void *); 215130561Sobrien. bfd_int64_t (*bfd_getx_signed_64) (const void *); 216130561Sobrien. void (*bfd_putx64) (bfd_uint64_t, void *); 217130561Sobrien. bfd_vma (*bfd_getx32) (const void *); 218130561Sobrien. bfd_signed_vma (*bfd_getx_signed_32) (const void *); 219130561Sobrien. void (*bfd_putx32) (bfd_vma, void *); 220130561Sobrien. bfd_vma (*bfd_getx16) (const void *); 221130561Sobrien. bfd_signed_vma (*bfd_getx_signed_16) (const void *); 222130561Sobrien. void (*bfd_putx16) (bfd_vma, void *); 22391041Sobrien. 22491041Sobrien. {* Byte swapping for the headers. *} 225130561Sobrien. bfd_uint64_t (*bfd_h_getx64) (const void *); 226130561Sobrien. bfd_int64_t (*bfd_h_getx_signed_64) (const void *); 227130561Sobrien. void (*bfd_h_putx64) (bfd_uint64_t, void *); 228130561Sobrien. bfd_vma (*bfd_h_getx32) (const void *); 229130561Sobrien. bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); 230130561Sobrien. void (*bfd_h_putx32) (bfd_vma, void *); 231130561Sobrien. bfd_vma (*bfd_h_getx16) (const void *); 232130561Sobrien. bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); 233130561Sobrien. void (*bfd_h_putx16) (bfd_vma, void *); 23491041Sobrien. 23591041Sobrien. {* Format dependent routines: these are vectors of entry points 23691041Sobrien. within the target vector structure, one for each format to check. *} 23791041Sobrien. 23891041Sobrien. {* Check the format of a file being read. Return a <<bfd_target *>> or zero. *} 239130561Sobrien. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *); 24091041Sobrien. 24191041Sobrien. {* Set the format of a file being written. *} 242130561Sobrien. bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); 24391041Sobrien. 24491041Sobrien. {* Write cached information into a file being written, at <<bfd_close>>. *} 245130561Sobrien. bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); 24691041Sobrien. 24760484SobrienThe general target vector. These vectors are initialized using the 24860484SobrienBFD_JUMP_TABLE macros. 24933965Sjdp. 25033965Sjdp. {* Generic entry points. *} 25189857Sobrien.#define BFD_JUMP_TABLE_GENERIC(NAME) \ 252130561Sobrien. NAME##_close_and_cleanup, \ 253130561Sobrien. NAME##_bfd_free_cached_info, \ 254130561Sobrien. NAME##_new_section_hook, \ 255130561Sobrien. NAME##_get_section_contents, \ 256130561Sobrien. NAME##_get_section_contents_in_window 25733965Sjdp. 25833965Sjdp. {* Called when the BFD is being closed to do any necessary cleanup. *} 259130561Sobrien. bfd_boolean (*_close_and_cleanup) (bfd *); 26033965Sjdp. {* Ask the BFD to free all cached information. *} 261130561Sobrien. bfd_boolean (*_bfd_free_cached_info) (bfd *); 26233965Sjdp. {* Called when a new section is created. *} 263130561Sobrien. bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); 26433965Sjdp. {* Read the contents of a section. *} 265130561Sobrien. bfd_boolean (*_bfd_get_section_contents) 266130561Sobrien. (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); 267130561Sobrien. bfd_boolean (*_bfd_get_section_contents_in_window) 268130561Sobrien. (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type); 26933965Sjdp. 27033965Sjdp. {* Entry points to copy private data. *} 27189857Sobrien.#define BFD_JUMP_TABLE_COPY(NAME) \ 272130561Sobrien. NAME##_bfd_copy_private_bfd_data, \ 273130561Sobrien. NAME##_bfd_merge_private_bfd_data, \ 274218822Sdim. _bfd_generic_init_private_section_data, \ 275130561Sobrien. NAME##_bfd_copy_private_section_data, \ 276130561Sobrien. NAME##_bfd_copy_private_symbol_data, \ 277218822Sdim. NAME##_bfd_copy_private_header_data, \ 278130561Sobrien. NAME##_bfd_set_private_flags, \ 279130561Sobrien. NAME##_bfd_print_private_bfd_data 280130561Sobrien. 28133965Sjdp. {* Called to copy BFD general private data from one object file 28233965Sjdp. to another. *} 283130561Sobrien. bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); 28433965Sjdp. {* Called to merge BFD general private data from one object file 28533965Sjdp. to a common output file when linking. *} 286130561Sobrien. bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); 287218822Sdim. {* Called to initialize BFD private section data from one object file 288218822Sdim. to another. *} 289218822Sdim.#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ 290218822Sdim. BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info)) 291218822Sdim. bfd_boolean (*_bfd_init_private_section_data) 292218822Sdim. (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *); 29333965Sjdp. {* Called to copy BFD private section data from one object file 29433965Sjdp. to another. *} 295130561Sobrien. bfd_boolean (*_bfd_copy_private_section_data) 296130561Sobrien. (bfd *, sec_ptr, bfd *, sec_ptr); 29777298Sobrien. {* Called to copy BFD private symbol data from one symbol 29833965Sjdp. to another. *} 299130561Sobrien. bfd_boolean (*_bfd_copy_private_symbol_data) 300130561Sobrien. (bfd *, asymbol *, bfd *, asymbol *); 301218822Sdim. {* Called to copy BFD private header data from one object file 302218822Sdim. to another. *} 303218822Sdim. bfd_boolean (*_bfd_copy_private_header_data) 304218822Sdim. (bfd *, bfd *); 30591041Sobrien. {* Called to set private backend flags. *} 306130561Sobrien. bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); 30733965Sjdp. 30891041Sobrien. {* Called to print private BFD data. *} 309130561Sobrien. bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); 31033965Sjdp. 31133965Sjdp. {* Core file entry points. *} 31289857Sobrien.#define BFD_JUMP_TABLE_CORE(NAME) \ 313130561Sobrien. NAME##_core_file_failing_command, \ 314130561Sobrien. NAME##_core_file_failing_signal, \ 315130561Sobrien. NAME##_core_file_matches_executable_p 31633965Sjdp. 317130561Sobrien. char * (*_core_file_failing_command) (bfd *); 318130561Sobrien. int (*_core_file_failing_signal) (bfd *); 319130561Sobrien. bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); 320130561Sobrien. 32133965Sjdp. {* Archive entry points. *} 32289857Sobrien.#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ 323130561Sobrien. NAME##_slurp_armap, \ 324130561Sobrien. NAME##_slurp_extended_name_table, \ 325130561Sobrien. NAME##_construct_extended_name_table, \ 326130561Sobrien. NAME##_truncate_arname, \ 327130561Sobrien. NAME##_write_armap, \ 328130561Sobrien. NAME##_read_ar_hdr, \ 329130561Sobrien. NAME##_openr_next_archived_file, \ 330130561Sobrien. NAME##_get_elt_at_index, \ 331130561Sobrien. NAME##_generic_stat_arch_elt, \ 332130561Sobrien. NAME##_update_armap_timestamp 33333965Sjdp. 334130561Sobrien. bfd_boolean (*_bfd_slurp_armap) (bfd *); 335130561Sobrien. bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); 336130561Sobrien. bfd_boolean (*_bfd_construct_extended_name_table) 337130561Sobrien. (bfd *, char **, bfd_size_type *, const char **); 338130561Sobrien. void (*_bfd_truncate_arname) (bfd *, const char *, char *); 339130561Sobrien. bfd_boolean (*write_armap) 340130561Sobrien. (bfd *, unsigned int, struct orl *, unsigned int, int); 341130561Sobrien. void * (*_bfd_read_ar_hdr_fn) (bfd *); 342130561Sobrien. bfd * (*openr_next_archived_file) (bfd *, bfd *); 343130561Sobrien.#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) 344130561Sobrien. bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); 345130561Sobrien. int (*_bfd_stat_arch_elt) (bfd *, struct stat *); 346130561Sobrien. bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); 347130561Sobrien. 34833965Sjdp. {* Entry points used for symbols. *} 34989857Sobrien.#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ 350130561Sobrien. NAME##_get_symtab_upper_bound, \ 351130561Sobrien. NAME##_canonicalize_symtab, \ 352130561Sobrien. NAME##_make_empty_symbol, \ 353130561Sobrien. NAME##_print_symbol, \ 354130561Sobrien. NAME##_get_symbol_info, \ 355130561Sobrien. NAME##_bfd_is_local_label_name, \ 356218822Sdim. NAME##_bfd_is_target_special_symbol, \ 357130561Sobrien. NAME##_get_lineno, \ 358130561Sobrien. NAME##_find_nearest_line, \ 359218822Sdim. _bfd_generic_find_line, \ 360218822Sdim. NAME##_find_inliner_info, \ 361130561Sobrien. NAME##_bfd_make_debug_symbol, \ 362130561Sobrien. NAME##_read_minisymbols, \ 363130561Sobrien. NAME##_minisymbol_to_symbol 36433965Sjdp. 365130561Sobrien. long (*_bfd_get_symtab_upper_bound) (bfd *); 366130561Sobrien. long (*_bfd_canonicalize_symtab) 367130561Sobrien. (bfd *, struct bfd_symbol **); 368130561Sobrien. struct bfd_symbol * 369130561Sobrien. (*_bfd_make_empty_symbol) (bfd *); 370130561Sobrien. void (*_bfd_print_symbol) 371130561Sobrien. (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type); 372130561Sobrien.#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) 373130561Sobrien. void (*_bfd_get_symbol_info) 374130561Sobrien. (bfd *, struct bfd_symbol *, symbol_info *); 375130561Sobrien.#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) 376130561Sobrien. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); 377218822Sdim. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); 378130561Sobrien. alent * (*_get_lineno) (bfd *, struct bfd_symbol *); 379130561Sobrien. bfd_boolean (*_bfd_find_nearest_line) 380130561Sobrien. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, 381130561Sobrien. const char **, const char **, unsigned int *); 382218822Sdim. bfd_boolean (*_bfd_find_line) 383218822Sdim. (bfd *, struct bfd_symbol **, struct bfd_symbol *, 384218822Sdim. const char **, unsigned int *); 385218822Sdim. bfd_boolean (*_bfd_find_inliner_info) 386218822Sdim. (bfd *, const char **, const char **, unsigned int *); 38733965Sjdp. {* Back-door to allow format-aware applications to create debug symbols 38833965Sjdp. while using BFD for everything else. Currently used by the assembler 38933965Sjdp. when creating COFF files. *} 390130561Sobrien. asymbol * (*_bfd_make_debug_symbol) 391130561Sobrien. (bfd *, void *, unsigned long size); 39233965Sjdp.#define bfd_read_minisymbols(b, d, m, s) \ 39333965Sjdp. BFD_SEND (b, _read_minisymbols, (b, d, m, s)) 394130561Sobrien. long (*_read_minisymbols) 395130561Sobrien. (bfd *, bfd_boolean, void **, unsigned int *); 39633965Sjdp.#define bfd_minisymbol_to_symbol(b, d, m, f) \ 39733965Sjdp. BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) 398130561Sobrien. asymbol * (*_minisymbol_to_symbol) 399130561Sobrien. (bfd *, bfd_boolean, const void *, asymbol *); 40033965Sjdp. 40133965Sjdp. {* Routines for relocs. *} 40289857Sobrien.#define BFD_JUMP_TABLE_RELOCS(NAME) \ 403130561Sobrien. NAME##_get_reloc_upper_bound, \ 404130561Sobrien. NAME##_canonicalize_reloc, \ 405218822Sdim. NAME##_bfd_reloc_type_lookup, \ 406218822Sdim. NAME##_bfd_reloc_name_lookup 407130561Sobrien. 408130561Sobrien. long (*_get_reloc_upper_bound) (bfd *, sec_ptr); 409130561Sobrien. long (*_bfd_canonicalize_reloc) 410130561Sobrien. (bfd *, sec_ptr, arelent **, struct bfd_symbol **); 41133965Sjdp. {* See documentation on reloc types. *} 41233965Sjdp. reloc_howto_type * 413130561Sobrien. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); 414218822Sdim. reloc_howto_type * 415218822Sdim. (*reloc_name_lookup) (bfd *, const char *); 41633965Sjdp. 417218822Sdim. 41833965Sjdp. {* Routines used when writing an object file. *} 41989857Sobrien.#define BFD_JUMP_TABLE_WRITE(NAME) \ 420130561Sobrien. NAME##_set_arch_mach, \ 421130561Sobrien. NAME##_set_section_contents 42233965Sjdp. 423130561Sobrien. bfd_boolean (*_bfd_set_arch_mach) 424130561Sobrien. (bfd *, enum bfd_architecture, unsigned long); 425130561Sobrien. bfd_boolean (*_bfd_set_section_contents) 426130561Sobrien. (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); 427130561Sobrien. 42833965Sjdp. {* Routines used by the linker. *} 42989857Sobrien.#define BFD_JUMP_TABLE_LINK(NAME) \ 430130561Sobrien. NAME##_sizeof_headers, \ 431130561Sobrien. NAME##_bfd_get_relocated_section_contents, \ 432130561Sobrien. NAME##_bfd_relax_section, \ 433130561Sobrien. NAME##_bfd_link_hash_table_create, \ 434130561Sobrien. NAME##_bfd_link_hash_table_free, \ 435130561Sobrien. NAME##_bfd_link_add_symbols, \ 436130561Sobrien. NAME##_bfd_link_just_syms, \ 437130561Sobrien. NAME##_bfd_final_link, \ 438130561Sobrien. NAME##_bfd_link_split_section, \ 439130561Sobrien. NAME##_bfd_gc_sections, \ 440130561Sobrien. NAME##_bfd_merge_sections, \ 441218822Sdim. NAME##_bfd_is_group_section, \ 442218822Sdim. NAME##_bfd_discard_group, \ 443218822Sdim. NAME##_section_already_linked \ 44433965Sjdp. 445218822Sdim. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); 446130561Sobrien. bfd_byte * (*_bfd_get_relocated_section_contents) 447130561Sobrien. (bfd *, struct bfd_link_info *, struct bfd_link_order *, 448130561Sobrien. bfd_byte *, bfd_boolean, struct bfd_symbol **); 44933965Sjdp. 450130561Sobrien. bfd_boolean (*_bfd_relax_section) 451130561Sobrien. (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *); 452130561Sobrien. 45333965Sjdp. {* Create a hash table for the linker. Different backends store 45433965Sjdp. different information in this table. *} 455130561Sobrien. struct bfd_link_hash_table * 456130561Sobrien. (*_bfd_link_hash_table_create) (bfd *); 45733965Sjdp. 458104834Sobrien. {* Release the memory associated with the linker hash table. *} 459130561Sobrien. void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); 460104834Sobrien. 46133965Sjdp. {* Add symbols from this object file into the hash table. *} 462130561Sobrien. bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); 46333965Sjdp. 464104834Sobrien. {* Indicate that we are only retrieving symbol values from this section. *} 465130561Sobrien. void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); 466104834Sobrien. 46733965Sjdp. {* Do a link based on the link_order structures attached to each 46833965Sjdp. section of the BFD. *} 469130561Sobrien. bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); 47033965Sjdp. 47133965Sjdp. {* Should this section be split up into smaller pieces during linking. *} 472130561Sobrien. bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); 47333965Sjdp. 47460484Sobrien. {* Remove sections that are not referenced from the output. *} 475130561Sobrien. bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); 47660484Sobrien. 47789857Sobrien. {* Attempt to merge SEC_MERGE sections. *} 478130561Sobrien. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); 47989857Sobrien. 480218822Sdim. {* Is this section a member of a group? *} 481218822Sdim. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); 482218822Sdim. 483104834Sobrien. {* Discard members of a group. *} 484130561Sobrien. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); 485104834Sobrien. 486218822Sdim. {* Check if SEC has been already linked during a reloceatable or 487218822Sdim. final link. *} 488218822Sdim. void (*_section_already_linked) (bfd *, struct bfd_section *, 489218822Sdim. struct bfd_link_info *); 490218822Sdim. 49160484Sobrien. {* Routines to handle dynamic symbols and relocs. *} 49289857Sobrien.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ 493130561Sobrien. NAME##_get_dynamic_symtab_upper_bound, \ 494130561Sobrien. NAME##_canonicalize_dynamic_symtab, \ 495218822Sdim. NAME##_get_synthetic_symtab, \ 496130561Sobrien. NAME##_get_dynamic_reloc_upper_bound, \ 497130561Sobrien. NAME##_canonicalize_dynamic_reloc 498130561Sobrien. 49991041Sobrien. {* Get the amount of memory required to hold the dynamic symbols. *} 500130561Sobrien. long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); 50133965Sjdp. {* Read in the dynamic symbols. *} 502130561Sobrien. long (*_bfd_canonicalize_dynamic_symtab) 503130561Sobrien. (bfd *, struct bfd_symbol **); 504218822Sdim. {* Create synthetized symbols. *} 505218822Sdim. long (*_bfd_get_synthetic_symtab) 506218822Sdim. (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **, 507218822Sdim. struct bfd_symbol **); 50833965Sjdp. {* Get the amount of memory required to hold the dynamic relocs. *} 509130561Sobrien. long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); 51033965Sjdp. {* Read in the dynamic relocs. *} 511130561Sobrien. long (*_bfd_canonicalize_dynamic_reloc) 512130561Sobrien. (bfd *, arelent **, struct bfd_symbol **); 51333965Sjdp. 51433965Sjdp 51560484SobrienA pointer to an alternative bfd_target in case the current one is not 51660484Sobriensatisfactory. This can happen when the target cpu supports both big 51760484Sobrienand little endian code, and target chosen by the linker has the wrong 51860484Sobrienendianness. The function open_output() in ld/ldlang.c uses this field 51960484Sobriento find an alternative output format that is suitable. 52060484Sobrien 52191041Sobrien. {* Opposite endian version of this target. *} 52291041Sobrien. const struct bfd_target * alternative_target; 52377298Sobrien. 52460484Sobrien 52591041Sobrien. {* Data for use by back-end routines, which isn't 52691041Sobrien. generic enough to belong in this structure. *} 527130561Sobrien. const void *backend_data; 52877298Sobrien. 52933965Sjdp.} bfd_target; 53091041Sobrien. 53133965Sjdp*/ 53233965Sjdp 53333965Sjdp/* All known xvecs (even those that don't compile on all systems). 53433965Sjdp Alphabetized for easy reference. 53533965Sjdp They are listed a second time below, since 53633965Sjdp we can't intermix extern's and initializers. */ 53733965Sjdpextern const bfd_target a_out_adobe_vec; 538104834Sobrienextern const bfd_target aix5coff64_vec; 53977298Sobrienextern const bfd_target aout0_big_vec; 54033965Sjdpextern const bfd_target aout_arm_big_vec; 54133965Sjdpextern const bfd_target aout_arm_little_vec; 54233965Sjdpextern const bfd_target aout_mips_big_vec; 54333965Sjdpextern const bfd_target aout_mips_little_vec; 54433965Sjdpextern const bfd_target apollocoff_vec; 54577298Sobrienextern const bfd_target arm_epoc_pe_big_vec; 54677298Sobrienextern const bfd_target arm_epoc_pe_little_vec; 54777298Sobrienextern const bfd_target arm_epoc_pei_big_vec; 54877298Sobrienextern const bfd_target arm_epoc_pei_little_vec; 549218822Sdimextern const bfd_target arm_wince_pe_big_vec; 550218822Sdimextern const bfd_target arm_wince_pe_little_vec; 551218822Sdimextern const bfd_target arm_wince_pei_big_vec; 552218822Sdimextern const bfd_target arm_wince_pei_little_vec; 55377298Sobrienextern const bfd_target armcoff_big_vec; 55433965Sjdpextern const bfd_target armcoff_little_vec; 55560484Sobrienextern const bfd_target armnetbsd_vec; 55677298Sobrienextern const bfd_target armpe_big_vec; 55733965Sjdpextern const bfd_target armpe_little_vec; 55877298Sobrienextern const bfd_target armpei_big_vec; 55933965Sjdpextern const bfd_target armpei_little_vec; 56033965Sjdpextern const bfd_target b_out_vec_big_host; 56133965Sjdpextern const bfd_target b_out_vec_little_host; 56277298Sobrienextern const bfd_target bfd_efi_app_ia32_vec; 563213274Srpauloextern const bfd_target bfd_efi_app_x86_64_vec; 56477298Sobrienextern const bfd_target bfd_efi_app_ia64_vec; 56560484Sobrienextern const bfd_target bfd_elf32_avr_vec; 566218822Sdimextern const bfd_target bfd_elf32_bfin_vec; 567218822Sdimextern const bfd_target bfd_elf32_bfinfdpic_vec; 56877298Sobrienextern const bfd_target bfd_elf32_big_generic_vec; 56938889Sjdpextern const bfd_target bfd_elf32_bigarc_vec; 57060484Sobrienextern const bfd_target bfd_elf32_bigarm_vec; 571218822Sdimextern const bfd_target bfd_elf32_bigarm_symbian_vec; 572218822Sdimextern const bfd_target bfd_elf32_bigarm_vxworks_vec; 57333965Sjdpextern const bfd_target bfd_elf32_bigmips_vec; 574218822Sdimextern const bfd_target bfd_elf32_bigmips_vxworks_vec; 575218822Sdimextern const bfd_target bfd_elf32_cr16_vec; 576218822Sdimextern const bfd_target bfd_elf32_cr16c_vec; 57777298Sobrienextern const bfd_target bfd_elf32_cris_vec; 578218822Sdimextern const bfd_target bfd_elf32_crx_vec; 57933965Sjdpextern const bfd_target bfd_elf32_d10v_vec; 58060484Sobrienextern const bfd_target bfd_elf32_d30v_vec; 581104834Sobrienextern const bfd_target bfd_elf32_dlx_big_vec; 58277298Sobrienextern const bfd_target bfd_elf32_fr30_vec; 583104834Sobrienextern const bfd_target bfd_elf32_frv_vec; 584130561Sobrienextern const bfd_target bfd_elf32_frvfdpic_vec; 58589857Sobrienextern const bfd_target bfd_elf32_h8300_vec; 58677298Sobrienextern const bfd_target bfd_elf32_hppa_linux_vec; 587218822Sdimextern const bfd_target bfd_elf32_hppa_nbsd_vec; 58833965Sjdpextern const bfd_target bfd_elf32_hppa_vec; 58960484Sobrienextern const bfd_target bfd_elf32_i370_vec; 590104834Sobrienextern const bfd_target bfd_elf32_i386_freebsd_vec; 591218822Sdimextern const bfd_target bfd_elf32_i386_vxworks_vec; 59233965Sjdpextern const bfd_target bfd_elf32_i386_vec; 59377298Sobrienextern const bfd_target bfd_elf32_i860_little_vec; 59433965Sjdpextern const bfd_target bfd_elf32_i860_vec; 59560484Sobrienextern const bfd_target bfd_elf32_i960_vec; 59677298Sobrienextern const bfd_target bfd_elf32_ia64_big_vec; 597218822Sdimextern const bfd_target bfd_elf64_ia64_freebsd_vec; 59889857Sobrienextern const bfd_target bfd_elf32_ia64_hpux_big_vec; 599130561Sobrienextern const bfd_target bfd_elf32_ip2k_vec; 600130561Sobrienextern const bfd_target bfd_elf32_iq2000_vec; 60133965Sjdpextern const bfd_target bfd_elf32_little_generic_vec; 60277298Sobrienextern const bfd_target bfd_elf32_littlearc_vec; 60377298Sobrienextern const bfd_target bfd_elf32_littlearm_vec; 604218822Sdimextern const bfd_target bfd_elf32_littlearm_symbian_vec; 605218822Sdimextern const bfd_target bfd_elf32_littlearm_vxworks_vec; 60633965Sjdpextern const bfd_target bfd_elf32_littlemips_vec; 607218822Sdimextern const bfd_target bfd_elf32_littlemips_vxworks_vec; 608218822Sdimextern const bfd_target bfd_elf32_m32c_vec; 60933965Sjdpextern const bfd_target bfd_elf32_m32r_vec; 610130561Sobrienextern const bfd_target bfd_elf32_m32rle_vec; 611130561Sobrienextern const bfd_target bfd_elf32_m32rlin_vec; 612130561Sobrienextern const bfd_target bfd_elf32_m32rlelin_vec; 61377298Sobrienextern const bfd_target bfd_elf32_m68hc11_vec; 61477298Sobrienextern const bfd_target bfd_elf32_m68hc12_vec; 61533965Sjdpextern const bfd_target bfd_elf32_m68k_vec; 61633965Sjdpextern const bfd_target bfd_elf32_m88k_vec; 61777298Sobrienextern const bfd_target bfd_elf32_mcore_big_vec; 61877298Sobrienextern const bfd_target bfd_elf32_mcore_little_vec; 619218822Sdimextern const bfd_target bfd_elf32_mep_vec; 620218822Sdimextern const bfd_target bfd_elf32_mep_little_vec; 62133965Sjdpextern const bfd_target bfd_elf32_mn10200_vec; 62233965Sjdpextern const bfd_target bfd_elf32_mn10300_vec; 623218822Sdimextern const bfd_target bfd_elf32_mt_vec; 624130561Sobrienextern const bfd_target bfd_elf32_msp430_vec; 625130561Sobrienextern const bfd_target bfd_elf32_nbigmips_vec; 626130561Sobrienextern const bfd_target bfd_elf32_nlittlemips_vec; 627130561Sobrienextern const bfd_target bfd_elf32_ntradbigmips_vec; 628130561Sobrienextern const bfd_target bfd_elf32_ntradlittlemips_vec; 62989857Sobrienextern const bfd_target bfd_elf32_openrisc_vec; 63091041Sobrienextern const bfd_target bfd_elf32_or32_big_vec; 63160484Sobrienextern const bfd_target bfd_elf32_pj_vec; 63260484Sobrienextern const bfd_target bfd_elf32_pjl_vec; 63333965Sjdpextern const bfd_target bfd_elf32_powerpc_vec; 63433965Sjdpextern const bfd_target bfd_elf32_powerpcle_vec; 635218822Sdimextern const bfd_target bfd_elf32_powerpc_vxworks_vec; 63689857Sobrienextern const bfd_target bfd_elf32_s390_vec; 637218822Sdimextern const bfd_target bfd_elf32_bigscore_vec; 638218822Sdimextern const bfd_target bfd_elf32_littlescore_vec; 639104834Sobrienextern const bfd_target bfd_elf32_sh64_vec; 640104834Sobrienextern const bfd_target bfd_elf32_sh64l_vec; 641130561Sobrienextern const bfd_target bfd_elf32_sh64lin_vec; 642130561Sobrienextern const bfd_target bfd_elf32_sh64blin_vec; 643104834Sobrienextern const bfd_target bfd_elf32_sh64lnbsd_vec; 644104834Sobrienextern const bfd_target bfd_elf32_sh64nbsd_vec; 64533965Sjdpextern const bfd_target bfd_elf32_sh_vec; 64677298Sobrienextern const bfd_target bfd_elf32_shblin_vec; 64733965Sjdpextern const bfd_target bfd_elf32_shl_vec; 648218822Sdimextern const bfd_target bfd_elf32_shl_symbian_vec; 64977298Sobrienextern const bfd_target bfd_elf32_shlin_vec; 65089857Sobrienextern const bfd_target bfd_elf32_shlnbsd_vec; 651218822Sdimextern const bfd_target bfd_elf32_shlvxworks_vec; 65289857Sobrienextern const bfd_target bfd_elf32_shnbsd_vec; 653218822Sdimextern const bfd_target bfd_elf32_shvxworks_vec; 65433965Sjdpextern const bfd_target bfd_elf32_sparc_vec; 655218822Sdimextern const bfd_target bfd_elf32_sparc_vxworks_vec; 656218822Sdimextern const bfd_target bfd_elf32_spu_vec; 65777298Sobrienextern const bfd_target bfd_elf32_tradbigmips_vec; 65877298Sobrienextern const bfd_target bfd_elf32_tradlittlemips_vec; 65977298Sobrienextern const bfd_target bfd_elf32_us_cris_vec; 66038889Sjdpextern const bfd_target bfd_elf32_v850_vec; 661104834Sobrienextern const bfd_target bfd_elf32_vax_vec; 662218822Sdimextern const bfd_target bfd_elf32_xc16x_vec; 66389857Sobrienextern const bfd_target bfd_elf32_xstormy16_vec; 664130561Sobrienextern const bfd_target bfd_elf32_xtensa_be_vec; 665130561Sobrienextern const bfd_target bfd_elf32_xtensa_le_vec; 666104834Sobrienextern const bfd_target bfd_elf64_alpha_freebsd_vec; 66777298Sobrienextern const bfd_target bfd_elf64_alpha_vec; 66833965Sjdpextern const bfd_target bfd_elf64_big_generic_vec; 66977298Sobrienextern const bfd_target bfd_elf64_bigmips_vec; 67077298Sobrienextern const bfd_target bfd_elf64_hppa_linux_vec; 67177298Sobrienextern const bfd_target bfd_elf64_hppa_vec; 67277298Sobrienextern const bfd_target bfd_elf64_ia64_big_vec; 67389857Sobrienextern const bfd_target bfd_elf64_ia64_hpux_big_vec; 67477298Sobrienextern const bfd_target bfd_elf64_ia64_little_vec; 67533965Sjdpextern const bfd_target bfd_elf64_little_generic_vec; 67677298Sobrienextern const bfd_target bfd_elf64_littlemips_vec; 67789857Sobrienextern const bfd_target bfd_elf64_mmix_vec; 67889857Sobrienextern const bfd_target bfd_elf64_powerpc_vec; 67989857Sobrienextern const bfd_target bfd_elf64_powerpcle_vec; 68089857Sobrienextern const bfd_target bfd_elf64_s390_vec; 681104834Sobrienextern const bfd_target bfd_elf64_sh64_vec; 682104834Sobrienextern const bfd_target bfd_elf64_sh64l_vec; 683130561Sobrienextern const bfd_target bfd_elf64_sh64lin_vec; 684130561Sobrienextern const bfd_target bfd_elf64_sh64blin_vec; 685104834Sobrienextern const bfd_target bfd_elf64_sh64lnbsd_vec; 686104834Sobrienextern const bfd_target bfd_elf64_sh64nbsd_vec; 68789857Sobrienextern const bfd_target bfd_elf64_sparc_vec; 688218822Sdimextern const bfd_target bfd_elf64_sparc_freebsd_vec; 68978828Sobrienextern const bfd_target bfd_elf64_tradbigmips_vec; 69078828Sobrienextern const bfd_target bfd_elf64_tradlittlemips_vec; 691218822Sdimextern const bfd_target bfd_elf64_x86_64_freebsd_vec; 69277298Sobrienextern const bfd_target bfd_elf64_x86_64_vec; 69389857Sobrienextern const bfd_target bfd_mmo_vec; 69477298Sobrienextern const bfd_target bfd_powerpc_pe_vec; 69577298Sobrienextern const bfd_target bfd_powerpc_pei_vec; 69677298Sobrienextern const bfd_target bfd_powerpcle_pe_vec; 69777298Sobrienextern const bfd_target bfd_powerpcle_pei_vec; 69877298Sobrienextern const bfd_target cris_aout_vec; 69933965Sjdpextern const bfd_target demo_64_vec; 70033965Sjdpextern const bfd_target ecoff_big_vec; 70177298Sobrienextern const bfd_target ecoff_biglittle_vec; 70233965Sjdpextern const bfd_target ecoff_little_vec; 70333965Sjdpextern const bfd_target ecoffalpha_little_vec; 70477298Sobrienextern const bfd_target go32coff_vec; 70577298Sobrienextern const bfd_target go32stubbedcoff_vec; 70633965Sjdpextern const bfd_target h8300coff_vec; 70733965Sjdpextern const bfd_target h8500coff_vec; 70833965Sjdpextern const bfd_target host_aout_vec; 70933965Sjdpextern const bfd_target hp300bsd_vec; 71033965Sjdpextern const bfd_target hp300hpux_vec; 71133965Sjdpextern const bfd_target i386aout_vec; 71233965Sjdpextern const bfd_target i386bsd_vec; 71377298Sobrienextern const bfd_target i386coff_vec; 71433965Sjdpextern const bfd_target i386dynix_vec; 71533965Sjdpextern const bfd_target i386freebsd_vec; 71633965Sjdpextern const bfd_target i386linux_vec; 71733965Sjdpextern const bfd_target i386lynx_aout_vec; 71833965Sjdpextern const bfd_target i386lynx_coff_vec; 71933965Sjdpextern const bfd_target i386mach3_vec; 72033965Sjdpextern const bfd_target i386msdos_vec; 72133965Sjdpextern const bfd_target i386netbsd_vec; 72277298Sobrienextern const bfd_target i386os9k_vec; 72377298Sobrienextern const bfd_target i386pe_vec; 72477298Sobrienextern const bfd_target i386pei_vec; 72533965Sjdpextern const bfd_target i860coff_vec; 72633965Sjdpextern const bfd_target icoff_big_vec; 72733965Sjdpextern const bfd_target icoff_little_vec; 72833965Sjdpextern const bfd_target ieee_vec; 72977298Sobrienextern const bfd_target m68k4knetbsd_vec; 73033965Sjdpextern const bfd_target m68kaux_coff_vec; 73133965Sjdpextern const bfd_target m68kcoff_vec; 73233965Sjdpextern const bfd_target m68kcoffun_vec; 73333965Sjdpextern const bfd_target m68klinux_vec; 73433965Sjdpextern const bfd_target m68knetbsd_vec; 73533965Sjdpextern const bfd_target m68ksysvcoff_vec; 73633965Sjdpextern const bfd_target m88kbcs_vec; 73733965Sjdpextern const bfd_target m88kmach3_vec; 738218822Sdimextern const bfd_target m88kopenbsd_vec; 739130561Sobrienextern const bfd_target mach_o_be_vec; 740130561Sobrienextern const bfd_target mach_o_le_vec; 741130561Sobrienextern const bfd_target mach_o_fat_vec; 742218822Sdimextern const bfd_target maxqcoff_vec; 74360484Sobrienextern const bfd_target mcore_pe_big_vec; 74460484Sobrienextern const bfd_target mcore_pe_little_vec; 74560484Sobrienextern const bfd_target mcore_pei_big_vec; 74660484Sobrienextern const bfd_target mcore_pei_little_vec; 74777298Sobrienextern const bfd_target mipslpe_vec; 74877298Sobrienextern const bfd_target mipslpei_vec; 74933965Sjdpextern const bfd_target newsos3_vec; 75077298Sobrienextern const bfd_target nlm32_alpha_vec; 75133965Sjdpextern const bfd_target nlm32_i386_vec; 75277298Sobrienextern const bfd_target nlm32_powerpc_vec; 75333965Sjdpextern const bfd_target nlm32_sparc_vec; 75433965Sjdpextern const bfd_target oasys_vec; 75591041Sobrienextern const bfd_target or32coff_big_vec; 75633965Sjdpextern const bfd_target pc532machaout_vec; 75777298Sobrienextern const bfd_target pc532netbsd_vec; 75889857Sobrienextern const bfd_target pdp11_aout_vec; 759130561Sobrienextern const bfd_target pef_vec; 760130561Sobrienextern const bfd_target pef_xlib_vec; 76177298Sobrienextern const bfd_target pmac_xcoff_vec; 76233965Sjdpextern const bfd_target ppcboot_vec; 76333965Sjdpextern const bfd_target riscix_vec; 76477298Sobrienextern const bfd_target rs6000coff64_vec; 76533965Sjdpextern const bfd_target rs6000coff_vec; 76677298Sobrienextern const bfd_target shcoff_small_vec; 76733965Sjdpextern const bfd_target shcoff_vec; 76877298Sobrienextern const bfd_target shlcoff_small_vec; 76933965Sjdpextern const bfd_target shlcoff_vec; 77060484Sobrienextern const bfd_target shlpe_vec; 77160484Sobrienextern const bfd_target shlpei_vec; 77277298Sobrienextern const bfd_target som_vec; 77377298Sobrienextern const bfd_target sparccoff_vec; 77433965Sjdpextern const bfd_target sparcle_aout_vec; 77533965Sjdpextern const bfd_target sparclinux_vec; 77633965Sjdpextern const bfd_target sparclynx_aout_vec; 77733965Sjdpextern const bfd_target sparclynx_coff_vec; 77833965Sjdpextern const bfd_target sparcnetbsd_vec; 77933965Sjdpextern const bfd_target sunos_big_vec; 780130561Sobrienextern const bfd_target sym_vec; 78138889Sjdpextern const bfd_target tic30_aout_vec; 78238889Sjdpextern const bfd_target tic30_coff_vec; 783130561Sobrienextern const bfd_target tic4x_coff0_beh_vec; 784130561Sobrienextern const bfd_target tic4x_coff0_vec; 785130561Sobrienextern const bfd_target tic4x_coff1_beh_vec; 786130561Sobrienextern const bfd_target tic4x_coff1_vec; 787130561Sobrienextern const bfd_target tic4x_coff2_beh_vec; 788130561Sobrienextern const bfd_target tic4x_coff2_vec; 78977298Sobrienextern const bfd_target tic54x_coff0_beh_vec; 79077298Sobrienextern const bfd_target tic54x_coff0_vec; 79177298Sobrienextern const bfd_target tic54x_coff1_beh_vec; 79277298Sobrienextern const bfd_target tic54x_coff1_vec; 79377298Sobrienextern const bfd_target tic54x_coff2_beh_vec; 79477298Sobrienextern const bfd_target tic54x_coff2_vec; 79560484Sobrienextern const bfd_target tic80coff_vec; 796104834Sobrienextern const bfd_target vaxbsd_vec; 79738889Sjdpextern const bfd_target vaxnetbsd_vec; 798104834Sobrienextern const bfd_target vax1knetbsd_vec; 79933965Sjdpextern const bfd_target versados_vec; 80060484Sobrienextern const bfd_target vms_alpha_vec; 80160484Sobrienextern const bfd_target vms_vax_vec; 80277298Sobrienextern const bfd_target w65_vec; 80333965Sjdpextern const bfd_target we32kcoff_vec; 804218822Sdimextern const bfd_target x86_64pe_vec; 805218822Sdimextern const bfd_target x86_64pei_vec; 806218822Sdimextern const bfd_target x86_64coff_vec; 807218822Sdimextern const bfd_target z80coff_vec; 80833965Sjdpextern const bfd_target z8kcoff_vec; 80933965Sjdp 81089857Sobrien/* These are always included. */ 81133965Sjdpextern const bfd_target srec_vec; 81233965Sjdpextern const bfd_target symbolsrec_vec; 81389857Sobrienextern const bfd_target tekhex_vec; 81433965Sjdpextern const bfd_target binary_vec; 81533965Sjdpextern const bfd_target ihex_vec; 81633965Sjdp 81733965Sjdp/* All of the xvecs for core files. */ 81833965Sjdpextern const bfd_target aix386_core_vec; 81960484Sobrienextern const bfd_target cisco_core_big_vec; 82060484Sobrienextern const bfd_target cisco_core_little_vec; 82189857Sobrienextern const bfd_target hppabsd_core_vec; 82233965Sjdpextern const bfd_target hpux_core_vec; 82333965Sjdpextern const bfd_target irix_core_vec; 82433965Sjdpextern const bfd_target netbsd_core_vec; 82533965Sjdpextern const bfd_target osf_core_vec; 82689857Sobrienextern const bfd_target ptrace_core_vec; 82760484Sobrienextern const bfd_target sco5_core_vec; 82833965Sjdpextern const bfd_target trad_core_vec; 82933965Sjdp 830130561Sobrienextern const bfd_target bfd_elf32_am33lin_vec; 831218822Sdimstatic const bfd_target * const _bfd_target_vector[] = 832218822Sdim{ 83333965Sjdp#ifdef SELECT_VECS 83433965Sjdp 83533965Sjdp SELECT_VECS, 83633965Sjdp 83733965Sjdp#else /* not SELECT_VECS */ 83833965Sjdp 83933965Sjdp#ifdef DEFAULT_VECTOR 84033965Sjdp &DEFAULT_VECTOR, 84133965Sjdp#endif 84233965Sjdp /* This list is alphabetized to make it easy to compare 84333965Sjdp with other vector lists -- the decls above and 84433965Sjdp the case statement in configure.in. 84533965Sjdp Vectors that don't compile on all systems, or aren't finished, 84633965Sjdp should have an entry here with #if 0 around it, to show that 84733965Sjdp it wasn't omitted by mistake. */ 84833965Sjdp &a_out_adobe_vec, 849104834Sobrien#ifdef BFD64 850104834Sobrien &aix5coff64_vec, 851104834Sobrien#endif 85289857Sobrien &aout0_big_vec, 85389857Sobrien#if 0 854130561Sobrien /* We have no way of distinguishing these from other a.out variants. */ 85589857Sobrien &aout_arm_big_vec, 85689857Sobrien &aout_arm_little_vec, 85789857Sobrien /* No one seems to use this. */ 85833965Sjdp &aout_mips_big_vec, 85933965Sjdp#endif 86033965Sjdp &aout_mips_little_vec, 86189857Sobrien#if 0 86289857Sobrien &apollocoff_vec, 86389857Sobrien#endif 86489857Sobrien &arm_epoc_pe_big_vec, 86589857Sobrien &arm_epoc_pe_little_vec, 86689857Sobrien &arm_epoc_pei_big_vec, 86789857Sobrien &arm_epoc_pei_little_vec, 868218822Sdim &arm_wince_pe_big_vec, 869218822Sdim &arm_wince_pe_little_vec, 870218822Sdim &arm_wince_pei_big_vec, 871218822Sdim &arm_wince_pei_little_vec, 87289857Sobrien &armcoff_big_vec, 87389857Sobrien &armcoff_little_vec, 87489857Sobrien &armnetbsd_vec, 87589857Sobrien &armpe_big_vec, 87689857Sobrien &armpe_little_vec, 87789857Sobrien &armpei_big_vec, 87889857Sobrien &armpei_little_vec, 87933965Sjdp &b_out_vec_big_host, 88033965Sjdp &b_out_vec_little_host, 88177298Sobrien &bfd_efi_app_ia32_vec, 882213274Srpaulo &bfd_efi_app_x86_64_vec, 88377298Sobrien#ifdef BFD64 884218822Sdim &bfd_efi_app_x86_64_vec, 88577298Sobrien &bfd_efi_app_ia64_vec, 88677298Sobrien#endif 88789857Sobrien &bfd_elf32_avr_vec, 888218822Sdim &bfd_elf32_bfin_vec, 889218822Sdim &bfd_elf32_bfinfdpic_vec, 89077298Sobrien 89133965Sjdp /* This, and other vectors, may not be used in any *.mt configuration. 89233965Sjdp But that does not mean they are unnecessary. If configured with 89333965Sjdp --enable-targets=all, objdump or gdb should be able to examine 89433965Sjdp the file even if we don't recognize the machine type. */ 89533965Sjdp &bfd_elf32_big_generic_vec, 89638889Sjdp &bfd_elf32_bigarc_vec, 89789857Sobrien &bfd_elf32_bigarm_vec, 898218822Sdim &bfd_elf32_bigarm_symbian_vec, 899218822Sdim &bfd_elf32_bigarm_vxworks_vec, 90033965Sjdp &bfd_elf32_bigmips_vec, 901218822Sdim &bfd_elf32_bigmips_vxworks_vec, 902218822Sdim &bfd_elf32_cr16_vec, 903218822Sdim &bfd_elf32_cr16c_vec, 90477298Sobrien &bfd_elf32_cris_vec, 905218822Sdim &bfd_elf32_crx_vec, 90633965Sjdp &bfd_elf32_d10v_vec, 90760484Sobrien &bfd_elf32_d30v_vec, 908104834Sobrien &bfd_elf32_dlx_big_vec, 90989857Sobrien &bfd_elf32_fr30_vec, 910104834Sobrien &bfd_elf32_frv_vec, 911130561Sobrien &bfd_elf32_frvfdpic_vec, 91289857Sobrien &bfd_elf32_h8300_vec, 91389857Sobrien &bfd_elf32_hppa_linux_vec, 914218822Sdim &bfd_elf32_hppa_nbsd_vec, 91533965Sjdp &bfd_elf32_hppa_vec, 91660484Sobrien &bfd_elf32_i370_vec, 917104834Sobrien &bfd_elf32_i386_freebsd_vec, 918218822Sdim &bfd_elf32_i386_vxworks_vec, 91933965Sjdp &bfd_elf32_i386_vec, 92089857Sobrien &bfd_elf32_i860_little_vec, 92133965Sjdp &bfd_elf32_i860_vec, 92260484Sobrien &bfd_elf32_i960_vec, 92389857Sobrien#if 0 92489857Sobrien &bfd_elf32_ia64_big_vec, 92589857Sobrien#endif 926218822Sdim#ifdef BFD64 92789857Sobrien &bfd_elf32_ia64_hpux_big_vec, 928218822Sdim#endif 929130561Sobrien &bfd_elf32_ip2k_vec, 930130561Sobrien &bfd_elf32_iq2000_vec, 93133965Sjdp &bfd_elf32_little_generic_vec, 93238889Sjdp &bfd_elf32_littlearc_vec, 93389857Sobrien &bfd_elf32_littlearm_vec, 934218822Sdim &bfd_elf32_littlearm_symbian_vec, 935218822Sdim &bfd_elf32_littlearm_vxworks_vec, 93633965Sjdp &bfd_elf32_littlemips_vec, 937218822Sdim &bfd_elf32_littlemips_vxworks_vec, 938218822Sdim &bfd_elf32_m32c_vec, 93933965Sjdp &bfd_elf32_m32r_vec, 940130561Sobrien &bfd_elf32_m32rle_vec, 941130561Sobrien &bfd_elf32_m32rlin_vec, 942130561Sobrien &bfd_elf32_m32rlelin_vec, 94377298Sobrien &bfd_elf32_m68hc11_vec, 94477298Sobrien &bfd_elf32_m68hc12_vec, 94533965Sjdp &bfd_elf32_m68k_vec, 94633965Sjdp &bfd_elf32_m88k_vec, 94789857Sobrien &bfd_elf32_mcore_big_vec, 94889857Sobrien &bfd_elf32_mcore_little_vec, 949218822Sdim &bfd_elf32_mep_vec, 95089857Sobrien &bfd_elf32_mn10200_vec, 95189857Sobrien &bfd_elf32_mn10300_vec, 952218822Sdim &bfd_elf32_mt_vec, 953130561Sobrien &bfd_elf32_msp430_vec, 954130561Sobrien#ifdef BFD64 955130561Sobrien &bfd_elf32_nbigmips_vec, 956130561Sobrien &bfd_elf32_nlittlemips_vec, 957130561Sobrien &bfd_elf32_ntradbigmips_vec, 958130561Sobrien &bfd_elf32_ntradlittlemips_vec, 959130561Sobrien#endif 96089857Sobrien &bfd_elf32_openrisc_vec, 96191041Sobrien &bfd_elf32_or32_big_vec, 96260484Sobrien &bfd_elf32_pj_vec, 96360484Sobrien &bfd_elf32_pjl_vec, 96433965Sjdp &bfd_elf32_powerpc_vec, 965218822Sdim &bfd_elf32_powerpc_vxworks_vec, 96638889Sjdp &bfd_elf32_powerpcle_vec, 96789857Sobrien &bfd_elf32_s390_vec, 968218822Sdim &bfd_elf32_bigscore_vec, 969218822Sdim &bfd_elf32_littlescore_vec, 97089857Sobrien &bfd_elf32_sh_vec, 97189857Sobrien &bfd_elf32_shblin_vec, 97289857Sobrien &bfd_elf32_shl_vec, 973218822Sdim &bfd_elf32_shl_symbian_vec, 97489857Sobrien &bfd_elf32_shlin_vec, 97589857Sobrien &bfd_elf32_shlnbsd_vec, 976218822Sdim &bfd_elf32_shlvxworks_vec, 97789857Sobrien &bfd_elf32_shnbsd_vec, 978218822Sdim &bfd_elf32_shvxworks_vec, 979104834Sobrien#ifdef BFD64 980104834Sobrien &bfd_elf32_sh64_vec, 981104834Sobrien &bfd_elf32_sh64l_vec, 982104834Sobrien &bfd_elf32_sh64lnbsd_vec, 983104834Sobrien &bfd_elf32_sh64nbsd_vec, 984130561Sobrien &bfd_elf32_sh64lin_vec, 985130561Sobrien &bfd_elf32_sh64blin_vec, 986104834Sobrien#endif 98778828Sobrien &bfd_elf32_sparc_vec, 988218822Sdim &bfd_elf32_sparc_vxworks_vec, 989218822Sdim &bfd_elf32_spu_vec, 99077298Sobrien &bfd_elf32_tradbigmips_vec, 99177298Sobrien &bfd_elf32_tradlittlemips_vec, 99289857Sobrien &bfd_elf32_us_cris_vec, 99389857Sobrien &bfd_elf32_v850_vec, 994104834Sobrien &bfd_elf32_vax_vec, 995218822Sdim &bfd_elf32_xc16x_vec, 99689857Sobrien &bfd_elf32_xstormy16_vec, 997130561Sobrien &bfd_elf32_xtensa_be_vec, 998130561Sobrien &bfd_elf32_xtensa_le_vec, 99978828Sobrien#ifdef BFD64 1000104834Sobrien &bfd_elf64_alpha_freebsd_vec, 100189857Sobrien &bfd_elf64_alpha_vec, 100233965Sjdp &bfd_elf64_big_generic_vec, 100389857Sobrien &bfd_elf64_bigmips_vec, 100489857Sobrien &bfd_elf64_hppa_linux_vec, 100589857Sobrien &bfd_elf64_hppa_vec, 100689857Sobrien &bfd_elf64_ia64_big_vec, 100789857Sobrien &bfd_elf64_ia64_hpux_big_vec, 100889857Sobrien &bfd_elf64_ia64_little_vec, 100933965Sjdp &bfd_elf64_little_generic_vec, 101089857Sobrien &bfd_elf64_littlemips_vec, 101189857Sobrien &bfd_elf64_mmix_vec, 101289857Sobrien &bfd_elf64_powerpc_vec, 101389857Sobrien &bfd_elf64_powerpcle_vec, 101489857Sobrien &bfd_elf64_s390_vec, 1015104834Sobrien &bfd_elf64_sh64_vec, 1016104834Sobrien &bfd_elf64_sh64l_vec, 1017104834Sobrien &bfd_elf64_sh64lnbsd_vec, 1018104834Sobrien &bfd_elf64_sh64nbsd_vec, 1019130561Sobrien &bfd_elf64_sh64lin_vec, 1020130561Sobrien &bfd_elf64_sh64blin_vec, 102133965Sjdp &bfd_elf64_sparc_vec, 1022218822Sdim &bfd_elf64_sparc_freebsd_vec, 102389857Sobrien &bfd_elf64_tradbigmips_vec, 102489857Sobrien &bfd_elf64_tradlittlemips_vec, 1025218822Sdim &bfd_elf64_x86_64_freebsd_vec, 102689857Sobrien &bfd_elf64_x86_64_vec, 1027218822Sdim &bfd_mmo_vec, 102889857Sobrien#endif 102989857Sobrien &bfd_powerpc_pe_vec, 103089857Sobrien &bfd_powerpc_pei_vec, 103189857Sobrien &bfd_powerpcle_pe_vec, 103289857Sobrien &bfd_powerpcle_pei_vec, 103389857Sobrien &cris_aout_vec, 103433965Sjdp#ifdef BFD64 1035130561Sobrien &demo_64_vec, /* Only compiled if host has long-long support. */ 103633965Sjdp#endif 103733965Sjdp &ecoff_big_vec, 103889857Sobrien &ecoff_biglittle_vec, 103933965Sjdp &ecoff_little_vec, 104033965Sjdp#ifdef BFD64 104133965Sjdp &ecoffalpha_little_vec, 104233965Sjdp#endif 104389857Sobrien &go32coff_vec, 104489857Sobrien &go32stubbedcoff_vec, 104533965Sjdp &h8300coff_vec, 104633965Sjdp &h8500coff_vec, 104733965Sjdp#if 0 104833965Sjdp /* Since a.out files lack decent magic numbers, no way to recognize 104933965Sjdp which kind of a.out file it is. */ 105033965Sjdp &host_aout_vec, 105189857Sobrien /* Clashes with sunos_big_vec magic no. */ 105233965Sjdp &hp300bsd_vec, 105333965Sjdp#endif 105433965Sjdp &hp300hpux_vec, 105533965Sjdp &i386aout_vec, 105633965Sjdp &i386bsd_vec, 105733965Sjdp &i386coff_vec, 105889857Sobrien#if 0 105989857Sobrien &i386dynix_vec, 106089857Sobrien#endif 106133965Sjdp &i386freebsd_vec, 106233965Sjdp#if 0 106333965Sjdp /* Since a.out files lack decent magic numbers, no way to recognize 106433965Sjdp which kind of a.out file it is. */ 106533965Sjdp &i386linux_vec, 106633965Sjdp#endif 106733965Sjdp &i386lynx_aout_vec, 106833965Sjdp &i386lynx_coff_vec, 106933965Sjdp#if 0 107033965Sjdp /* No distinguishing features for Mach 3 executables. */ 107133965Sjdp &i386mach3_vec, 107233965Sjdp#endif 107333965Sjdp &i386msdos_vec, 107433965Sjdp &i386netbsd_vec, 107533965Sjdp &i386os9k_vec, 107633965Sjdp &i386pe_vec, 107733965Sjdp &i386pei_vec, 1078218822Sdim#ifdef BFD64 1079218822Sdim &x86_64coff_vec, 1080218822Sdim &x86_64pe_vec, 1081218822Sdim &x86_64pei_vec, 1082218822Sdim#endif 108389857Sobrien &i860coff_vec, 108433965Sjdp &icoff_big_vec, 108533965Sjdp &icoff_little_vec, 108633965Sjdp &ieee_vec, 108789857Sobrien#if 0 108889857Sobrien &m68k4knetbsd_vec, 108989857Sobrien &m68kaux_coff_vec, 109089857Sobrien#endif 109133965Sjdp &m68kcoff_vec, 109233965Sjdp &m68kcoffun_vec, 109333965Sjdp#if 0 109433965Sjdp /* Since a.out files lack decent magic numbers, no way to recognize 109533965Sjdp which kind of a.out file it is. */ 109633965Sjdp &m68klinux_vec, 109733965Sjdp#endif 109833965Sjdp &m68knetbsd_vec, 109933965Sjdp &m68ksysvcoff_vec, 110033965Sjdp &m88kbcs_vec, 110133965Sjdp &m88kmach3_vec, 1102218822Sdim &m88kopenbsd_vec, 1103130561Sobrien &mach_o_be_vec, 1104130561Sobrien &mach_o_le_vec, 1105130561Sobrien &mach_o_fat_vec, 1106218822Sdim &maxqcoff_vec, 110760484Sobrien &mcore_pe_big_vec, 110860484Sobrien &mcore_pe_little_vec, 110960484Sobrien &mcore_pei_big_vec, 111060484Sobrien &mcore_pei_little_vec, 111189857Sobrien &mipslpe_vec, 111289857Sobrien &mipslpei_vec, 111333965Sjdp &newsos3_vec, 111433965Sjdp#ifdef BFD64 111533965Sjdp &nlm32_alpha_vec, 111633965Sjdp#endif 111789857Sobrien &nlm32_i386_vec, 111889857Sobrien &nlm32_powerpc_vec, 111989857Sobrien &nlm32_sparc_vec, 112033965Sjdp#if 0 112133965Sjdp /* We have no oasys tools anymore, so we can't test any of this 112233965Sjdp anymore. If you want to test the stuff yourself, go ahead... 112333965Sjdp steve@cygnus.com 112433965Sjdp Worse, since there is no magic number for archives, there 112533965Sjdp can be annoying target mis-matches. */ 112633965Sjdp &oasys_vec, 112733965Sjdp#endif 112891041Sobrien /* Entry for the OpenRISC family. */ 112991041Sobrien &or32coff_big_vec, 113091041Sobrien 113133965Sjdp &pc532machaout_vec, 113289857Sobrien &pc532netbsd_vec, 113389857Sobrien &pdp11_aout_vec, 1134130561Sobrien &pef_vec, 1135130561Sobrien &pef_xlib_vec, 113633965Sjdp#if 0 113789857Sobrien /* This has the same magic number as RS/6000. */ 113889857Sobrien &pmac_xcoff_vec, 113989857Sobrien#endif 114089857Sobrien &ppcboot_vec, 114189857Sobrien#if 0 1142130561Sobrien /* We have no way of distinguishing these from other a.out variants. */ 114333965Sjdp &riscix_vec, 114433965Sjdp#endif 114577298Sobrien#ifdef BFD64 114677298Sobrien &rs6000coff64_vec, 114777298Sobrien#endif 114889857Sobrien &rs6000coff_vec, 114989857Sobrien &shcoff_small_vec, 115033965Sjdp &shcoff_vec, 115189857Sobrien &shlcoff_small_vec, 115233965Sjdp &shlcoff_vec, 115389857Sobrien &shlpe_vec, 115489857Sobrien &shlpei_vec, 115589857Sobrien#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) 115689857Sobrien &som_vec, 115789857Sobrien#endif 115889857Sobrien &sparccoff_vec, 115933965Sjdp &sparcle_aout_vec, 116033965Sjdp &sparclinux_vec, 116133965Sjdp &sparclynx_aout_vec, 116233965Sjdp &sparclynx_coff_vec, 116333965Sjdp &sparcnetbsd_vec, 116433965Sjdp &sunos_big_vec, 1165130561Sobrien &sym_vec, 116638889Sjdp &tic30_aout_vec, 116738889Sjdp &tic30_coff_vec, 116889857Sobrien &tic54x_coff0_beh_vec, 116977298Sobrien &tic54x_coff0_vec, 117089857Sobrien &tic54x_coff1_beh_vec, 117177298Sobrien &tic54x_coff1_vec, 117289857Sobrien &tic54x_coff2_beh_vec, 117377298Sobrien &tic54x_coff2_vec, 117460484Sobrien &tic80coff_vec, 1175104834Sobrien &vaxbsd_vec, 117638889Sjdp &vaxnetbsd_vec, 1177104834Sobrien &vax1knetbsd_vec, 117838889Sjdp &versados_vec, 117960484Sobrien#ifdef BFD64 118060484Sobrien &vms_alpha_vec, 118160484Sobrien#endif 118260484Sobrien &vms_vax_vec, 118389857Sobrien &w65_vec, 118433965Sjdp &we32kcoff_vec, 1185218822Sdim &z80coff_vec, 118633965Sjdp &z8kcoff_vec, 1187130561Sobrien &bfd_elf32_am33lin_vec, 118833965Sjdp#endif /* not SELECT_VECS */ 118933965Sjdp 119033965Sjdp/* Always support S-records, for convenience. */ 119133965Sjdp &srec_vec, 119233965Sjdp &symbolsrec_vec, 119333965Sjdp/* And tekhex */ 119433965Sjdp &tekhex_vec, 119533965Sjdp/* Likewise for binary output. */ 119633965Sjdp &binary_vec, 119733965Sjdp/* Likewise for ihex. */ 119833965Sjdp &ihex_vec, 119933965Sjdp 120033965Sjdp/* Add any required traditional-core-file-handler. */ 120133965Sjdp 120233965Sjdp#ifdef AIX386_CORE 120333965Sjdp &aix386_core_vec, 120433965Sjdp#endif 120589857Sobrien#if 0 120689857Sobrien /* We don't include cisco_core_*_vec. Although it has a magic number, 120789857Sobrien the magic number isn't at the beginning of the file, and thus 120889857Sobrien might spuriously match other kinds of files. */ 120989857Sobrien &cisco_core_big_vec, 121089857Sobrien &cisco_core_little_vec, 121133965Sjdp#endif 121233965Sjdp#ifdef HPPABSD_CORE 121333965Sjdp &hppabsd_core_vec, 121433965Sjdp#endif 121589857Sobrien#ifdef HPUX_CORE 121689857Sobrien &hpux_core_vec, 121789857Sobrien#endif 121833965Sjdp#ifdef IRIX_CORE 121933965Sjdp &irix_core_vec, 122033965Sjdp#endif 122138889Sjdp#ifdef NETBSD_CORE 122238889Sjdp &netbsd_core_vec, 122338889Sjdp#endif 122433965Sjdp#ifdef OSF_CORE 122533965Sjdp &osf_core_vec, 122633965Sjdp#endif 122789857Sobrien#ifdef PTRACE_CORE 122889857Sobrien &ptrace_core_vec, 122989857Sobrien#endif 123060484Sobrien#ifdef SCO5_CORE 123160484Sobrien &sco5_core_vec, 123260484Sobrien#endif 123389857Sobrien#ifdef TRAD_CORE 123433965Sjdp &trad_core_vec, 123533965Sjdp#endif 123633965Sjdp 123733965Sjdp NULL /* end of list marker */ 123833965Sjdp}; 123978828Sobrienconst bfd_target * const *bfd_target_vector = _bfd_target_vector; 124033965Sjdp 124133965Sjdp/* bfd_default_vector[0] contains either the address of the default vector, 124233965Sjdp if there is one, or zero if there isn't. */ 124333965Sjdp 124433965Sjdpconst bfd_target *bfd_default_vector[] = { 124533965Sjdp#ifdef DEFAULT_VECTOR 124633965Sjdp &DEFAULT_VECTOR, 124733965Sjdp#endif 124833965Sjdp NULL 124933965Sjdp}; 125033965Sjdp 1251130561Sobrien/* bfd_associated_vector[] contains the associated target vectors used 1252130561Sobrien to reduce the ambiguity in bfd_check_format_matches. */ 1253130561Sobrien 1254130561Sobrienstatic const bfd_target *_bfd_associated_vector[] = { 1255130561Sobrien#ifdef ASSOCIATED_VECS 1256130561Sobrien ASSOCIATED_VECS, 1257130561Sobrien#endif 1258130561Sobrien NULL 1259130561Sobrien}; 1260130561Sobrienconst bfd_target * const *bfd_associated_vector = _bfd_associated_vector; 1261130561Sobrien 126233965Sjdp/* When there is an ambiguous match, bfd_check_format_matches puts the 126333965Sjdp names of the matching targets in an array. This variable is the maximum 126433965Sjdp number of entries that the array could possibly need. */ 126578828Sobrienconst size_t _bfd_target_vector_entries = sizeof (_bfd_target_vector)/sizeof (*_bfd_target_vector); 126633965Sjdp 126733965Sjdp/* This array maps configuration triplets onto BFD vectors. */ 126833965Sjdp 126933965Sjdpstruct targmatch 127033965Sjdp{ 127133965Sjdp /* The configuration triplet. */ 127233965Sjdp const char *triplet; 127333965Sjdp /* The BFD vector. If this is NULL, then the vector is found by 127433965Sjdp searching forward for the next structure with a non NULL vector 127533965Sjdp field. */ 127633965Sjdp const bfd_target *vector; 127733965Sjdp}; 127833965Sjdp 127933965Sjdp/* targmatch.h is built by Makefile out of config.bfd. */ 128033965Sjdpstatic const struct targmatch bfd_target_match[] = { 128133965Sjdp#include "targmatch.h" 128233965Sjdp { NULL, NULL } 128333965Sjdp}; 128433965Sjdp 128533965Sjdp/* Find a target vector, given a name or configuration triplet. */ 128633965Sjdp 128733965Sjdpstatic const bfd_target * 1288130561Sobrienfind_target (const char *name) 128933965Sjdp{ 129033965Sjdp const bfd_target * const *target; 129133965Sjdp const struct targmatch *match; 129233965Sjdp 129333965Sjdp for (target = &bfd_target_vector[0]; *target != NULL; target++) 129433965Sjdp if (strcmp (name, (*target)->name) == 0) 129533965Sjdp return *target; 129633965Sjdp 129733965Sjdp /* If we couldn't match on the exact name, try matching on the 129833965Sjdp configuration triplet. FIXME: We should run the triplet through 129933965Sjdp config.sub first, but that is hard. */ 130033965Sjdp for (match = &bfd_target_match[0]; match->triplet != NULL; match++) 130133965Sjdp { 130233965Sjdp if (fnmatch (match->triplet, name, 0) == 0) 130333965Sjdp { 130433965Sjdp while (match->vector == NULL) 130533965Sjdp ++match; 130633965Sjdp return match->vector; 130733965Sjdp } 130833965Sjdp } 130933965Sjdp 131033965Sjdp bfd_set_error (bfd_error_invalid_target); 131133965Sjdp return NULL; 131233965Sjdp} 131333965Sjdp 131433965Sjdp/* 131533965SjdpFUNCTION 131633965Sjdp bfd_set_default_target 131733965Sjdp 131833965SjdpSYNOPSIS 1319130561Sobrien bfd_boolean bfd_set_default_target (const char *name); 132033965Sjdp 132133965SjdpDESCRIPTION 132233965Sjdp Set the default target vector to use when recognizing a BFD. 132333965Sjdp This takes the name of the target, which may be a BFD target 132433965Sjdp name or a configuration triplet. 132533965Sjdp*/ 132633965Sjdp 1327130561Sobrienbfd_boolean 1328130561Sobrienbfd_set_default_target (const char *name) 132933965Sjdp{ 133033965Sjdp const bfd_target *target; 133133965Sjdp 133233965Sjdp if (bfd_default_vector[0] != NULL 133333965Sjdp && strcmp (name, bfd_default_vector[0]->name) == 0) 1334130561Sobrien return TRUE; 133533965Sjdp 133633965Sjdp target = find_target (name); 133733965Sjdp if (target == NULL) 1338130561Sobrien return FALSE; 133933965Sjdp 134033965Sjdp bfd_default_vector[0] = target; 1341130561Sobrien return TRUE; 134233965Sjdp} 134333965Sjdp 134433965Sjdp/* 134533965SjdpFUNCTION 134633965Sjdp bfd_find_target 134733965Sjdp 134833965SjdpSYNOPSIS 1349130561Sobrien const bfd_target *bfd_find_target (const char *target_name, bfd *abfd); 135033965Sjdp 135133965SjdpDESCRIPTION 135233965Sjdp Return a pointer to the transfer vector for the object target 1353218822Sdim named @var{target_name}. If @var{target_name} is <<NULL>>, 1354218822Sdim choose the one in the environment variable <<GNUTARGET>>; if 1355218822Sdim that is null or not defined, then choose the first entry in the 1356218822Sdim target list. Passing in the string "default" or setting the 1357218822Sdim environment variable to "default" will cause the first entry in 1358218822Sdim the target list to be returned, and "target_defaulted" will be 1359218822Sdim set in the BFD if @var{abfd} isn't <<NULL>>. This causes 1360218822Sdim <<bfd_check_format>> to loop over all the targets to find the 1361218822Sdim one that matches the file being read. 136233965Sjdp*/ 136333965Sjdp 136433965Sjdpconst bfd_target * 1365130561Sobrienbfd_find_target (const char *target_name, bfd *abfd) 136633965Sjdp{ 136733965Sjdp const char *targname; 136833965Sjdp const bfd_target *target; 136933965Sjdp 137033965Sjdp if (target_name != NULL) 137133965Sjdp targname = target_name; 137233965Sjdp else 137333965Sjdp targname = getenv ("GNUTARGET"); 137433965Sjdp 1375130561Sobrien /* This is safe; the vector cannot be null. */ 137633965Sjdp if (targname == NULL || strcmp (targname, "default") == 0) 137733965Sjdp { 137833965Sjdp if (bfd_default_vector[0] != NULL) 1379218822Sdim target = bfd_default_vector[0]; 138033965Sjdp else 1381218822Sdim target = bfd_target_vector[0]; 1382218822Sdim if (abfd) 1383218822Sdim { 1384218822Sdim abfd->xvec = target; 1385218822Sdim abfd->target_defaulted = TRUE; 1386218822Sdim } 1387218822Sdim return target; 138833965Sjdp } 138933965Sjdp 1390218822Sdim if (abfd) 1391218822Sdim abfd->target_defaulted = FALSE; 139233965Sjdp 139333965Sjdp target = find_target (targname); 139433965Sjdp if (target == NULL) 139533965Sjdp return NULL; 139633965Sjdp 1397218822Sdim if (abfd) 1398218822Sdim abfd->xvec = target; 139933965Sjdp return target; 140033965Sjdp} 140133965Sjdp 140233965Sjdp/* 140333965SjdpFUNCTION 140433965Sjdp bfd_target_list 140533965Sjdp 140633965SjdpSYNOPSIS 1407130561Sobrien const char ** bfd_target_list (void); 140833965Sjdp 140933965SjdpDESCRIPTION 141033965Sjdp Return a freshly malloced NULL-terminated 141133965Sjdp vector of the names of all the valid BFD targets. Do not 141233965Sjdp modify the names. 141333965Sjdp 141433965Sjdp*/ 141533965Sjdp 141633965Sjdpconst char ** 1417130561Sobrienbfd_target_list (void) 141833965Sjdp{ 1419130561Sobrien int vec_length = 0; 142089857Sobrien bfd_size_type amt; 142133965Sjdp#if defined (HOST_HPPAHPUX) && ! defined (__STDC__) 142233965Sjdp /* The native compiler on the HP9000/700 has a bug which causes it 142333965Sjdp to loop endlessly when compiling this file. This avoids it. */ 142433965Sjdp volatile 142533965Sjdp#endif 142689857Sobrien const bfd_target * const *target; 142789857Sobrien const char **name_list, **name_ptr; 142833965Sjdp 142933965Sjdp for (target = &bfd_target_vector[0]; *target != NULL; target++) 143033965Sjdp vec_length++; 143133965Sjdp 143289857Sobrien amt = (vec_length + 1) * sizeof (char **); 1433130561Sobrien name_ptr = name_list = bfd_malloc (amt); 143433965Sjdp 143533965Sjdp if (name_list == NULL) 143633965Sjdp return NULL; 143733965Sjdp 143833965Sjdp for (target = &bfd_target_vector[0]; *target != NULL; target++) 1439107492Sobrien if (target == &bfd_target_vector[0] 1440107492Sobrien || *target != bfd_target_vector[0]) 1441107492Sobrien *name_ptr++ = (*target)->name; 144233965Sjdp 1443130561Sobrien *name_ptr = NULL; 144433965Sjdp return name_list; 144533965Sjdp} 144660484Sobrien 144760484Sobrien/* 144860484SobrienFUNCTION 144960484Sobrien bfd_seach_for_target 145060484Sobrien 145160484SobrienSYNOPSIS 1452130561Sobrien const bfd_target *bfd_search_for_target 1453130561Sobrien (int (*search_func) (const bfd_target *, void *), 1454130561Sobrien void *); 145560484Sobrien 145660484SobrienDESCRIPTION 145760484Sobrien Return a pointer to the first transfer vector in the list of 145860484Sobrien transfer vectors maintained by BFD that produces a non-zero 145960484Sobrien result when passed to the function @var{search_func}. The 146060484Sobrien parameter @var{data} is passed, unexamined, to the search 146160484Sobrien function. 146260484Sobrien*/ 146360484Sobrien 146460484Sobrienconst bfd_target * 1465130561Sobrienbfd_search_for_target (int (*search_func) (const bfd_target *, void *), 1466130561Sobrien void *data) 146760484Sobrien{ 1468130561Sobrien const bfd_target * const *target; 146960484Sobrien 1470130561Sobrien for (target = bfd_target_vector; *target != NULL; target ++) 1471130561Sobrien if (search_func (*target, data)) 1472130561Sobrien return *target; 147360484Sobrien 147460484Sobrien return NULL; 147560484Sobrien} 1476