| 1 | /* BFD support for the M16C/M32C processors. |
| 2 | Copyright (C) 2004-2017 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of BFD, the Binary File Descriptor library. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 3 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 19 | MA 02110-1301, USA. */ |
| 20 | |
| 21 | #include "sysdep.h" |
| 22 | #include "bfd.h" |
| 23 | #include "libbfd.h" |
| 24 | |
| 25 | /* Like bfd_default_scan but if the string is just "m32c" then |
| 26 | skip the m16c architecture. */ |
| 27 | |
| 28 | static bfd_boolean |
| 29 | m32c_scan (const bfd_arch_info_type * info, const char * string) |
| 30 | { |
| 31 | if (strcmp (string, "m32c") == 0 |
| 32 | && info->mach == bfd_mach_m16c) |
| 33 | return FALSE; |
| 34 | |
| 35 | return bfd_default_scan (info, string); |
| 36 | } |
| 37 | |
| 38 | static const bfd_arch_info_type arch_info_struct[] = |
| 39 | { |
| 40 | { |
| 41 | 32, /* bits per word */ |
| 42 | 32, /* bits per address */ |
| 43 | 8, /* bits per byte */ |
| 44 | bfd_arch_m32c, /* architecture */ |
| 45 | bfd_mach_m32c, /* machine */ |
| 46 | "m32c", /* architecture name */ |
| 47 | "m32c", /* printable name */ |
| 48 | 3, /* section align power */ |
| 49 | FALSE, /* the default ? */ |
| 50 | bfd_default_compatible, /* architecture comparison fn */ |
| 51 | m32c_scan, /* string to architecture convert fn */ |
| 52 | bfd_arch_default_fill, /* Default fill. */ |
| 53 | NULL /* next in list */ |
| 54 | }, |
| 55 | }; |
| 56 | |
| 57 | const bfd_arch_info_type bfd_m32c_arch = |
| 58 | { |
| 59 | 32, /* Bits per word. */ |
| 60 | 32, /* Bits per address. */ |
| 61 | 8, /* Bits per byte. */ |
| 62 | bfd_arch_m32c, /* Architecture. */ |
| 63 | bfd_mach_m16c, /* Machine. */ |
| 64 | "m32c", /* Architecture name. */ |
| 65 | "m16c", /* Printable name. */ |
| 66 | 4, /* Section align power. */ |
| 67 | TRUE, /* The default ? */ |
| 68 | bfd_default_compatible, /* Architecture comparison fn. */ |
| 69 | m32c_scan, /* String to architecture convert fn. */ |
| 70 | bfd_arch_default_fill, /* Default fill. */ |
| 71 | &arch_info_struct[0], /* Next in list. */ |
| 72 | }; |