Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* HPPA ELF support for BFD. |
41ee1a61 | 2 | Copyright (C) 1993, 1994, 1999 Free Software Foundation, Inc. |
252b5132 RH |
3 | |
4 | This file is part of BFD, the Binary File Descriptor library. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
19 | ||
20 | /* This file holds definitions specific to the HPPA ELF ABI. Note | |
21 | that most of this is not actually implemented by BFD. */ | |
22 | ||
23 | #ifndef _ELF_HPPA_H | |
24 | #define _ELF_HPPA_H | |
25 | ||
26 | /* Processor specific flags for the ELF header e_flags field. */ | |
27 | ||
41ee1a61 JL |
28 | /* Trap null address dereferences. */ |
29 | #define EF_PARISC_TRAPNIL 0x00010000 | |
252b5132 | 30 | |
41ee1a61 JL |
31 | /* .PARISC.archext section is present. */ |
32 | #define EF_PARISC_EXT 0x00020000 | |
252b5132 | 33 | |
41ee1a61 JL |
34 | /* Program expects little-endian mode. */ |
35 | #define EF_PARISC_LSB 0x00040000 | |
252b5132 | 36 | |
41ee1a61 JL |
37 | /* Program expects wide mode. */ |
38 | #define EF_PARISC_WIDE 0x00080000 | |
252b5132 | 39 | |
41ee1a61 JL |
40 | /* Do not allow kernel-assisted branch prediction. */ |
41 | #define EF_PARISC_NO_KABP 0x00100000 | |
252b5132 | 42 | |
41ee1a61 JL |
43 | /* Allow lazy swap for dynamically allocated program segments. */ |
44 | #define EF_PARISC_LAZYSWAP 0x00400000 | |
252b5132 | 45 | |
41ee1a61 JL |
46 | /* Architecture version */ |
47 | #define EF_PARISC_ARCH 0x0000ffff | |
48 | ||
49 | #define EFA_PARISC_1_0 0x020b | |
50 | #define EFA_PARISC_1_1 0x0210 | |
51 | #define EFA_PARISC_2_0 0x0214 | |
252b5132 | 52 | |
41ee1a61 JL |
53 | /* Special section indices. */ |
54 | /* A symbol that has been declared as a tentative definition in an ANSI C | |
55 | compilation. */ | |
56 | #define SHN_PARISC_ANSI_COMMON 0xff00 | |
252b5132 | 57 | |
41ee1a61 JL |
58 | /* A symbol that has been declared as a common block using the |
59 | huge memory model. */ | |
60 | #define SHN_PARISC_HUGE_COMMON 0xff01 | |
252b5132 | 61 | |
41ee1a61 | 62 | /* Processor specific section types. */ |
252b5132 | 63 | |
41ee1a61 JL |
64 | /* Section contains product specific extension bits. */ |
65 | #define SHT_PARISC_EXT 0x70000000 | |
252b5132 | 66 | |
41ee1a61 JL |
67 | /* Section contains unwind table entries. */ |
68 | #define SHT_PARISC_UNWIND 0x70000001 | |
252b5132 | 69 | |
41ee1a61 JL |
70 | /* Section contains debug information for optimized code. */ |
71 | #define SHT_PARISC_DOC 0x70000002 | |
252b5132 | 72 | |
41ee1a61 JL |
73 | /* Section contains code annotations. */ |
74 | #define SHT_PARISC_ANNOT 0x70000003 | |
252b5132 | 75 | |
41ee1a61 JL |
76 | /* These are strictly for compatibility with the older elf32-hppa |
77 | implementation. Hopefully we can eliminate them in the future. */ | |
252b5132 | 78 | /* Optional section holding argument location/relocation info. */ |
41ee1a61 | 79 | #define SHT_PARISC_SYMEXTN SHT_LOPROC+8 |
252b5132 RH |
80 | |
81 | /* Option section for linker stubs. */ | |
41ee1a61 | 82 | #define SHT_PARISC_STUBS SHT_LOPROC+9 |
252b5132 RH |
83 | |
84 | /* Processor specific section flags. */ | |
85 | ||
41ee1a61 JL |
86 | /* Section contains code compiled for static branch prediction. */ |
87 | #define SHF_PARISC_SBP 0x80000000 | |
88 | ||
89 | /* Section should be allocated from from GP. */ | |
90 | #define SHF_PARISC_HUGE 0x40000000 | |
252b5132 | 91 | |
41ee1a61 JL |
92 | /* Section should go near GP. */ |
93 | #define SHF_PARISC_SHORT 0x20000000 | |
252b5132 | 94 | |
252b5132 | 95 | |
41ee1a61 JL |
96 | /* Identifies the entry point of a millicode routine. */ |
97 | #define STT_PARISC_MILLI 13 | |
252b5132 RH |
98 | |
99 | /* ELF/HPPA relocation types */ | |
100 | ||
41ee1a61 | 101 | /* Note: PA-ELF is defined to use only RELA relocations. */ |
252b5132 RH |
102 | #include "reloc-macros.h" |
103 | ||
104 | START_RELOC_NUMBERS (elf32_hppa_reloc_type) | |
105 | RELOC_NUMBER (R_PARISC_NONE, 0) /* No reloc */ | |
106 | ||
107 | /* These relocation types do simple base + offset relocations. */ | |
108 | ||
41ee1a61 JL |
109 | RELOC_NUMBER (R_PARISC_DIR32, 1) |
110 | RELOC_NUMBER (R_PARISC_DIR21L, 2) | |
111 | RELOC_NUMBER (R_PARISC_DIR17R, 3) | |
112 | RELOC_NUMBER (R_PARISC_DIR17F, 4) | |
113 | RELOC_NUMBER (R_PARISC_DIR14R, 6) | |
252b5132 RH |
114 | |
115 | /* PC-relative relocation types | |
116 | Typically used for calls. | |
117 | Note PCREL17C and PCREL17F differ only in overflow handling. | |
118 | PCREL17C never reports a relocation error. | |
119 | ||
120 | When supporting argument relocations, function calls must be | |
121 | accompanied by parameter relocation information. This information is | |
122 | carried in the ten high-order bits of the addend field. The remaining | |
123 | 22 bits of of the addend field are sign-extended to form the Addend. | |
124 | ||
125 | Note the code to build argument relocations depends on the | |
126 | addend being zero. A consequence of this limitation is GAS | |
127 | can not perform relocation reductions for function symbols. */ | |
128 | ||
41ee1a61 JL |
129 | RELOC_NUMBER (R_PARISC_PCREL32, 9) |
130 | RELOC_NUMBER (R_PARISC_PCREL21L, 10) | |
131 | RELOC_NUMBER (R_PARISC_PCREL17R, 11) | |
132 | RELOC_NUMBER (R_PARISC_PCREL17F, 12) | |
133 | RELOC_NUMBER (R_PARISC_PCREL17C, 13) | |
134 | RELOC_NUMBER (R_PARISC_PCREL14R, 14) | |
135 | RELOC_NUMBER (R_PARISC_PCREL14F, 15) | |
252b5132 RH |
136 | |
137 | /* DP-relative relocation types. */ | |
41ee1a61 JL |
138 | RELOC_NUMBER (R_PARISC_DPREL21L, 18) |
139 | RELOC_NUMBER (R_PARISC_DPREL14WR, 19) | |
140 | RELOC_NUMBER (R_PARISC_DPREL14DR, 20) | |
141 | RELOC_NUMBER (R_PARISC_DPREL14R, 22) | |
142 | RELOC_NUMBER (R_PARISC_DPREL14F, 23) | |
252b5132 RH |
143 | |
144 | /* Data linkage table (DLT) relocation types | |
145 | ||
146 | SOM DLT_REL fixup requests are used to for static data references | |
147 | from position-independent code within shared libraries. They are | |
148 | similar to the GOT relocation types in some SVR4 implementations. */ | |
149 | ||
41ee1a61 JL |
150 | RELOC_NUMBER (R_PARISC_DLTREL21L, 26) |
151 | RELOC_NUMBER (R_PARISC_DLTREL14R, 30) | |
152 | RELOC_NUMBER (R_PARISC_DLTREL14F, 31) | |
252b5132 RH |
153 | |
154 | /* DLT indirect relocation types */ | |
41ee1a61 JL |
155 | RELOC_NUMBER (R_PARISC_DLTIND21L, 34) |
156 | RELOC_NUMBER (R_PARISC_DLTIND14R, 38) | |
157 | RELOC_NUMBER (R_PARISC_DLTIND14F, 39) | |
252b5132 RH |
158 | |
159 | /* Base relative relocation types. Ugh. These imply lots of state */ | |
41ee1a61 JL |
160 | RELOC_NUMBER (R_PARISC_SETBASE, 40) |
161 | RELOC_NUMBER (R_PARISC_SECREL32, 41) | |
162 | RELOC_NUMBER (R_PARISC_BASEREL21L, 42) | |
163 | RELOC_NUMBER (R_PARISC_BASEREL17R, 43) | |
164 | RELOC_NUMBER (R_PARISC_BASEREL17F, 44) | |
165 | RELOC_NUMBER (R_PARISC_BASEREL14R, 46) | |
166 | RELOC_NUMBER (R_PARISC_BASEREL14F, 47) | |
252b5132 RH |
167 | |
168 | /* Segment relative relocation types. */ | |
41ee1a61 JL |
169 | RELOC_NUMBER (R_PARISC_SEGBASE, 48) |
170 | RELOC_NUMBER (R_PARISC_SEGREL32, 49) | |
171 | ||
172 | /* Offsets from the PLT. */ | |
173 | RELOC_NUMBER (R_PARISC_PLTOFF21L, 50) | |
174 | RELOC_NUMBER (R_PARISC_PLTOFF14R, 54) | |
175 | RELOC_NUMBER (R_PARISC_PLTOFF14F, 55) | |
176 | ||
177 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR32, 57) | |
178 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR21L, 58) | |
179 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR14R, 62) | |
180 | ||
181 | RELOC_NUMBER (R_PARISC_FPTR64, 64) | |
252b5132 RH |
182 | |
183 | /* Plabel relocation types. */ | |
41ee1a61 JL |
184 | RELOC_NUMBER (R_PARISC_PLABEL32, 65) |
185 | RELOC_NUMBER (R_PARISC_PLABEL21L, 66) | |
186 | RELOC_NUMBER (R_PARISC_PLABEL14R, 70) | |
187 | ||
188 | /* PCREL relocations. */ | |
189 | RELOC_NUMBER (R_PARISC_PCREL64, 72) | |
190 | RELOC_NUMBER (R_PARISC_PCREL22C, 73) | |
191 | RELOC_NUMBER (R_PARISC_PCREL22F, 74) | |
192 | RELOC_NUMBER (R_PARISC_PCREL14WR, 75) | |
193 | RELOC_NUMBER (R_PARISC_PCREL14DR, 76) | |
194 | RELOC_NUMBER (R_PARISC_PCREL16F, 77) | |
195 | RELOC_NUMBER (R_PARISC_PCREL16WF, 78) | |
196 | RELOC_NUMBER (R_PARISC_PCREL16DF, 79) | |
197 | ||
198 | ||
199 | RELOC_NUMBER (R_PARISC_DIR64, 80) | |
200 | RELOC_NUMBER (R_PARISC_DIR64WR, 81) | |
201 | RELOC_NUMBER (R_PARISC_DIR64DR, 82) | |
202 | RELOC_NUMBER (R_PARISC_DIR14WR, 83) | |
203 | RELOC_NUMBER (R_PARISC_DIR14DR, 84) | |
204 | RELOC_NUMBER (R_PARISC_DIR16F, 85) | |
205 | RELOC_NUMBER (R_PARISC_DIR16WF, 86) | |
206 | RELOC_NUMBER (R_PARISC_DIR16DF, 87) | |
207 | ||
208 | RELOC_NUMBER (R_PARISC_GPREL64, 88) | |
209 | ||
210 | RELOC_NUMBER (R_PARISC_DLTREL14WR, 91) | |
211 | RELOC_NUMBER (R_PARISC_DLTREL14DR, 92) | |
212 | RELOC_NUMBER (R_PARISC_GPREL16F, 93) | |
213 | RELOC_NUMBER (R_PARISC_GPREL16WF, 94) | |
214 | RELOC_NUMBER (R_PARISC_GPREL16DF, 95) | |
215 | ||
216 | ||
217 | RELOC_NUMBER (R_PARISC_LTOFF64, 96) | |
218 | RELOC_NUMBER (R_PARISC_DLTIND14WR, 99) | |
219 | RELOC_NUMBER (R_PARISC_DLTIND14DR, 100) | |
220 | RELOC_NUMBER (R_PARISC_LTOFF16F, 101) | |
221 | RELOC_NUMBER (R_PARISC_LTOFF16WF, 102) | |
222 | RELOC_NUMBER (R_PARISC_LTOFF16DF, 103) | |
223 | ||
224 | RELOC_NUMBER (R_PARISC_SECREL64, 104) | |
225 | ||
226 | RELOC_NUMBER (R_PARISC_BASEREL14WR, 107) | |
227 | RELOC_NUMBER (R_PARISC_BASEREL14DR, 108) | |
228 | ||
229 | RELOC_NUMBER (R_PARISC_SEGREL64, 112) | |
230 | ||
231 | RELOC_NUMBER (R_PARISC_PLTOFF14WR, 115) | |
232 | RELOC_NUMBER (R_PARISC_PLTOFF14DR, 116) | |
233 | RELOC_NUMBER (R_PARISC_PLTOFF16F, 117) | |
234 | RELOC_NUMBER (R_PARISC_PLTOFF16WF, 118) | |
235 | RELOC_NUMBER (R_PARISC_PLTOFF16DF, 119) | |
236 | ||
237 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR64, 120) | |
238 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR14WR, 123) | |
239 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR14DR, 124) | |
240 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR16F, 125) | |
241 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR16WF, 126) | |
242 | RELOC_NUMBER (R_PARISC_LTOFF_FPTR16DF, 127) | |
243 | ||
244 | ||
245 | RELOC_NUMBER (R_PARISC_COPY, 128) | |
246 | RELOC_NUMBER (R_PARISC_IPLT, 129) | |
247 | RELOC_NUMBER (R_PARISC_EPLT, 130) | |
248 | ||
249 | RELOC_NUMBER (R_PARISC_TPREL32, 153) | |
250 | RELOC_NUMBER (R_PARISC_TPREL21L, 154) | |
251 | RELOC_NUMBER (R_PARISC_TPREL14R, 158) | |
252 | ||
253 | RELOC_NUMBER (R_PARISC_LTOFF_TP21L, 162) | |
254 | RELOC_NUMBER (R_PARISC_LTOFF_TP14R, 166) | |
255 | RELOC_NUMBER (R_PARISC_LTOFF_TP14F, 167) | |
256 | ||
257 | RELOC_NUMBER (R_PARISC_TPREL64, 216) | |
258 | RELOC_NUMBER (R_PARISC_TPREL14WR, 219) | |
259 | RELOC_NUMBER (R_PARISC_TPREL14DR, 220) | |
260 | RELOC_NUMBER (R_PARISC_TPREL16F, 221) | |
261 | RELOC_NUMBER (R_PARISC_TPREL16WF, 222) | |
262 | RELOC_NUMBER (R_PARISC_TPREL16DF, 223) | |
263 | ||
264 | RELOC_NUMBER (R_PARISC_LTOFF_TP64, 224) | |
265 | RELOC_NUMBER (R_PARISC_LTOFF_TP14WR, 227) | |
266 | RELOC_NUMBER (R_PARISC_LTOFF_TP14DR, 228) | |
267 | RELOC_NUMBER (R_PARISC_LTOFF_TP16F, 229) | |
268 | RELOC_NUMBER (R_PARISC_LTOFF_TP16WF, 230) | |
269 | RELOC_NUMBER (R_PARISC_LTOFF_TP16DF, 231) | |
270 | EMPTY_RELOC (R_PARISC_UNIMPLEMENTED) | |
252b5132 RH |
271 | END_RELOC_NUMBERS |
272 | ||
273 | #ifndef RELOC_MACROS_GEN_FUNC | |
274 | typedef enum elf32_hppa_reloc_type elf32_hppa_reloc_type; | |
275 | #endif | |
276 | ||
41ee1a61 JL |
277 | #define PT_PARISC_ARCHEXT 0x70000000 |
278 | #define PT_PARISC_UNWIND 0x70000001 | |
279 | #define PF_PARISC_SBP 0x08000000 | |
252b5132 | 280 | #endif /* _ELF_HPPA_H */ |