1 /* BFD library support routines for the Hitachi H8/300 architecture.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001
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 int bfd_default_scan_num_mach ();
28 static boolean h8300_scan
29 PARAMS ((const struct bfd_arch_info *, const char *));
30 static const bfd_arch_info_type * compatible
31 PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
34 h8300_scan (info, string)
35 const struct bfd_arch_info *info;
38 if (*string != 'h' && *string != 'H')
61 /* In ELF linker scripts, we typically express the architecture/machine
62 as architecture:machine.
64 So if we've matched so far and encounter a colon, try to match the
65 string following the colon. */
69 h8300_scan (info, string);
72 if (*string == 'h' || *string == 'H')
74 return (info->mach == bfd_mach_h8300h);
76 else if (*string == 's' || *string == 'S')
78 return (info->mach == bfd_mach_h8300s);
82 return info->mach == bfd_mach_h8300;
86 /* This routine is provided two arch_infos and works out the machine
87 which would be compatible with both and returns a pointer to its
90 static const bfd_arch_info_type *
92 const bfd_arch_info_type *in;
93 const bfd_arch_info_type *out;
95 /* It's really not a good idea to mix and match modes. */
96 if (in->mach != out->mach)
102 static const bfd_arch_info_type h8300_info_struct =
104 16, /* 16 bits in a word */
105 16, /* 16 bits in an address */
106 8, /* 8 bits in a byte */
109 "h8300", /* arch_name */
110 "h8300", /* printable name */
112 true, /* the default machine */
116 local_bfd_reloc_type_lookup,
121 static const bfd_arch_info_type h8300h_info_struct =
123 32, /* 32 bits in a word */
124 32, /* 32 bits in an address */
125 8, /* 8 bits in a byte */
128 "h8300h", /* arch_name */
129 "h8300h", /* printable name */
131 false, /* the default machine */
135 local_bfd_reloc_type_lookup,
140 const bfd_arch_info_type bfd_h8300_arch =
142 32, /* 32 bits in a word */
143 32, /* 32 bits in an address */
144 8, /* 8 bits in a byte */
147 "h8300s", /* arch_name */
148 "h8300s", /* printable name */
150 false, /* the default machine */
154 local_bfd_reloc_type_lookup,