OLD | NEW |
1 /* BFD library support routines for the i960 architecture. | 1 /* BFD library support routines for the i960 architecture. |
2 Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2005, 2006, | 2 Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2005, 2006, |
3 2007 Free Software Foundation, Inc. | 3 2007, 2012 Free Software Foundation, Inc. |
4 Hacked by Steve Chamberlain of Cygnus Support. | 4 Hacked by Steve Chamberlain of Cygnus Support. |
5 | 5 |
6 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 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 | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 GNU General Public License for more details. | 16 GNU General Public License for more details. |
17 | 17 |
18 You should have received a copy of the GNU General Public License | 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 | 19 along with this program; if not, write to the Free Software |
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
21 MA 02110-1301, USA. */ | 21 MA 02110-1301, USA. */ |
22 | 22 |
23 #include "sysdep.h" | 23 #include "sysdep.h" |
24 #include "bfd.h" | 24 #include "bfd.h" |
25 #include "libbfd.h" | 25 #include "libbfd.h" |
26 | 26 |
27 static bfd_boolean scan_960_mach | |
28 PARAMS ((const bfd_arch_info_type *, const char *)); | |
29 static const bfd_arch_info_type *compatible | |
30 PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); | |
31 | |
32 /* This routine is provided a string, and tries to work out if it | 27 /* This routine is provided a string, and tries to work out if it |
33 could possibly refer to the i960 machine pointed at in the | 28 could possibly refer to the i960 machine pointed at in the |
34 info_struct pointer */ | 29 info_struct pointer */ |
35 | 30 |
36 static bfd_boolean | 31 static bfd_boolean |
37 scan_960_mach (ap, string) | 32 scan_960_mach (const bfd_arch_info_type *ap, |
38 const bfd_arch_info_type *ap; | 33 » const char *string) |
39 const char *string; | |
40 { | 34 { |
41 unsigned long machine; | 35 unsigned long machine; |
42 int fail_because_not_80960 = FALSE; | 36 int fail_because_not_80960 = FALSE; |
43 | 37 |
44 /* Look for the string i960 at the front of the string. */ | 38 /* Look for the string i960 at the front of the string. */ |
45 if (strncasecmp ("i960", string, 4) == 0) | 39 if (strncasecmp ("i960", string, 4) == 0) |
46 { | 40 { |
47 string += 4; | 41 string += 4; |
48 | 42 |
49 /* i960 on it's own means core to us. */ | 43 /* i960 on it's own means core to us. */ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return TRUE; | 104 return TRUE; |
111 | 105 |
112 return FALSE; | 106 return FALSE; |
113 } | 107 } |
114 | 108 |
115 /* This routine is provided two arch_infos and works out the i960 | 109 /* This routine is provided two arch_infos and works out the i960 |
116 machine which would be compatible with both and returns a pointer | 110 machine which would be compatible with both and returns a pointer |
117 to its info structure */ | 111 to its info structure */ |
118 | 112 |
119 static const bfd_arch_info_type * | 113 static const bfd_arch_info_type * |
120 compatible (a,b) | 114 compatible (const bfd_arch_info_type *a, |
121 const bfd_arch_info_type *a; | 115 » const bfd_arch_info_type *b) |
122 const bfd_arch_info_type *b; | |
123 { | 116 { |
124 | 117 |
125 /* The i960 has distinct subspecies which may not interbreed: | 118 /* The i960 has distinct subspecies which may not interbreed: |
126 CORE CA | 119 CORE CA |
127 CORE KA KB MC XA | 120 CORE KA KB MC XA |
128 CORE HX JX | 121 CORE HX JX |
129 Any architecture on the same line is compatible, the one on | 122 Any architecture on the same line is compatible, the one on |
130 the right is the least restrictive. | 123 the right is the least restrictive. |
131 | 124 |
132 We represent this information in an array, each machine to a side */ | 125 We represent this information in an array, each machine to a side */ |
(...skipping 16 matching lines...) Expand all Loading... |
149 { KA, KA, KA, KB, MC, XA, ERROR, ERROR, ERROR}, | 142 { KA, KA, KA, KB, MC, XA, ERROR, ERROR, ERROR}, |
150 { KB, KB, KB, KB, MC, XA, ERROR, ERROR, ERROR}, | 143 { KB, KB, KB, KB, MC, XA, ERROR, ERROR, ERROR}, |
151 { MC, MC, MC, MC, MC, XA, ERROR, ERROR, ERROR}, | 144 { MC, MC, MC, MC, MC, XA, ERROR, ERROR, ERROR}, |
152 { XA, XA, XA, XA, XA, XA, ERROR, ERROR, ERROR}, | 145 { XA, XA, XA, XA, XA, XA, ERROR, ERROR, ERROR}, |
153 { CA, CA, ERROR, ERROR, ERROR, ERROR, CA, ERROR, ERROR}, | 146 { CA, CA, ERROR, ERROR, ERROR, ERROR, CA, ERROR, ERROR}, |
154 { JX, JX, ERROR, ERROR, ERROR, ERROR, ERROR, JX, HX }, | 147 { JX, JX, ERROR, ERROR, ERROR, ERROR, ERROR, JX, HX }, |
155 { HX, HX, ERROR, ERROR, ERROR, ERROR, ERROR, HX, HX }, | 148 { HX, HX, ERROR, ERROR, ERROR, ERROR, ERROR, HX, HX }, |
156 }; | 149 }; |
157 | 150 |
158 if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR) | 151 if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR) |
159 { | |
160 return NULL; | 152 return NULL; |
161 } | 153 |
162 else | 154 return (a->mach == matrix[a->mach][b->mach]) ? a : b; |
163 { | |
164 return (a->mach == matrix[a->mach][b->mach]) ? a : b; | |
165 } | |
166 } | 155 } |
167 | 156 |
168 #define N(a,b,d,n) \ | 157 #define N(a,b,d,n) \ |
169 { 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach,n,} | 158 { 32, 32, 8,bfd_arch_i960,a,"i960",b,3,d,compatible,scan_960_mach, \ |
| 159 bfd_arch_default_fill, n,} |
170 | 160 |
171 static const bfd_arch_info_type arch_info_struct[] = | 161 static const bfd_arch_info_type arch_info_struct[] = |
172 { | 162 { |
173 N(bfd_mach_i960_ka_sa,"i960:ka_sa",FALSE, &arch_info_struct[1]), | 163 N(bfd_mach_i960_ka_sa,"i960:ka_sa",FALSE, &arch_info_struct[1]), |
174 N(bfd_mach_i960_kb_sb,"i960:kb_sb",FALSE, &arch_info_struct[2]), | 164 N(bfd_mach_i960_kb_sb,"i960:kb_sb",FALSE, &arch_info_struct[2]), |
175 N(bfd_mach_i960_mc, "i960:mc", FALSE, &arch_info_struct[3]), | 165 N(bfd_mach_i960_mc, "i960:mc", FALSE, &arch_info_struct[3]), |
176 N(bfd_mach_i960_xa, "i960:xa", FALSE, &arch_info_struct[4]), | 166 N(bfd_mach_i960_xa, "i960:xa", FALSE, &arch_info_struct[4]), |
177 N(bfd_mach_i960_ca, "i960:ca", FALSE, &arch_info_struct[5]), | 167 N(bfd_mach_i960_ca, "i960:ca", FALSE, &arch_info_struct[5]), |
178 N(bfd_mach_i960_jx, "i960:jx", FALSE, &arch_info_struct[6]), | 168 N(bfd_mach_i960_jx, "i960:jx", FALSE, &arch_info_struct[6]), |
179 N(bfd_mach_i960_hx, "i960:hx", FALSE, 0), | 169 N(bfd_mach_i960_hx, "i960:hx", FALSE, 0), |
180 }; | 170 }; |
181 | 171 |
182 const bfd_arch_info_type bfd_i960_arch = | 172 const bfd_arch_info_type bfd_i960_arch = |
183 N(bfd_mach_i960_core, "i960:core", TRUE, &arch_info_struct[0]); | 173 N(bfd_mach_i960_core, "i960:core", TRUE, &arch_info_struct[0]); |
OLD | NEW |