1 | /* BFD library support routines for the Hitachi H8/300 architecture.
|
---|
2 | Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000
|
---|
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 | int bfd_default_scan_num_mach ();
|
---|
27 |
|
---|
28 | static boolean
|
---|
29 | h8300_scan (info, string)
|
---|
30 | const struct bfd_arch_info *info;
|
---|
31 | const char *string;
|
---|
32 | {
|
---|
33 | if (*string != 'h' && *string != 'H')
|
---|
34 | return false;
|
---|
35 |
|
---|
36 | string++;
|
---|
37 | if (*string != '8')
|
---|
38 | return false;
|
---|
39 |
|
---|
40 | string++;
|
---|
41 | if (*string == '/')
|
---|
42 | string++;
|
---|
43 |
|
---|
44 | if (*string != '3')
|
---|
45 | return false;
|
---|
46 | string++;
|
---|
47 | if (*string != '0')
|
---|
48 | return false;
|
---|
49 | string++;
|
---|
50 | if (*string != '0')
|
---|
51 | return false;
|
---|
52 | string++;
|
---|
53 | if (*string == '-')
|
---|
54 | string++;
|
---|
55 | if (*string == 'h' || *string == 'H')
|
---|
56 | {
|
---|
57 | return (info->mach == bfd_mach_h8300h);
|
---|
58 | }
|
---|
59 | else if (*string == 's' || *string == 'S')
|
---|
60 | {
|
---|
61 | return (info->mach == bfd_mach_h8300s);
|
---|
62 | }
|
---|
63 | else
|
---|
64 | {
|
---|
65 | return info->mach == bfd_mach_h8300;
|
---|
66 | }
|
---|
67 | }
|
---|
68 |
|
---|
69 | /* This routine is provided two arch_infos and works out the machine
|
---|
70 | which would be compatible with both and returns a pointer to its
|
---|
71 | 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 | #if 0
|
---|
99 | local_bfd_reloc_type_lookup,
|
---|
100 | #endif
|
---|
101 | 0,
|
---|
102 | };
|
---|
103 |
|
---|
104 | static const bfd_arch_info_type h8300h_info_struct =
|
---|
105 | {
|
---|
106 | 32, /* 32 bits in a word */
|
---|
107 | 32, /* 32 bits in an address */
|
---|
108 | 8, /* 8 bits in a byte */
|
---|
109 | bfd_arch_h8300,
|
---|
110 | bfd_mach_h8300h,
|
---|
111 | "h8300h", /* arch_name */
|
---|
112 | "h8300h", /* printable name */
|
---|
113 | 1,
|
---|
114 | false, /* the default machine */
|
---|
115 | compatible,
|
---|
116 | h8300_scan,
|
---|
117 | #if 0
|
---|
118 | local_bfd_reloc_type_lookup,
|
---|
119 | #endif
|
---|
120 | &h8300_info_struct,
|
---|
121 | };
|
---|
122 |
|
---|
123 | const bfd_arch_info_type bfd_h8300_arch =
|
---|
124 | {
|
---|
125 | 32, /* 32 bits in a word */
|
---|
126 | 32, /* 32 bits in an address */
|
---|
127 | 8, /* 8 bits in a byte */
|
---|
128 | bfd_arch_h8300,
|
---|
129 | bfd_mach_h8300s,
|
---|
130 | "h8300s", /* arch_name */
|
---|
131 | "h8300s", /* printable name */
|
---|
132 | 1,
|
---|
133 | false, /* the default machine */
|
---|
134 | compatible,
|
---|
135 | h8300_scan,
|
---|
136 | #if 0
|
---|
137 | local_bfd_reloc_type_lookup,
|
---|
138 | #endif
|
---|
139 | &h8300h_info_struct,
|
---|
140 | };
|
---|