Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
archures.c File Reference
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "safe-ctype.h"

Go to the source code of this file.

Defines

#define bfd_powerpc_arch   bfd_powerpc_archs[0]

Functions

const char * bfd_printable_name (bfd *abfd)
const bfd_arch_info_typebfd_scan_arch (const char *string)
const char ** bfd_arch_list (void)
const bfd_arch_info_typebfd_arch_get_compatible (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns)
void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg)
bfd_boolean bfd_default_set_arch_mach (bfd *abfd, enum bfd_architecture arch, unsigned long mach)
enum bfd_architecture bfd_get_arch (bfd *abfd)
unsigned long bfd_get_mach (bfd *abfd)
unsigned int bfd_arch_bits_per_byte (bfd *abfd)
unsigned int bfd_arch_bits_per_address (bfd *abfd)
const bfd_arch_info_typebfd_default_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
bfd_boolean bfd_default_scan (const bfd_arch_info_type *info, const char *string)
const bfd_arch_info_typebfd_get_arch_info (bfd *abfd)
const bfd_arch_info_typebfd_lookup_arch (enum bfd_architecture arch, unsigned long machine)
const char * bfd_printable_arch_mach (enum bfd_architecture arch, unsigned long machine)
unsigned int bfd_octets_per_byte (bfd *abfd)
unsigned int bfd_arch_mach_octets_per_byte (enum bfd_architecture arch, unsigned long mach)

Variables

const bfd_arch_info_type bfd_alpha_arch
const bfd_arch_info_type bfd_arc_arch
const bfd_arch_info_type bfd_arm_arch
const bfd_arch_info_type bfd_avr_arch
const bfd_arch_info_type bfd_bfin_arch
const bfd_arch_info_type bfd_cr16c_arch
const bfd_arch_info_type bfd_cris_arch
const bfd_arch_info_type bfd_crx_arch
const bfd_arch_info_type bfd_d10v_arch
const bfd_arch_info_type bfd_d30v_arch
const bfd_arch_info_type bfd_dlx_arch
const bfd_arch_info_type bfd_fr30_arch
const bfd_arch_info_type bfd_frv_arch
const bfd_arch_info_type bfd_h8300_arch
const bfd_arch_info_type bfd_h8500_arch
const bfd_arch_info_type bfd_hppa_arch
const bfd_arch_info_type bfd_i370_arch
const bfd_arch_info_type bfd_i386_arch
const bfd_arch_info_type bfd_i860_arch
const bfd_arch_info_type bfd_i960_arch
const bfd_arch_info_type bfd_ia64_arch
const bfd_arch_info_type bfd_ip2k_arch
const bfd_arch_info_type bfd_iq2000_arch
const bfd_arch_info_type bfd_m32c_arch
const bfd_arch_info_type bfd_m32r_arch
const bfd_arch_info_type bfd_m68hc11_arch
const bfd_arch_info_type bfd_m68hc12_arch
const bfd_arch_info_type bfd_m68k_arch
const bfd_arch_info_type bfd_m88k_arch
const bfd_arch_info_type bfd_maxq_arch
const bfd_arch_info_type bfd_mcore_arch
const bfd_arch_info_type bfd_mep_arch
const bfd_arch_info_type bfd_mips_arch
const bfd_arch_info_type bfd_mmix_arch
const bfd_arch_info_type bfd_mn10200_arch
const bfd_arch_info_type bfd_mn10300_arch
const bfd_arch_info_type bfd_msp430_arch
const bfd_arch_info_type bfd_mt_arch
const bfd_arch_info_type bfd_ns32k_arch
const bfd_arch_info_type bfd_openrisc_arch
const bfd_arch_info_type bfd_or32_arch
const bfd_arch_info_type bfd_pdp11_arch
const bfd_arch_info_type bfd_pj_arch
const bfd_arch_info_type bfd_powerpc_archs []
const bfd_arch_info_type bfd_rs6000_arch
const bfd_arch_info_type bfd_s390_arch
const bfd_arch_info_type bfd_score_arch
const bfd_arch_info_type bfd_sh_arch
const bfd_arch_info_type bfd_sparc_arch
const bfd_arch_info_type bfd_spu_arch
const bfd_arch_info_type bfd_tic30_arch
const bfd_arch_info_type bfd_tic4x_arch
const bfd_arch_info_type bfd_tic54x_arch
const bfd_arch_info_type bfd_tic80_arch
const bfd_arch_info_type bfd_v850_arch
const bfd_arch_info_type bfd_vax_arch
const bfd_arch_info_type bfd_we32k_arch
const bfd_arch_info_type bfd_w65_arch
const bfd_arch_info_type bfd_xstormy16_arch
const bfd_arch_info_type bfd_xtensa_arch
const bfd_arch_info_type bfd_xc16x_arch
const bfd_arch_info_type bfd_z80_arch = N (0, "z80-any", TRUE, M(0))
const bfd_arch_info_type bfd_z8k_arch
static const
bfd_arch_info_type *const 
bfd_archures_list []
const bfd_arch_info_type bfd_default_arch_struct

