Back to index

cell-binutils  2.17cvs20070401
cpu-arc.c
Go to the documentation of this file.
00001 /* BFD support for the ARC processor
00002    Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc.
00003    Contributed by Doug Evans (dje@cygnus.com).
00004 
00005 This file is part of BFD, the Binary File Descriptor library.
00006 
00007 This program is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #include "bfd.h"
00022 #include "sysdep.h"
00023 #include "libbfd.h"
00024 
00025 #define ARC(mach, print_name, default_p, next) \
00026 {                                  \
00027     32,       /* 32 bits in a word  */    \
00028     32,       /* 32 bits in an address  */       \
00029     8, /* 8 bits in a byte  */            \
00030     bfd_arch_arc,                  \
00031     mach,                          \
00032     "arc",                         \
00033     print_name,                           \
00034     4, /* section alignment power  */     \
00035     default_p,                            \
00036     bfd_default_compatible,        \
00037     bfd_default_scan,                     \
00038     next,                          \
00039   }
00040 
00041 static const bfd_arch_info_type arch_info_struct[] =
00042 {
00043   ARC ( bfd_mach_arc_5, "arc5", FALSE, &arch_info_struct[1] ),
00044   ARC ( bfd_mach_arc_5, "base", FALSE, &arch_info_struct[2] ),
00045   ARC ( bfd_mach_arc_6, "arc6", FALSE, &arch_info_struct[3] ),
00046   ARC ( bfd_mach_arc_7, "arc7", FALSE, &arch_info_struct[4] ),
00047   ARC ( bfd_mach_arc_8, "arc8", FALSE, NULL ),
00048 };
00049 
00050 const bfd_arch_info_type bfd_arc_arch =
00051   ARC ( bfd_mach_arc_6, "arc", TRUE, &arch_info_struct[0] );
00052 
00053 /* Utility routines.  */
00054 
00055 /* Given cpu type NAME, return its bfd_mach_arc_xxx value.
00056    Returns -1 if not found.  */
00057 
00058 int arc_get_mach PARAMS ((char *));
00059 
00060 int
00061 arc_get_mach (name)
00062      char *name;
00063 {
00064   const bfd_arch_info_type *p;
00065 
00066   for (p = &bfd_arc_arch; p != NULL; p = p->next)
00067     if (strcmp (name, p->printable_name) == 0)
00068       return p->mach;
00069   return -1;
00070 }