Initial revision
[binutils.git] / bfd / cpu-arc.c
blobbce59d4c99f351601776facdb3ab9d8c5e5d1ce5
1 /* BFD support for the ARC processor
2 Copyright 1994, 1995, 1997 Free Software Foundation, Inc.
3 Contributed by Doug Evans (dje@cygnus.com).
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21 #include "bfd.h"
22 #include "sysdep.h"
23 #include "libbfd.h"
25 #define ARC(mach, print_name, default_p, next) \
26 { \
27 32, /* 32 bits in a word */ \
28 32, /* 32 bits in an address */ \
29 8, /* 8 bits in a byte */ \
30 bfd_arch_arc, \
31 mach, \
32 "arc", \
33 print_name, \
34 4, /* section alignment power */ \
35 default_p, \
36 bfd_default_compatible, \
37 bfd_default_scan, \
38 next, \
41 #if 0 /* ??? Not currently needed, but keep in for future reference. */
42 static const bfd_arch_info_type arch_info_struct[] =
44 ARC (bfd_mach_arc_foo, "arc-foo", false, &arch_info_struct[1]),
45 ARC (bfd_mach_arc_bar, "arc-bar", false, 0),
47 #endif
49 const bfd_arch_info_type bfd_arc_arch =
50 ARC (bfd_mach_arc_base, "arc-base", true, 0 /*&arch_info_struct[0]*/);
52 /* Utility routines. */
54 /* Given cpu type NAME, return its bfd_mach_arc_xxx value.
55 Returns -1 if not found. */
57 int
58 arc_get_mach (name)
59 char *name;
61 const bfd_arch_info_type *p;
63 for (p = &bfd_arc_arch; p != NULL; p = p->next)
65 /* +4: skip over "arc-" */
66 if (strcmp (name, p->printable_name + 4) == 0)
67 return p->mach;
69 return -1;