1146515Sru/* BFD support for the score processor
2114472Sru   Copyright (C) 2006-2024 Free Software Foundation, Inc.
3114472Sru   Contributed by
4146515Sru   Brain.lin (brain.lin@sunplusct.com)
5146515Sru   Mei Ligang (ligang@sunnorth.com.cn)
6114472Sru   Pei-Lin Tsai (pltsai@sunplus.com)
7114472Sru
8114472Sru   This file is part of BFD, the Binary File Descriptor library.
9114472Sru
10116525Sru   This program is free software; you can redistribute it and/or modify
11146515Sru   it under the terms of the GNU General Public License as published by
12146515Sru   the Free Software Foundation; either version 3 of the License, or
13116525Sru   (at your option) any later version.
14116525Sru
15116525Sru   This program is distributed in the hope that it will be useful,
16116525Sru   but WITHOUT ANY WARRANTY; without even the implied warranty of
17116525Sru   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18116525Sru   GNU General Public License for more details.
19146515Sru
20116525Sru   You should have received a copy of the GNU General Public License
21116525Sru   along with this program; if not, write to the Free Software
22116525Sru   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23116525Sru   MA 02110-1301, USA.  */
24116525Sru
25146515Sru#include "sysdep.h"
2642660Smarkm#include "bfd.h"
27116525Sru#include "libbfd.h"
28116525Sru
29116525Sru/* This routine is provided two arch_infos and works out which Score
30146515Sru   machine which would be compatible with both and returns a pointer
31146515Sru   to its info structure.  */
32
33static const bfd_arch_info_type *
34compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b)
35{
36  /* If a & b are for different architectures we can do nothing.  */
37  if (a->arch != b->arch)
38    return NULL;
39
40  if (a->mach != b->mach)
41    return NULL;
42
43  return a;
44}
45
46#define N(machine, print, default, next)			\
47{								\
48  32,				/* Bits in a word.  */		\
49  32,				/* Bits in an address.  */	\
50  8,				/* Bits in a byte.  */		\
51  bfd_arch_score,						\
52  machine,			/* Machine number.  */		\
53  "score",			/* Architecture name.   */	\
54  print,			/* Printable name.  */		\
55  4,				/* Section align power.  */	\
56  default,			/* The default machine.  */	\
57  compatible,							\
58  bfd_default_scan,						\
59  bfd_arch_default_fill,					\
60  next,								\
61  0 /* Maximum offset of a reloc from the start of an insn.  */ \
62}
63
64static const bfd_arch_info_type arch_info_struct[] =
65{
66  N (bfd_mach_score3, "score3", false, NULL),
67};
68
69const bfd_arch_info_type bfd_score_arch =
70  N (bfd_mach_score7, "score7", true, & arch_info_struct[0]);
71