OSDN Git Service

Touches most files in bfd/, so likely will be blamed for everything..
[pf3gnuchains/pf3gnuchains3x.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
62 static const bfd_arch_info_type arch_info_struct[] =
63 {
64   {
65     32,                         /* 32 bits in a word */
66     32,                         /* 32 bits in an address */
67     8,                          /* 8 bits in a byte */
68     bfd_arch_sh,
69     bfd_mach_sh2,
70     "sh",                       /* arch_name  */
71     "sh2",                      /* printable name */
72     1,
73     false,                      /* not the default */
74     bfd_default_compatible,
75     scan_mach,
76     SH2_NEXT
77   },
78   {
79     32,                         /* 32 bits in a word */
80     32,                         /* 32 bits in an address */
81     8,                          /* 8 bits in a byte */
82     bfd_arch_sh,
83     bfd_mach_sh_dsp,
84     "sh",                       /* arch_name  */
85     "sh-dsp",                   /* printable name */
86     1,
87     false,                      /* not the default */
88     bfd_default_compatible,
89     scan_mach,
90     SH_DSP_NEXT
91   },
92   {
93     32,                         /* 32 bits in a word */
94     32,                         /* 32 bits in an address */
95     8,                          /* 8 bits in a byte */
96     bfd_arch_sh,
97     bfd_mach_sh3,
98     "sh",                       /* arch_name  */
99     "sh3",                      /* printable name */
100     1,
101     false,                      /* not the default */
102     bfd_default_compatible,
103     scan_mach,
104     SH3_NEXT
105   },
106   {
107     32,                         /* 32 bits in a word */
108     32,                         /* 32 bits in an address */
109     8,                          /* 8 bits in a byte */
110     bfd_arch_sh,
111     bfd_mach_sh3_dsp,
112     "sh",                       /* arch_name  */
113     "sh3-dsp",                  /* printable name */
114     1,
115     false,                      /* not the default */
116     bfd_default_compatible,
117     scan_mach,
118     SH3_DSP_NEXT
119   },
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_sh,
125     bfd_mach_sh3e,
126     "sh",                       /* arch_name  */
127     "sh3e",                     /* printable name */
128     1,
129     false,                      /* not the default */
130     bfd_default_compatible,
131     scan_mach,
132     SH3E_NEXT
133   },
134   {
135     32,                         /* 32 bits in a word */
136     32,                         /* 32 bits in an address */
137     8,                          /* 8 bits in a byte */
138     bfd_arch_sh,
139     bfd_mach_sh4,
140     "sh",                       /* arch_name  */
141     "sh4",                      /* printable name */
142     1,
143     false,                      /* not the default */
144     bfd_default_compatible,
145     scan_mach,
146     SH4_NEXT
147   },
148 };
149
150 const bfd_arch_info_type bfd_sh_arch =
151 {
152   32,                           /* 32 bits in a word */
153   32,                           /* 32 bits in an address */
154   8,                            /* 8 bits in a byte */
155   bfd_arch_sh,
156   bfd_mach_sh,
157   "sh",                         /* arch_name  */
158   "sh",                         /* printable name */
159   1,
160   true,                         /* the default machine */
161   bfd_default_compatible,
162   scan_mach,
163   SH_NEXT
164 };