gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / targets.c
index b02dfc548474f6b3f9ed7c73ae63d32c257c17e6..e5fc71a206ab59ee7cfe4fcad6fb594d3707b634 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic target-file-type support for the BFD library.
-   Copyright (C) 1990-2019 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.
@@ -176,6 +176,8 @@ DESCRIPTION
 .{* 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.  *}
@@ -240,9 +242,9 @@ DESCRIPTION
 .  {* 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 *);
@@ -390,9 +392,10 @@ BFD_JUMP_TABLE macros.
 .#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 *);
@@ -584,6 +587,74 @@ to find an alternative output format that is suitable.
 .
 .} 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).
@@ -629,7 +700,6 @@ extern const bfd_target avr_elf32_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;
@@ -672,6 +742,7 @@ extern const bfd_target i386_elf32_vxworks_vec;
 extern const bfd_target i386_mach_o_vec;
 extern const bfd_target i386_msdos_vec;
 extern const bfd_target i386_pe_vec;
+extern const bfd_target i386_pe_big_vec;
 extern const bfd_target i386_pei_vec;
 extern const bfd_target iamcu_elf32_vec;
 extern const bfd_target ia64_elf32_be_vec;
@@ -832,7 +903,6 @@ extern const bfd_target tic6x_elf32_c6000_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;
@@ -857,7 +927,7 @@ extern const bfd_target x86_64_elf64_nacl_vec;
 extern const bfd_target x86_64_elf64_sol2_vec;
 extern const bfd_target x86_64_mach_o_vec;
 extern const bfd_target x86_64_pe_vec;
-extern const bfd_target x86_64_pe_be_vec;
+extern const bfd_target x86_64_pe_big_vec;
 extern const bfd_target x86_64_pei_vec;
 extern const bfd_target xc16x_elf32_vec;
 extern const bfd_target xgate_elf32_vec;
@@ -865,6 +935,7 @@ extern const bfd_target xstormy16_elf32_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.  */
@@ -961,7 +1032,6 @@ static const bfd_target * const _bfd_target_vector[] =
        &bfin_elf32_fdpic_vec,
 
        &cr16_elf32_vec,
-       &cr16c_elf32_vec,
 
        &cris_aout_vec,
        &cris_elf32_vec,
@@ -1022,6 +1092,7 @@ static const bfd_target * const _bfd_target_vector[] =
        &i386_mach_o_vec,
        &i386_msdos_vec,
        &i386_pe_vec,
+       &i386_pe_big_vec,
        &i386_pei_vec,
 
        &iamcu_elf32_vec,
@@ -1240,7 +1311,6 @@ static const bfd_target * const _bfd_target_vector[] =
        &tic54x_coff2_vec,
        &tic6x_elf32_be_vec,
        &tic6x_elf32_le_vec,
-       &tic80_coff_vec,
 
        &tilegx_elf32_be_vec,
        &tilegx_elf32_le_vec,
@@ -1275,7 +1345,7 @@ static const bfd_target * const _bfd_target_vector[] =
        &x86_64_elf64_sol2_vec,
        &x86_64_mach_o_vec,
        &x86_64_pe_vec,
-       &x86_64_pe_be_vec,
+       &x86_64_pe_big_vec,
        &x86_64_pei_vec,
 #endif
 
@@ -1289,6 +1359,7 @@ static const bfd_target * const _bfd_target_vector[] =
        &xtensa_elf32_le_vec,
 
        &z80_coff_vec,
+       &z80_elf32_vec,
 
        &z8k_coff_vec,
 #endif /* not SELECT_VECS */
@@ -1621,8 +1692,7 @@ bfd_get_target_info (const char *target_name, bfd *abfd,
            _bfd_find_arch_match (tname, arches, def_target_arch);
        }
 
-      if (arches)
-       free (arches);
+      free (arches);
     }
   return target_vec;
 }
@@ -1645,7 +1715,7 @@ const char **
 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;
 
This page took 0.02646 seconds and 4 git commands to generate.