12a6b7db3Sskrll /* BFD support for the M16C/M32C processors.
2*cb63e24eSchristos Copyright (C) 2004-2024 Free Software Foundation, Inc.
32a6b7db3Sskrll
42a6b7db3Sskrll This file is part of BFD, the Binary File Descriptor library.
52a6b7db3Sskrll
62a6b7db3Sskrll This program is free software; you can redistribute it and/or modify
72a6b7db3Sskrll it under the terms of the GNU General Public License as published by
82a6b7db3Sskrll the Free Software Foundation; either version 3 of the License, or
92a6b7db3Sskrll (at your option) any later version.
102a6b7db3Sskrll
112a6b7db3Sskrll This program is distributed in the hope that it will be useful,
122a6b7db3Sskrll but WITHOUT ANY WARRANTY; without even the implied warranty of
132a6b7db3Sskrll MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142a6b7db3Sskrll GNU General Public License for more details.
152a6b7db3Sskrll
162a6b7db3Sskrll You should have received a copy of the GNU General Public License
172a6b7db3Sskrll along with this program; if not, write to the Free Software
182a6b7db3Sskrll Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
192a6b7db3Sskrll MA 02110-1301, USA. */
202a6b7db3Sskrll
212a6b7db3Sskrll #include "sysdep.h"
222a6b7db3Sskrll #include "bfd.h"
232a6b7db3Sskrll #include "libbfd.h"
242a6b7db3Sskrll
2531799520Schristos /* Like bfd_default_scan but if the string is just "m32c" then
2631799520Schristos skip the m16c architecture. */
2731799520Schristos
284f645668Schristos static bool
m32c_scan(const bfd_arch_info_type * info,const char * string)2931799520Schristos m32c_scan (const bfd_arch_info_type * info, const char * string)
3031799520Schristos {
3131799520Schristos if (strcmp (string, "m32c") == 0
3231799520Schristos && info->mach == bfd_mach_m16c)
334f645668Schristos return false;
3431799520Schristos
3531799520Schristos return bfd_default_scan (info, string);
3631799520Schristos }
3731799520Schristos
386f4ced0bSchristos #define N(number, print, align, default, next) \
396f4ced0bSchristos { 32, 32, 8, bfd_arch_m32c, number, "m32c", print, align, default, \
406f4ced0bSchristos bfd_default_compatible, m32c_scan, bfd_arch_default_fill, next, 0 }
416f4ced0bSchristos
426f4ced0bSchristos static const bfd_arch_info_type arch_info_struct =
434f645668Schristos N (bfd_mach_m32c, "m32c", 3, false, NULL);
442a6b7db3Sskrll
452a6b7db3Sskrll const bfd_arch_info_type bfd_m32c_arch =
464f645668Schristos N (bfd_mach_m16c, "m16c", 4, true, &arch_info_struct);
476f4ced0bSchristos
48