Contribute sh64-elf.
[deliverable/binutils-gdb.git] / bfd / cpu-sh.c
1 /* BFD library support routines for the Hitachi-SH architecture.
2 Copyright 1993, 1994, 1997, 1998, 2000, 2001
3 Free Software Foundation, Inc.
4 Hacked by Steve Chamberlain of Cygnus Support.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "libbfd.h"
25
26 static boolean scan_mach
27 PARAMS ((const struct bfd_arch_info *, const char *));
28
29 static boolean
30 scan_mach (info, string)
31 const struct bfd_arch_info *info;
32 const char *string;
33 {
34 if (strcasecmp (info->printable_name, string) == 0)
35 return true;
36 return false;
37 }
38
39 #if 0
40 /* This routine is provided two arch_infos and returns whether
41 they'd be compatible */
42
43 static const bfd_arch_info_type *
44 compatible (a,b)
45 const bfd_arch_info_type *a;
46 const bfd_arch_info_type *b;
47 {
48 if (a->arch != b->arch || a->mach != b->mach)
49 return NULL;
50 return a;
51 }
52 #endif
53
54 #define SH_NEXT &arch_info_struct[0]
55 #define SH2_NEXT &arch_info_struct[1]
56 #define SH_DSP_NEXT &arch_info_struct[2]
57 #define SH3_NEXT &arch_info_struct[3]
58 #define SH3_DSP_NEXT &arch_info_struct[4]
59 #define SH3E_NEXT &arch_info_struct[5]
60 #define SH4_NEXT NULL
61 #undef SH4_NEXT
62 #define SH4_NEXT &arch_info_struct[6]
63 #define SH64_NEXT NULL
64
65 static const bfd_arch_info_type arch_info_struct[] =
66 {
67 {
68 32, /* 32 bits in a word */
69 32, /* 32 bits in an address */
70 8, /* 8 bits in a byte */
71 bfd_arch_sh,
72 bfd_mach_sh2,
73 "sh", /* arch_name */
74 "sh2", /* printable name */
75 1,
76 false, /* not the default */
77 bfd_default_compatible,
78 scan_mach,
79 SH2_NEXT
80 },
81 {
82 32, /* 32 bits in a word */
83 32, /* 32 bits in an address */
84 8, /* 8 bits in a byte */
85 bfd_arch_sh,
86 bfd_mach_sh_dsp,
87 "sh", /* arch_name */
88 "sh-dsp", /* printable name */
89 1,
90 false, /* not the default */
91 bfd_default_compatible,
92 scan_mach,
93 SH_DSP_NEXT
94 },
95 {
96 32, /* 32 bits in a word */
97 32, /* 32 bits in an address */
98 8, /* 8 bits in a byte */
99 bfd_arch_sh,
100 bfd_mach_sh3,
101 "sh", /* arch_name */
102 "sh3", /* printable name */
103 1,
104 false, /* not the default */
105 bfd_default_compatible,
106 scan_mach,
107 SH3_NEXT
108 },
109 {
110 32, /* 32 bits in a word */
111 32, /* 32 bits in an address */
112 8, /* 8 bits in a byte */
113 bfd_arch_sh,
114 bfd_mach_sh3_dsp,
115 "sh", /* arch_name */
116 "sh3-dsp", /* printable name */
117 1,
118 false, /* not the default */
119 bfd_default_compatible,
120 scan_mach,
121 SH3_DSP_NEXT
122 },
123 {
124 32, /* 32 bits in a word */
125 32, /* 32 bits in an address */
126 8, /* 8 bits in a byte */
127 bfd_arch_sh,
128 bfd_mach_sh3e,
129 "sh", /* arch_name */
130 "sh3e", /* printable name */
131 1,
132 false, /* not the default */
133 bfd_default_compatible,
134 scan_mach,
135 SH3E_NEXT
136 },
137 {
138 32, /* 32 bits in a word */
139 32, /* 32 bits in an address */
140 8, /* 8 bits in a byte */
141 bfd_arch_sh,
142 bfd_mach_sh4,
143 "sh", /* arch_name */
144 "sh4", /* printable name */
145 1,
146 false, /* not the default */
147 bfd_default_compatible,
148 scan_mach,
149 SH4_NEXT
150 },
151 {
152 64, /* 64 bits in a word */
153 64, /* 64 bits in an address */
154 8, /* 8 bits in a byte */
155 bfd_arch_sh,
156 bfd_mach_sh5,
157 "sh", /* arch_name */
158 "sh5", /* printable name */
159 1,
160 false, /* not the default */
161 bfd_default_compatible,
162 scan_mach,
163 SH64_NEXT
164 },
165 };
166
167 const bfd_arch_info_type bfd_sh_arch =
168 {
169 32, /* 32 bits in a word */
170 32, /* 32 bits in an address */
171 8, /* 8 bits in a byte */
172 bfd_arch_sh,
173 bfd_mach_sh,
174 "sh", /* arch_name */
175 "sh", /* printable name */
176 1,
177 true, /* the default machine */
178 bfd_default_compatible,
179 scan_mach,
180 SH_NEXT
181 };
This page took 0.056138 seconds and 5 git commands to generate.