1 /* BFD library support routines for the Renesas H8/300 architecture.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2003
3 Free Software Foundation, Inc.
4 Hacked by Steve Chamberlain of Cygnus Support.
6 This file is part of BFD, the Binary File Descriptor library.
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.
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.
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. */
26 static bfd_boolean h8300_scan
27 PARAMS ((const struct bfd_arch_info
*, const char *));
28 static const bfd_arch_info_type
* compatible
29 PARAMS ((const bfd_arch_info_type
*, const bfd_arch_info_type
*));
32 h8300_scan (info
, string
)
33 const struct bfd_arch_info
*info
;
36 if (*string
!= 'h' && *string
!= 'H')
59 /* In ELF linker scripts, we typically express the architecture/machine
60 as architecture:machine.
62 So if we've matched so far and encounter a colon, try to match the
63 string following the colon. */
67 return h8300_scan (info
, string
);
70 if (*string
== 'h' || *string
== 'H')
73 if (*string
== 'n' || *string
== 'N')
74 return (info
->mach
== bfd_mach_h8300hn
);
76 return (info
->mach
== bfd_mach_h8300h
);
78 else if (*string
== 's' || *string
== 'S')
81 if (*string
== 'n' || *string
== 'N')
82 return (info
->mach
== bfd_mach_h8300sn
);
84 return (info
->mach
== bfd_mach_h8300s
);
87 return info
->mach
== bfd_mach_h8300
;
90 /* This routine is provided two arch_infos and works out the machine
91 which would be compatible with both and returns a pointer to its
94 static const bfd_arch_info_type
*
96 const bfd_arch_info_type
*in
;
97 const bfd_arch_info_type
*out
;
99 /* It's really not a good idea to mix and match modes. */
100 if (in
->arch
!= out
->arch
|| in
->mach
!= out
->mach
)
106 static const bfd_arch_info_type h8300sn_info_struct
=
108 32, /* 32 bits in a word. */
109 32, /* 32 bits in an address. */
110 8, /* 8 bits in a byte. */
113 "h8300sn", /* Architecture name. */
114 "h8300sn", /* Printable name. */
116 FALSE
, /* The default machine. */
123 static const bfd_arch_info_type h8300hn_info_struct
=
125 32, /* 32 bits in a word. */
126 32, /* 32 bits in an address. */
127 8, /* 8 bits in a byte. */
130 "h8300hn", /* Architecture name. */
131 "h8300hn", /* Printable name. */
133 FALSE
, /* The default machine. */
139 static const bfd_arch_info_type h8300s_info_struct
=
141 32, /* 32 bits in a word. */
142 32, /* 32 bits in an address. */
143 8, /* 8 bits in a byte. */
146 "h8300s", /* Architecture name. */
147 "h8300s", /* Printable name. */
149 FALSE
, /* The default machine. */
152 & h8300hn_info_struct
155 static const bfd_arch_info_type h8300h_info_struct
=
157 32, /* 32 bits in a word. */
158 32, /* 32 bits in an address. */
159 8, /* 8 bits in a byte. */
162 "h8300h", /* Architecture name. */
163 "h8300h", /* Printable name. */
165 FALSE
, /* The default machine. */
171 const bfd_arch_info_type bfd_h8300_arch
=
173 16, /* 16 bits in a word. */
174 16, /* 16 bits in an address. */
175 8, /* 8 bits in a byte. */
178 "h8300", /* Architecture name. */
179 "h8300", /* Printable name. */
181 TRUE
, /* The default machine. */