Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* BFD support for the ARC processor |
b34976b6 | 2 | Copyright 1994, 1995, 1997, 2001, 2002 Free Software Foundation, Inc. |
252b5132 RH |
3 | Contributed by Doug Evans (dje@cygnus.com). |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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 | |
3e110533 | 19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
252b5132 RH |
20 | |
21 | #include "bfd.h" | |
22 | #include "sysdep.h" | |
23 | #include "libbfd.h" | |
24 | ||
25 | #define ARC(mach, print_name, default_p, next) \ | |
26 | { \ | |
0d2bcfaf NC |
27 | 32, /* 32 bits in a word */ \ |
28 | 32, /* 32 bits in an address */ \ | |
29 | 8, /* 8 bits in a byte */ \ | |
252b5132 RH |
30 | bfd_arch_arc, \ |
31 | mach, \ | |
32 | "arc", \ | |
33 | print_name, \ | |
0d2bcfaf | 34 | 4, /* section alignment power */ \ |
252b5132 | 35 | default_p, \ |
bcee8eb8 | 36 | bfd_default_compatible, \ |
252b5132 RH |
37 | bfd_default_scan, \ |
38 | next, \ | |
39 | } | |
40 | ||
252b5132 RH |
41 | static const bfd_arch_info_type arch_info_struct[] = |
42 | { | |
b34976b6 AM |
43 | ARC ( bfd_mach_arc_5, "arc5", FALSE, &arch_info_struct[1] ), |
44 | ARC ( bfd_mach_arc_5, "base", FALSE, &arch_info_struct[2] ), | |
45 | ARC ( bfd_mach_arc_6, "arc6", FALSE, &arch_info_struct[3] ), | |
46 | ARC ( bfd_mach_arc_7, "arc7", FALSE, &arch_info_struct[4] ), | |
47 | ARC ( bfd_mach_arc_8, "arc8", FALSE, NULL ), | |
252b5132 | 48 | }; |
252b5132 RH |
49 | |
50 | const bfd_arch_info_type bfd_arc_arch = | |
b34976b6 | 51 | ARC ( bfd_mach_arc_6, "arc", TRUE, &arch_info_struct[0] ); |
0d2bcfaf | 52 | |
252b5132 RH |
53 | /* Utility routines. */ |
54 | ||
55 | /* Given cpu type NAME, return its bfd_mach_arc_xxx value. | |
56 | Returns -1 if not found. */ | |
57 | ||
dc810e39 AM |
58 | int arc_get_mach PARAMS ((char *)); |
59 | ||
252b5132 RH |
60 | int |
61 | arc_get_mach (name) | |
62 | char *name; | |
63 | { | |
64 | const bfd_arch_info_type *p; | |
65 | ||
66 | for (p = &bfd_arc_arch; p != NULL; p = p->next) | |
0d2bcfaf NC |
67 | if (strcmp (name, p->printable_name) == 0) |
68 | return p->mach; | |
252b5132 RH |
69 | return -1; |
70 | } |