Define Documentation

Definition at line 475 of file archures.c.


Function Documentation

Definition at line 846 of file archures.c.

{
  return abfd->arch_info->bits_per_address;
}

Here is the caller graph for this function:

Definition at line 828 of file archures.c.

{
  return abfd->arch_info->bits_per_byte;
}

Here is the caller graph for this function:

const bfd_arch_info_type* bfd_arch_get_compatible ( const bfd abfd,
const bfd bbfd,
bfd_boolean  accept_unknowns 
)

Definition at line 687 of file archures.c.

{
  const bfd * ubfd = NULL;

  /* Look for an unknown architecture.  */
  if (((ubfd = abfd) && ubfd->arch_info->arch == bfd_arch_unknown)
      || ((ubfd = bbfd) && ubfd->arch_info->arch == bfd_arch_unknown))
    {
      /* We can allow an unknown architecture if accept_unknowns
        is true, or if the target is the "binary" format, which
        has an unknown architecture.  Since the binary format can
        only be set by explicit request from the user, it is safe
        to assume that they know what they are doing.  */
      if (accept_unknowns
         || strcmp (bfd_get_target (ubfd), "binary") == 0)
       return ubfd->arch_info;
      return NULL;
    }

  /* Otherwise architecture-specific code has to decide.  */
  return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char** bfd_arch_list ( void  )

Definition at line 630 of file archures.c.

{
  int vec_length = 0;
  const char **name_ptr;
  const char **name_list;
  const bfd_arch_info_type * const *app;
  bfd_size_type amt;

  /* Determine the number of architectures.  */
  vec_length = 0;
  for (app = bfd_archures_list; *app != NULL; app++)
    {
      const bfd_arch_info_type *ap;
      for (ap = *app; ap != NULL; ap = ap->next)
       {
         vec_length++;
       }
    }

  amt = (vec_length + 1) * sizeof (char **);
  name_list = bfd_malloc (amt);
  if (name_list == NULL)
    return NULL;

  /* Point the list at each of the names.  */
  name_ptr = name_list;
  for (app = bfd_archures_list; *app != NULL; app++)
    {
      const bfd_arch_info_type *ap;
      for (ap = *app; ap != NULL; ap = ap->next)
       {
         *name_ptr = ap->printable_name;
         name_ptr++;
       }
    }
  *name_ptr = NULL;

  return name_list;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1216 of file archures.c.

{
  const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach);

  if (ap)
    return ap->bits_per_byte / 8;
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 864 of file archures.c.

{
  if (a->arch != b->arch)
    return NULL;

  if (a->bits_per_word != b->bits_per_word)
    return NULL;

  if (a->mach > b->mach)
    return a;

  if (b->mach > a->mach)
    return b;

  return a;
}

Here is the caller graph for this function:

bfd_boolean bfd_default_scan ( const bfd_arch_info_type info,
const char *  string 
)

Definition at line 896 of file archures.c.

{
  const char *ptr_src;
  const char *ptr_tst;
  unsigned long number;
  enum bfd_architecture arch;
  const char *printable_name_colon;

  /* Exact match of the architecture name (ARCH_NAME) and also the
     default architecture?  */
  if (strcasecmp (string, info->arch_name) == 0
      && info->the_default)
    return TRUE;

  /* Exact match of the machine name (PRINTABLE_NAME)?  */
  if (strcasecmp (string, info->printable_name) == 0)
    return TRUE;

  /* Given that printable_name contains no colon, attempt to match:
     ARCH_NAME [ ":" ] PRINTABLE_NAME?  */
  printable_name_colon = strchr (info->printable_name, ':');
  if (printable_name_colon == NULL)
    {
      size_t strlen_arch_name = strlen (info->arch_name);
      if (strncasecmp (string, info->arch_name, strlen_arch_name) == 0)
       {
         if (string[strlen_arch_name] == ':')
           {
             if (strcasecmp (string + strlen_arch_name + 1,
                           info->printable_name) == 0)
              return TRUE;
           }
         else
           {
             if (strcasecmp (string + strlen_arch_name,
                           info->printable_name) == 0)
              return TRUE;
           }
       }
    }

  /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>;
     Attempt to match: <arch> <mach>?  */
  if (printable_name_colon != NULL)
    {
      size_t colon_index = printable_name_colon - info->printable_name;
      if (strncasecmp (string, info->printable_name, colon_index) == 0
         && strcasecmp (string + colon_index,
                      info->printable_name + colon_index + 1) == 0)
       return TRUE;
    }

  /* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
     attempt to match just <mach>, it could be ambiguous.  This test
     is left until later.  */

  /* NOTE: The below is retained for compatibility only.  Please do
     not add to this code.  */

  /* See how much of the supplied string matches with the
     architecture, eg the string m68k:68020 would match the 68k entry
     up to the :, then we get left with the machine number.  */

  for (ptr_src = string, ptr_tst = info->arch_name;
       *ptr_src && *ptr_tst;
       ptr_src++, ptr_tst++)
    {
      if (*ptr_src != *ptr_tst)
       break;
    }

  /* Chewed up as much of the architecture as will match, skip any
     colons.  */
  if (*ptr_src == ':')
    ptr_src++;

  if (*ptr_src == 0)
    {
      /* Nothing more, then only keep this one if it is the default
        machine for this architecture.  */
      return info->the_default;
    }

  number = 0;
  while (ISDIGIT (*ptr_src))
    {
      number = number * 10 + *ptr_src - '0';
      ptr_src++;
    }

  /* NOTE: The below is retained for compatibility only.
     PLEASE DO NOT ADD TO THIS CODE.  */

  switch (number)
    {
      /* FIXME: These are needed to parse IEEE objects.  */
      /* The following seven case's are here only for compatibility with
        older binutils (at least IEEE objects from binutils 2.9.1 require
        them).  */
    case bfd_mach_m68000:
    case bfd_mach_m68010:
    case bfd_mach_m68020:
    case bfd_mach_m68030:
    case bfd_mach_m68040:
    case bfd_mach_m68060:
    case bfd_mach_cpu32:
      arch = bfd_arch_m68k;
      break;
    case 68000:
      arch = bfd_arch_m68k;
      number = bfd_mach_m68000;
      break;
    case 68010:
      arch = bfd_arch_m68k;
      number = bfd_mach_m68010;
      break;
    case 68020:
      arch = bfd_arch_m68k;
      number = bfd_mach_m68020;
      break;
    case 68030:
      arch = bfd_arch_m68k;
      number = bfd_mach_m68030;
      break;
    case 68040:
      arch = bfd_arch_m68k;
      number = bfd_mach_m68040;
      break;
    case 68060:
      arch = bfd_arch_m68k;
      number = bfd_mach_m68060;
      break;
    case 68332:
      arch = bfd_arch_m68k;
      number = bfd_mach_cpu32;
      break;
    case 5200:
      arch = bfd_arch_m68k;
      number = bfd_mach_mcf_isa_a_nodiv;
      break;
    case 5206:
      arch = bfd_arch_m68k;
      number = bfd_mach_mcf_isa_a_mac;
      break;
    case 5307:
      arch = bfd_arch_m68k;
      number = bfd_mach_mcf_isa_a_mac;
      break;
    case 5407:
      arch = bfd_arch_m68k;
      number = bfd_mach_mcf_isa_b_nousp_mac;
      break;
    case 5282:
      arch = bfd_arch_m68k;
      number = bfd_mach_mcf_isa_aplus_emac;
      break;

    case 32000:
      arch = bfd_arch_we32k;
      break;

    case 3000:
      arch = bfd_arch_mips;
      number = bfd_mach_mips3000;
      break;

    case 4000:
      arch = bfd_arch_mips;
      number = bfd_mach_mips4000;
      break;

    case 6000:
      arch = bfd_arch_rs6000;
      break;

    case 7410:
      arch = bfd_arch_sh;
      number = bfd_mach_sh_dsp;
      break;

    case 7708:
      arch = bfd_arch_sh;
      number = bfd_mach_sh3;
      break;

    case 7729:
      arch = bfd_arch_sh;
      number = bfd_mach_sh3_dsp;
      break;

    case 7750:
      arch = bfd_arch_sh;
      number = bfd_mach_sh4;
      break;

    default:
      return FALSE;
    }

  if (arch != info->arch)
    return FALSE;

  if (number != info->mach)
    return FALSE;

  return TRUE;
}

Here is the call graph for this function:

Definition at line 766 of file archures.c.

{
  abfd->arch_info = bfd_lookup_arch (arch, mach);
  if (abfd->arch_info != NULL)
    return TRUE;

  abfd->arch_info = &bfd_default_arch_struct;
  bfd_set_error (bfd_error_bad_value);
  return FALSE;
}

Here is the call graph for this function:

enum bfd_architecture bfd_get_arch ( bfd abfd)

Definition at line 792 of file archures.c.

{
  return abfd->arch_info->arch;
}

Definition at line 1116 of file archures.c.

{
  return abfd->arch_info;
}

Here is the caller graph for this function:

Definition at line 810 of file archures.c.

{
  return abfd->arch_info->mach;
}

Definition at line 1137 of file archures.c.

{
  const bfd_arch_info_type * const *app, *ap;

  for (app = bfd_archures_list; *app != NULL; app++)
    {
      for (ap = *app; ap != NULL; ap = ap->next)
       {
         if (ap->arch == arch
             && (ap->mach == machine
                || (machine == 0 && ap->the_default)))
           return ap;
       }
    }

  return NULL;
}

Here is the caller graph for this function:

Definition at line 1194 of file archures.c.

Here is the call graph for this function:

Here is the caller graph for this function:

const char* bfd_printable_arch_mach ( enum bfd_architecture  arch,
unsigned long  machine 
)

Definition at line 1171 of file archures.c.

{
  const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine);

  if (ap)
    return ap->printable_name;
  return "UNKNOWN!";
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* bfd_printable_name ( bfd abfd)

Definition at line 581 of file archures.c.

{
  return abfd->arch_info->printable_name;
}

Here is the caller graph for this function:

Definition at line 600 of file archures.c.

{
  const bfd_arch_info_type * const *app, *ap;

  /* Look through all the installed architectures.  */
  for (app = bfd_archures_list; *app != NULL; app++)
    {
      for (ap = *app; ap != NULL; ap = ap->next)
       {
         if (ap->scan (ap, string))
           return ap;
       }
    }

  return NULL;
}

Here is the caller graph for this function:

void bfd_set_arch_info ( bfd abfd,
const bfd_arch_info_type arg 
)

Definition at line 745 of file archures.c.

{
  abfd->arch_info = arg;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 51 of file cpu-alpha.c.

Definition at line 50 of file cpu-arc.c.

Definition at line 496 of file archures.c.

Definition at line 145 of file cpu-arm.c.

Definition at line 91 of file cpu-avr.c.

Definition at line 26 of file cpu-bfin.c.

Definition at line 24 of file cpu-cr16c.c.

Definition at line 78 of file cpu-cris.c.

Definition at line 25 of file cpu-crx.c.

Definition at line 58 of file cpu-d10v.c.

Definition at line 26 of file cpu-d30v.c.

Initial value:
 {
  32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
  bfd_default_compatible,
  bfd_default_scan,
  0,
}

Definition at line 726 of file archures.c.

Definition at line 25 of file cpu-dlx.c.

Definition at line 24 of file cpu-fr30.c.

Definition at line 62 of file cpu-frv.c.

Definition at line 212 of file cpu-h8300.c.

Definition at line 45 of file cpu-h8500.c.

Definition at line 75 of file cpu-hppa.c.

Definition at line 61 of file cpu-i370.c.

Definition at line 89 of file cpu-i386.c.

Definition at line 26 of file cpu-i860.c.

Definition at line 181 of file cpu-i960.c.

Definition at line 41 of file cpu-ia64.c.

Definition at line 40 of file cpu-ip2k.c.

Definition at line 42 of file cpu-iq2000.c.

Definition at line 42 of file cpu-m32c.c.

Definition at line 37 of file cpu-m32r.c.

Definition at line 24 of file cpu-m68hc11.c.

Definition at line 40 of file cpu-m68hc12.c.

Definition at line 95 of file cpu-m68k.c.

Definition at line 25 of file cpu-m88k.c.

Definition at line 45 of file cpu-maxq.c.

Definition at line 24 of file cpu-mcore.c.

Definition at line 28 of file cpu-mep.c.

Definition at line 128 of file cpu-mips.c.

Definition at line 26 of file cpu-mmix.c.

Definition at line 24 of file cpu-m10200.c.

Definition at line 57 of file cpu-m10300.c.

Definition at line 92 of file cpu-msp430.c.

Definition at line 56 of file cpu-mt.c.

Definition at line 36 of file cpu-ns32k.c.

Definition at line 41 of file cpu-openrisc.c.

Definition at line 25 of file cpu-or32.c.

Definition at line 24 of file cpu-pdp11.c.

Definition at line 25 of file cpu-pj.c.

Definition at line 51 of file cpu-powerpc.c.

Definition at line 103 of file cpu-rs6000.c.

Definition at line 42 of file cpu-s390.c.

Definition at line 28 of file cpu-score.c.

Definition at line 333 of file cpu-sh.c.

Definition at line 155 of file cpu-sparc.c.

Definition at line 38 of file cpu-spu.c.

Definition at line 25 of file cpu-tic30.c.

Definition at line 69 of file cpu-tic4x.c.

Definition at line 25 of file cpu-tic54x.c.

Definition at line 25 of file cpu-tic80.c.

Definition at line 41 of file cpu-v850.c.

Definition at line 25 of file cpu-vax.c.

Definition at line 40 of file cpu-w65.c.

Definition at line 25 of file cpu-we32k.c.

Definition at line 59 of file cpu-xc16x.c.

Definition at line 24 of file cpu-xstormy16.c.

Definition at line 24 of file cpu-xtensa.c.

const bfd_arch_info_type bfd_z80_arch = N (0, "z80-any", TRUE, M(0))

Definition at line 57 of file cpu-z80.c.

Definition at line 43 of file cpu-z8k.c.