cpu-arc.c revision 256281
197769Sru/* BFD support for the ARC processor
297769Sru   Copyright 1994, 1995, 1997, 2001, 2002, 2007
397769Sru   Free Software Foundation, Inc.
497769Sru   Contributed by Doug Evans (dje@cygnus.com).
597769Sru
697769SruThis file is part of BFD, the Binary File Descriptor library.
797769Sru
897769SruThis program is free software; you can redistribute it and/or modify
997769Sruit under the terms of the GNU General Public License as published by
1097769Sruthe Free Software Foundation; either version 2 of the License, or
1197769Sru(at your option) any later version.
1297769Sru
1397769SruThis program is distributed in the hope that it will be useful,
1497769Srubut WITHOUT ANY WARRANTY; without even the implied warranty of
1597769SruMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1697769SruGNU General Public License for more details.
1797769Sru
1897769SruYou should have received a copy of the GNU General Public License
1997769Srualong with this program; if not, write to the Free Software
2097769SruFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2197769Sru
2297769Sru#include "sysdep.h"
2397769Sru#include "bfd.h"
2497769Sru#include "libbfd.h"
2597769Sru
2697769Sru#define ARC(mach, print_name, default_p, next) \
2797769Sru{					\
2897769Sru    32,	/* 32 bits in a word  */	\
2997769Sru    32,	/* 32 bits in an address  */	\
3097769Sru    8,	/* 8 bits in a byte  */		\
3197769Sru    bfd_arch_arc,			\
3297769Sru    mach,				\
3397769Sru    "arc",				\
3497769Sru    print_name,				\
3597769Sru    4, /* section alignment power  */	\
3697769Sru    default_p,				\
3797769Sru    bfd_default_compatible,		\
3897769Sru    bfd_default_scan,			\
3997769Sru    next,				\
4097769Sru  }
4197769Sru
4297769Srustatic const bfd_arch_info_type arch_info_struct[] =
4397769Sru{
4497769Sru  ARC ( bfd_mach_arc_5, "arc5", FALSE, &arch_info_struct[1] ),
4597769Sru  ARC ( bfd_mach_arc_5, "base", FALSE, &arch_info_struct[2] ),
4697769Sru  ARC ( bfd_mach_arc_6, "arc6", FALSE, &arch_info_struct[3] ),
4797769Sru  ARC ( bfd_mach_arc_7, "arc7", FALSE, &arch_info_struct[4] ),
4897769Sru  ARC ( bfd_mach_arc_8, "arc8", FALSE, NULL ),
4997769Sru};
5097769Sru
5197769Sruconst bfd_arch_info_type bfd_arc_arch =
5297769Sru  ARC ( bfd_mach_arc_6, "arc", TRUE, &arch_info_struct[0] );
5397769Sru
5497769Sru/* Utility routines.  */
5597769Sru
5697769Sru/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
5797769Sru   Returns -1 if not found.  */
5897769Sru
5997769Sruint arc_get_mach PARAMS ((char *));
6097769Sru
6197769Sruint
6297769Sruarc_get_mach (name)
6397769Sru     char *name;
6497769Sru{
6597769Sru  const bfd_arch_info_type *p;
6697769Sru
6797769Sru  for (p = &bfd_arc_arch; p != NULL; p = p->next)
6897769Sru    if (strcmp (name, p->printable_name) == 0)
6999343Sru      return p->mach;
70  return -1;
71}
72