cpu-arc.c revision 89857
138889Sjdp/* BFD support for the ARC processor
285815Sobrien   Copyright 1994, 1995, 1997, 2001 Free Software Foundation, Inc.
338889Sjdp   Contributed by Doug Evans (dje@cygnus.com).
438889Sjdp
538889SjdpThis file is part of BFD, the Binary File Descriptor library.
638889Sjdp
738889SjdpThis program is free software; you can redistribute it and/or modify
838889Sjdpit under the terms of the GNU General Public License as published by
938889Sjdpthe Free Software Foundation; either version 2 of the License, or
1038889Sjdp(at your option) any later version.
1138889Sjdp
1238889SjdpThis program is distributed in the hope that it will be useful,
1338889Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of
1438889SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1538889SjdpGNU General Public License for more details.
1638889Sjdp
1738889SjdpYou should have received a copy of the GNU General Public License
1838889Sjdpalong with this program; if not, write to the Free Software
1938889SjdpFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
2038889Sjdp
2138889Sjdp#include "bfd.h"
2238889Sjdp#include "sysdep.h"
2338889Sjdp#include "libbfd.h"
2438889Sjdp
2538889Sjdp#define ARC(mach, print_name, default_p, next) \
2638889Sjdp{					\
2785815Sobrien    32,	/* 32 bits in a word  */	\
2885815Sobrien    32,	/* 32 bits in an address  */	\
2985815Sobrien    8,	/* 8 bits in a byte  */		\
3038889Sjdp    bfd_arch_arc,			\
3138889Sjdp    mach,				\
3238889Sjdp    "arc",				\
3338889Sjdp    print_name,				\
3485815Sobrien    4, /* section alignment power  */	\
3538889Sjdp    default_p,				\
3685815Sobrien    bfd_default_compatible,		\
3738889Sjdp    bfd_default_scan,			\
3838889Sjdp    next,				\
3938889Sjdp  }
4038889Sjdp
4138889Sjdpstatic const bfd_arch_info_type arch_info_struct[] =
4238889Sjdp{
4385815Sobrien  ARC ( bfd_mach_arc_5, "arc5", false, &arch_info_struct[1] ),
4485815Sobrien  ARC ( bfd_mach_arc_5, "base", false, &arch_info_struct[2] ),
4585815Sobrien  ARC ( bfd_mach_arc_6, "arc6", false, &arch_info_struct[3] ),
4685815Sobrien  ARC ( bfd_mach_arc_7, "arc7", false, &arch_info_struct[4] ),
4785815Sobrien  ARC ( bfd_mach_arc_8, "arc8", false, NULL ),
4838889Sjdp};
4938889Sjdp
5038889Sjdpconst bfd_arch_info_type bfd_arc_arch =
5185815Sobrien  ARC ( bfd_mach_arc_6, "arc", true, &arch_info_struct[0] );
5285815Sobrien
5338889Sjdp/* Utility routines.  */
5438889Sjdp
5538889Sjdp/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
5638889Sjdp   Returns -1 if not found.  */
5738889Sjdp
5889857Sobrienint arc_get_mach PARAMS ((char *));
5989857Sobrien
6038889Sjdpint
6138889Sjdparc_get_mach (name)
6238889Sjdp     char *name;
6338889Sjdp{
6438889Sjdp  const bfd_arch_info_type *p;
6538889Sjdp
6638889Sjdp  for (p = &bfd_arc_arch; p != NULL; p = p->next)
6785815Sobrien    if (strcmp (name, p->printable_name) == 0)
6885815Sobrien      return p->mach;
6938889Sjdp  return -1;
7038889Sjdp}
71