Commit | Line | Data |
---|---|---|
36591ba1 | 1 | /* BFD support for the Altera Nios II processor. |
82704155 | 2 | Copyright (C) 2012-2019 Free Software Foundation, Inc. |
36591ba1 SL |
3 | Contributed by Nigel Gray (ngray@altera.com). |
4 | Contributed by Mentor Graphics, Inc. | |
5 | ||
6 | This file is part of BFD, the Binary File Descriptor library. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 3 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
21 | MA 02110-1301, USA. */ | |
22 | ||
23 | #include "sysdep.h" | |
24 | #include "bfd.h" | |
25 | #include "libbfd.h" | |
26 | ||
965b1d80 SL |
27 | static const bfd_arch_info_type * |
28 | nios2_compatible (const bfd_arch_info_type *a, | |
29 | const bfd_arch_info_type *b) | |
30 | { | |
31 | if (a->arch != b->arch) | |
32 | return NULL; | |
33 | ||
34 | if (a->bits_per_word != b->bits_per_word) | |
35 | return NULL; | |
36 | ||
37 | if (a->mach == bfd_mach_nios2) | |
38 | return a; | |
39 | else if (b->mach == bfd_mach_nios2) | |
40 | return b; | |
41 | else if (a->mach != b->mach) | |
42 | return NULL; | |
43 | ||
44 | return a; | |
45 | } | |
46 | ||
aebcfb76 | 47 | #define N(NUMBER, PRINT, DEFAULT, NEXT) \ |
36591ba1 | 48 | { \ |
aebcfb76 NC |
49 | 32, /* Bits in a word. */ \ |
50 | 32, /* Bits in an address. */ \ | |
51 | 8, /* Bits in a byte. */ \ | |
36591ba1 SL |
52 | bfd_arch_nios2, \ |
53 | NUMBER, \ | |
54 | "nios2", \ | |
55 | PRINT, \ | |
56 | 3, \ | |
57 | DEFAULT, \ | |
965b1d80 | 58 | nios2_compatible, \ |
36591ba1 | 59 | bfd_default_scan, \ |
07d6d2b8 | 60 | bfd_arch_default_fill, \ |
aebcfb76 NC |
61 | NEXT, \ |
62 | 0 /* Maximum offset of a reloc from the start of an insn. */ \ | |
36591ba1 SL |
63 | } |
64 | ||
965b1d80 SL |
65 | #define NIOS2R1_NEXT &arch_info_struct[0] |
66 | #define NIOS2R2_NEXT &arch_info_struct[1] | |
67 | ||
aebcfb76 | 68 | static const bfd_arch_info_type arch_info_struct[2] = |
965b1d80 | 69 | { |
aebcfb76 NC |
70 | N (bfd_mach_nios2r1, "nios2:r1", FALSE, NIOS2R2_NEXT), |
71 | N (bfd_mach_nios2r2, "nios2:r2", FALSE, NULL), | |
965b1d80 SL |
72 | }; |
73 | ||
1b786873 | 74 | const bfd_arch_info_type bfd_nios2_arch = |
aebcfb76 | 75 | N (bfd_mach_nios2, "nios2", TRUE, NIOS2R1_NEXT); |