xref: /netbsd-src/external/gpl3/binutils.old/dist/bfd/cpu-loongarch.c (revision c42dbd0ed2e61fe6eda8590caa852ccf34719964)
1*c42dbd0eSchristos /* BFD support for LoongArch.
2*c42dbd0eSchristos    Copyright (C) 2021-2022 Free Software Foundation, Inc.
3*c42dbd0eSchristos    Contributed by Loongson Ltd.
4*c42dbd0eSchristos 
5*c42dbd0eSchristos    This file is part of BFD, the Binary File Descriptor library.
6*c42dbd0eSchristos 
7*c42dbd0eSchristos    This program is free software; you can redistribute it and/or modify
8*c42dbd0eSchristos    it under the terms of the GNU General Public License as published by
9*c42dbd0eSchristos    the Free Software Foundation; either version 3 of the License, or
10*c42dbd0eSchristos    (at your option) any later version.
11*c42dbd0eSchristos 
12*c42dbd0eSchristos    This program is distributed in the hope that it will be useful,
13*c42dbd0eSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*c42dbd0eSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*c42dbd0eSchristos    GNU General Public License for more details.
16*c42dbd0eSchristos 
17*c42dbd0eSchristos    You should have received a copy of the GNU General Public License
18*c42dbd0eSchristos    along with this program; see the file COPYING3.  If not,
19*c42dbd0eSchristos    see <http://www.gnu.org/licenses/>.  */
20*c42dbd0eSchristos 
21*c42dbd0eSchristos #include "sysdep.h"
22*c42dbd0eSchristos #include "bfd.h"
23*c42dbd0eSchristos #include "libbfd.h"
24*c42dbd0eSchristos 
25*c42dbd0eSchristos static const bfd_arch_info_type bfd_loongarch32_arch =
26*c42dbd0eSchristos {
27*c42dbd0eSchristos   32,				/* 32 bits in a word.  */
28*c42dbd0eSchristos   32,				/* 64 bits in an address.  */
29*c42dbd0eSchristos   8,				/* 8 bits in a byte.  */
30*c42dbd0eSchristos   bfd_arch_loongarch,		/* Architecture.  */
31*c42dbd0eSchristos   bfd_mach_loongarch32, 	/* Machine number - 0 for now.  */
32*c42dbd0eSchristos   "loongarch32",		/* Architecture name.  */
33*c42dbd0eSchristos   "Loongarch32",		/* Printable name.  */
34*c42dbd0eSchristos   3,				/* Section align power.  */
35*c42dbd0eSchristos   false,			/* This is the default architecture.  */
36*c42dbd0eSchristos   bfd_default_compatible,	/* Architecture comparison function.  */
37*c42dbd0eSchristos   bfd_default_scan,		/* String to architecture conversion.  */
38*c42dbd0eSchristos   bfd_arch_default_fill,	/* Default fill.  */
39*c42dbd0eSchristos   NULL, 			/* Next in list.  */
40*c42dbd0eSchristos   0,
41*c42dbd0eSchristos };
42*c42dbd0eSchristos 
43*c42dbd0eSchristos const bfd_arch_info_type bfd_loongarch_arch =
44*c42dbd0eSchristos {
45*c42dbd0eSchristos   32,				/* 32 bits in a word.  */
46*c42dbd0eSchristos   64,				/* 64 bits in an address.  */
47*c42dbd0eSchristos   8,				/* 8 bits in a byte.  */
48*c42dbd0eSchristos   bfd_arch_loongarch,		/* Architecture.  */
49*c42dbd0eSchristos   /* Machine number of LoongArch64 is larger
50*c42dbd0eSchristos    * so that LoongArch64 is compatible to LoongArch32.  */
51*c42dbd0eSchristos   bfd_mach_loongarch64,
52*c42dbd0eSchristos   "loongarch64",		/* Architecture name.  */
53*c42dbd0eSchristos   "Loongarch64",		/* Printable name.  */
54*c42dbd0eSchristos   3,				/* Section align power.  */
55*c42dbd0eSchristos   true, 			/* This is the default architecture.  */
56*c42dbd0eSchristos   bfd_default_compatible,	/* Architecture comparison function.  */
57*c42dbd0eSchristos   bfd_default_scan,		/* String to architecture conversion.  */
58*c42dbd0eSchristos   bfd_arch_default_fill,	/* Default fill.  */
59*c42dbd0eSchristos   &bfd_loongarch32_arch,	/* Next in list.  */
60*c42dbd0eSchristos   0,
61*c42dbd0eSchristos };
62