1 |
/* BFD library support routines for the i960 architecture. |
/* BFD library support routines for the i960 architecture. |
2 |
Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001 |
Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002 |
3 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
4 |
Hacked by Steve Chamberlain of Cygnus Support. |
Hacked by Steve Chamberlain of Cygnus Support. |
5 |
|
|
23 |
#include "sysdep.h" |
#include "sysdep.h" |
24 |
#include "libbfd.h" |
#include "libbfd.h" |
25 |
|
|
26 |
static boolean scan_960_mach |
static bfd_boolean scan_960_mach |
27 |
PARAMS ((const bfd_arch_info_type *, const char *)); |
PARAMS ((const bfd_arch_info_type *, const char *)); |
28 |
static const bfd_arch_info_type *compatible |
static const bfd_arch_info_type *compatible |
29 |
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); |
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); |
32 |
could possibly refer to the i960 machine pointed at in the |
could possibly refer to the i960 machine pointed at in the |
33 |
info_struct pointer */ |
info_struct pointer */ |
34 |
|
|
35 |
static boolean |
static bfd_boolean |
36 |
scan_960_mach (ap, string) |
scan_960_mach (ap, string) |
37 |
const bfd_arch_info_type *ap; |
const bfd_arch_info_type *ap; |
38 |
const char *string; |
const char *string; |
39 |
{ |
{ |
40 |
unsigned long machine; |
unsigned long machine; |
41 |
int fail_because_not_80960 = false; |
int fail_because_not_80960 = FALSE; |
42 |
|
|
43 |
/* Look for the string i960 at the front of the string. */ |
/* Look for the string i960 at the front of the string. */ |
44 |
if (strncasecmp ("i960", string, 4) == 0) |
if (strncasecmp ("i960", string, 4) == 0) |
51 |
|
|
52 |
/* "i960:*" is valid, anything else is not. */ |
/* "i960:*" is valid, anything else is not. */ |
53 |
if (* string != ':') |
if (* string != ':') |
54 |
return false; |
return FALSE; |
55 |
|
|
56 |
string ++; |
string ++; |
57 |
} |
} |
61 |
{ |
{ |
62 |
string += 5; |
string += 5; |
63 |
|
|
64 |
/* Sett his to true here. If a correct matching postfix |
/* Set this to TRUE here. If a correct matching postfix |
65 |
is detected below it will be reset to false. */ |
is detected below it will be reset to FALSE. */ |
66 |
fail_because_not_80960 = true; |
fail_because_not_80960 = TRUE; |
67 |
} |
} |
68 |
/* No match, can't be us. */ |
/* No match, can't be us. */ |
69 |
else |
else |
70 |
return false; |
return FALSE; |
71 |
|
|
72 |
if (* string == '\0') |
if (* string == '\0') |
73 |
return false; |
return FALSE; |
74 |
|
|
75 |
if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' && |
if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' && |
76 |
string[3] == 'e' && string[4] == '\0') |
string[3] == 'e' && string[4] == '\0') |
80 |
else if (strcasecmp (string, "kb_sb") == 0) |
else if (strcasecmp (string, "kb_sb") == 0) |
81 |
machine = bfd_mach_i960_kb_sb; |
machine = bfd_mach_i960_kb_sb; |
82 |
else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char. */ |
else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char. */ |
83 |
return false; |
return FALSE; |
84 |
else if (string[0] == 'k' && string[1] == 'b') |
else if (string[0] == 'k' && string[1] == 'b') |
85 |
{ machine = bfd_mach_i960_kb_sb; fail_because_not_80960 = false; } |
{ machine = bfd_mach_i960_kb_sb; fail_because_not_80960 = FALSE; } |
86 |
else if (string[0] == 's' && string[1] == 'b') |
else if (string[0] == 's' && string[1] == 'b') |
87 |
machine = bfd_mach_i960_kb_sb; |
machine = bfd_mach_i960_kb_sb; |
88 |
else if (string[0] == 'm' && string[1] == 'c') |
else if (string[0] == 'm' && string[1] == 'c') |
89 |
{ machine = bfd_mach_i960_mc; fail_because_not_80960 = false; } |
{ machine = bfd_mach_i960_mc; fail_because_not_80960 = FALSE; } |
90 |
else if (string[0] == 'x' && string[1] == 'a') |
else if (string[0] == 'x' && string[1] == 'a') |
91 |
machine = bfd_mach_i960_xa; |
machine = bfd_mach_i960_xa; |
92 |
else if (string[0] == 'c' && string[1] == 'a') |
else if (string[0] == 'c' && string[1] == 'a') |
93 |
{ machine = bfd_mach_i960_ca; fail_because_not_80960 = false; } |
{ machine = bfd_mach_i960_ca; fail_because_not_80960 = FALSE; } |
94 |
else if (string[0] == 'k' && string[1] == 'a') |
else if (string[0] == 'k' && string[1] == 'a') |
95 |
{ machine = bfd_mach_i960_ka_sa; fail_because_not_80960 = false; } |
{ machine = bfd_mach_i960_ka_sa; fail_because_not_80960 = FALSE; } |
96 |
else if (string[0] == 's' && string[1] == 'a') |
else if (string[0] == 's' && string[1] == 'a') |
97 |
machine = bfd_mach_i960_ka_sa; |
machine = bfd_mach_i960_ka_sa; |
98 |
else if (string[0] == 'j' && string[1] == 'x') |
else if (string[0] == 'j' && string[1] == 'x') |
100 |
else if (string[0] == 'h' && string[1] == 'x') |
else if (string[0] == 'h' && string[1] == 'x') |
101 |
machine = bfd_mach_i960_hx; |
machine = bfd_mach_i960_hx; |
102 |
else |
else |
103 |
return false; |
return FALSE; |
104 |
|
|
105 |
if (fail_because_not_80960) |
if (fail_because_not_80960) |
106 |
return false; |
return FALSE; |
107 |
|
|
108 |
if (machine == ap->mach) |
if (machine == ap->mach) |
109 |
return true; |
return TRUE; |
110 |
|
|
111 |
return false; |
return FALSE; |
112 |
} |
} |
113 |
|
|
114 |
/* This routine is provided two arch_infos and works out the i960 |
/* This routine is provided two arch_infos and works out the i960 |
169 |
|
|
170 |
static const bfd_arch_info_type arch_info_struct[] = |
static const bfd_arch_info_type arch_info_struct[] = |
171 |
{ |
{ |
172 |
N(bfd_mach_i960_ka_sa,"i960:ka_sa",false, &arch_info_struct[1]), |
N(bfd_mach_i960_ka_sa,"i960:ka_sa",FALSE, &arch_info_struct[1]), |
173 |
N(bfd_mach_i960_kb_sb,"i960:kb_sb",false, &arch_info_struct[2]), |
N(bfd_mach_i960_kb_sb,"i960:kb_sb",FALSE, &arch_info_struct[2]), |
174 |
N(bfd_mach_i960_mc, "i960:mc", false, &arch_info_struct[3]), |
N(bfd_mach_i960_mc, "i960:mc", FALSE, &arch_info_struct[3]), |
175 |
N(bfd_mach_i960_xa, "i960:xa", false, &arch_info_struct[4]), |
N(bfd_mach_i960_xa, "i960:xa", FALSE, &arch_info_struct[4]), |
176 |
N(bfd_mach_i960_ca, "i960:ca", false, &arch_info_struct[5]), |
N(bfd_mach_i960_ca, "i960:ca", FALSE, &arch_info_struct[5]), |
177 |
N(bfd_mach_i960_jx, "i960:jx", false, &arch_info_struct[6]), |
N(bfd_mach_i960_jx, "i960:jx", FALSE, &arch_info_struct[6]), |
178 |
N(bfd_mach_i960_hx, "i960:hx", false, 0), |
N(bfd_mach_i960_hx, "i960:hx", FALSE, 0), |
179 |
}; |
}; |
180 |
|
|
181 |
const bfd_arch_info_type bfd_i960_arch = |
const bfd_arch_info_type bfd_i960_arch = |
182 |
N(bfd_mach_i960_core, "i960:core", true, &arch_info_struct[0]); |
N(bfd_mach_i960_core, "i960:core", TRUE, &arch_info_struct[0]); |