138889Sjdp/* BFD support for the ARC processor
2218822Sdim   Copyright 1994, 1995, 1997, 2001, 2002, 2007
3218822Sdim   Free Software Foundation, Inc.
438889Sjdp   Contributed by Doug Evans (dje@cygnus.com).
538889Sjdp
638889SjdpThis file is part of BFD, the Binary File Descriptor library.
738889Sjdp
838889SjdpThis program is free software; you can redistribute it and/or modify
938889Sjdpit under the terms of the GNU General Public License as published by
1038889Sjdpthe Free Software Foundation; either version 2 of the License, or
1138889Sjdp(at your option) any later version.
1238889Sjdp
1338889SjdpThis program is distributed in the hope that it will be useful,
1438889Sjdpbut WITHOUT ANY WARRANTY; without even the implied warranty of
1538889SjdpMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1638889SjdpGNU General Public License for more details.
1738889Sjdp
1838889SjdpYou should have received a copy of the GNU General Public License
1938889Sjdpalong with this program; if not, write to the Free Software
20218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
2138889Sjdp
22218822Sdim#include "sysdep.h"
2338889Sjdp#include "bfd.h"
2438889Sjdp#include "libbfd.h"
2538889Sjdp
2638889Sjdp#define ARC(mach, print_name, default_p, next) \
2738889Sjdp{					\
2885815Sobrien    32,	/* 32 bits in a word  */	\
2985815Sobrien    32,	/* 32 bits in an address  */	\
3085815Sobrien    8,	/* 8 bits in a byte  */		\
3138889Sjdp    bfd_arch_arc,			\
3238889Sjdp    mach,				\
3338889Sjdp    "arc",				\
3438889Sjdp    print_name,				\
3585815Sobrien    4, /* section alignment power  */	\
3638889Sjdp    default_p,				\
3785815Sobrien    bfd_default_compatible,		\
3838889Sjdp    bfd_default_scan,			\
3938889Sjdp    next,				\
4038889Sjdp  }
4138889Sjdp
4238889Sjdpstatic const bfd_arch_info_type arch_info_struct[] =
4338889Sjdp{
44130561Sobrien  ARC ( bfd_mach_arc_5, "arc5", FALSE, &arch_info_struct[1] ),
45130561Sobrien  ARC ( bfd_mach_arc_5, "base", FALSE, &arch_info_struct[2] ),
46130561Sobrien  ARC ( bfd_mach_arc_6, "arc6", FALSE, &arch_info_struct[3] ),
47130561Sobrien  ARC ( bfd_mach_arc_7, "arc7", FALSE, &arch_info_struct[4] ),
48130561Sobrien  ARC ( bfd_mach_arc_8, "arc8", FALSE, NULL ),
4938889Sjdp};
5038889Sjdp
5138889Sjdpconst bfd_arch_info_type bfd_arc_arch =
52130561Sobrien  ARC ( bfd_mach_arc_6, "arc", TRUE, &arch_info_struct[0] );
5385815Sobrien
5438889Sjdp/* Utility routines.  */
5538889Sjdp
5638889Sjdp/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
5738889Sjdp   Returns -1 if not found.  */
5838889Sjdp
5989857Sobrienint arc_get_mach PARAMS ((char *));
6089857Sobrien
6138889Sjdpint
6238889Sjdparc_get_mach (name)
6338889Sjdp     char *name;
6438889Sjdp{
6538889Sjdp  const bfd_arch_info_type *p;
6638889Sjdp
6738889Sjdp  for (p = &bfd_arc_arch; p != NULL; p = p->next)
6885815Sobrien    if (strcmp (name, p->printable_name) == 0)
6985815Sobrien      return p->mach;
7038889Sjdp  return -1;
7138889Sjdp}
72