12a6b7db3Sskrll /* BFD support for the score processor
2*cb63e24eSchristos Copyright (C) 2006-2024 Free Software Foundation, Inc.
32a6b7db3Sskrll Contributed by
431799520Schristos Brain.lin (brain.lin@sunplusct.com)
52a6b7db3Sskrll Mei Ligang (ligang@sunnorth.com.cn)
62a6b7db3Sskrll Pei-Lin Tsai (pltsai@sunplus.com)
72a6b7db3Sskrll
82a6b7db3Sskrll This file is part of BFD, the Binary File Descriptor library.
92a6b7db3Sskrll
102a6b7db3Sskrll This program is free software; you can redistribute it and/or modify
112a6b7db3Sskrll it under the terms of the GNU General Public License as published by
122a6b7db3Sskrll the Free Software Foundation; either version 3 of the License, or
132a6b7db3Sskrll (at your option) any later version.
142a6b7db3Sskrll
152a6b7db3Sskrll This program is distributed in the hope that it will be useful,
162a6b7db3Sskrll but WITHOUT ANY WARRANTY; without even the implied warranty of
172a6b7db3Sskrll MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
182a6b7db3Sskrll GNU General Public License for more details.
192a6b7db3Sskrll
202a6b7db3Sskrll You should have received a copy of the GNU General Public License
212a6b7db3Sskrll along with this program; if not, write to the Free Software
222a6b7db3Sskrll Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
232a6b7db3Sskrll MA 02110-1301, USA. */
242a6b7db3Sskrll
2531799520Schristos #include "sysdep.h"
26883529b6Schristos #include "bfd.h"
272a6b7db3Sskrll #include "libbfd.h"
282a6b7db3Sskrll
2931799520Schristos /* This routine is provided two arch_infos and works out which Score
3031799520Schristos machine which would be compatible with both and returns a pointer
3131799520Schristos to its info structure. */
3231799520Schristos
3331799520Schristos static const bfd_arch_info_type *
compatible(const bfd_arch_info_type * a,const bfd_arch_info_type * b)3431799520Schristos compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
352a6b7db3Sskrll {
3631799520Schristos /* If a & b are for different architectures we can do nothing. */
3731799520Schristos if (a->arch != b->arch)
3831799520Schristos return NULL;
3931799520Schristos
4031799520Schristos if (a->mach != b->mach)
4131799520Schristos return NULL;
4231799520Schristos
4331799520Schristos return a;
4431799520Schristos }
4531799520Schristos
466f4ced0bSchristos #define N(machine, print, default, next) \
4731799520Schristos { \
486f4ced0bSchristos 32, /* Bits in a word. */ \
4931799520Schristos 32, /* Bits in an address. */ \
506f4ced0bSchristos 8, /* Bits in a byte. */ \
5131799520Schristos bfd_arch_score, \
5231799520Schristos machine, /* Machine number. */ \
5331799520Schristos "score", /* Architecture name. */ \
5431799520Schristos print, /* Printable name. */ \
5531799520Schristos 4, /* Section align power. */ \
5631799520Schristos default, /* The default machine. */ \
5731799520Schristos compatible, \
5831799520Schristos bfd_default_scan, \
59883529b6Schristos bfd_arch_default_fill, \
606f4ced0bSchristos next, \
616f4ced0bSchristos 0 /* Maximum offset of a reloc from the start of an insn. */ \
6231799520Schristos }
6331799520Schristos
6431799520Schristos static const bfd_arch_info_type arch_info_struct[] =
6531799520Schristos {
664f645668Schristos N (bfd_mach_score3, "score3", false, NULL),
672a6b7db3Sskrll };
6831799520Schristos
6931799520Schristos const bfd_arch_info_type bfd_score_arch =
704f645668Schristos N (bfd_mach_score7, "score7", true, & arch_info_struct[0]);
71