Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | /* BFD library support routines for the Hitachi H8/300 architecture. |
2 | Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. | |
3 | Hacked by Steve Chamberlain of Cygnus Support. | |
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 | |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #include "bfd.h" | |
22 | #include "sysdep.h" | |
23 | #include "libbfd.h" | |
24 | ||
25 | int bfd_default_scan_num_mach (); | |
26 | ||
27 | static boolean | |
28 | h8300_scan (info, string) | |
29 | const struct bfd_arch_info *info; | |
30 | const char *string; | |
31 | { | |
32 | if (*string != 'h' && *string != 'H') | |
33 | return false; | |
34 | ||
35 | string++; | |
36 | if (*string != '8') | |
37 | return false; | |
38 | ||
39 | string++; | |
40 | if (*string == '/') | |
41 | string++; | |
42 | ||
43 | if (*string != '3') | |
44 | return false; | |
45 | string++; | |
46 | if (*string != '0') | |
47 | return false; | |
48 | string++; | |
49 | if (*string != '0') | |
50 | return false; | |
51 | string++; | |
52 | if (*string == '-') | |
53 | string++; | |
54 | if (*string == 'h' || *string == 'H') | |
55 | { | |
56 | return (info->mach == bfd_mach_h8300h); | |
57 | } | |
58 | else if (*string == 's' || *string == 'S') | |
59 | { | |
60 | return (info->mach == bfd_mach_h8300s); | |
61 | } | |
62 | else | |
63 | { | |
64 | return info->mach == bfd_mach_h8300; | |
65 | } | |
66 | } | |
67 | ||
68 | ||
69 | /* This routine is provided two arch_infos and works out the | |
70 | machine which would be compatible with both and returns a pointer | |
71 | to its info structure */ | |
72 | ||
73 | static const bfd_arch_info_type * | |
74 | compatible (in, out) | |
75 | const bfd_arch_info_type * in; | |
76 | const bfd_arch_info_type * out; | |
77 | { | |
78 | /* It's really not a good idea to mix and match modes. */ | |
79 | if (in->mach != out->mach) | |
80 | return 0; | |
81 | else | |
82 | return in; | |
83 | } | |
84 | ||
85 | static const bfd_arch_info_type h8300_info_struct = | |
86 | { | |
87 | 16, /* 16 bits in a word */ | |
88 | 16, /* 16 bits in an address */ | |
89 | 8, /* 8 bits in a byte */ | |
90 | bfd_arch_h8300, | |
91 | bfd_mach_h8300, | |
92 | "h8300", /* arch_name */ | |
93 | "h8300", /* printable name */ | |
94 | 1, | |
95 | true, /* the default machine */ | |
96 | compatible, | |
97 | h8300_scan, | |
98 | /* local_bfd_reloc_type_lookup, */ | |
99 | 0, | |
100 | }; | |
101 | ||
102 | static const bfd_arch_info_type h8300h_info_struct = | |
103 | { | |
104 | 32, /* 32 bits in a word */ | |
105 | 32, /* 32 bits in an address */ | |
106 | 8, /* 8 bits in a byte */ | |
107 | bfd_arch_h8300, | |
108 | bfd_mach_h8300h, | |
109 | "h8300h", /* arch_name */ | |
110 | "h8300h", /* printable name */ | |
111 | 1, | |
112 | false, /* the default machine */ | |
113 | compatible, | |
114 | h8300_scan, | |
115 | /* local_bfd_reloc_type_lookup, */ | |
116 | &h8300_info_struct, | |
117 | }; | |
118 | ||
119 | const bfd_arch_info_type bfd_h8300_arch = | |
120 | { | |
121 | 32, /* 32 bits in a word */ | |
122 | 32, /* 32 bits in an address */ | |
123 | 8, /* 8 bits in a byte */ | |
124 | bfd_arch_h8300, | |
125 | bfd_mach_h8300s, | |
126 | "h8300s", /* arch_name */ | |
127 | "h8300s", /* printable name */ | |
128 | 1, | |
129 | false, /* the default machine */ | |
130 | compatible, | |
131 | h8300_scan, | |
132 | /* local_bfd_reloc_type_lookup, */ | |
133 | &h8300h_info_struct, | |
134 | }; |