175fd0b74Schristos /* BFD support for the score processor
2*e992f068Schristos Copyright (C) 2006-2022 Free Software Foundation, Inc.
375fd0b74Schristos Contributed by
475fd0b74Schristos Brain.lin (brain.lin@sunplusct.com)
575fd0b74Schristos Mei Ligang (ligang@sunnorth.com.cn)
675fd0b74Schristos Pei-Lin Tsai (pltsai@sunplus.com)
775fd0b74Schristos
875fd0b74Schristos This file is part of BFD, the Binary File Descriptor library.
975fd0b74Schristos
1075fd0b74Schristos This program is free software; you can redistribute it and/or modify
1175fd0b74Schristos it under the terms of the GNU General Public License as published by
1275fd0b74Schristos the Free Software Foundation; either version 3 of the License, or
1375fd0b74Schristos (at your option) any later version.
1475fd0b74Schristos
1575fd0b74Schristos This program is distributed in the hope that it will be useful,
1675fd0b74Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of
1775fd0b74Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1875fd0b74Schristos GNU General Public License for more details.
1975fd0b74Schristos
2075fd0b74Schristos You should have received a copy of the GNU General Public License
2175fd0b74Schristos along with this program; if not, write to the Free Software
2275fd0b74Schristos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
2375fd0b74Schristos MA 02110-1301, USA. */
2475fd0b74Schristos
2575fd0b74Schristos #include "sysdep.h"
2675fd0b74Schristos #include "bfd.h"
2775fd0b74Schristos #include "libbfd.h"
2875fd0b74Schristos
2975fd0b74Schristos /* This routine is provided two arch_infos and works out which Score
3075fd0b74Schristos machine which would be compatible with both and returns a pointer
3175fd0b74Schristos to its info structure. */
3275fd0b74Schristos
3375fd0b74Schristos static const bfd_arch_info_type *
compatible(const bfd_arch_info_type * a,const bfd_arch_info_type * b)3475fd0b74Schristos compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
3575fd0b74Schristos {
3675fd0b74Schristos /* If a & b are for different architectures we can do nothing. */
3775fd0b74Schristos if (a->arch != b->arch)
3875fd0b74Schristos return NULL;
3975fd0b74Schristos
4075fd0b74Schristos if (a->mach != b->mach)
4175fd0b74Schristos return NULL;
4275fd0b74Schristos
4375fd0b74Schristos return a;
4475fd0b74Schristos }
4575fd0b74Schristos
46012573ebSchristos #define N(machine, print, default, next) \
4775fd0b74Schristos { \
48012573ebSchristos 32, /* Bits in a word. */ \
4975fd0b74Schristos 32, /* Bits in an address. */ \
50012573ebSchristos 8, /* Bits in a byte. */ \
5175fd0b74Schristos bfd_arch_score, \
5275fd0b74Schristos machine, /* Machine number. */ \
5375fd0b74Schristos "score", /* Architecture name. */ \
5475fd0b74Schristos print, /* Printable name. */ \
5575fd0b74Schristos 4, /* Section align power. */ \
5675fd0b74Schristos default, /* The default machine. */ \
5775fd0b74Schristos compatible, \
5875fd0b74Schristos bfd_default_scan, \
5975fd0b74Schristos bfd_arch_default_fill, \
60012573ebSchristos next, \
61012573ebSchristos 0 /* Maximum offset of a reloc from the start of an insn. */ \
6275fd0b74Schristos }
6375fd0b74Schristos
6475fd0b74Schristos static const bfd_arch_info_type arch_info_struct[] =
6575fd0b74Schristos {
66*e992f068Schristos N (bfd_mach_score3, "score3", false, NULL),
6775fd0b74Schristos };
6875fd0b74Schristos
6975fd0b74Schristos const bfd_arch_info_type bfd_score_arch =
70*e992f068Schristos N (bfd_mach_score7, "score7", true, & arch_info_struct[0]);
71