/* Generic target-file-type support for the BFD library.
- Copyright (C) 1990-2018 Free Software Foundation, Inc.
+ Copyright (C) 1990-2020 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
.{* Forward declaration. *}
.typedef struct flag_info flag_info;
.
+.typedef void (*bfd_cleanup) (bfd *);
+.
.typedef struct bfd_target
.{
. {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. *}
-. char *name;
+. const char *name;
.
. {* The "flavour" of a back end is a general indication about
. the contents of a file. *}
. {* Format dependent routines: these are vectors of entry points
. within the target vector structure, one for each format to check. *}
.
-. {* Check the format of a file being read. Return a <<bfd_target *>> or zero. *}
-. const struct bfd_target *
-. (*_bfd_check_format[bfd_type_end]) (bfd *);
+. {* Check the format of a file being read. Return a <<bfd_cleanup>> on
+. success or zero on failure. *}
+. bfd_cleanup (*_bfd_check_format[bfd_type_end]) (bfd *);
.
. {* Set the format of a file being written. *}
. bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
.#define bfd_get_symbol_info(b,p,e) \
. BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
. const char *(*_bfd_get_symbol_version_string) (bfd *, struct bfd_symbol *,
+. bfd_boolean,
. bfd_boolean *);
-.#define bfd_get_symbol_version_string(b,s,h) \
-. BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h))
+.#define bfd_get_symbol_version_string(b,s,p,h) \
+. BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,p,h))
. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
. alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
. NAME##_bfd_lookup_section_flags, \
. NAME##_bfd_merge_sections, \
. NAME##_bfd_is_group_section, \
+. NAME##_bfd_group_name, \
. NAME##_bfd_discard_group, \
. NAME##_section_already_linked, \
. NAME##_bfd_define_common_symbol, \
+. NAME##_bfd_link_hide_symbol, \
. NAME##_bfd_define_start_stop
.
. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
. {* Is this section a member of a group? *}
. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
.
+. {* The group name, if section is a member of a group. *}
+. const char *(*_bfd_group_name) (bfd *, const struct bfd_section *);
+.
. {* Discard members of a group. *}
. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
.
. bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
. struct bfd_link_hash_entry *);
.
+. {* Hide a symbol. *}
+. void (*_bfd_link_hide_symbol) (bfd *, struct bfd_link_info *,
+. struct bfd_link_hash_entry *);
+.
. {* Define a __start, __stop, .startof. or .sizeof. symbol. *}
. struct bfd_link_hash_entry *
. (*_bfd_define_start_stop) (struct bfd_link_info *, const char *,
.
.} bfd_target;
.
+.static inline const char *
+.bfd_get_target (const bfd *abfd)
+.{
+. return abfd->xvec->name;
+.}
+.
+.static inline enum bfd_flavour
+.bfd_get_flavour (const bfd *abfd)
+.{
+. return abfd->xvec->flavour;
+.}
+.
+.static inline flagword
+.bfd_applicable_file_flags (const bfd *abfd)
+.{
+. return abfd->xvec->object_flags;
+.}
+.
+.static inline bfd_boolean
+.bfd_family_coff (const bfd *abfd)
+.{
+. return (bfd_get_flavour (abfd) == bfd_target_coff_flavour
+. || bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
+.}
+.
+.static inline bfd_boolean
+.bfd_big_endian (const bfd *abfd)
+.{
+. return abfd->xvec->byteorder == BFD_ENDIAN_BIG;
+.}
+.static inline bfd_boolean
+.bfd_little_endian (const bfd *abfd)
+.{
+. return abfd->xvec->byteorder == BFD_ENDIAN_LITTLE;
+.}
+.
+.static inline bfd_boolean
+.bfd_header_big_endian (const bfd *abfd)
+.{
+. return abfd->xvec->header_byteorder == BFD_ENDIAN_BIG;
+.}
+.
+.static inline bfd_boolean
+.bfd_header_little_endian (const bfd *abfd)
+.{
+. return abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE;
+.}
+.
+.static inline flagword
+.bfd_applicable_section_flags (const bfd *abfd)
+.{
+. return abfd->xvec->section_flags;
+.}
+.
+.static inline char
+.bfd_get_symbol_leading_char (const bfd *abfd)
+.{
+. return abfd->xvec->symbol_leading_char;
+.}
+.
+.static inline enum bfd_flavour
+.bfd_asymbol_flavour (const asymbol *sy)
+.{
+. if ((sy->flags & BSF_SYNTHETIC) != 0)
+. return bfd_target_unknown_flavour;
+. return sy->the_bfd->xvec->flavour;
+.}
+.
*/
/* All known xvecs (even those that don't compile on all systems).
extern const bfd_target aout_vec;
extern const bfd_target arc_elf32_be_vec;
extern const bfd_target arc_elf32_le_vec;
-extern const bfd_target arm_aout_be_vec;
-extern const bfd_target arm_aout_le_vec;
-extern const bfd_target arm_aout_nbsd_vec;
-extern const bfd_target arm_aout_riscix_vec;
-extern const bfd_target arm_coff_be_vec;
-extern const bfd_target arm_coff_le_vec;
extern const bfd_target arm_elf32_be_vec;
extern const bfd_target arm_elf32_le_vec;
+extern const bfd_target arm_elf32_fdpic_be_vec;
+extern const bfd_target arm_elf32_fdpic_le_vec;
extern const bfd_target arm_elf32_nacl_be_vec;
extern const bfd_target arm_elf32_nacl_le_vec;
extern const bfd_target arm_elf32_symbian_be_vec;
extern const bfd_target bfin_elf32_vec;
extern const bfd_target bfin_elf32_fdpic_vec;
extern const bfd_target cr16_elf32_vec;
-extern const bfd_target cr16c_elf32_vec;
extern const bfd_target cris_aout_vec;
extern const bfd_target cris_elf32_vec;
extern const bfd_target cris_elf32_us_vec;
extern const bfd_target crx_elf32_vec;
+extern const bfd_target csky_elf32_be_vec;
+extern const bfd_target csky_elf32_le_vec;
extern const bfd_target d10v_elf32_vec;
extern const bfd_target d30v_elf32_vec;
extern const bfd_target dlx_elf32_be_vec;
extern const bfd_target elf32_le_vec;
extern const bfd_target elf64_be_vec;
extern const bfd_target elf64_le_vec;
+extern const bfd_target bpf_elf64_le_vec;
+extern const bfd_target bpf_elf64_be_vec;
extern const bfd_target epiphany_elf32_vec;
extern const bfd_target fr30_elf32_vec;
extern const bfd_target frv_elf32_vec;
extern const bfd_target m68hc11_elf32_vec;
extern const bfd_target m68hc12_elf32_vec;
extern const bfd_target m68k_elf32_vec;
+extern const bfd_target s12z_elf32_vec;
extern const bfd_target mach_o_be_vec;
extern const bfd_target mach_o_le_vec;
extern const bfd_target mach_o_fat_vec;
extern const bfd_target metag_elf32_vec;
extern const bfd_target microblaze_elf32_vec;
extern const bfd_target microblaze_elf32_le_vec;
+extern const bfd_target mips_ecoff_be_vec;
+extern const bfd_target mips_ecoff_le_vec;
+extern const bfd_target mips_ecoff_bele_vec;
extern const bfd_target mips_elf32_be_vec;
extern const bfd_target mips_elf32_le_vec;
extern const bfd_target mips_elf32_n_be_vec;
extern const bfd_target nds32_elf32_le_vec;
extern const bfd_target nds32_elf32_linux_be_vec;
extern const bfd_target nds32_elf32_linux_le_vec;
+extern const bfd_target nfp_elf64_vec;
extern const bfd_target nios2_elf32_be_vec;
extern const bfd_target nios2_elf32_le_vec;
extern const bfd_target ns32k_aout_pc532mach_vec;
extern const bfd_target rx_elf32_be_vec;
extern const bfd_target rx_elf32_be_ns_vec;
extern const bfd_target rx_elf32_le_vec;
+extern const bfd_target rx_elf32_linux_le_vec;
extern const bfd_target s390_elf32_vec;
extern const bfd_target s390_elf64_vec;
extern const bfd_target score_elf32_be_vec;
extern const bfd_target tic6x_elf32_c6000_le_vec;
extern const bfd_target tic6x_elf32_linux_be_vec;
extern const bfd_target tic6x_elf32_linux_le_vec;
-extern const bfd_target tic80_coff_vec;
extern const bfd_target tilegx_elf32_be_vec;
extern const bfd_target tilegx_elf32_le_vec;
extern const bfd_target tilegx_elf64_be_vec;
extern const bfd_target xtensa_elf32_be_vec;
extern const bfd_target xtensa_elf32_le_vec;
extern const bfd_target z80_coff_vec;
+extern const bfd_target z80_elf32_vec;
extern const bfd_target z8k_coff_vec;
/* These are always included. */
&arc_elf32_be_vec,
&arc_elf32_le_vec,
-#if 0
- /* We have no way of distinguishing these from other a.out variants. */
- &arm_aout_be_vec,
- &arm_aout_le_vec,
-#endif
- &arm_aout_nbsd_vec,
-#if 0
- /* We have no way of distinguishing these from other a.out variants. */
- &arm_aout_riscix_vec,
-#endif
- &arm_coff_be_vec,
- &arm_coff_le_vec,
&arm_elf32_be_vec,
&arm_elf32_le_vec,
+ &arm_elf32_fdpic_be_vec,
+ &arm_elf32_fdpic_le_vec,
&arm_elf32_symbian_be_vec,
&arm_elf32_symbian_le_vec,
&arm_elf32_vxworks_be_vec,
&bfin_elf32_fdpic_vec,
&cr16_elf32_vec,
- &cr16c_elf32_vec,
&cris_aout_vec,
&cris_elf32_vec,
&crx_elf32_vec,
+ &csky_elf32_be_vec,
+ &csky_elf32_le_vec,
+
&d10v_elf32_vec,
&d30v_elf32_vec,
&iamcu_elf32_vec,
+#ifdef BFD64
+ &bpf_elf64_be_vec,
+ &bpf_elf64_le_vec,
+#endif
+
#ifdef BFD64
#if 0
&ia64_elf32_be_vec,
&m68k_elf32_vec,
+ &s12z_elf32_vec,
+
&mach_o_be_vec,
&mach_o_le_vec,
&mach_o_fat_vec,
µblaze_elf32_vec,
+ &mips_ecoff_be_vec,
+ &mips_ecoff_le_vec,
+ &mips_ecoff_bele_vec,
#ifdef BFD64
&mips_elf32_be_vec,
&mips_elf32_le_vec,
&nds32_elf32_linux_be_vec,
&nds32_elf32_linux_le_vec,
+#ifdef BFD64
+ &nfp_elf64_vec,
+#endif
+
&nios2_elf32_be_vec,
&nios2_elf32_le_vec,
&pj_elf32_vec,
&pj_elf32_le_vec,
-#if BFD_SUPPORTS_PLUGINS
- &plugin_vec,
-#endif
-
&powerpc_boot_vec,
&powerpc_elf32_vec,
&powerpc_elf32_le_vec,
&tic54x_coff2_vec,
&tic6x_elf32_be_vec,
&tic6x_elf32_le_vec,
- &tic80_coff_vec,
&tilegx_elf32_be_vec,
&tilegx_elf32_le_vec,
&xtensa_elf32_le_vec,
&z80_coff_vec,
+ &z80_elf32_vec,
&z8k_coff_vec,
#endif /* not SELECT_VECS */
/* Likewise for ihex. */
&ihex_vec,
+#if BFD_SUPPORTS_PLUGINS
+ &plugin_vec,
+#endif
+
/* Add any required traditional-core-file-handler. */
#ifdef AIX386_CORE
bfd_target_list (void)
{
int vec_length = 0;
- bfd_size_type amt;
+ size_t amt;
const bfd_target * const *target;
const char **name_list, **name_ptr;