xref: /netbsd-src/external/gpl3/gdb/dist/include/elf/nios2.h (revision 02f41505626a9ceb584d30d0789203495760ac88)
1a2e2270fSchristos /* Altera Nios II ELF support for BFD.
2*02f41505Schristos    Copyright (C) 2012-2024 Free Software Foundation, Inc.
3a2e2270fSchristos    Contributed by Nigel Gray (ngray@altera.com).
4a2e2270fSchristos    Contributed by Mentor Graphics, Inc.
5a2e2270fSchristos 
6a2e2270fSchristos    This file is part of BFD, the Binary File Descriptor library.
7a2e2270fSchristos 
8a2e2270fSchristos    This program is free software; you can redistribute it and/or modify
9a2e2270fSchristos    it under the terms of the GNU General Public License as published by
10a2e2270fSchristos    the Free Software Foundation; either version 3 of the License, or
11a2e2270fSchristos    (at your option) any later version.
12a2e2270fSchristos 
13a2e2270fSchristos    This program is distributed in the hope that it will be useful,
14a2e2270fSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
15a2e2270fSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16a2e2270fSchristos    GNU General Public License for more details.
17a2e2270fSchristos 
18a2e2270fSchristos    You should have received a copy of the GNU General Public License
19a2e2270fSchristos    along with this program; if not, write to the Free Software
20a2e2270fSchristos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21a2e2270fSchristos    MA 02110-1301, USA.  */
22a2e2270fSchristos 
23a2e2270fSchristos 
24a2e2270fSchristos /* This file holds definitions specific to the Altera Nios II ELF ABI.  Note
25a2e2270fSchristos    that most of this is not actually implemented by BFD.  */
26a2e2270fSchristos 
27a2e2270fSchristos #ifndef _ELF_NIOS2_H
28a2e2270fSchristos #define _ELF_NIOS2_H
29a2e2270fSchristos 
30a2e2270fSchristos #include "elf/reloc-macros.h"
31a2e2270fSchristos 
32a2e2270fSchristos /* The order of these numbers must match the order in
33a2e2270fSchristos    the elf_nios2_howto_table_rel table for the lookup
34a2e2270fSchristos    function to work properly.  */
35a2e2270fSchristos 
36a2e2270fSchristos START_RELOC_NUMBERS (elf_nios2_reloc_type)
37212397c6Schristos   /* Relocs used by both R1 and R2, with different howtos to match
38212397c6Schristos      the respective encodings.  */
39a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_NONE,	  0)
40a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_S16,	  1)
41a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_U16,	  2)
42a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_PCREL16, 3)
43a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_CALL26,  4)
44a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_IMM5,	  5)
45a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_CACHE_OPX, 6)
46a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_IMM6,	  7)
47a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_IMM8,	  8)
48a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_HI16,	  9)
49a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_LO16,	  10)
50a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_HIADJ16, 11)
51a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_BFD_RELOC_32, 12)
52a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_BFD_RELOC_16, 13)
53a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_BFD_RELOC_8, 14)
54a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GPREL, 15)
55a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GNU_VTINHERIT, 16)
56a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GNU_VTENTRY, 17)
57a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_UJMP, 18)
58a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_CJMP, 19)
59a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_CALLR, 20)
60a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_ALIGN, 21)
61a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GOT16, 22)
62a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_CALL16, 23)
63a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GOTOFF_LO, 24)
64a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GOTOFF_HA, 25)
65a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_PCREL_LO, 26)
66a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_PCREL_HA, 27)
67a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_GD16, 28)
68a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_LDM16, 29)
69a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_LDO16, 30)
70a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_IE16, 31)
71a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_LE16, 32)
72a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_DTPMOD, 33)
73a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_DTPREL, 34)
74a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_TLS_TPREL, 35)
75a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_COPY, 36)
76a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GLOB_DAT, 37)
77a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_JUMP_SLOT, 38)
78a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_RELATIVE, 39)
79a2e2270fSchristos   RELOC_NUMBER (R_NIOS2_GOTOFF, 40)
80968cf8f2Schristos   RELOC_NUMBER (R_NIOS2_CALL26_NOAT,  41)
81968cf8f2Schristos   RELOC_NUMBER (R_NIOS2_GOT_LO, 42)
82968cf8f2Schristos   RELOC_NUMBER (R_NIOS2_GOT_HA, 43)
83968cf8f2Schristos   RELOC_NUMBER (R_NIOS2_CALL_LO, 44)
84968cf8f2Schristos   RELOC_NUMBER (R_NIOS2_CALL_HA, 45)
85212397c6Schristos 
86212397c6Schristos   /* Relocs specific to R2.  */
87212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_S12, 64)
88212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_I10_1_PCREL, 65)
89212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_T1I7_1_PCREL, 66)
90212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_T1I7_2, 67)
91212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_T2I4, 68)
92212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_T2I4_1, 69)
93212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_T2I4_2, 70)
94212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_X1I7_2, 71)
95212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_X2L5, 72)
96212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_F1I5_2, 73)
97212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_L5I4X1, 74)
98212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_T1X1I6, 75)
99212397c6Schristos   RELOC_NUMBER (R_NIOS2_R2_T1X1I6_2, 76)
100212397c6Schristos 
101212397c6Schristos   /* Last reloc.  */
102212397c6Schristos   RELOC_NUMBER (R_NIOS2_ILLEGAL, 77)
103a2e2270fSchristos END_RELOC_NUMBERS (R_NIOS2_maxext)
104a2e2270fSchristos 
105a2e2270fSchristos /* Processor-specific section flags.  */
106a2e2270fSchristos 
107a2e2270fSchristos /* This is used to mark gp-relative sections.  */
108a2e2270fSchristos #define SHF_NIOS2_GPREL	0x10000000
109a2e2270fSchristos 
110a2e2270fSchristos /* Processor-specific dynamic array tags.  */
111a2e2270fSchristos 
112a2e2270fSchristos /* Address of _gp.  */
113a2e2270fSchristos #define DT_NIOS2_GP 0x70000002
114a2e2270fSchristos 
115212397c6Schristos /* Processor specific flags for the Elf header e_flags field.  */
116212397c6Schristos 
117212397c6Schristos #define EF_NIOS2_ARCH_R1 0x00000000
118212397c6Schristos #define EF_NIOS2_ARCH_R2 0x00000001
119212397c6Schristos 
120a2e2270fSchristos #endif /* _ELF_NIOS2_H */
121