xref: /netbsd-src/external/gpl3/binutils.old/dist/bfd/cpu-m32c.c (revision e992f068c547fd6e84b3f104dc2340adcc955732)
175fd0b74Schristos /* BFD support for the M16C/M32C processors.
2*e992f068Schristos    Copyright (C) 2004-2022 Free Software Foundation, Inc.
375fd0b74Schristos 
475fd0b74Schristos    This file is part of BFD, the Binary File Descriptor library.
575fd0b74Schristos 
675fd0b74Schristos    This program is free software; you can redistribute it and/or modify
775fd0b74Schristos    it under the terms of the GNU General Public License as published by
875fd0b74Schristos    the Free Software Foundation; either version 3 of the License, or
975fd0b74Schristos    (at your option) any later version.
1075fd0b74Schristos 
1175fd0b74Schristos    This program is distributed in the hope that it will be useful,
1275fd0b74Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1375fd0b74Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1475fd0b74Schristos    GNU General Public License for more details.
1575fd0b74Schristos 
1675fd0b74Schristos    You should have received a copy of the GNU General Public License
1775fd0b74Schristos    along with this program; if not, write to the Free Software
1875fd0b74Schristos    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1975fd0b74Schristos    MA 02110-1301, USA.  */
2075fd0b74Schristos 
2175fd0b74Schristos #include "sysdep.h"
2275fd0b74Schristos #include "bfd.h"
2375fd0b74Schristos #include "libbfd.h"
2475fd0b74Schristos 
2575fd0b74Schristos /* Like bfd_default_scan but if the string is just "m32c" then
2675fd0b74Schristos    skip the m16c architecture.  */
2775fd0b74Schristos 
28*e992f068Schristos static bool
m32c_scan(const bfd_arch_info_type * info,const char * string)2975fd0b74Schristos m32c_scan (const bfd_arch_info_type * info, const char * string)
3075fd0b74Schristos {
3175fd0b74Schristos   if (strcmp (string, "m32c") == 0
3275fd0b74Schristos       && info->mach == bfd_mach_m16c)
33*e992f068Schristos     return false;
3475fd0b74Schristos 
3575fd0b74Schristos   return bfd_default_scan (info, string);
3675fd0b74Schristos }
3775fd0b74Schristos 
38012573ebSchristos #define N(number, print, align, default, next)			   \
39012573ebSchristos { 32, 32, 8, bfd_arch_m32c, number, "m32c", print, align, default, \
40012573ebSchristos   bfd_default_compatible, m32c_scan, bfd_arch_default_fill, next, 0 }
41012573ebSchristos 
42012573ebSchristos static const bfd_arch_info_type arch_info_struct =
43*e992f068Schristos   N (bfd_mach_m32c, "m32c", 3, false, NULL);
4475fd0b74Schristos 
4575fd0b74Schristos const bfd_arch_info_type bfd_m32c_arch =
46*e992f068Schristos   N (bfd_mach_m16c, "m16c", 4, true, &arch_info_struct);
47012573ebSchristos 
48