| 1 | /* BFD library support routines for the Hitachi-SH architecture. |
| 2 | Copyright 1993, 1994, 1997, 1998, 2000, 2001, 2002, 2003 |
| 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 | #if 0 |
| 27 | /* This routine is provided two arch_infos and returns whether |
| 28 | they'd be compatible. */ |
| 29 | |
| 30 | static const bfd_arch_info_type * |
| 31 | compatible (a,b) |
| 32 | const bfd_arch_info_type *a; |
| 33 | const bfd_arch_info_type *b; |
| 34 | { |
| 35 | if (a->arch != b->arch || a->mach != b->mach) |
| 36 | return NULL; |
| 37 | return a; |
| 38 | } |
| 39 | #endif |
| 40 | |
| 41 | #define SH_NEXT &arch_info_struct[0] |
| 42 | #define SH2_NEXT &arch_info_struct[1] |
| 43 | #define SH2E_NEXT &arch_info_struct[2] |
| 44 | #define SH_DSP_NEXT &arch_info_struct[3] |
| 45 | #define SH3_NEXT &arch_info_struct[4] |
| 46 | #define SH3_DSP_NEXT &arch_info_struct[5] |
| 47 | #define SH3E_NEXT &arch_info_struct[6] |
| 48 | #define SH4_NEXT &arch_info_struct[7] |
| 49 | #define SH64_NEXT NULL |
| 50 | |
| 51 | static const bfd_arch_info_type arch_info_struct[] = |
| 52 | { |
| 53 | { |
| 54 | 32, /* 32 bits in a word */ |
| 55 | 32, /* 32 bits in an address */ |
| 56 | 8, /* 8 bits in a byte */ |
| 57 | bfd_arch_sh, |
| 58 | bfd_mach_sh2, |
| 59 | "sh", /* arch_name */ |
| 60 | "sh2", /* printable name */ |
| 61 | 1, |
| 62 | FALSE, /* not the default */ |
| 63 | bfd_default_compatible, |
| 64 | bfd_default_scan, |
| 65 | SH2_NEXT |
| 66 | }, |
| 67 | { |
| 68 | 32, /* 32 bits in a word */ |
| 69 | 32, /* 32 bits in an address */ |
| 70 | 8, /* 8 bits in a byte */ |
| 71 | bfd_arch_sh, |
| 72 | bfd_mach_sh2e, |
| 73 | "sh", /* arch_name */ |
| 74 | "sh2e", /* printable name */ |
| 75 | 1, |
| 76 | FALSE, /* not the default */ |
| 77 | bfd_default_compatible, |
| 78 | bfd_default_scan, |
| 79 | SH2E_NEXT |
| 80 | }, |
| 81 | { |
| 82 | 32, /* 32 bits in a word */ |
| 83 | 32, /* 32 bits in an address */ |
| 84 | 8, /* 8 bits in a byte */ |
| 85 | bfd_arch_sh, |
| 86 | bfd_mach_sh_dsp, |
| 87 | "sh", /* arch_name */ |
| 88 | "sh-dsp", /* printable name */ |
| 89 | 1, |
| 90 | FALSE, /* not the default */ |
| 91 | bfd_default_compatible, |
| 92 | bfd_default_scan, |
| 93 | SH_DSP_NEXT |
| 94 | }, |
| 95 | { |
| 96 | 32, /* 32 bits in a word */ |
| 97 | 32, /* 32 bits in an address */ |
| 98 | 8, /* 8 bits in a byte */ |
| 99 | bfd_arch_sh, |
| 100 | bfd_mach_sh3, |
| 101 | "sh", /* arch_name */ |
| 102 | "sh3", /* printable name */ |
| 103 | 1, |
| 104 | FALSE, /* not the default */ |
| 105 | bfd_default_compatible, |
| 106 | bfd_default_scan, |
| 107 | SH3_NEXT |
| 108 | }, |
| 109 | { |
| 110 | 32, /* 32 bits in a word */ |
| 111 | 32, /* 32 bits in an address */ |
| 112 | 8, /* 8 bits in a byte */ |
| 113 | bfd_arch_sh, |
| 114 | bfd_mach_sh3_dsp, |
| 115 | "sh", /* arch_name */ |
| 116 | "sh3-dsp", /* printable name */ |
| 117 | 1, |
| 118 | FALSE, /* not the default */ |
| 119 | bfd_default_compatible, |
| 120 | bfd_default_scan, |
| 121 | SH3_DSP_NEXT |
| 122 | }, |
| 123 | { |
| 124 | 32, /* 32 bits in a word */ |
| 125 | 32, /* 32 bits in an address */ |
| 126 | 8, /* 8 bits in a byte */ |
| 127 | bfd_arch_sh, |
| 128 | bfd_mach_sh3e, |
| 129 | "sh", /* arch_name */ |
| 130 | "sh3e", /* printable name */ |
| 131 | 1, |
| 132 | FALSE, /* not the default */ |
| 133 | bfd_default_compatible, |
| 134 | bfd_default_scan, |
| 135 | SH3E_NEXT |
| 136 | }, |
| 137 | { |
| 138 | 32, /* 32 bits in a word */ |
| 139 | 32, /* 32 bits in an address */ |
| 140 | 8, /* 8 bits in a byte */ |
| 141 | bfd_arch_sh, |
| 142 | bfd_mach_sh4, |
| 143 | "sh", /* arch_name */ |
| 144 | "sh4", /* printable name */ |
| 145 | 1, |
| 146 | FALSE, /* not the default */ |
| 147 | bfd_default_compatible, |
| 148 | bfd_default_scan, |
| 149 | SH4_NEXT |
| 150 | }, |
| 151 | { |
| 152 | 64, /* 64 bits in a word */ |
| 153 | 64, /* 64 bits in an address */ |
| 154 | 8, /* 8 bits in a byte */ |
| 155 | bfd_arch_sh, |
| 156 | bfd_mach_sh5, |
| 157 | "sh", /* arch_name */ |
| 158 | "sh5", /* printable name */ |
| 159 | 1, |
| 160 | FALSE, /* not the default */ |
| 161 | bfd_default_compatible, |
| 162 | bfd_default_scan, |
| 163 | SH64_NEXT |
| 164 | }, |
| 165 | }; |
| 166 | |
| 167 | const bfd_arch_info_type bfd_sh_arch = |
| 168 | { |
| 169 | 32, /* 32 bits in a word */ |
| 170 | 32, /* 32 bits in an address */ |
| 171 | 8, /* 8 bits in a byte */ |
| 172 | bfd_arch_sh, |
| 173 | bfd_mach_sh, |
| 174 | "sh", /* arch_name */ |
| 175 | "sh", /* printable name */ |
| 176 | 1, |
| 177 | TRUE, /* the default machine */ |
| 178 | bfd_default_compatible, |
| 179 | bfd_default_scan, |
| 180 | SH_NEXT |
| 181 | }; |