cpu-arc.c revision 38889
138889Sjdp/* BFD support for the ARC processor
238889Sjdp   Copyright 1994, 1995, 1997 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{					\
2738889Sjdp    32,	/* 32 bits in a word */		\
2838889Sjdp    32,	/* 32 bits in an address */	\
2938889Sjdp    8,	/* 8 bits in a byte */		\
3038889Sjdp    bfd_arch_arc,			\
3138889Sjdp    mach,				\
3238889Sjdp    "arc",				\
3338889Sjdp    print_name,				\
3438889Sjdp    4, /* section alignment power */	\
3538889Sjdp    default_p,				\
3638889Sjdp    bfd_default_compatible, 		\
3738889Sjdp    bfd_default_scan,			\
3838889Sjdp    next,				\
3938889Sjdp  }
4038889Sjdp
4138889Sjdp#if 0 /* ??? Not currently needed, but keep in for future reference.  */
4238889Sjdpstatic const bfd_arch_info_type arch_info_struct[] =
4338889Sjdp{
4438889Sjdp  ARC (bfd_mach_arc_foo, "arc-foo", false, &arch_info_struct[1]),
4538889Sjdp  ARC (bfd_mach_arc_bar, "arc-bar", false, 0),
4638889Sjdp};
4738889Sjdp#endif
4838889Sjdp
4938889Sjdpconst bfd_arch_info_type bfd_arc_arch =
5038889Sjdp  ARC (bfd_mach_arc_base, "arc-base", true, 0 /*&arch_info_struct[0]*/);
5138889Sjdp
5238889Sjdp/* Utility routines.  */
5338889Sjdp
5438889Sjdp/* Given cpu type NAME, return its bfd_mach_arc_xxx value.
5538889Sjdp   Returns -1 if not found.  */
5638889Sjdp
5738889Sjdpint
5838889Sjdparc_get_mach (name)
5938889Sjdp     char *name;
6038889Sjdp{
6138889Sjdp  const bfd_arch_info_type *p;
6238889Sjdp
6338889Sjdp  for (p = &bfd_arc_arch; p != NULL; p = p->next)
6438889Sjdp    {
6538889Sjdp      /* +4: skip over "arc-" */
6638889Sjdp      if (strcmp (name, p->printable_name + 4) == 0)
6738889Sjdp	return p->mach;
6838889Sjdp    }
6938889Sjdp  return -1;
7038889Sjdp}
71