1f7cc78ecSespie /* BFD support for the ARC processor
2*d2201f2fSdrahn Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc.
3f7cc78ecSespie Contributed by Doug Evans (dje@cygnus.com).
4f7cc78ecSespie
5f7cc78ecSespie This file is part of BFD, the Binary File Descriptor library.
6f7cc78ecSespie
7f7cc78ecSespie This program is free software; you can redistribute it and/or modify
8f7cc78ecSespie it under the terms of the GNU General Public License as published by
9f7cc78ecSespie the Free Software Foundation; either version 2 of the License, or
10f7cc78ecSespie (at your option) any later version.
11f7cc78ecSespie
12f7cc78ecSespie This program is distributed in the hope that it will be useful,
13f7cc78ecSespie but WITHOUT ANY WARRANTY; without even the implied warranty of
14f7cc78ecSespie MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15f7cc78ecSespie GNU General Public License for more details.
16f7cc78ecSespie
17f7cc78ecSespie You should have received a copy of the GNU General Public License
18f7cc78ecSespie along with this program; if not, write to the Free Software
19f7cc78ecSespie Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20f7cc78ecSespie
21f7cc78ecSespie #include "bfd.h"
22f7cc78ecSespie #include "sysdep.h"
23f7cc78ecSespie #include "libbfd.h"
24f7cc78ecSespie
25f7cc78ecSespie #define ARC(mach, print_name, default_p, next) \
26f7cc78ecSespie { \
27f7cc78ecSespie 32, /* 32 bits in a word */ \
28f7cc78ecSespie 32, /* 32 bits in an address */ \
29f7cc78ecSespie 8, /* 8 bits in a byte */ \
30f7cc78ecSespie bfd_arch_arc, \
31f7cc78ecSespie mach, \
32f7cc78ecSespie "arc", \
33f7cc78ecSespie print_name, \
34f7cc78ecSespie 4, /* section alignment power */ \
35f7cc78ecSespie default_p, \
36f7cc78ecSespie bfd_default_compatible, \
37f7cc78ecSespie bfd_default_scan, \
38f7cc78ecSespie next, \
39f7cc78ecSespie }
40f7cc78ecSespie
41f7cc78ecSespie static const bfd_arch_info_type arch_info_struct[] =
42f7cc78ecSespie {
43*d2201f2fSdrahn ARC ( bfd_mach_arc_5, "arc5", FALSE, &arch_info_struct[1] ),
44*d2201f2fSdrahn ARC ( bfd_mach_arc_5, "base", FALSE, &arch_info_struct[2] ),
45*d2201f2fSdrahn ARC ( bfd_mach_arc_6, "arc6", FALSE, &arch_info_struct[3] ),
46*d2201f2fSdrahn ARC ( bfd_mach_arc_7, "arc7", FALSE, &arch_info_struct[4] ),
47*d2201f2fSdrahn ARC ( bfd_mach_arc_8, "arc8", FALSE, NULL ),
48f7cc78ecSespie };
49f7cc78ecSespie
50f7cc78ecSespie const bfd_arch_info_type bfd_arc_arch =
51*d2201f2fSdrahn ARC ( bfd_mach_arc_6, "arc", TRUE, &arch_info_struct[0] );
525f210c2aSfgsch
53f7cc78ecSespie /* Utility routines. */
54f7cc78ecSespie
55f7cc78ecSespie /* Given cpu type NAME, return its bfd_mach_arc_xxx value.
56f7cc78ecSespie Returns -1 if not found. */
57f7cc78ecSespie
58*d2201f2fSdrahn int arc_get_mach PARAMS ((char *));
59*d2201f2fSdrahn
60f7cc78ecSespie int
arc_get_mach(name)61f7cc78ecSespie arc_get_mach (name)
62f7cc78ecSespie char *name;
63f7cc78ecSespie {
64f7cc78ecSespie const bfd_arch_info_type *p;
65f7cc78ecSespie
66f7cc78ecSespie for (p = &bfd_arc_arch; p != NULL; p = p->next)
675f210c2aSfgsch if (strcmp (name, p->printable_name) == 0)
68f7cc78ecSespie return p->mach;
69f7cc78ecSespie return -1;
70f7cc78ecSespie }
71