]> git.proxmox.com Git - rustc.git/blob - vendor/object/src/elf.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / vendor / object / src / elf.rs
1 //! ELF definitions.
2 //!
3 //! These definitions are independent of read/write support, although we do implement
4 //! some traits useful for those.
5 //!
6 //! This module is the equivalent of /usr/include/elf.h, and is based heavily on it.
7
8 #![allow(clippy::identity_op)]
9
10 use crate::endian::{Endian, U32Bytes, U64Bytes, I32, I64, U16, U32, U64};
11 use crate::pod::Pod;
12
13 /// The header at the start of every 32-bit ELF file.
14 #[derive(Debug, Clone, Copy)]
15 #[repr(C)]
16 pub struct FileHeader32<E: Endian> {
17 /// Magic number and other information.
18 pub e_ident: Ident,
19 /// Object file type. One of the `ET_*` constants.
20 pub e_type: U16<E>,
21 /// Architecture. One of the `EM_*` constants.
22 pub e_machine: U16<E>,
23 /// Object file version. Must be `EV_CURRENT`.
24 pub e_version: U32<E>,
25 /// Entry point virtual address.
26 pub e_entry: U32<E>,
27 /// Program header table file offset.
28 pub e_phoff: U32<E>,
29 /// Section header table file offset.
30 pub e_shoff: U32<E>,
31 /// Processor-specific flags.
32 ///
33 /// A combination of the `EF_*` constants.
34 pub e_flags: U32<E>,
35 /// Size in bytes of this header.
36 pub e_ehsize: U16<E>,
37 /// Program header table entry size.
38 pub e_phentsize: U16<E>,
39 /// Program header table entry count.
40 ///
41 /// If the count is greater than or equal to `PN_XNUM` then this field is set to
42 /// `PN_XNUM` and the count is stored in the `sh_info` field of section 0.
43 pub e_phnum: U16<E>,
44 /// Section header table entry size.
45 pub e_shentsize: U16<E>,
46 /// Section header table entry count.
47 ///
48 /// If the count is greater than or equal to `SHN_LORESERVE` then this field is set to
49 /// `0` and the count is stored in the `sh_size` field of section 0.
50 /// first section header.
51 pub e_shnum: U16<E>,
52 /// Section header string table index.
53 ///
54 /// If the index is greater than or equal to `SHN_LORESERVE` then this field is set to
55 /// `SHN_XINDEX` and the index is stored in the `sh_link` field of section 0.
56 pub e_shstrndx: U16<E>,
57 }
58
59 /// The header at the start of every 64-bit ELF file.
60 #[derive(Debug, Clone, Copy)]
61 #[repr(C)]
62 pub struct FileHeader64<E: Endian> {
63 /// Magic number and other information.
64 pub e_ident: Ident,
65 /// Object file type. One of the `ET_*` constants.
66 pub e_type: U16<E>,
67 /// Architecture. One of the `EM_*` constants.
68 pub e_machine: U16<E>,
69 /// Object file version. Must be `EV_CURRENT`.
70 pub e_version: U32<E>,
71 /// Entry point virtual address.
72 pub e_entry: U64<E>,
73 /// Program header table file offset.
74 pub e_phoff: U64<E>,
75 /// Section header table file offset.
76 pub e_shoff: U64<E>,
77 /// Processor-specific flags.
78 ///
79 /// A combination of the `EF_*` constants.
80 pub e_flags: U32<E>,
81 /// Size in bytes of this header.
82 pub e_ehsize: U16<E>,
83 /// Program header table entry size.
84 pub e_phentsize: U16<E>,
85 /// Program header table entry count.
86 ///
87 /// If the count is greater than or equal to `PN_XNUM` then this field is set to
88 /// `PN_XNUM` and the count is stored in the `sh_info` field of section 0.
89 pub e_phnum: U16<E>,
90 /// Section header table entry size.
91 pub e_shentsize: U16<E>,
92 /// Section header table entry count.
93 ///
94 /// If the count is greater than or equal to `SHN_LORESERVE` then this field is set to
95 /// `0` and the count is stored in the `sh_size` field of section 0.
96 /// first section header.
97 pub e_shnum: U16<E>,
98 /// Section header string table index.
99 ///
100 /// If the index is greater than or equal to `SHN_LORESERVE` then this field is set to
101 /// `SHN_XINDEX` and the index is stored in the `sh_link` field of section 0.
102 pub e_shstrndx: U16<E>,
103 }
104
105 /// Magic number and other information.
106 ///
107 /// Contained in the file header.
108 #[derive(Debug, Clone, Copy)]
109 #[repr(C)]
110 pub struct Ident {
111 /// Magic number. Must be `ELFMAG`.
112 pub magic: [u8; 4],
113 /// File class. One of the `ELFCLASS*` constants.
114 pub class: u8,
115 /// Data encoding. One of the `ELFDATA*` constants.
116 pub data: u8,
117 /// ELF version. Must be `EV_CURRENT`.
118 pub version: u8,
119 /// OS ABI identification. One of the `ELFOSABI*` constants.
120 pub os_abi: u8,
121 /// ABI version.
122 ///
123 /// The meaning of this field depends on the `os_abi` value.
124 pub abi_version: u8,
125 /// Padding bytes.
126 pub padding: [u8; 7],
127 }
128
129 /// File identification bytes stored in `Ident::magic`.
130 pub const ELFMAG: [u8; 4] = [0x7f, b'E', b'L', b'F'];
131
132 // Values for `Ident::class`.
133 /// Invalid class.
134 pub const ELFCLASSNONE: u8 = 0;
135 /// 32-bit object.
136 pub const ELFCLASS32: u8 = 1;
137 /// 64-bit object.
138 pub const ELFCLASS64: u8 = 2;
139
140 // Values for `Ident::data`.
141 /// Invalid data encoding.
142 pub const ELFDATANONE: u8 = 0;
143 /// 2's complement, little endian.
144 pub const ELFDATA2LSB: u8 = 1;
145 /// 2's complement, big endian.
146 pub const ELFDATA2MSB: u8 = 2;
147
148 // Values for `Ident::os_abi`.
149 /// UNIX System V ABI.
150 pub const ELFOSABI_NONE: u8 = 0;
151 /// UNIX System V ABI.
152 ///
153 /// Alias.
154 pub const ELFOSABI_SYSV: u8 = 0;
155 /// HP-UX.
156 pub const ELFOSABI_HPUX: u8 = 1;
157 /// NetBSD.
158 pub const ELFOSABI_NETBSD: u8 = 2;
159 /// Object uses GNU ELF extensions.
160 pub const ELFOSABI_GNU: u8 = 3;
161 /// Object uses GNU ELF extensions.
162 ///
163 /// Compatibility alias.
164 pub const ELFOSABI_LINUX: u8 = ELFOSABI_GNU;
165 /// GNU/Hurd.
166 pub const ELFOSABI_HURD: u8 = 4;
167 /// Sun Solaris.
168 pub const ELFOSABI_SOLARIS: u8 = 6;
169 /// IBM AIX.
170 pub const ELFOSABI_AIX: u8 = 7;
171 /// SGI Irix.
172 pub const ELFOSABI_IRIX: u8 = 8;
173 /// FreeBSD.
174 pub const ELFOSABI_FREEBSD: u8 = 9;
175 /// Compaq TRU64 UNIX.
176 pub const ELFOSABI_TRU64: u8 = 10;
177 /// Novell Modesto.
178 pub const ELFOSABI_MODESTO: u8 = 11;
179 /// OpenBSD.
180 pub const ELFOSABI_OPENBSD: u8 = 12;
181 /// OpenVMS.
182 pub const ELFOSABI_OPENVMS: u8 = 13;
183 /// Hewlett-Packard Non-Stop Kernel.
184 pub const ELFOSABI_NSK: u8 = 14;
185 /// AROS
186 pub const ELFOSABI_AROS: u8 = 15;
187 /// FenixOS
188 pub const ELFOSABI_FENIXOS: u8 = 16;
189 /// Nuxi CloudABI
190 pub const ELFOSABI_CLOUDABI: u8 = 17;
191 /// ARM EABI.
192 pub const ELFOSABI_ARM_AEABI: u8 = 64;
193 /// ARM.
194 pub const ELFOSABI_ARM: u8 = 97;
195 /// Standalone (embedded) application.
196 pub const ELFOSABI_STANDALONE: u8 = 255;
197
198 // Values for `FileHeader*::e_type`.
199 /// No file type.
200 pub const ET_NONE: u16 = 0;
201 /// Relocatable file.
202 pub const ET_REL: u16 = 1;
203 /// Executable file.
204 pub const ET_EXEC: u16 = 2;
205 /// Shared object file.
206 pub const ET_DYN: u16 = 3;
207 /// Core file.
208 pub const ET_CORE: u16 = 4;
209 /// OS-specific range start.
210 pub const ET_LOOS: u16 = 0xfe00;
211 /// OS-specific range end.
212 pub const ET_HIOS: u16 = 0xfeff;
213 /// Processor-specific range start.
214 pub const ET_LOPROC: u16 = 0xff00;
215 /// Processor-specific range end.
216 pub const ET_HIPROC: u16 = 0xffff;
217
218 // Values for `FileHeader*::e_machine`.
219 /// No machine
220 pub const EM_NONE: u16 = 0;
221 /// AT&T WE 32100
222 pub const EM_M32: u16 = 1;
223 /// SUN SPARC
224 pub const EM_SPARC: u16 = 2;
225 /// Intel 80386
226 pub const EM_386: u16 = 3;
227 /// Motorola m68k family
228 pub const EM_68K: u16 = 4;
229 /// Motorola m88k family
230 pub const EM_88K: u16 = 5;
231 /// Intel MCU
232 pub const EM_IAMCU: u16 = 6;
233 /// Intel 80860
234 pub const EM_860: u16 = 7;
235 /// MIPS R3000 big-endian
236 pub const EM_MIPS: u16 = 8;
237 /// IBM System/370
238 pub const EM_S370: u16 = 9;
239 /// MIPS R3000 little-endian
240 pub const EM_MIPS_RS3_LE: u16 = 10;
241 /// HPPA
242 pub const EM_PARISC: u16 = 15;
243 /// Fujitsu VPP500
244 pub const EM_VPP500: u16 = 17;
245 /// Sun's "v8plus"
246 pub const EM_SPARC32PLUS: u16 = 18;
247 /// Intel 80960
248 pub const EM_960: u16 = 19;
249 /// PowerPC
250 pub const EM_PPC: u16 = 20;
251 /// PowerPC 64-bit
252 pub const EM_PPC64: u16 = 21;
253 /// IBM S390
254 pub const EM_S390: u16 = 22;
255 /// IBM SPU/SPC
256 pub const EM_SPU: u16 = 23;
257 /// NEC V800 series
258 pub const EM_V800: u16 = 36;
259 /// Fujitsu FR20
260 pub const EM_FR20: u16 = 37;
261 /// TRW RH-32
262 pub const EM_RH32: u16 = 38;
263 /// Motorola RCE
264 pub const EM_RCE: u16 = 39;
265 /// ARM
266 pub const EM_ARM: u16 = 40;
267 /// Digital Alpha
268 pub const EM_FAKE_ALPHA: u16 = 41;
269 /// Hitachi SH
270 pub const EM_SH: u16 = 42;
271 /// SPARC v9 64-bit
272 pub const EM_SPARCV9: u16 = 43;
273 /// Siemens Tricore
274 pub const EM_TRICORE: u16 = 44;
275 /// Argonaut RISC Core
276 pub const EM_ARC: u16 = 45;
277 /// Hitachi H8/300
278 pub const EM_H8_300: u16 = 46;
279 /// Hitachi H8/300H
280 pub const EM_H8_300H: u16 = 47;
281 /// Hitachi H8S
282 pub const EM_H8S: u16 = 48;
283 /// Hitachi H8/500
284 pub const EM_H8_500: u16 = 49;
285 /// Intel Merced
286 pub const EM_IA_64: u16 = 50;
287 /// Stanford MIPS-X
288 pub const EM_MIPS_X: u16 = 51;
289 /// Motorola Coldfire
290 pub const EM_COLDFIRE: u16 = 52;
291 /// Motorola M68HC12
292 pub const EM_68HC12: u16 = 53;
293 /// Fujitsu MMA Multimedia Accelerator
294 pub const EM_MMA: u16 = 54;
295 /// Siemens PCP
296 pub const EM_PCP: u16 = 55;
297 /// Sony nCPU embeeded RISC
298 pub const EM_NCPU: u16 = 56;
299 /// Denso NDR1 microprocessor
300 pub const EM_NDR1: u16 = 57;
301 /// Motorola Start*Core processor
302 pub const EM_STARCORE: u16 = 58;
303 /// Toyota ME16 processor
304 pub const EM_ME16: u16 = 59;
305 /// STMicroelectronic ST100 processor
306 pub const EM_ST100: u16 = 60;
307 /// Advanced Logic Corp. Tinyj emb.fam
308 pub const EM_TINYJ: u16 = 61;
309 /// AMD x86-64 architecture
310 pub const EM_X86_64: u16 = 62;
311 /// Sony DSP Processor
312 pub const EM_PDSP: u16 = 63;
313 /// Digital PDP-10
314 pub const EM_PDP10: u16 = 64;
315 /// Digital PDP-11
316 pub const EM_PDP11: u16 = 65;
317 /// Siemens FX66 microcontroller
318 pub const EM_FX66: u16 = 66;
319 /// STMicroelectronics ST9+ 8/16 mc
320 pub const EM_ST9PLUS: u16 = 67;
321 /// STmicroelectronics ST7 8 bit mc
322 pub const EM_ST7: u16 = 68;
323 /// Motorola MC68HC16 microcontroller
324 pub const EM_68HC16: u16 = 69;
325 /// Motorola MC68HC11 microcontroller
326 pub const EM_68HC11: u16 = 70;
327 /// Motorola MC68HC08 microcontroller
328 pub const EM_68HC08: u16 = 71;
329 /// Motorola MC68HC05 microcontroller
330 pub const EM_68HC05: u16 = 72;
331 /// Silicon Graphics SVx
332 pub const EM_SVX: u16 = 73;
333 /// STMicroelectronics ST19 8 bit mc
334 pub const EM_ST19: u16 = 74;
335 /// Digital VAX
336 pub const EM_VAX: u16 = 75;
337 /// Axis Communications 32-bit emb.proc
338 pub const EM_CRIS: u16 = 76;
339 /// Infineon Technologies 32-bit emb.proc
340 pub const EM_JAVELIN: u16 = 77;
341 /// Element 14 64-bit DSP Processor
342 pub const EM_FIREPATH: u16 = 78;
343 /// LSI Logic 16-bit DSP Processor
344 pub const EM_ZSP: u16 = 79;
345 /// Donald Knuth's educational 64-bit proc
346 pub const EM_MMIX: u16 = 80;
347 /// Harvard University machine-independent object files
348 pub const EM_HUANY: u16 = 81;
349 /// SiTera Prism
350 pub const EM_PRISM: u16 = 82;
351 /// Atmel AVR 8-bit microcontroller
352 pub const EM_AVR: u16 = 83;
353 /// Fujitsu FR30
354 pub const EM_FR30: u16 = 84;
355 /// Mitsubishi D10V
356 pub const EM_D10V: u16 = 85;
357 /// Mitsubishi D30V
358 pub const EM_D30V: u16 = 86;
359 /// NEC v850
360 pub const EM_V850: u16 = 87;
361 /// Mitsubishi M32R
362 pub const EM_M32R: u16 = 88;
363 /// Matsushita MN10300
364 pub const EM_MN10300: u16 = 89;
365 /// Matsushita MN10200
366 pub const EM_MN10200: u16 = 90;
367 /// picoJava
368 pub const EM_PJ: u16 = 91;
369 /// OpenRISC 32-bit embedded processor
370 pub const EM_OPENRISC: u16 = 92;
371 /// ARC International ARCompact
372 pub const EM_ARC_COMPACT: u16 = 93;
373 /// Tensilica Xtensa Architecture
374 pub const EM_XTENSA: u16 = 94;
375 /// Alphamosaic VideoCore
376 pub const EM_VIDEOCORE: u16 = 95;
377 /// Thompson Multimedia General Purpose Proc
378 pub const EM_TMM_GPP: u16 = 96;
379 /// National Semi. 32000
380 pub const EM_NS32K: u16 = 97;
381 /// Tenor Network TPC
382 pub const EM_TPC: u16 = 98;
383 /// Trebia SNP 1000
384 pub const EM_SNP1K: u16 = 99;
385 /// STMicroelectronics ST200
386 pub const EM_ST200: u16 = 100;
387 /// Ubicom IP2xxx
388 pub const EM_IP2K: u16 = 101;
389 /// MAX processor
390 pub const EM_MAX: u16 = 102;
391 /// National Semi. CompactRISC
392 pub const EM_CR: u16 = 103;
393 /// Fujitsu F2MC16
394 pub const EM_F2MC16: u16 = 104;
395 /// Texas Instruments msp430
396 pub const EM_MSP430: u16 = 105;
397 /// Analog Devices Blackfin DSP
398 pub const EM_BLACKFIN: u16 = 106;
399 /// Seiko Epson S1C33 family
400 pub const EM_SE_C33: u16 = 107;
401 /// Sharp embedded microprocessor
402 pub const EM_SEP: u16 = 108;
403 /// Arca RISC
404 pub const EM_ARCA: u16 = 109;
405 /// PKU-Unity & MPRC Peking Uni. mc series
406 pub const EM_UNICORE: u16 = 110;
407 /// eXcess configurable cpu
408 pub const EM_EXCESS: u16 = 111;
409 /// Icera Semi. Deep Execution Processor
410 pub const EM_DXP: u16 = 112;
411 /// Altera Nios II
412 pub const EM_ALTERA_NIOS2: u16 = 113;
413 /// National Semi. CompactRISC CRX
414 pub const EM_CRX: u16 = 114;
415 /// Motorola XGATE
416 pub const EM_XGATE: u16 = 115;
417 /// Infineon C16x/XC16x
418 pub const EM_C166: u16 = 116;
419 /// Renesas M16C
420 pub const EM_M16C: u16 = 117;
421 /// Microchip Technology dsPIC30F
422 pub const EM_DSPIC30F: u16 = 118;
423 /// Freescale Communication Engine RISC
424 pub const EM_CE: u16 = 119;
425 /// Renesas M32C
426 pub const EM_M32C: u16 = 120;
427 /// Altium TSK3000
428 pub const EM_TSK3000: u16 = 131;
429 /// Freescale RS08
430 pub const EM_RS08: u16 = 132;
431 /// Analog Devices SHARC family
432 pub const EM_SHARC: u16 = 133;
433 /// Cyan Technology eCOG2
434 pub const EM_ECOG2: u16 = 134;
435 /// Sunplus S+core7 RISC
436 pub const EM_SCORE7: u16 = 135;
437 /// New Japan Radio (NJR) 24-bit DSP
438 pub const EM_DSP24: u16 = 136;
439 /// Broadcom VideoCore III
440 pub const EM_VIDEOCORE3: u16 = 137;
441 /// RISC for Lattice FPGA
442 pub const EM_LATTICEMICO32: u16 = 138;
443 /// Seiko Epson C17
444 pub const EM_SE_C17: u16 = 139;
445 /// Texas Instruments TMS320C6000 DSP
446 pub const EM_TI_C6000: u16 = 140;
447 /// Texas Instruments TMS320C2000 DSP
448 pub const EM_TI_C2000: u16 = 141;
449 /// Texas Instruments TMS320C55x DSP
450 pub const EM_TI_C5500: u16 = 142;
451 /// Texas Instruments App. Specific RISC
452 pub const EM_TI_ARP32: u16 = 143;
453 /// Texas Instruments Prog. Realtime Unit
454 pub const EM_TI_PRU: u16 = 144;
455 /// STMicroelectronics 64bit VLIW DSP
456 pub const EM_MMDSP_PLUS: u16 = 160;
457 /// Cypress M8C
458 pub const EM_CYPRESS_M8C: u16 = 161;
459 /// Renesas R32C
460 pub const EM_R32C: u16 = 162;
461 /// NXP Semi. TriMedia
462 pub const EM_TRIMEDIA: u16 = 163;
463 /// QUALCOMM Hexagon
464 pub const EM_HEXAGON: u16 = 164;
465 /// Intel 8051 and variants
466 pub const EM_8051: u16 = 165;
467 /// STMicroelectronics STxP7x
468 pub const EM_STXP7X: u16 = 166;
469 /// Andes Tech. compact code emb. RISC
470 pub const EM_NDS32: u16 = 167;
471 /// Cyan Technology eCOG1X
472 pub const EM_ECOG1X: u16 = 168;
473 /// Dallas Semi. MAXQ30 mc
474 pub const EM_MAXQ30: u16 = 169;
475 /// New Japan Radio (NJR) 16-bit DSP
476 pub const EM_XIMO16: u16 = 170;
477 /// M2000 Reconfigurable RISC
478 pub const EM_MANIK: u16 = 171;
479 /// Cray NV2 vector architecture
480 pub const EM_CRAYNV2: u16 = 172;
481 /// Renesas RX
482 pub const EM_RX: u16 = 173;
483 /// Imagination Tech. META
484 pub const EM_METAG: u16 = 174;
485 /// MCST Elbrus
486 pub const EM_MCST_ELBRUS: u16 = 175;
487 /// Cyan Technology eCOG16
488 pub const EM_ECOG16: u16 = 176;
489 /// National Semi. CompactRISC CR16
490 pub const EM_CR16: u16 = 177;
491 /// Freescale Extended Time Processing Unit
492 pub const EM_ETPU: u16 = 178;
493 /// Infineon Tech. SLE9X
494 pub const EM_SLE9X: u16 = 179;
495 /// Intel L10M
496 pub const EM_L10M: u16 = 180;
497 /// Intel K10M
498 pub const EM_K10M: u16 = 181;
499 /// ARM AARCH64
500 pub const EM_AARCH64: u16 = 183;
501 /// Amtel 32-bit microprocessor
502 pub const EM_AVR32: u16 = 185;
503 /// STMicroelectronics STM8
504 pub const EM_STM8: u16 = 186;
505 /// Tileta TILE64
506 pub const EM_TILE64: u16 = 187;
507 /// Tilera TILEPro
508 pub const EM_TILEPRO: u16 = 188;
509 /// Xilinx MicroBlaze
510 pub const EM_MICROBLAZE: u16 = 189;
511 /// NVIDIA CUDA
512 pub const EM_CUDA: u16 = 190;
513 /// Tilera TILE-Gx
514 pub const EM_TILEGX: u16 = 191;
515 /// CloudShield
516 pub const EM_CLOUDSHIELD: u16 = 192;
517 /// KIPO-KAIST Core-A 1st gen.
518 pub const EM_COREA_1ST: u16 = 193;
519 /// KIPO-KAIST Core-A 2nd gen.
520 pub const EM_COREA_2ND: u16 = 194;
521 /// Synopsys ARCompact V2
522 pub const EM_ARC_COMPACT2: u16 = 195;
523 /// Open8 RISC
524 pub const EM_OPEN8: u16 = 196;
525 /// Renesas RL78
526 pub const EM_RL78: u16 = 197;
527 /// Broadcom VideoCore V
528 pub const EM_VIDEOCORE5: u16 = 198;
529 /// Renesas 78KOR
530 pub const EM_78KOR: u16 = 199;
531 /// Freescale 56800EX DSC
532 pub const EM_56800EX: u16 = 200;
533 /// Beyond BA1
534 pub const EM_BA1: u16 = 201;
535 /// Beyond BA2
536 pub const EM_BA2: u16 = 202;
537 /// XMOS xCORE
538 pub const EM_XCORE: u16 = 203;
539 /// Microchip 8-bit PIC(r)
540 pub const EM_MCHP_PIC: u16 = 204;
541 /// KM211 KM32
542 pub const EM_KM32: u16 = 210;
543 /// KM211 KMX32
544 pub const EM_KMX32: u16 = 211;
545 /// KM211 KMX16
546 pub const EM_EMX16: u16 = 212;
547 /// KM211 KMX8
548 pub const EM_EMX8: u16 = 213;
549 /// KM211 KVARC
550 pub const EM_KVARC: u16 = 214;
551 /// Paneve CDP
552 pub const EM_CDP: u16 = 215;
553 /// Cognitive Smart Memory Processor
554 pub const EM_COGE: u16 = 216;
555 /// Bluechip CoolEngine
556 pub const EM_COOL: u16 = 217;
557 /// Nanoradio Optimized RISC
558 pub const EM_NORC: u16 = 218;
559 /// CSR Kalimba
560 pub const EM_CSR_KALIMBA: u16 = 219;
561 /// Zilog Z80
562 pub const EM_Z80: u16 = 220;
563 /// Controls and Data Services VISIUMcore
564 pub const EM_VISIUM: u16 = 221;
565 /// FTDI Chip FT32
566 pub const EM_FT32: u16 = 222;
567 /// Moxie processor
568 pub const EM_MOXIE: u16 = 223;
569 /// AMD GPU
570 pub const EM_AMDGPU: u16 = 224;
571 /// RISC-V
572 pub const EM_RISCV: u16 = 243;
573 /// Linux BPF -- in-kernel virtual machine
574 pub const EM_BPF: u16 = 247;
575 /// C-SKY
576 pub const EM_CSKY: u16 = 252;
577 /// Loongson LoongArch
578 pub const EM_LOONGARCH: u16 = 258;
579 /// Digital Alpha
580 pub const EM_ALPHA: u16 = 0x9026;
581
582 // Values for `FileHeader*::e_version` and `Ident::version`.
583 /// Invalid ELF version.
584 pub const EV_NONE: u8 = 0;
585 /// Current ELF version.
586 pub const EV_CURRENT: u8 = 1;
587
588 /// Section header.
589 #[derive(Debug, Clone, Copy)]
590 #[repr(C)]
591 pub struct SectionHeader32<E: Endian> {
592 /// Section name.
593 ///
594 /// This is an offset into the section header string table.
595 pub sh_name: U32<E>,
596 /// Section type. One of the `SHT_*` constants.
597 pub sh_type: U32<E>,
598 /// Section flags. A combination of the `SHF_*` constants.
599 pub sh_flags: U32<E>,
600 /// Section virtual address at execution.
601 pub sh_addr: U32<E>,
602 /// Section file offset.
603 pub sh_offset: U32<E>,
604 /// Section size in bytes.
605 pub sh_size: U32<E>,
606 /// Link to another section.
607 ///
608 /// The section relationship depends on the `sh_type` value.
609 pub sh_link: U32<E>,
610 /// Additional section information.
611 ///
612 /// The meaning of this field depends on the `sh_type` value.
613 pub sh_info: U32<E>,
614 /// Section alignment.
615 pub sh_addralign: U32<E>,
616 /// Entry size if the section holds a table.
617 pub sh_entsize: U32<E>,
618 }
619
620 /// Section header.
621 #[derive(Debug, Clone, Copy)]
622 #[repr(C)]
623 pub struct SectionHeader64<E: Endian> {
624 /// Section name.
625 ///
626 /// This is an offset into the section header string table.
627 pub sh_name: U32<E>,
628 /// Section type. One of the `SHT_*` constants.
629 pub sh_type: U32<E>,
630 /// Section flags. A combination of the `SHF_*` constants.
631 pub sh_flags: U64<E>,
632 /// Section virtual address at execution.
633 pub sh_addr: U64<E>,
634 /// Section file offset.
635 pub sh_offset: U64<E>,
636 /// Section size in bytes.
637 pub sh_size: U64<E>,
638 /// Link to another section.
639 ///
640 /// The section relationship depends on the `sh_type` value.
641 pub sh_link: U32<E>,
642 /// Additional section information.
643 ///
644 /// The meaning of this field depends on the `sh_type` value.
645 pub sh_info: U32<E>,
646 /// Section alignment.
647 pub sh_addralign: U64<E>,
648 /// Entry size if the section holds a table.
649 pub sh_entsize: U64<E>,
650 }
651
652 // Special values for section indices.
653 /// Undefined section.
654 pub const SHN_UNDEF: u16 = 0;
655 /// OS-specific range start.
656 /// Start of reserved section indices.
657 pub const SHN_LORESERVE: u16 = 0xff00;
658 /// Start of processor-specific section indices.
659 pub const SHN_LOPROC: u16 = 0xff00;
660 /// End of processor-specific section indices.
661 pub const SHN_HIPROC: u16 = 0xff1f;
662 /// Start of OS-specific section indices.
663 pub const SHN_LOOS: u16 = 0xff20;
664 /// End of OS-specific section indices.
665 pub const SHN_HIOS: u16 = 0xff3f;
666 /// Associated symbol is absolute.
667 pub const SHN_ABS: u16 = 0xfff1;
668 /// Associated symbol is common.
669 pub const SHN_COMMON: u16 = 0xfff2;
670 /// Section index is in the `SHT_SYMTAB_SHNDX` section.
671 pub const SHN_XINDEX: u16 = 0xffff;
672 /// End of reserved section indices.
673 pub const SHN_HIRESERVE: u16 = 0xffff;
674
675 // Values for `SectionHeader*::sh_type`.
676 /// Section header table entry is unused.
677 pub const SHT_NULL: u32 = 0;
678 /// Program data.
679 pub const SHT_PROGBITS: u32 = 1;
680 /// Symbol table.
681 pub const SHT_SYMTAB: u32 = 2;
682 /// String table.
683 pub const SHT_STRTAB: u32 = 3;
684 /// Relocation entries with explicit addends.
685 pub const SHT_RELA: u32 = 4;
686 /// Symbol hash table.
687 pub const SHT_HASH: u32 = 5;
688 /// Dynamic linking information.
689 pub const SHT_DYNAMIC: u32 = 6;
690 /// Notes.
691 pub const SHT_NOTE: u32 = 7;
692 /// Program space with no data (bss).
693 pub const SHT_NOBITS: u32 = 8;
694 /// Relocation entries without explicit addends.
695 pub const SHT_REL: u32 = 9;
696 /// Reserved section type.
697 pub const SHT_SHLIB: u32 = 10;
698 /// Dynamic linker symbol table.
699 pub const SHT_DYNSYM: u32 = 11;
700 /// Array of constructors.
701 pub const SHT_INIT_ARRAY: u32 = 14;
702 /// Array of destructors.
703 pub const SHT_FINI_ARRAY: u32 = 15;
704 /// Array of pre-constructors.
705 pub const SHT_PREINIT_ARRAY: u32 = 16;
706 /// Section group.
707 pub const SHT_GROUP: u32 = 17;
708 /// Extended section indices for a symbol table.
709 pub const SHT_SYMTAB_SHNDX: u32 = 18;
710 /// Start of OS-specific section types.
711 pub const SHT_LOOS: u32 = 0x6000_0000;
712 /// Object attributes.
713 pub const SHT_GNU_ATTRIBUTES: u32 = 0x6fff_fff5;
714 /// GNU-style hash table.
715 pub const SHT_GNU_HASH: u32 = 0x6fff_fff6;
716 /// Prelink library list
717 pub const SHT_GNU_LIBLIST: u32 = 0x6fff_fff7;
718 /// Checksum for DSO content.
719 pub const SHT_CHECKSUM: u32 = 0x6fff_fff8;
720 /// Sun-specific low bound.
721 pub const SHT_LOSUNW: u32 = 0x6fff_fffa;
722 #[allow(missing_docs, non_upper_case_globals)]
723 pub const SHT_SUNW_move: u32 = 0x6fff_fffa;
724 #[allow(missing_docs)]
725 pub const SHT_SUNW_COMDAT: u32 = 0x6fff_fffb;
726 #[allow(missing_docs, non_upper_case_globals)]
727 pub const SHT_SUNW_syminfo: u32 = 0x6fff_fffc;
728 /// Version definition section.
729 #[allow(non_upper_case_globals)]
730 pub const SHT_GNU_VERDEF: u32 = 0x6fff_fffd;
731 /// Version needs section.
732 #[allow(non_upper_case_globals)]
733 pub const SHT_GNU_VERNEED: u32 = 0x6fff_fffe;
734 /// Version symbol table.
735 #[allow(non_upper_case_globals)]
736 pub const SHT_GNU_VERSYM: u32 = 0x6fff_ffff;
737 /// Sun-specific high bound.
738 pub const SHT_HISUNW: u32 = 0x6fff_ffff;
739 /// End of OS-specific section types.
740 pub const SHT_HIOS: u32 = 0x6fff_ffff;
741 /// Start of processor-specific section types.
742 pub const SHT_LOPROC: u32 = 0x7000_0000;
743 /// End of processor-specific section types.
744 pub const SHT_HIPROC: u32 = 0x7fff_ffff;
745 /// Start of application-specific section types.
746 pub const SHT_LOUSER: u32 = 0x8000_0000;
747 /// End of application-specific section types.
748 pub const SHT_HIUSER: u32 = 0x8fff_ffff;
749
750 // Values for `SectionHeader*::sh_flags`.
751 /// Section is writable.
752 pub const SHF_WRITE: u32 = 1 << 0;
753 /// Section occupies memory during execution.
754 pub const SHF_ALLOC: u32 = 1 << 1;
755 /// Section is executable.
756 pub const SHF_EXECINSTR: u32 = 1 << 2;
757 /// Section may be be merged to eliminate duplication.
758 pub const SHF_MERGE: u32 = 1 << 4;
759 /// Section contains nul-terminated strings.
760 pub const SHF_STRINGS: u32 = 1 << 5;
761 /// The `sh_info` field contains a section header table index.
762 pub const SHF_INFO_LINK: u32 = 1 << 6;
763 /// Section has special ordering requirements when combining sections.
764 pub const SHF_LINK_ORDER: u32 = 1 << 7;
765 /// Section requires special OS-specific handling.
766 pub const SHF_OS_NONCONFORMING: u32 = 1 << 8;
767 /// Section is a member of a group.
768 pub const SHF_GROUP: u32 = 1 << 9;
769 /// Section holds thread-local storage.
770 pub const SHF_TLS: u32 = 1 << 10;
771 /// Section is compressed.
772 ///
773 /// Compressed sections begin with one of the `CompressionHeader*` headers.
774 pub const SHF_COMPRESSED: u32 = 1 << 11;
775 /// OS-specific section flags.
776 pub const SHF_MASKOS: u32 = 0x0ff0_0000;
777 /// Processor-specific section flags.
778 pub const SHF_MASKPROC: u32 = 0xf000_0000;
779 /// This section is excluded from the final executable or shared library.
780 pub const SHF_EXCLUDE: u32 = 0x8000_0000;
781
782 /// Section compression header.
783 ///
784 /// Used when `SHF_COMPRESSED` is set.
785 ///
786 /// Note: this type currently allows for misaligned headers, but that may be
787 /// changed in a future version.
788 #[derive(Debug, Default, Clone, Copy)]
789 #[repr(C)]
790 pub struct CompressionHeader32<E: Endian> {
791 /// Compression format. One of the `ELFCOMPRESS_*` values.
792 pub ch_type: U32Bytes<E>,
793 /// Uncompressed data size.
794 pub ch_size: U32Bytes<E>,
795 /// Uncompressed data alignment.
796 pub ch_addralign: U32Bytes<E>,
797 }
798
799 /// Section compression header.
800 ///
801 /// Used when `SHF_COMPRESSED` is set.
802 ///
803 /// Note: this type currently allows for misaligned headers, but that may be
804 /// changed in a future version.
805 #[derive(Debug, Default, Clone, Copy)]
806 #[repr(C)]
807 pub struct CompressionHeader64<E: Endian> {
808 /// Compression format. One of the `ELFCOMPRESS_*` values.
809 pub ch_type: U32Bytes<E>,
810 /// Reserved.
811 pub ch_reserved: U32Bytes<E>,
812 /// Uncompressed data size.
813 pub ch_size: U64Bytes<E>,
814 /// Uncompressed data alignment.
815 pub ch_addralign: U64Bytes<E>,
816 }
817
818 /// ZLIB/DEFLATE algorithm.
819 pub const ELFCOMPRESS_ZLIB: u32 = 1;
820 /// Start of OS-specific compression types.
821 pub const ELFCOMPRESS_LOOS: u32 = 0x6000_0000;
822 /// End of OS-specific compression types.
823 pub const ELFCOMPRESS_HIOS: u32 = 0x6fff_ffff;
824 /// Start of processor-specific compression types.
825 pub const ELFCOMPRESS_LOPROC: u32 = 0x7000_0000;
826 /// End of processor-specific compression types.
827 pub const ELFCOMPRESS_HIPROC: u32 = 0x7fff_ffff;
828
829 // Values for the flag entry for section groups.
830 /// Mark group as COMDAT.
831 pub const GRP_COMDAT: u32 = 1;
832
833 /// Symbol table entry.
834 #[derive(Debug, Default, Clone, Copy)]
835 #[repr(C)]
836 pub struct Sym32<E: Endian> {
837 /// Symbol name.
838 ///
839 /// This is an offset into the symbol string table.
840 pub st_name: U32<E>,
841 /// Symbol value.
842 pub st_value: U32<E>,
843 /// Symbol size.
844 pub st_size: U32<E>,
845 /// Symbol type and binding.
846 ///
847 /// Use the `st_type` and `st_bind` methods to access this value.
848 pub st_info: u8,
849 /// Symbol visibility.
850 ///
851 /// Use the `st_visibility` method to access this value.
852 pub st_other: u8,
853 /// Section index or one of the `SHN_*` values.
854 pub st_shndx: U16<E>,
855 }
856
857 impl<E: Endian> Sym32<E> {
858 /// Get the `st_bind` component of the `st_info` field.
859 #[inline]
860 pub fn st_bind(&self) -> u8 {
861 self.st_info >> 4
862 }
863
864 /// Get the `st_type` component of the `st_info` field.
865 #[inline]
866 pub fn st_type(&self) -> u8 {
867 self.st_info & 0xf
868 }
869
870 /// Set the `st_info` field given the `st_bind` and `st_type` components.
871 #[inline]
872 pub fn set_st_info(&mut self, st_bind: u8, st_type: u8) {
873 self.st_info = (st_bind << 4) + (st_type & 0xf);
874 }
875
876 /// Get the `st_visibility` component of the `st_info` field.
877 #[inline]
878 pub fn st_visibility(&self) -> u8 {
879 self.st_other & 0x3
880 }
881 }
882
883 /// Symbol table entry.
884 #[derive(Debug, Default, Clone, Copy)]
885 #[repr(C)]
886 pub struct Sym64<E: Endian> {
887 /// Symbol name.
888 ///
889 /// This is an offset into the symbol string table.
890 pub st_name: U32<E>,
891 /// Symbol type and binding.
892 ///
893 /// Use the `st_bind` and `st_type` methods to access this value.
894 pub st_info: u8,
895 /// Symbol visibility.
896 ///
897 /// Use the `st_visibility` method to access this value.
898 pub st_other: u8,
899 /// Section index or one of the `SHN_*` values.
900 pub st_shndx: U16<E>,
901 /// Symbol value.
902 pub st_value: U64<E>,
903 /// Symbol size.
904 pub st_size: U64<E>,
905 }
906
907 impl<E: Endian> Sym64<E> {
908 /// Get the `st_bind` component of the `st_info` field.
909 #[inline]
910 pub fn st_bind(&self) -> u8 {
911 self.st_info >> 4
912 }
913
914 /// Get the `st_type` component of the `st_info` field.
915 #[inline]
916 pub fn st_type(&self) -> u8 {
917 self.st_info & 0xf
918 }
919
920 /// Set the `st_info` field given the `st_bind` and `st_type` components.
921 #[inline]
922 pub fn set_st_info(&mut self, st_bind: u8, st_type: u8) {
923 self.st_info = (st_bind << 4) + (st_type & 0xf);
924 }
925
926 /// Get the `st_visibility` component of the `st_info` field.
927 #[inline]
928 pub fn st_visibility(&self) -> u8 {
929 self.st_other & 0x3
930 }
931 }
932
933 /// Additional information about a `Sym32`.
934 #[derive(Debug, Clone, Copy)]
935 #[repr(C)]
936 pub struct Syminfo32<E: Endian> {
937 /// Direct bindings, symbol bound to.
938 pub si_boundto: U16<E>,
939 /// Per symbol flags.
940 pub si_flags: U16<E>,
941 }
942
943 /// Additional information about a `Sym64`.
944 #[derive(Debug, Clone, Copy)]
945 #[repr(C)]
946 pub struct Syminfo64<E: Endian> {
947 /// Direct bindings, symbol bound to.
948 pub si_boundto: U16<E>,
949 /// Per symbol flags.
950 pub si_flags: U16<E>,
951 }
952
953 // Values for `Syminfo*::si_boundto`.
954 /// Symbol bound to self
955 pub const SYMINFO_BT_SELF: u16 = 0xffff;
956 /// Symbol bound to parent
957 pub const SYMINFO_BT_PARENT: u16 = 0xfffe;
958 /// Beginning of reserved entries
959 pub const SYMINFO_BT_LOWRESERVE: u16 = 0xff00;
960
961 // Values for `Syminfo*::si_flags`.
962 /// Direct bound symbol
963 pub const SYMINFO_FLG_DIRECT: u16 = 0x0001;
964 /// Pass-thru symbol for translator
965 pub const SYMINFO_FLG_PASSTHRU: u16 = 0x0002;
966 /// Symbol is a copy-reloc
967 pub const SYMINFO_FLG_COPY: u16 = 0x0004;
968 /// Symbol bound to object to be lazy loaded
969 pub const SYMINFO_FLG_LAZYLOAD: u16 = 0x0008;
970
971 // Syminfo version values.
972 #[allow(missing_docs)]
973 pub const SYMINFO_NONE: u16 = 0;
974 #[allow(missing_docs)]
975 pub const SYMINFO_CURRENT: u16 = 1;
976 #[allow(missing_docs)]
977 pub const SYMINFO_NUM: u16 = 2;
978
979 // Values for bind component of `Sym*::st_info`.
980 /// Local symbol.
981 pub const STB_LOCAL: u8 = 0;
982 /// Global symbol.
983 pub const STB_GLOBAL: u8 = 1;
984 /// Weak symbol.
985 pub const STB_WEAK: u8 = 2;
986 /// Start of OS-specific symbol binding.
987 pub const STB_LOOS: u8 = 10;
988 /// Unique symbol.
989 pub const STB_GNU_UNIQUE: u8 = 10;
990 /// End of OS-specific symbol binding.
991 pub const STB_HIOS: u8 = 12;
992 /// Start of processor-specific symbol binding.
993 pub const STB_LOPROC: u8 = 13;
994 /// End of processor-specific symbol binding.
995 pub const STB_HIPROC: u8 = 15;
996
997 // Values for type component of `Sym*::st_info`.
998 /// Symbol type is unspecified.
999 pub const STT_NOTYPE: u8 = 0;
1000 /// Symbol is a data object.
1001 pub const STT_OBJECT: u8 = 1;
1002 /// Symbol is a code object.
1003 pub const STT_FUNC: u8 = 2;
1004 /// Symbol is associated with a section.
1005 pub const STT_SECTION: u8 = 3;
1006 /// Symbol's name is a file name.
1007 pub const STT_FILE: u8 = 4;
1008 /// Symbol is a common data object.
1009 pub const STT_COMMON: u8 = 5;
1010 /// Symbol is a thread-local storage object.
1011 pub const STT_TLS: u8 = 6;
1012 /// Start of OS-specific symbol types.
1013 pub const STT_LOOS: u8 = 10;
1014 /// Symbol is an indirect code object.
1015 pub const STT_GNU_IFUNC: u8 = 10;
1016 /// End of OS-specific symbol types.
1017 pub const STT_HIOS: u8 = 12;
1018 /// Start of processor-specific symbol types.
1019 pub const STT_LOPROC: u8 = 13;
1020 /// End of processor-specific symbol types.
1021 pub const STT_HIPROC: u8 = 15;
1022
1023 // Values for visibility component of `Symbol*::st_other`.
1024 /// Default symbol visibility rules.
1025 pub const STV_DEFAULT: u8 = 0;
1026 /// Processor specific hidden class.
1027 pub const STV_INTERNAL: u8 = 1;
1028 /// Symbol is not visible to other components.
1029 pub const STV_HIDDEN: u8 = 2;
1030 /// Symbol is visible to other components, but is not preemptible.
1031 pub const STV_PROTECTED: u8 = 3;
1032
1033 /// Relocation table entry without explicit addend.
1034 #[derive(Debug, Clone, Copy)]
1035 #[repr(C)]
1036 pub struct Rel32<E: Endian> {
1037 /// Relocation address.
1038 pub r_offset: U32<E>,
1039 /// Relocation type and symbol index.
1040 pub r_info: U32<E>,
1041 }
1042
1043 impl<E: Endian> Rel32<E> {
1044 /// Get the `r_sym` component of the `r_info` field.
1045 #[inline]
1046 pub fn r_sym(&self, endian: E) -> u32 {
1047 self.r_info.get(endian) >> 8
1048 }
1049
1050 /// Get the `r_type` component of the `r_info` field.
1051 #[inline]
1052 pub fn r_type(&self, endian: E) -> u32 {
1053 self.r_info.get(endian) & 0xff
1054 }
1055
1056 /// Calculate the `r_info` field given the `r_sym` and `r_type` components.
1057 pub fn r_info(endian: E, r_sym: u32, r_type: u8) -> U32<E> {
1058 U32::new(endian, (r_sym << 8) | u32::from(r_type))
1059 }
1060
1061 /// Set the `r_info` field given the `r_sym` and `r_type` components.
1062 pub fn set_r_info(&mut self, endian: E, r_sym: u32, r_type: u8) {
1063 self.r_info = Self::r_info(endian, r_sym, r_type)
1064 }
1065 }
1066
1067 /// Relocation table entry with explicit addend.
1068 #[derive(Debug, Clone, Copy)]
1069 #[repr(C)]
1070 pub struct Rela32<E: Endian> {
1071 /// Relocation address.
1072 pub r_offset: U32<E>,
1073 /// Relocation type and symbol index.
1074 pub r_info: U32<E>,
1075 /// Explicit addend.
1076 pub r_addend: I32<E>,
1077 }
1078
1079 impl<E: Endian> Rela32<E> {
1080 /// Get the `r_sym` component of the `r_info` field.
1081 #[inline]
1082 pub fn r_sym(&self, endian: E) -> u32 {
1083 self.r_info.get(endian) >> 8
1084 }
1085
1086 /// Get the `r_type` component of the `r_info` field.
1087 #[inline]
1088 pub fn r_type(&self, endian: E) -> u32 {
1089 self.r_info.get(endian) & 0xff
1090 }
1091
1092 /// Calculate the `r_info` field given the `r_sym` and `r_type` components.
1093 pub fn r_info(endian: E, r_sym: u32, r_type: u8) -> U32<E> {
1094 U32::new(endian, (r_sym << 8) | u32::from(r_type))
1095 }
1096
1097 /// Set the `r_info` field given the `r_sym` and `r_type` components.
1098 pub fn set_r_info(&mut self, endian: E, r_sym: u32, r_type: u8) {
1099 self.r_info = Self::r_info(endian, r_sym, r_type)
1100 }
1101 }
1102
1103 impl<E: Endian> From<Rel32<E>> for Rela32<E> {
1104 fn from(rel: Rel32<E>) -> Self {
1105 Rela32 {
1106 r_offset: rel.r_offset,
1107 r_info: rel.r_info,
1108 r_addend: I32::default(),
1109 }
1110 }
1111 }
1112
1113 /// Relocation table entry without explicit addend.
1114 #[derive(Debug, Clone, Copy)]
1115 #[repr(C)]
1116 pub struct Rel64<E: Endian> {
1117 /// Relocation address.
1118 pub r_offset: U64<E>,
1119 /// Relocation type and symbol index.
1120 pub r_info: U64<E>,
1121 }
1122
1123 impl<E: Endian> Rel64<E> {
1124 /// Get the `r_sym` component of the `r_info` field.
1125 #[inline]
1126 pub fn r_sym(&self, endian: E) -> u32 {
1127 (self.r_info.get(endian) >> 32) as u32
1128 }
1129
1130 /// Get the `r_type` component of the `r_info` field.
1131 #[inline]
1132 pub fn r_type(&self, endian: E) -> u32 {
1133 (self.r_info.get(endian) & 0xffff_ffff) as u32
1134 }
1135
1136 /// Calculate the `r_info` field given the `r_sym` and `r_type` components.
1137 pub fn r_info(endian: E, r_sym: u32, r_type: u32) -> U64<E> {
1138 U64::new(endian, (u64::from(r_sym) << 32) | u64::from(r_type))
1139 }
1140
1141 /// Set the `r_info` field given the `r_sym` and `r_type` components.
1142 pub fn set_r_info(&mut self, endian: E, r_sym: u32, r_type: u32) {
1143 self.r_info = Self::r_info(endian, r_sym, r_type)
1144 }
1145 }
1146
1147 impl<E: Endian> From<Rel64<E>> for Rela64<E> {
1148 fn from(rel: Rel64<E>) -> Self {
1149 Rela64 {
1150 r_offset: rel.r_offset,
1151 r_info: rel.r_info,
1152 r_addend: I64::default(),
1153 }
1154 }
1155 }
1156
1157 /// Relocation table entry with explicit addend.
1158 #[derive(Debug, Clone, Copy)]
1159 #[repr(C)]
1160 pub struct Rela64<E: Endian> {
1161 /// Relocation address.
1162 pub r_offset: U64<E>,
1163 /// Relocation type and symbol index.
1164 pub r_info: U64<E>,
1165 /// Explicit addend.
1166 pub r_addend: I64<E>,
1167 }
1168
1169 impl<E: Endian> Rela64<E> {
1170 pub(crate) fn get_r_info(&self, endian: E, is_mips64el: bool) -> u64 {
1171 let mut t = self.r_info.get(endian);
1172 if is_mips64el {
1173 t = (t << 32)
1174 | ((t >> 8) & 0xff000000)
1175 | ((t >> 24) & 0x00ff0000)
1176 | ((t >> 40) & 0x0000ff00)
1177 | ((t >> 56) & 0x000000ff);
1178 }
1179 t
1180 }
1181
1182 /// Get the `r_sym` component of the `r_info` field.
1183 #[inline]
1184 pub fn r_sym(&self, endian: E, is_mips64el: bool) -> u32 {
1185 (self.get_r_info(endian, is_mips64el) >> 32) as u32
1186 }
1187
1188 /// Get the `r_type` component of the `r_info` field.
1189 #[inline]
1190 pub fn r_type(&self, endian: E, is_mips64el: bool) -> u32 {
1191 (self.get_r_info(endian, is_mips64el) & 0xffff_ffff) as u32
1192 }
1193
1194 /// Calculate the `r_info` field given the `r_sym` and `r_type` components.
1195 pub fn r_info(endian: E, is_mips64el: bool, r_sym: u32, r_type: u32) -> U64<E> {
1196 let mut t = (u64::from(r_sym) << 32) | u64::from(r_type);
1197 if is_mips64el {
1198 t = (t >> 32)
1199 | ((t & 0xff000000) << 8)
1200 | ((t & 0x00ff0000) << 24)
1201 | ((t & 0x0000ff00) << 40)
1202 | ((t & 0x000000ff) << 56);
1203 }
1204 U64::new(endian, t)
1205 }
1206
1207 /// Set the `r_info` field given the `r_sym` and `r_type` components.
1208 pub fn set_r_info(&mut self, endian: E, is_mips64el: bool, r_sym: u32, r_type: u32) {
1209 self.r_info = Self::r_info(endian, is_mips64el, r_sym, r_type);
1210 }
1211 }
1212
1213 /// Program segment header.
1214 #[derive(Debug, Clone, Copy)]
1215 #[repr(C)]
1216 pub struct ProgramHeader32<E: Endian> {
1217 /// Segment type. One of the `PT_*` constants.
1218 pub p_type: U32<E>,
1219 /// Segment file offset.
1220 pub p_offset: U32<E>,
1221 /// Segment virtual address.
1222 pub p_vaddr: U32<E>,
1223 /// Segment physical address.
1224 pub p_paddr: U32<E>,
1225 /// Segment size in the file.
1226 pub p_filesz: U32<E>,
1227 /// Segment size in memory.
1228 pub p_memsz: U32<E>,
1229 /// Segment flags. A combination of the `PF_*` constants.
1230 pub p_flags: U32<E>,
1231 /// Segment alignment.
1232 pub p_align: U32<E>,
1233 }
1234
1235 /// Program segment header.
1236 #[derive(Debug, Clone, Copy)]
1237 #[repr(C)]
1238 pub struct ProgramHeader64<E: Endian> {
1239 /// Segment type. One of the `PT_*` constants.
1240 pub p_type: U32<E>,
1241 /// Segment flags. A combination of the `PF_*` constants.
1242 pub p_flags: U32<E>,
1243 /// Segment file offset.
1244 pub p_offset: U64<E>,
1245 /// Segment virtual address.
1246 pub p_vaddr: U64<E>,
1247 /// Segment physical address.
1248 pub p_paddr: U64<E>,
1249 /// Segment size in the file.
1250 pub p_filesz: U64<E>,
1251 /// Segment size in memory.
1252 pub p_memsz: U64<E>,
1253 /// Segment alignment.
1254 pub p_align: U64<E>,
1255 }
1256
1257 /// Special value for `FileHeader*::e_phnum`.
1258 ///
1259 /// This indicates that the real number of program headers is too large to fit into e_phnum.
1260 /// Instead the real value is in the field `sh_info` of section 0.
1261 pub const PN_XNUM: u16 = 0xffff;
1262
1263 // Values for `ProgramHeader*::p_type`.
1264 /// Program header table entry is unused.
1265 pub const PT_NULL: u32 = 0;
1266 /// Loadable program segment.
1267 pub const PT_LOAD: u32 = 1;
1268 /// Dynamic linking information.
1269 pub const PT_DYNAMIC: u32 = 2;
1270 /// Program interpreter.
1271 pub const PT_INTERP: u32 = 3;
1272 /// Auxiliary information.
1273 pub const PT_NOTE: u32 = 4;
1274 /// Reserved.
1275 pub const PT_SHLIB: u32 = 5;
1276 /// Segment contains the program header table.
1277 pub const PT_PHDR: u32 = 6;
1278 /// Thread-local storage segment.
1279 pub const PT_TLS: u32 = 7;
1280 /// Start of OS-specific segment types.
1281 pub const PT_LOOS: u32 = 0x6000_0000;
1282 /// GCC `.eh_frame_hdr` segment.
1283 pub const PT_GNU_EH_FRAME: u32 = 0x6474_e550;
1284 /// Indicates stack executability.
1285 pub const PT_GNU_STACK: u32 = 0x6474_e551;
1286 /// Read-only after relocation.
1287 pub const PT_GNU_RELRO: u32 = 0x6474_e552;
1288 /// End of OS-specific segment types.
1289 pub const PT_HIOS: u32 = 0x6fff_ffff;
1290 /// Start of processor-specific segment types.
1291 pub const PT_LOPROC: u32 = 0x7000_0000;
1292 /// End of processor-specific segment types.
1293 pub const PT_HIPROC: u32 = 0x7fff_ffff;
1294
1295 // Values for `ProgramHeader*::p_flags`.
1296 /// Segment is executable.
1297 pub const PF_X: u32 = 1 << 0;
1298 /// Segment is writable.
1299 pub const PF_W: u32 = 1 << 1;
1300 /// Segment is readable.
1301 pub const PF_R: u32 = 1 << 2;
1302 /// OS-specific segment flags.
1303 pub const PF_MASKOS: u32 = 0x0ff0_0000;
1304 /// Processor-specific segment flags.
1305 pub const PF_MASKPROC: u32 = 0xf000_0000;
1306
1307 /// Note name for core files.
1308 pub static ELF_NOTE_CORE: &[u8] = b"CORE";
1309 /// Note name for linux core files.
1310 ///
1311 /// Notes in linux core files may also use `ELF_NOTE_CORE`.
1312 pub static ELF_NOTE_LINUX: &[u8] = b"LINUX";
1313
1314 // Values for `NoteHeader*::n_type` in core files.
1315 //
1316 /// Contains copy of prstatus struct.
1317 pub const NT_PRSTATUS: u32 = 1;
1318 /// Contains copy of fpregset struct.
1319 pub const NT_PRFPREG: u32 = 2;
1320 /// Contains copy of fpregset struct.
1321 pub const NT_FPREGSET: u32 = 2;
1322 /// Contains copy of prpsinfo struct.
1323 pub const NT_PRPSINFO: u32 = 3;
1324 /// Contains copy of prxregset struct.
1325 pub const NT_PRXREG: u32 = 4;
1326 /// Contains copy of task structure.
1327 pub const NT_TASKSTRUCT: u32 = 4;
1328 /// String from sysinfo(SI_PLATFORM).
1329 pub const NT_PLATFORM: u32 = 5;
1330 /// Contains copy of auxv array.
1331 pub const NT_AUXV: u32 = 6;
1332 /// Contains copy of gwindows struct.
1333 pub const NT_GWINDOWS: u32 = 7;
1334 /// Contains copy of asrset struct.
1335 pub const NT_ASRS: u32 = 8;
1336 /// Contains copy of pstatus struct.
1337 pub const NT_PSTATUS: u32 = 10;
1338 /// Contains copy of psinfo struct.
1339 pub const NT_PSINFO: u32 = 13;
1340 /// Contains copy of prcred struct.
1341 pub const NT_PRCRED: u32 = 14;
1342 /// Contains copy of utsname struct.
1343 pub const NT_UTSNAME: u32 = 15;
1344 /// Contains copy of lwpstatus struct.
1345 pub const NT_LWPSTATUS: u32 = 16;
1346 /// Contains copy of lwpinfo struct.
1347 pub const NT_LWPSINFO: u32 = 17;
1348 /// Contains copy of fprxregset struct.
1349 pub const NT_PRFPXREG: u32 = 20;
1350 /// Contains copy of siginfo_t, size might increase.
1351 pub const NT_SIGINFO: u32 = 0x5349_4749;
1352 /// Contains information about mapped files.
1353 pub const NT_FILE: u32 = 0x4649_4c45;
1354 /// Contains copy of user_fxsr_struct.
1355 pub const NT_PRXFPREG: u32 = 0x46e6_2b7f;
1356 /// PowerPC Altivec/VMX registers.
1357 pub const NT_PPC_VMX: u32 = 0x100;
1358 /// PowerPC SPE/EVR registers.
1359 pub const NT_PPC_SPE: u32 = 0x101;
1360 /// PowerPC VSX registers.
1361 pub const NT_PPC_VSX: u32 = 0x102;
1362 /// Target Address Register.
1363 pub const NT_PPC_TAR: u32 = 0x103;
1364 /// Program Priority Register.
1365 pub const NT_PPC_PPR: u32 = 0x104;
1366 /// Data Stream Control Register.
1367 pub const NT_PPC_DSCR: u32 = 0x105;
1368 /// Event Based Branch Registers.
1369 pub const NT_PPC_EBB: u32 = 0x106;
1370 /// Performance Monitor Registers.
1371 pub const NT_PPC_PMU: u32 = 0x107;
1372 /// TM checkpointed GPR Registers.
1373 pub const NT_PPC_TM_CGPR: u32 = 0x108;
1374 /// TM checkpointed FPR Registers.
1375 pub const NT_PPC_TM_CFPR: u32 = 0x109;
1376 /// TM checkpointed VMX Registers.
1377 pub const NT_PPC_TM_CVMX: u32 = 0x10a;
1378 /// TM checkpointed VSX Registers.
1379 pub const NT_PPC_TM_CVSX: u32 = 0x10b;
1380 /// TM Special Purpose Registers.
1381 pub const NT_PPC_TM_SPR: u32 = 0x10c;
1382 /// TM checkpointed Target Address Register.
1383 pub const NT_PPC_TM_CTAR: u32 = 0x10d;
1384 /// TM checkpointed Program Priority Register.
1385 pub const NT_PPC_TM_CPPR: u32 = 0x10e;
1386 /// TM checkpointed Data Stream Control Register.
1387 pub const NT_PPC_TM_CDSCR: u32 = 0x10f;
1388 /// Memory Protection Keys registers.
1389 pub const NT_PPC_PKEY: u32 = 0x110;
1390 /// i386 TLS slots (struct user_desc).
1391 pub const NT_386_TLS: u32 = 0x200;
1392 /// x86 io permission bitmap (1=deny).
1393 pub const NT_386_IOPERM: u32 = 0x201;
1394 /// x86 extended state using xsave.
1395 pub const NT_X86_XSTATE: u32 = 0x202;
1396 /// s390 upper register halves.
1397 pub const NT_S390_HIGH_GPRS: u32 = 0x300;
1398 /// s390 timer register.
1399 pub const NT_S390_TIMER: u32 = 0x301;
1400 /// s390 TOD clock comparator register.
1401 pub const NT_S390_TODCMP: u32 = 0x302;
1402 /// s390 TOD programmable register.
1403 pub const NT_S390_TODPREG: u32 = 0x303;
1404 /// s390 control registers.
1405 pub const NT_S390_CTRS: u32 = 0x304;
1406 /// s390 prefix register.
1407 pub const NT_S390_PREFIX: u32 = 0x305;
1408 /// s390 breaking event address.
1409 pub const NT_S390_LAST_BREAK: u32 = 0x306;
1410 /// s390 system call restart data.
1411 pub const NT_S390_SYSTEM_CALL: u32 = 0x307;
1412 /// s390 transaction diagnostic block.
1413 pub const NT_S390_TDB: u32 = 0x308;
1414 /// s390 vector registers 0-15 upper half.
1415 pub const NT_S390_VXRS_LOW: u32 = 0x309;
1416 /// s390 vector registers 16-31.
1417 pub const NT_S390_VXRS_HIGH: u32 = 0x30a;
1418 /// s390 guarded storage registers.
1419 pub const NT_S390_GS_CB: u32 = 0x30b;
1420 /// s390 guarded storage broadcast control block.
1421 pub const NT_S390_GS_BC: u32 = 0x30c;
1422 /// s390 runtime instrumentation.
1423 pub const NT_S390_RI_CB: u32 = 0x30d;
1424 /// ARM VFP/NEON registers.
1425 pub const NT_ARM_VFP: u32 = 0x400;
1426 /// ARM TLS register.
1427 pub const NT_ARM_TLS: u32 = 0x401;
1428 /// ARM hardware breakpoint registers.
1429 pub const NT_ARM_HW_BREAK: u32 = 0x402;
1430 /// ARM hardware watchpoint registers.
1431 pub const NT_ARM_HW_WATCH: u32 = 0x403;
1432 /// ARM system call number.
1433 pub const NT_ARM_SYSTEM_CALL: u32 = 0x404;
1434 /// ARM Scalable Vector Extension registers.
1435 pub const NT_ARM_SVE: u32 = 0x405;
1436 /// Vmcore Device Dump Note.
1437 pub const NT_VMCOREDD: u32 = 0x700;
1438 /// MIPS DSP ASE registers.
1439 pub const NT_MIPS_DSP: u32 = 0x800;
1440 /// MIPS floating-point mode.
1441 pub const NT_MIPS_FP_MODE: u32 = 0x801;
1442
1443 /// Note type for version string.
1444 ///
1445 /// This note may appear in object files.
1446 ///
1447 /// It must be handled as a special case because it has no descriptor, and instead
1448 /// uses the note name as the version string.
1449 pub const NT_VERSION: u32 = 1;
1450
1451 /// Dynamic section entry.
1452 #[derive(Debug, Clone, Copy)]
1453 #[repr(C)]
1454 pub struct Dyn32<E: Endian> {
1455 /// Dynamic entry type.
1456 pub d_tag: U32<E>,
1457 /// Value (integer or address).
1458 pub d_val: U32<E>,
1459 }
1460
1461 /// Dynamic section entry.
1462 #[derive(Debug, Clone, Copy)]
1463 #[repr(C)]
1464 pub struct Dyn64<E: Endian> {
1465 /// Dynamic entry type.
1466 pub d_tag: U64<E>,
1467 /// Value (integer or address).
1468 pub d_val: U64<E>,
1469 }
1470
1471 // Values for `Dyn*::d_tag`.
1472
1473 /// Marks end of dynamic section
1474 pub const DT_NULL: u32 = 0;
1475 /// Name of needed library
1476 pub const DT_NEEDED: u32 = 1;
1477 /// Size in bytes of PLT relocs
1478 pub const DT_PLTRELSZ: u32 = 2;
1479 /// Processor defined value
1480 pub const DT_PLTGOT: u32 = 3;
1481 /// Address of symbol hash table
1482 pub const DT_HASH: u32 = 4;
1483 /// Address of string table
1484 pub const DT_STRTAB: u32 = 5;
1485 /// Address of symbol table
1486 pub const DT_SYMTAB: u32 = 6;
1487 /// Address of Rela relocs
1488 pub const DT_RELA: u32 = 7;
1489 /// Total size of Rela relocs
1490 pub const DT_RELASZ: u32 = 8;
1491 /// Size of one Rela reloc
1492 pub const DT_RELAENT: u32 = 9;
1493 /// Size of string table
1494 pub const DT_STRSZ: u32 = 10;
1495 /// Size of one symbol table entry
1496 pub const DT_SYMENT: u32 = 11;
1497 /// Address of init function
1498 pub const DT_INIT: u32 = 12;
1499 /// Address of termination function
1500 pub const DT_FINI: u32 = 13;
1501 /// Name of shared object
1502 pub const DT_SONAME: u32 = 14;
1503 /// Library search path (deprecated)
1504 pub const DT_RPATH: u32 = 15;
1505 /// Start symbol search here
1506 pub const DT_SYMBOLIC: u32 = 16;
1507 /// Address of Rel relocs
1508 pub const DT_REL: u32 = 17;
1509 /// Total size of Rel relocs
1510 pub const DT_RELSZ: u32 = 18;
1511 /// Size of one Rel reloc
1512 pub const DT_RELENT: u32 = 19;
1513 /// Type of reloc in PLT
1514 pub const DT_PLTREL: u32 = 20;
1515 /// For debugging; unspecified
1516 pub const DT_DEBUG: u32 = 21;
1517 /// Reloc might modify .text
1518 pub const DT_TEXTREL: u32 = 22;
1519 /// Address of PLT relocs
1520 pub const DT_JMPREL: u32 = 23;
1521 /// Process relocations of object
1522 pub const DT_BIND_NOW: u32 = 24;
1523 /// Array with addresses of init fct
1524 pub const DT_INIT_ARRAY: u32 = 25;
1525 /// Array with addresses of fini fct
1526 pub const DT_FINI_ARRAY: u32 = 26;
1527 /// Size in bytes of DT_INIT_ARRAY
1528 pub const DT_INIT_ARRAYSZ: u32 = 27;
1529 /// Size in bytes of DT_FINI_ARRAY
1530 pub const DT_FINI_ARRAYSZ: u32 = 28;
1531 /// Library search path
1532 pub const DT_RUNPATH: u32 = 29;
1533 /// Flags for the object being loaded
1534 pub const DT_FLAGS: u32 = 30;
1535 /// Start of encoded range
1536 pub const DT_ENCODING: u32 = 32;
1537 /// Array with addresses of preinit fct
1538 pub const DT_PREINIT_ARRAY: u32 = 32;
1539 /// size in bytes of DT_PREINIT_ARRAY
1540 pub const DT_PREINIT_ARRAYSZ: u32 = 33;
1541 /// Address of SYMTAB_SHNDX section
1542 pub const DT_SYMTAB_SHNDX: u32 = 34;
1543 /// Start of OS-specific
1544 pub const DT_LOOS: u32 = 0x6000_000d;
1545 /// End of OS-specific
1546 pub const DT_HIOS: u32 = 0x6fff_f000;
1547 /// Start of processor-specific
1548 pub const DT_LOPROC: u32 = 0x7000_0000;
1549 /// End of processor-specific
1550 pub const DT_HIPROC: u32 = 0x7fff_ffff;
1551
1552 // `DT_*` entries between `DT_VALRNGHI` & `DT_VALRNGLO` use `d_val` as a value.
1553 #[allow(missing_docs)]
1554 pub const DT_VALRNGLO: u32 = 0x6fff_fd00;
1555 /// Prelinking timestamp
1556 pub const DT_GNU_PRELINKED: u32 = 0x6fff_fdf5;
1557 /// Size of conflict section
1558 pub const DT_GNU_CONFLICTSZ: u32 = 0x6fff_fdf6;
1559 /// Size of library list
1560 pub const DT_GNU_LIBLISTSZ: u32 = 0x6fff_fdf7;
1561 #[allow(missing_docs)]
1562 pub const DT_CHECKSUM: u32 = 0x6fff_fdf8;
1563 #[allow(missing_docs)]
1564 pub const DT_PLTPADSZ: u32 = 0x6fff_fdf9;
1565 #[allow(missing_docs)]
1566 pub const DT_MOVEENT: u32 = 0x6fff_fdfa;
1567 #[allow(missing_docs)]
1568 pub const DT_MOVESZ: u32 = 0x6fff_fdfb;
1569 /// Feature selection (DTF_*).
1570 pub const DT_FEATURE_1: u32 = 0x6fff_fdfc;
1571 /// Flags for DT_* entries, affecting the following DT_* entry.
1572 pub const DT_POSFLAG_1: u32 = 0x6fff_fdfd;
1573 /// Size of syminfo table (in bytes)
1574 pub const DT_SYMINSZ: u32 = 0x6fff_fdfe;
1575 /// Entry size of syminfo
1576 pub const DT_SYMINENT: u32 = 0x6fff_fdff;
1577 #[allow(missing_docs)]
1578 pub const DT_VALRNGHI: u32 = 0x6fff_fdff;
1579
1580 // `DT_*` entries between `DT_ADDRRNGHI` & `DT_ADDRRNGLO` use `d_val` as an address.
1581 //
1582 // If any adjustment is made to the ELF object after it has been
1583 // built these entries will need to be adjusted.
1584 #[allow(missing_docs)]
1585 pub const DT_ADDRRNGLO: u32 = 0x6fff_fe00;
1586 /// GNU-style hash table.
1587 pub const DT_GNU_HASH: u32 = 0x6fff_fef5;
1588 #[allow(missing_docs)]
1589 pub const DT_TLSDESC_PLT: u32 = 0x6fff_fef6;
1590 #[allow(missing_docs)]
1591 pub const DT_TLSDESC_GOT: u32 = 0x6fff_fef7;
1592 /// Start of conflict section
1593 pub const DT_GNU_CONFLICT: u32 = 0x6fff_fef8;
1594 /// Library list
1595 pub const DT_GNU_LIBLIST: u32 = 0x6fff_fef9;
1596 /// Configuration information.
1597 pub const DT_CONFIG: u32 = 0x6fff_fefa;
1598 /// Dependency auditing.
1599 pub const DT_DEPAUDIT: u32 = 0x6fff_fefb;
1600 /// Object auditing.
1601 pub const DT_AUDIT: u32 = 0x6fff_fefc;
1602 /// PLT padding.
1603 pub const DT_PLTPAD: u32 = 0x6fff_fefd;
1604 /// Move table.
1605 pub const DT_MOVETAB: u32 = 0x6fff_fefe;
1606 /// Syminfo table.
1607 pub const DT_SYMINFO: u32 = 0x6fff_feff;
1608 #[allow(missing_docs)]
1609 pub const DT_ADDRRNGHI: u32 = 0x6fff_feff;
1610
1611 // The versioning entry types. The next are defined as part of the
1612 // GNU extension.
1613 #[allow(missing_docs)]
1614 pub const DT_VERSYM: u32 = 0x6fff_fff0;
1615 #[allow(missing_docs)]
1616 pub const DT_RELACOUNT: u32 = 0x6fff_fff9;
1617 #[allow(missing_docs)]
1618 pub const DT_RELCOUNT: u32 = 0x6fff_fffa;
1619 /// State flags, see DF_1_* below.
1620 pub const DT_FLAGS_1: u32 = 0x6fff_fffb;
1621 /// Address of version definition table
1622 pub const DT_VERDEF: u32 = 0x6fff_fffc;
1623 /// Number of version definitions
1624 pub const DT_VERDEFNUM: u32 = 0x6fff_fffd;
1625 /// Address of table with needed versions
1626 pub const DT_VERNEED: u32 = 0x6fff_fffe;
1627 /// Number of needed versions
1628 pub const DT_VERNEEDNUM: u32 = 0x6fff_ffff;
1629
1630 // Machine-independent extensions in the "processor-specific" range.
1631 /// Shared object to load before self
1632 pub const DT_AUXILIARY: u32 = 0x7fff_fffd;
1633 /// Shared object to get values from
1634 pub const DT_FILTER: u32 = 0x7fff_ffff;
1635
1636 // Values of `Dyn*::d_val` in the `DT_FLAGS` entry.
1637 /// Object may use DF_ORIGIN
1638 pub const DF_ORIGIN: u32 = 0x0000_0001;
1639 /// Symbol resolutions starts here
1640 pub const DF_SYMBOLIC: u32 = 0x0000_0002;
1641 /// Object contains text relocations
1642 pub const DF_TEXTREL: u32 = 0x0000_0004;
1643 /// No lazy binding for this object
1644 pub const DF_BIND_NOW: u32 = 0x0000_0008;
1645 /// Module uses the static TLS model
1646 pub const DF_STATIC_TLS: u32 = 0x0000_0010;
1647
1648 // Values of `Dyn*::d_val` in the `DT_FLAGS_1` entry.
1649 /// Set RTLD_NOW for this object.
1650 pub const DF_1_NOW: u32 = 0x0000_0001;
1651 /// Set RTLD_GLOBAL for this object.
1652 pub const DF_1_GLOBAL: u32 = 0x0000_0002;
1653 /// Set RTLD_GROUP for this object.
1654 pub const DF_1_GROUP: u32 = 0x0000_0004;
1655 /// Set RTLD_NODELETE for this object.
1656 pub const DF_1_NODELETE: u32 = 0x0000_0008;
1657 /// Trigger filtee loading at runtime.
1658 pub const DF_1_LOADFLTR: u32 = 0x0000_0010;
1659 /// Set RTLD_INITFIRST for this object.
1660 pub const DF_1_INITFIRST: u32 = 0x0000_0020;
1661 /// Set RTLD_NOOPEN for this object.
1662 pub const DF_1_NOOPEN: u32 = 0x0000_0040;
1663 /// $ORIGIN must be handled.
1664 pub const DF_1_ORIGIN: u32 = 0x0000_0080;
1665 /// Direct binding enabled.
1666 pub const DF_1_DIRECT: u32 = 0x0000_0100;
1667 #[allow(missing_docs)]
1668 pub const DF_1_TRANS: u32 = 0x0000_0200;
1669 /// Object is used to interpose.
1670 pub const DF_1_INTERPOSE: u32 = 0x0000_0400;
1671 /// Ignore default lib search path.
1672 pub const DF_1_NODEFLIB: u32 = 0x0000_0800;
1673 /// Object can't be dldump'ed.
1674 pub const DF_1_NODUMP: u32 = 0x0000_1000;
1675 /// Configuration alternative created.
1676 pub const DF_1_CONFALT: u32 = 0x0000_2000;
1677 /// Filtee terminates filters search.
1678 pub const DF_1_ENDFILTEE: u32 = 0x0000_4000;
1679 /// Disp reloc applied at build time.
1680 pub const DF_1_DISPRELDNE: u32 = 0x0000_8000;
1681 /// Disp reloc applied at run-time.
1682 pub const DF_1_DISPRELPND: u32 = 0x0001_0000;
1683 /// Object has no-direct binding.
1684 pub const DF_1_NODIRECT: u32 = 0x0002_0000;
1685 #[allow(missing_docs)]
1686 pub const DF_1_IGNMULDEF: u32 = 0x0004_0000;
1687 #[allow(missing_docs)]
1688 pub const DF_1_NOKSYMS: u32 = 0x0008_0000;
1689 #[allow(missing_docs)]
1690 pub const DF_1_NOHDR: u32 = 0x0010_0000;
1691 /// Object is modified after built.
1692 pub const DF_1_EDITED: u32 = 0x0020_0000;
1693 #[allow(missing_docs)]
1694 pub const DF_1_NORELOC: u32 = 0x0040_0000;
1695 /// Object has individual interposers.
1696 pub const DF_1_SYMINTPOSE: u32 = 0x0080_0000;
1697 /// Global auditing required.
1698 pub const DF_1_GLOBAUDIT: u32 = 0x0100_0000;
1699 /// Singleton symbols are used.
1700 pub const DF_1_SINGLETON: u32 = 0x0200_0000;
1701 #[allow(missing_docs)]
1702 pub const DF_1_STUB: u32 = 0x0400_0000;
1703 #[allow(missing_docs)]
1704 pub const DF_1_PIE: u32 = 0x0800_0000;
1705
1706 /// Version symbol information
1707 #[derive(Debug, Clone, Copy)]
1708 #[repr(C)]
1709 pub struct Versym<E: Endian>(pub U16<E>);
1710
1711 /// Symbol is hidden.
1712 pub const VERSYM_HIDDEN: u16 = 0x8000;
1713 /// Symbol version index.
1714 pub const VERSYM_VERSION: u16 = 0x7fff;
1715
1716 /// Version definition sections
1717 #[derive(Debug, Clone, Copy)]
1718 #[repr(C)]
1719 pub struct Verdef<E: Endian> {
1720 /// Version revision
1721 pub vd_version: U16<E>,
1722 /// Version information
1723 pub vd_flags: U16<E>,
1724 /// Version Index
1725 pub vd_ndx: U16<E>,
1726 /// Number of associated aux entries
1727 pub vd_cnt: U16<E>,
1728 /// Version name hash value
1729 pub vd_hash: U32<E>,
1730 /// Offset in bytes to verdaux array
1731 pub vd_aux: U32<E>,
1732 /// Offset in bytes to next verdef entry
1733 pub vd_next: U32<E>,
1734 }
1735
1736 // Legal values for vd_version (version revision).
1737 /// No version
1738 pub const VER_DEF_NONE: u16 = 0;
1739 /// Current version
1740 pub const VER_DEF_CURRENT: u16 = 1;
1741
1742 // Legal values for vd_flags (version information flags).
1743 /// Version definition of file itself
1744 pub const VER_FLG_BASE: u16 = 0x1;
1745 // Legal values for vd_flags and vna_flags (version information flags).
1746 /// Weak version identifier
1747 pub const VER_FLG_WEAK: u16 = 0x2;
1748
1749 // Versym symbol index values.
1750 /// Symbol is local.
1751 pub const VER_NDX_LOCAL: u16 = 0;
1752 /// Symbol is global.
1753 pub const VER_NDX_GLOBAL: u16 = 1;
1754
1755 /// Auxiliary version information.
1756 #[derive(Debug, Clone, Copy)]
1757 #[repr(C)]
1758 pub struct Verdaux<E: Endian> {
1759 /// Version or dependency names
1760 pub vda_name: U32<E>,
1761 /// Offset in bytes to next verdaux
1762 pub vda_next: U32<E>,
1763 }
1764
1765 /// Version dependency.
1766 #[derive(Debug, Clone, Copy)]
1767 #[repr(C)]
1768 pub struct Verneed<E: Endian> {
1769 /// Version of structure
1770 pub vn_version: U16<E>,
1771 /// Number of associated aux entries
1772 pub vn_cnt: U16<E>,
1773 /// Offset of filename for this dependency
1774 pub vn_file: U32<E>,
1775 /// Offset in bytes to vernaux array
1776 pub vn_aux: U32<E>,
1777 /// Offset in bytes to next verneed entry
1778 pub vn_next: U32<E>,
1779 }
1780
1781 // Legal values for vn_version (version revision).
1782 /// No version
1783 pub const VER_NEED_NONE: u16 = 0;
1784 /// Current version
1785 pub const VER_NEED_CURRENT: u16 = 1;
1786
1787 /// Auxiliary needed version information.
1788 #[derive(Debug, Clone, Copy)]
1789 #[repr(C)]
1790 pub struct Vernaux<E: Endian> {
1791 /// Hash value of dependency name
1792 pub vna_hash: U32<E>,
1793 /// Dependency specific information
1794 pub vna_flags: U16<E>,
1795 /// Version Index
1796 pub vna_other: U16<E>,
1797 /// Dependency name string offset
1798 pub vna_name: U32<E>,
1799 /// Offset in bytes to next vernaux entry
1800 pub vna_next: U32<E>,
1801 }
1802
1803 // TODO: Elf*_auxv_t, AT_*
1804
1805 /// Note section entry header.
1806 ///
1807 /// A note consists of a header followed by a variable length name and descriptor.
1808 #[derive(Debug, Clone, Copy)]
1809 #[repr(C)]
1810 pub struct NoteHeader32<E: Endian> {
1811 /// Length of the note's name.
1812 ///
1813 /// Some known names are defined by the `ELF_NOTE_*` constants.
1814 pub n_namesz: U32<E>,
1815 /// Length of the note's descriptor.
1816 ///
1817 /// The content of the descriptor depends on the note name and type.
1818 pub n_descsz: U32<E>,
1819 /// Type of the note.
1820 ///
1821 /// One of the `NT_*` constants. The note name determines which
1822 /// `NT_*` constants are valid.
1823 pub n_type: U32<E>,
1824 }
1825
1826 /// Note section entry header.
1827 #[derive(Debug, Clone, Copy)]
1828 #[repr(C)]
1829 pub struct NoteHeader64<E: Endian> {
1830 /// Length of the note's name.
1831 ///
1832 /// Some known names are defined by the `ELF_NOTE_*` constants.
1833 pub n_namesz: U32<E>,
1834 /// Length of the note's descriptor.
1835 ///
1836 /// The content of the descriptor depends on the note name and type.
1837 pub n_descsz: U32<E>,
1838 /// Type of the note.
1839 ///
1840 /// One of the `NT_*` constants. The note name determines which
1841 /// `NT_*` constants are valid.
1842 pub n_type: U32<E>,
1843 }
1844
1845 /// Solaris entries in the note section have this name.
1846 pub static ELF_NOTE_SOLARIS: &[u8] = b"SUNW Solaris";
1847
1848 // Values for `n_type` when the name is `ELF_NOTE_SOLARIS`.
1849 /// Desired pagesize for the binary.
1850 pub const NT_SOLARIS_PAGESIZE_HINT: u32 = 1;
1851
1852 /// GNU entries in the note section have this name.
1853 pub static ELF_NOTE_GNU: &[u8] = b"GNU";
1854
1855 // Note types for `ELF_NOTE_GNU`.
1856
1857 /// ABI information.
1858 ///
1859 /// The descriptor consists of words:
1860 /// - word 0: OS descriptor
1861 /// - word 1: major version of the ABI
1862 /// - word 2: minor version of the ABI
1863 /// - word 3: subminor version of the ABI
1864 pub const NT_GNU_ABI_TAG: u32 = 1;
1865
1866 /// OS descriptor for `NT_GNU_ABI_TAG`.
1867 pub const ELF_NOTE_OS_LINUX: u32 = 0;
1868 /// OS descriptor for `NT_GNU_ABI_TAG`.
1869 pub const ELF_NOTE_OS_GNU: u32 = 1;
1870 /// OS descriptor for `NT_GNU_ABI_TAG`.
1871 pub const ELF_NOTE_OS_SOLARIS2: u32 = 2;
1872 /// OS descriptor for `NT_GNU_ABI_TAG`.
1873 pub const ELF_NOTE_OS_FREEBSD: u32 = 3;
1874
1875 /// Synthetic hwcap information.
1876 ///
1877 /// The descriptor begins with two words:
1878 /// - word 0: number of entries
1879 /// - word 1: bitmask of enabled entries
1880 /// Then follow variable-length entries, one byte followed by a
1881 /// '\0'-terminated hwcap name string. The byte gives the bit
1882 /// number to test if enabled, (1U << bit) & bitmask. */
1883 pub const NT_GNU_HWCAP: u32 = 2;
1884
1885 /// Build ID bits as generated by `ld --build-id`.
1886 ///
1887 /// The descriptor consists of any nonzero number of bytes.
1888 pub const NT_GNU_BUILD_ID: u32 = 3;
1889
1890 /// Version note generated by GNU gold containing a version string.
1891 pub const NT_GNU_GOLD_VERSION: u32 = 4;
1892
1893 /// Program property.
1894 pub const NT_GNU_PROPERTY_TYPE_0: u32 = 5;
1895
1896 // TODO: GNU_PROPERTY_*
1897 // TODO: Elf*_Move
1898
1899 /// Header of `SHT_HASH` section.
1900 #[derive(Debug, Clone, Copy)]
1901 #[repr(C)]
1902 pub struct HashHeader<E: Endian> {
1903 /// The number of hash buckets.
1904 pub bucket_count: U32<E>,
1905 /// The number of chain values.
1906 pub chain_count: U32<E>,
1907 // Array of hash bucket start indices.
1908 // buckets: U32<E>[bucket_count]
1909 // Array of hash chain links. An index of 0 terminates the chain.
1910 // chains: U32<E>[chain_count]
1911 }
1912
1913 /// Calculate the SysV hash for a symbol name.
1914 ///
1915 /// Used for `SHT_HASH`.
1916 pub fn hash(name: &[u8]) -> u32 {
1917 let mut hash = 0u32;
1918 for byte in name {
1919 hash = hash.wrapping_mul(16).wrapping_add(u32::from(*byte));
1920 hash ^= (hash >> 24) & 0xf0;
1921 }
1922 hash & 0xfff_ffff
1923 }
1924
1925 /// Header of `SHT_GNU_HASH` section.
1926 #[derive(Debug, Clone, Copy)]
1927 #[repr(C)]
1928 pub struct GnuHashHeader<E: Endian> {
1929 /// The number of hash buckets.
1930 pub bucket_count: U32<E>,
1931 /// The symbol table index of the first symbol in the hash.
1932 pub symbol_base: U32<E>,
1933 /// The number of words in the bloom filter.
1934 ///
1935 /// Must be a non-zero power of 2.
1936 pub bloom_count: U32<E>,
1937 /// The bit shift count for the bloom filter.
1938 pub bloom_shift: U32<E>,
1939 // Array of bloom filter words.
1940 // bloom_filters: U32<E>[bloom_count] or U64<E>[bloom_count]
1941 // Array of hash bucket start indices.
1942 // buckets: U32<E>[bucket_count]
1943 // Array of hash values, one for each symbol starting at symbol_base.
1944 // values: U32<E>[symbol_count]
1945 }
1946
1947 /// Calculate the GNU hash for a symbol name.
1948 ///
1949 /// Used for `SHT_GNU_HASH`.
1950 pub fn gnu_hash(name: &[u8]) -> u32 {
1951 let mut hash = 5381u32;
1952 for byte in name {
1953 hash = hash.wrapping_mul(33).wrapping_add(u32::from(*byte));
1954 }
1955 hash
1956 }
1957
1958 // Motorola 68k specific definitions.
1959
1960 // m68k values for `Rel*::r_type`.
1961
1962 /// No reloc
1963 pub const R_68K_NONE: u32 = 0;
1964 /// Direct 32 bit
1965 pub const R_68K_32: u32 = 1;
1966 /// Direct 16 bit
1967 pub const R_68K_16: u32 = 2;
1968 /// Direct 8 bit
1969 pub const R_68K_8: u32 = 3;
1970 /// PC relative 32 bit
1971 pub const R_68K_PC32: u32 = 4;
1972 /// PC relative 16 bit
1973 pub const R_68K_PC16: u32 = 5;
1974 /// PC relative 8 bit
1975 pub const R_68K_PC8: u32 = 6;
1976 /// 32 bit PC relative GOT entry
1977 pub const R_68K_GOT32: u32 = 7;
1978 /// 16 bit PC relative GOT entry
1979 pub const R_68K_GOT16: u32 = 8;
1980 /// 8 bit PC relative GOT entry
1981 pub const R_68K_GOT8: u32 = 9;
1982 /// 32 bit GOT offset
1983 pub const R_68K_GOT32O: u32 = 10;
1984 /// 16 bit GOT offset
1985 pub const R_68K_GOT16O: u32 = 11;
1986 /// 8 bit GOT offset
1987 pub const R_68K_GOT8O: u32 = 12;
1988 /// 32 bit PC relative PLT address
1989 pub const R_68K_PLT32: u32 = 13;
1990 /// 16 bit PC relative PLT address
1991 pub const R_68K_PLT16: u32 = 14;
1992 /// 8 bit PC relative PLT address
1993 pub const R_68K_PLT8: u32 = 15;
1994 /// 32 bit PLT offset
1995 pub const R_68K_PLT32O: u32 = 16;
1996 /// 16 bit PLT offset
1997 pub const R_68K_PLT16O: u32 = 17;
1998 /// 8 bit PLT offset
1999 pub const R_68K_PLT8O: u32 = 18;
2000 /// Copy symbol at runtime
2001 pub const R_68K_COPY: u32 = 19;
2002 /// Create GOT entry
2003 pub const R_68K_GLOB_DAT: u32 = 20;
2004 /// Create PLT entry
2005 pub const R_68K_JMP_SLOT: u32 = 21;
2006 /// Adjust by program base
2007 pub const R_68K_RELATIVE: u32 = 22;
2008 /// 32 bit GOT offset for GD
2009 pub const R_68K_TLS_GD32: u32 = 25;
2010 /// 16 bit GOT offset for GD
2011 pub const R_68K_TLS_GD16: u32 = 26;
2012 /// 8 bit GOT offset for GD
2013 pub const R_68K_TLS_GD8: u32 = 27;
2014 /// 32 bit GOT offset for LDM
2015 pub const R_68K_TLS_LDM32: u32 = 28;
2016 /// 16 bit GOT offset for LDM
2017 pub const R_68K_TLS_LDM16: u32 = 29;
2018 /// 8 bit GOT offset for LDM
2019 pub const R_68K_TLS_LDM8: u32 = 30;
2020 /// 32 bit module-relative offset
2021 pub const R_68K_TLS_LDO32: u32 = 31;
2022 /// 16 bit module-relative offset
2023 pub const R_68K_TLS_LDO16: u32 = 32;
2024 /// 8 bit module-relative offset
2025 pub const R_68K_TLS_LDO8: u32 = 33;
2026 /// 32 bit GOT offset for IE
2027 pub const R_68K_TLS_IE32: u32 = 34;
2028 /// 16 bit GOT offset for IE
2029 pub const R_68K_TLS_IE16: u32 = 35;
2030 /// 8 bit GOT offset for IE
2031 pub const R_68K_TLS_IE8: u32 = 36;
2032 /// 32 bit offset relative to static TLS block
2033 pub const R_68K_TLS_LE32: u32 = 37;
2034 /// 16 bit offset relative to static TLS block
2035 pub const R_68K_TLS_LE16: u32 = 38;
2036 /// 8 bit offset relative to static TLS block
2037 pub const R_68K_TLS_LE8: u32 = 39;
2038 /// 32 bit module number
2039 pub const R_68K_TLS_DTPMOD32: u32 = 40;
2040 /// 32 bit module-relative offset
2041 pub const R_68K_TLS_DTPREL32: u32 = 41;
2042 /// 32 bit TP-relative offset
2043 pub const R_68K_TLS_TPREL32: u32 = 42;
2044
2045 // Intel 80386 specific definitions.
2046
2047 // i386 values for `Rel*::r_type`.
2048
2049 /// No reloc
2050 pub const R_386_NONE: u32 = 0;
2051 /// Direct 32 bit
2052 pub const R_386_32: u32 = 1;
2053 /// PC relative 32 bit
2054 pub const R_386_PC32: u32 = 2;
2055 /// 32 bit GOT entry
2056 pub const R_386_GOT32: u32 = 3;
2057 /// 32 bit PLT address
2058 pub const R_386_PLT32: u32 = 4;
2059 /// Copy symbol at runtime
2060 pub const R_386_COPY: u32 = 5;
2061 /// Create GOT entry
2062 pub const R_386_GLOB_DAT: u32 = 6;
2063 /// Create PLT entry
2064 pub const R_386_JMP_SLOT: u32 = 7;
2065 /// Adjust by program base
2066 pub const R_386_RELATIVE: u32 = 8;
2067 /// 32 bit offset to GOT
2068 pub const R_386_GOTOFF: u32 = 9;
2069 /// 32 bit PC relative offset to GOT
2070 pub const R_386_GOTPC: u32 = 10;
2071 /// Direct 32 bit PLT address
2072 pub const R_386_32PLT: u32 = 11;
2073 /// Offset in static TLS block
2074 pub const R_386_TLS_TPOFF: u32 = 14;
2075 /// Address of GOT entry for static TLS block offset
2076 pub const R_386_TLS_IE: u32 = 15;
2077 /// GOT entry for static TLS block offset
2078 pub const R_386_TLS_GOTIE: u32 = 16;
2079 /// Offset relative to static TLS block
2080 pub const R_386_TLS_LE: u32 = 17;
2081 /// Direct 32 bit for GNU version of general dynamic thread local data
2082 pub const R_386_TLS_GD: u32 = 18;
2083 /// Direct 32 bit for GNU version of local dynamic thread local data in LE code
2084 pub const R_386_TLS_LDM: u32 = 19;
2085 /// Direct 16 bit
2086 pub const R_386_16: u32 = 20;
2087 /// PC relative 16 bit
2088 pub const R_386_PC16: u32 = 21;
2089 /// Direct 8 bit
2090 pub const R_386_8: u32 = 22;
2091 /// PC relative 8 bit
2092 pub const R_386_PC8: u32 = 23;
2093 /// Direct 32 bit for general dynamic thread local data
2094 pub const R_386_TLS_GD_32: u32 = 24;
2095 /// Tag for pushl in GD TLS code
2096 pub const R_386_TLS_GD_PUSH: u32 = 25;
2097 /// Relocation for call to __tls_get_addr()
2098 pub const R_386_TLS_GD_CALL: u32 = 26;
2099 /// Tag for popl in GD TLS code
2100 pub const R_386_TLS_GD_POP: u32 = 27;
2101 /// Direct 32 bit for local dynamic thread local data in LE code
2102 pub const R_386_TLS_LDM_32: u32 = 28;
2103 /// Tag for pushl in LDM TLS code
2104 pub const R_386_TLS_LDM_PUSH: u32 = 29;
2105 /// Relocation for call to __tls_get_addr() in LDM code
2106 pub const R_386_TLS_LDM_CALL: u32 = 30;
2107 /// Tag for popl in LDM TLS code
2108 pub const R_386_TLS_LDM_POP: u32 = 31;
2109 /// Offset relative to TLS block
2110 pub const R_386_TLS_LDO_32: u32 = 32;
2111 /// GOT entry for negated static TLS block offset
2112 pub const R_386_TLS_IE_32: u32 = 33;
2113 /// Negated offset relative to static TLS block
2114 pub const R_386_TLS_LE_32: u32 = 34;
2115 /// ID of module containing symbol
2116 pub const R_386_TLS_DTPMOD32: u32 = 35;
2117 /// Offset in TLS block
2118 pub const R_386_TLS_DTPOFF32: u32 = 36;
2119 /// Negated offset in static TLS block
2120 pub const R_386_TLS_TPOFF32: u32 = 37;
2121 /// 32-bit symbol size
2122 pub const R_386_SIZE32: u32 = 38;
2123 /// GOT offset for TLS descriptor.
2124 pub const R_386_TLS_GOTDESC: u32 = 39;
2125 /// Marker of call through TLS descriptor for relaxation.
2126 pub const R_386_TLS_DESC_CALL: u32 = 40;
2127 /// TLS descriptor containing pointer to code and to argument, returning the TLS offset for the symbol.
2128 pub const R_386_TLS_DESC: u32 = 41;
2129 /// Adjust indirectly by program base
2130 pub const R_386_IRELATIVE: u32 = 42;
2131 /// Load from 32 bit GOT entry, relaxable.
2132 pub const R_386_GOT32X: u32 = 43;
2133
2134 // SUN SPARC specific definitions.
2135
2136 // SPARC values for `st_type` component of `Sym*::st_info`.
2137
2138 /// Global register reserved to app.
2139 pub const STT_SPARC_REGISTER: u8 = 13;
2140
2141 // SPARC values for `FileHeader64::e_flags`.
2142
2143 #[allow(missing_docs)]
2144 pub const EF_SPARCV9_MM: u32 = 3;
2145 #[allow(missing_docs)]
2146 pub const EF_SPARCV9_TSO: u32 = 0;
2147 #[allow(missing_docs)]
2148 pub const EF_SPARCV9_PSO: u32 = 1;
2149 #[allow(missing_docs)]
2150 pub const EF_SPARCV9_RMO: u32 = 2;
2151 /// little endian data
2152 pub const EF_SPARC_LEDATA: u32 = 0x80_0000;
2153 #[allow(missing_docs)]
2154 pub const EF_SPARC_EXT_MASK: u32 = 0xFF_FF00;
2155 /// generic V8+ features
2156 pub const EF_SPARC_32PLUS: u32 = 0x00_0100;
2157 /// Sun UltraSPARC1 extensions
2158 pub const EF_SPARC_SUN_US1: u32 = 0x00_0200;
2159 /// HAL R1 extensions
2160 pub const EF_SPARC_HAL_R1: u32 = 0x00_0400;
2161 /// Sun UltraSPARCIII extensions
2162 pub const EF_SPARC_SUN_US3: u32 = 0x00_0800;
2163
2164 // SPARC values for `Rel*::r_type`.
2165
2166 /// No reloc
2167 pub const R_SPARC_NONE: u32 = 0;
2168 /// Direct 8 bit
2169 pub const R_SPARC_8: u32 = 1;
2170 /// Direct 16 bit
2171 pub const R_SPARC_16: u32 = 2;
2172 /// Direct 32 bit
2173 pub const R_SPARC_32: u32 = 3;
2174 /// PC relative 8 bit
2175 pub const R_SPARC_DISP8: u32 = 4;
2176 /// PC relative 16 bit
2177 pub const R_SPARC_DISP16: u32 = 5;
2178 /// PC relative 32 bit
2179 pub const R_SPARC_DISP32: u32 = 6;
2180 /// PC relative 30 bit shifted
2181 pub const R_SPARC_WDISP30: u32 = 7;
2182 /// PC relative 22 bit shifted
2183 pub const R_SPARC_WDISP22: u32 = 8;
2184 /// High 22 bit
2185 pub const R_SPARC_HI22: u32 = 9;
2186 /// Direct 22 bit
2187 pub const R_SPARC_22: u32 = 10;
2188 /// Direct 13 bit
2189 pub const R_SPARC_13: u32 = 11;
2190 /// Truncated 10 bit
2191 pub const R_SPARC_LO10: u32 = 12;
2192 /// Truncated 10 bit GOT entry
2193 pub const R_SPARC_GOT10: u32 = 13;
2194 /// 13 bit GOT entry
2195 pub const R_SPARC_GOT13: u32 = 14;
2196 /// 22 bit GOT entry shifted
2197 pub const R_SPARC_GOT22: u32 = 15;
2198 /// PC relative 10 bit truncated
2199 pub const R_SPARC_PC10: u32 = 16;
2200 /// PC relative 22 bit shifted
2201 pub const R_SPARC_PC22: u32 = 17;
2202 /// 30 bit PC relative PLT address
2203 pub const R_SPARC_WPLT30: u32 = 18;
2204 /// Copy symbol at runtime
2205 pub const R_SPARC_COPY: u32 = 19;
2206 /// Create GOT entry
2207 pub const R_SPARC_GLOB_DAT: u32 = 20;
2208 /// Create PLT entry
2209 pub const R_SPARC_JMP_SLOT: u32 = 21;
2210 /// Adjust by program base
2211 pub const R_SPARC_RELATIVE: u32 = 22;
2212 /// Direct 32 bit unaligned
2213 pub const R_SPARC_UA32: u32 = 23;
2214
2215 // Sparc64 values for `Rel*::r_type`.
2216
2217 /// Direct 32 bit ref to PLT entry
2218 pub const R_SPARC_PLT32: u32 = 24;
2219 /// High 22 bit PLT entry
2220 pub const R_SPARC_HIPLT22: u32 = 25;
2221 /// Truncated 10 bit PLT entry
2222 pub const R_SPARC_LOPLT10: u32 = 26;
2223 /// PC rel 32 bit ref to PLT entry
2224 pub const R_SPARC_PCPLT32: u32 = 27;
2225 /// PC rel high 22 bit PLT entry
2226 pub const R_SPARC_PCPLT22: u32 = 28;
2227 /// PC rel trunc 10 bit PLT entry
2228 pub const R_SPARC_PCPLT10: u32 = 29;
2229 /// Direct 10 bit
2230 pub const R_SPARC_10: u32 = 30;
2231 /// Direct 11 bit
2232 pub const R_SPARC_11: u32 = 31;
2233 /// Direct 64 bit
2234 pub const R_SPARC_64: u32 = 32;
2235 /// 10bit with secondary 13bit addend
2236 pub const R_SPARC_OLO10: u32 = 33;
2237 /// Top 22 bits of direct 64 bit
2238 pub const R_SPARC_HH22: u32 = 34;
2239 /// High middle 10 bits of ...
2240 pub const R_SPARC_HM10: u32 = 35;
2241 /// Low middle 22 bits of ...
2242 pub const R_SPARC_LM22: u32 = 36;
2243 /// Top 22 bits of pc rel 64 bit
2244 pub const R_SPARC_PC_HH22: u32 = 37;
2245 /// High middle 10 bit of ...
2246 pub const R_SPARC_PC_HM10: u32 = 38;
2247 /// Low miggle 22 bits of ...
2248 pub const R_SPARC_PC_LM22: u32 = 39;
2249 /// PC relative 16 bit shifted
2250 pub const R_SPARC_WDISP16: u32 = 40;
2251 /// PC relative 19 bit shifted
2252 pub const R_SPARC_WDISP19: u32 = 41;
2253 /// was part of v9 ABI but was removed
2254 pub const R_SPARC_GLOB_JMP: u32 = 42;
2255 /// Direct 7 bit
2256 pub const R_SPARC_7: u32 = 43;
2257 /// Direct 5 bit
2258 pub const R_SPARC_5: u32 = 44;
2259 /// Direct 6 bit
2260 pub const R_SPARC_6: u32 = 45;
2261 /// PC relative 64 bit
2262 pub const R_SPARC_DISP64: u32 = 46;
2263 /// Direct 64 bit ref to PLT entry
2264 pub const R_SPARC_PLT64: u32 = 47;
2265 /// High 22 bit complemented
2266 pub const R_SPARC_HIX22: u32 = 48;
2267 /// Truncated 11 bit complemented
2268 pub const R_SPARC_LOX10: u32 = 49;
2269 /// Direct high 12 of 44 bit
2270 pub const R_SPARC_H44: u32 = 50;
2271 /// Direct mid 22 of 44 bit
2272 pub const R_SPARC_M44: u32 = 51;
2273 /// Direct low 10 of 44 bit
2274 pub const R_SPARC_L44: u32 = 52;
2275 /// Global register usage
2276 pub const R_SPARC_REGISTER: u32 = 53;
2277 /// Direct 64 bit unaligned
2278 pub const R_SPARC_UA64: u32 = 54;
2279 /// Direct 16 bit unaligned
2280 pub const R_SPARC_UA16: u32 = 55;
2281 #[allow(missing_docs)]
2282 pub const R_SPARC_TLS_GD_HI22: u32 = 56;
2283 #[allow(missing_docs)]
2284 pub const R_SPARC_TLS_GD_LO10: u32 = 57;
2285 #[allow(missing_docs)]
2286 pub const R_SPARC_TLS_GD_ADD: u32 = 58;
2287 #[allow(missing_docs)]
2288 pub const R_SPARC_TLS_GD_CALL: u32 = 59;
2289 #[allow(missing_docs)]
2290 pub const R_SPARC_TLS_LDM_HI22: u32 = 60;
2291 #[allow(missing_docs)]
2292 pub const R_SPARC_TLS_LDM_LO10: u32 = 61;
2293 #[allow(missing_docs)]
2294 pub const R_SPARC_TLS_LDM_ADD: u32 = 62;
2295 #[allow(missing_docs)]
2296 pub const R_SPARC_TLS_LDM_CALL: u32 = 63;
2297 #[allow(missing_docs)]
2298 pub const R_SPARC_TLS_LDO_HIX22: u32 = 64;
2299 #[allow(missing_docs)]
2300 pub const R_SPARC_TLS_LDO_LOX10: u32 = 65;
2301 #[allow(missing_docs)]
2302 pub const R_SPARC_TLS_LDO_ADD: u32 = 66;
2303 #[allow(missing_docs)]
2304 pub const R_SPARC_TLS_IE_HI22: u32 = 67;
2305 #[allow(missing_docs)]
2306 pub const R_SPARC_TLS_IE_LO10: u32 = 68;
2307 #[allow(missing_docs)]
2308 pub const R_SPARC_TLS_IE_LD: u32 = 69;
2309 #[allow(missing_docs)]
2310 pub const R_SPARC_TLS_IE_LDX: u32 = 70;
2311 #[allow(missing_docs)]
2312 pub const R_SPARC_TLS_IE_ADD: u32 = 71;
2313 #[allow(missing_docs)]
2314 pub const R_SPARC_TLS_LE_HIX22: u32 = 72;
2315 #[allow(missing_docs)]
2316 pub const R_SPARC_TLS_LE_LOX10: u32 = 73;
2317 #[allow(missing_docs)]
2318 pub const R_SPARC_TLS_DTPMOD32: u32 = 74;
2319 #[allow(missing_docs)]
2320 pub const R_SPARC_TLS_DTPMOD64: u32 = 75;
2321 #[allow(missing_docs)]
2322 pub const R_SPARC_TLS_DTPOFF32: u32 = 76;
2323 #[allow(missing_docs)]
2324 pub const R_SPARC_TLS_DTPOFF64: u32 = 77;
2325 #[allow(missing_docs)]
2326 pub const R_SPARC_TLS_TPOFF32: u32 = 78;
2327 #[allow(missing_docs)]
2328 pub const R_SPARC_TLS_TPOFF64: u32 = 79;
2329 #[allow(missing_docs)]
2330 pub const R_SPARC_GOTDATA_HIX22: u32 = 80;
2331 #[allow(missing_docs)]
2332 pub const R_SPARC_GOTDATA_LOX10: u32 = 81;
2333 #[allow(missing_docs)]
2334 pub const R_SPARC_GOTDATA_OP_HIX22: u32 = 82;
2335 #[allow(missing_docs)]
2336 pub const R_SPARC_GOTDATA_OP_LOX10: u32 = 83;
2337 #[allow(missing_docs)]
2338 pub const R_SPARC_GOTDATA_OP: u32 = 84;
2339 #[allow(missing_docs)]
2340 pub const R_SPARC_H34: u32 = 85;
2341 #[allow(missing_docs)]
2342 pub const R_SPARC_SIZE32: u32 = 86;
2343 #[allow(missing_docs)]
2344 pub const R_SPARC_SIZE64: u32 = 87;
2345 #[allow(missing_docs)]
2346 pub const R_SPARC_WDISP10: u32 = 88;
2347 #[allow(missing_docs)]
2348 pub const R_SPARC_JMP_IREL: u32 = 248;
2349 #[allow(missing_docs)]
2350 pub const R_SPARC_IRELATIVE: u32 = 249;
2351 #[allow(missing_docs)]
2352 pub const R_SPARC_GNU_VTINHERIT: u32 = 250;
2353 #[allow(missing_docs)]
2354 pub const R_SPARC_GNU_VTENTRY: u32 = 251;
2355 #[allow(missing_docs)]
2356 pub const R_SPARC_REV32: u32 = 252;
2357
2358 // Sparc64 values for `Dyn32::d_tag`.
2359
2360 #[allow(missing_docs)]
2361 pub const DT_SPARC_REGISTER: u32 = 0x7000_0001;
2362
2363 // MIPS R3000 specific definitions.
2364
2365 // MIPS values for `FileHeader32::e_flags`.
2366
2367 /// A .noreorder directive was used.
2368 pub const EF_MIPS_NOREORDER: u32 = 1;
2369 /// Contains PIC code.
2370 pub const EF_MIPS_PIC: u32 = 2;
2371 /// Uses PIC calling sequence.
2372 pub const EF_MIPS_CPIC: u32 = 4;
2373 #[allow(missing_docs)]
2374 pub const EF_MIPS_XGOT: u32 = 8;
2375 #[allow(missing_docs)]
2376 pub const EF_MIPS_64BIT_WHIRL: u32 = 16;
2377 #[allow(missing_docs)]
2378 pub const EF_MIPS_ABI2: u32 = 32;
2379 #[allow(missing_docs)]
2380 pub const EF_MIPS_ABI_ON32: u32 = 64;
2381 /// Uses FP64 (12 callee-saved).
2382 pub const EF_MIPS_FP64: u32 = 512;
2383 /// Uses IEEE 754-2008 NaN encoding.
2384 pub const EF_MIPS_NAN2008: u32 = 1024;
2385 /// MIPS architecture level.
2386 pub const EF_MIPS_ARCH: u32 = 0xf000_0000;
2387
2388 /// The first MIPS 32 bit ABI
2389 pub const EF_MIPS_ABI_O32: u32 = 0x0000_1000;
2390 /// O32 ABI extended for 64-bit architectures
2391 pub const EF_MIPS_ABI_O64: u32 = 0x0000_2000;
2392 /// EABI in 32-bit mode
2393 pub const EF_MIPS_ABI_EABI32: u32 = 0x0000_3000;
2394 /// EABI in 64-bit mode
2395 pub const EF_MIPS_ABI_EABI64: u32 = 0x0000_4000;
2396 /// Mask for selecting EF_MIPS_ABI_ variant
2397 pub const EF_MIPS_ABI: u32 = 0x0000_f000;
2398
2399 // Legal values for MIPS architecture level.
2400
2401 /// -mips1 code.
2402 pub const EF_MIPS_ARCH_1: u32 = 0x0000_0000;
2403 /// -mips2 code.
2404 pub const EF_MIPS_ARCH_2: u32 = 0x1000_0000;
2405 /// -mips3 code.
2406 pub const EF_MIPS_ARCH_3: u32 = 0x2000_0000;
2407 /// -mips4 code.
2408 pub const EF_MIPS_ARCH_4: u32 = 0x3000_0000;
2409 /// -mips5 code.
2410 pub const EF_MIPS_ARCH_5: u32 = 0x4000_0000;
2411 /// MIPS32 code.
2412 pub const EF_MIPS_ARCH_32: u32 = 0x5000_0000;
2413 /// MIPS64 code.
2414 pub const EF_MIPS_ARCH_64: u32 = 0x6000_0000;
2415 /// MIPS32r2 code.
2416 pub const EF_MIPS_ARCH_32R2: u32 = 0x7000_0000;
2417 /// MIPS64r2 code.
2418 pub const EF_MIPS_ARCH_64R2: u32 = 0x8000_0000;
2419 /// MIPS32r6 code
2420 pub const EF_MIPS_ARCH_32R6: u32 = 0x9000_0000;
2421 /// MIPS64r6 code
2422 pub const EF_MIPS_ARCH_64R6: u32 = 0xa000_0000;
2423
2424 // MIPS values for `Sym32::st_shndx`.
2425
2426 /// Allocated common symbols.
2427 pub const SHN_MIPS_ACOMMON: u16 = 0xff00;
2428 /// Allocated test symbols.
2429 pub const SHN_MIPS_TEXT: u16 = 0xff01;
2430 /// Allocated data symbols.
2431 pub const SHN_MIPS_DATA: u16 = 0xff02;
2432 /// Small common symbols.
2433 pub const SHN_MIPS_SCOMMON: u16 = 0xff03;
2434 /// Small undefined symbols.
2435 pub const SHN_MIPS_SUNDEFINED: u16 = 0xff04;
2436
2437 // MIPS values for `SectionHeader32::sh_type`.
2438
2439 /// Shared objects used in link.
2440 pub const SHT_MIPS_LIBLIST: u32 = 0x7000_0000;
2441 #[allow(missing_docs)]
2442 pub const SHT_MIPS_MSYM: u32 = 0x7000_0001;
2443 /// Conflicting symbols.
2444 pub const SHT_MIPS_CONFLICT: u32 = 0x7000_0002;
2445 /// Global data area sizes.
2446 pub const SHT_MIPS_GPTAB: u32 = 0x7000_0003;
2447 /// Reserved for SGI/MIPS compilers
2448 pub const SHT_MIPS_UCODE: u32 = 0x7000_0004;
2449 /// MIPS ECOFF debugging info.
2450 pub const SHT_MIPS_DEBUG: u32 = 0x7000_0005;
2451 /// Register usage information.
2452 pub const SHT_MIPS_REGINFO: u32 = 0x7000_0006;
2453 #[allow(missing_docs)]
2454 pub const SHT_MIPS_PACKAGE: u32 = 0x7000_0007;
2455 #[allow(missing_docs)]
2456 pub const SHT_MIPS_PACKSYM: u32 = 0x7000_0008;
2457 #[allow(missing_docs)]
2458 pub const SHT_MIPS_RELD: u32 = 0x7000_0009;
2459 #[allow(missing_docs)]
2460 pub const SHT_MIPS_IFACE: u32 = 0x7000_000b;
2461 #[allow(missing_docs)]
2462 pub const SHT_MIPS_CONTENT: u32 = 0x7000_000c;
2463 /// Miscellaneous options.
2464 pub const SHT_MIPS_OPTIONS: u32 = 0x7000_000d;
2465 #[allow(missing_docs)]
2466 pub const SHT_MIPS_SHDR: u32 = 0x7000_0010;
2467 #[allow(missing_docs)]
2468 pub const SHT_MIPS_FDESC: u32 = 0x7000_0011;
2469 #[allow(missing_docs)]
2470 pub const SHT_MIPS_EXTSYM: u32 = 0x7000_0012;
2471 #[allow(missing_docs)]
2472 pub const SHT_MIPS_DENSE: u32 = 0x7000_0013;
2473 #[allow(missing_docs)]
2474 pub const SHT_MIPS_PDESC: u32 = 0x7000_0014;
2475 #[allow(missing_docs)]
2476 pub const SHT_MIPS_LOCSYM: u32 = 0x7000_0015;
2477 #[allow(missing_docs)]
2478 pub const SHT_MIPS_AUXSYM: u32 = 0x7000_0016;
2479 #[allow(missing_docs)]
2480 pub const SHT_MIPS_OPTSYM: u32 = 0x7000_0017;
2481 #[allow(missing_docs)]
2482 pub const SHT_MIPS_LOCSTR: u32 = 0x7000_0018;
2483 #[allow(missing_docs)]
2484 pub const SHT_MIPS_LINE: u32 = 0x7000_0019;
2485 #[allow(missing_docs)]
2486 pub const SHT_MIPS_RFDESC: u32 = 0x7000_001a;
2487 #[allow(missing_docs)]
2488 pub const SHT_MIPS_DELTASYM: u32 = 0x7000_001b;
2489 #[allow(missing_docs)]
2490 pub const SHT_MIPS_DELTAINST: u32 = 0x7000_001c;
2491 #[allow(missing_docs)]
2492 pub const SHT_MIPS_DELTACLASS: u32 = 0x7000_001d;
2493 /// DWARF debugging information.
2494 pub const SHT_MIPS_DWARF: u32 = 0x7000_001e;
2495 #[allow(missing_docs)]
2496 pub const SHT_MIPS_DELTADECL: u32 = 0x7000_001f;
2497 #[allow(missing_docs)]
2498 pub const SHT_MIPS_SYMBOL_LIB: u32 = 0x7000_0020;
2499 /// Event section.
2500 pub const SHT_MIPS_EVENTS: u32 = 0x7000_0021;
2501 #[allow(missing_docs)]
2502 pub const SHT_MIPS_TRANSLATE: u32 = 0x7000_0022;
2503 #[allow(missing_docs)]
2504 pub const SHT_MIPS_PIXIE: u32 = 0x7000_0023;
2505 #[allow(missing_docs)]
2506 pub const SHT_MIPS_XLATE: u32 = 0x7000_0024;
2507 #[allow(missing_docs)]
2508 pub const SHT_MIPS_XLATE_DEBUG: u32 = 0x7000_0025;
2509 #[allow(missing_docs)]
2510 pub const SHT_MIPS_WHIRL: u32 = 0x7000_0026;
2511 #[allow(missing_docs)]
2512 pub const SHT_MIPS_EH_REGION: u32 = 0x7000_0027;
2513 #[allow(missing_docs)]
2514 pub const SHT_MIPS_XLATE_OLD: u32 = 0x7000_0028;
2515 #[allow(missing_docs)]
2516 pub const SHT_MIPS_PDR_EXCEPTION: u32 = 0x7000_0029;
2517
2518 // MIPS values for `SectionHeader32::sh_flags`.
2519
2520 /// Must be in global data area.
2521 pub const SHF_MIPS_GPREL: u32 = 0x1000_0000;
2522 #[allow(missing_docs)]
2523 pub const SHF_MIPS_MERGE: u32 = 0x2000_0000;
2524 #[allow(missing_docs)]
2525 pub const SHF_MIPS_ADDR: u32 = 0x4000_0000;
2526 #[allow(missing_docs)]
2527 pub const SHF_MIPS_STRINGS: u32 = 0x8000_0000;
2528 #[allow(missing_docs)]
2529 pub const SHF_MIPS_NOSTRIP: u32 = 0x0800_0000;
2530 #[allow(missing_docs)]
2531 pub const SHF_MIPS_LOCAL: u32 = 0x0400_0000;
2532 #[allow(missing_docs)]
2533 pub const SHF_MIPS_NAMES: u32 = 0x0200_0000;
2534 #[allow(missing_docs)]
2535 pub const SHF_MIPS_NODUPE: u32 = 0x0100_0000;
2536
2537 // MIPS values for `Sym32::st_other`.
2538
2539 #[allow(missing_docs)]
2540 pub const STO_MIPS_PLT: u8 = 0x8;
2541 /// Only valid for `STB_MIPS_SPLIT_COMMON`.
2542 pub const STO_MIPS_SC_ALIGN_UNUSED: u8 = 0xff;
2543
2544 // MIPS values for `Sym32::st_info'.
2545 #[allow(missing_docs)]
2546 pub const STB_MIPS_SPLIT_COMMON: u8 = 13;
2547
2548 // Entries found in sections of type `SHT_MIPS_GPTAB`.
2549
2550 // TODO: Elf32_gptab, Elf32_RegInfo, Elf_Options
2551
2552 // Values for `Elf_Options::kind`.
2553
2554 /// Undefined.
2555 pub const ODK_NULL: u32 = 0;
2556 /// Register usage information.
2557 pub const ODK_REGINFO: u32 = 1;
2558 /// Exception processing options.
2559 pub const ODK_EXCEPTIONS: u32 = 2;
2560 /// Section padding options.
2561 pub const ODK_PAD: u32 = 3;
2562 /// Hardware workarounds performed
2563 pub const ODK_HWPATCH: u32 = 4;
2564 /// record the fill value used by the linker.
2565 pub const ODK_FILL: u32 = 5;
2566 /// reserve space for desktop tools to write.
2567 pub const ODK_TAGS: u32 = 6;
2568 /// HW workarounds. 'AND' bits when merging.
2569 pub const ODK_HWAND: u32 = 7;
2570 /// HW workarounds. 'OR' bits when merging.
2571 pub const ODK_HWOR: u32 = 8;
2572
2573 // Values for `Elf_Options::info` for `ODK_EXCEPTIONS` entries.
2574
2575 /// FPE's which MUST be enabled.
2576 pub const OEX_FPU_MIN: u32 = 0x1f;
2577 /// FPE's which MAY be enabled.
2578 pub const OEX_FPU_MAX: u32 = 0x1f00;
2579 /// page zero must be mapped.
2580 pub const OEX_PAGE0: u32 = 0x10000;
2581 /// Force sequential memory mode?
2582 pub const OEX_SMM: u32 = 0x20000;
2583 /// Force floating point debug mode?
2584 pub const OEX_FPDBUG: u32 = 0x40000;
2585 #[allow(missing_docs)]
2586 pub const OEX_PRECISEFP: u32 = OEX_FPDBUG;
2587 /// Dismiss invalid address faults?
2588 pub const OEX_DISMISS: u32 = 0x80000;
2589
2590 #[allow(missing_docs)]
2591 pub const OEX_FPU_INVAL: u32 = 0x10;
2592 #[allow(missing_docs)]
2593 pub const OEX_FPU_DIV0: u32 = 0x08;
2594 #[allow(missing_docs)]
2595 pub const OEX_FPU_OFLO: u32 = 0x04;
2596 #[allow(missing_docs)]
2597 pub const OEX_FPU_UFLO: u32 = 0x02;
2598 #[allow(missing_docs)]
2599 pub const OEX_FPU_INEX: u32 = 0x01;
2600
2601 // Masks for `Elf_Options::info` for an `ODK_HWPATCH` entry. */
2602 /// R4000 end-of-page patch.
2603 pub const OHW_R4KEOP: u32 = 0x1;
2604 /// may need R8000 prefetch patch.
2605 pub const OHW_R8KPFETCH: u32 = 0x2;
2606 /// R5000 end-of-page patch.
2607 pub const OHW_R5KEOP: u32 = 0x4;
2608 /// R5000 cvt.\[ds\].l bug. clean=1.
2609 pub const OHW_R5KCVTL: u32 = 0x8;
2610
2611 #[allow(missing_docs)]
2612 pub const OPAD_PREFIX: u32 = 0x1;
2613 #[allow(missing_docs)]
2614 pub const OPAD_POSTFIX: u32 = 0x2;
2615 #[allow(missing_docs)]
2616 pub const OPAD_SYMBOL: u32 = 0x4;
2617
2618 // Entries found in sections of type `SHT_MIPS_OPTIONS`.
2619
2620 // TODO: Elf_Options_Hw
2621
2622 // Masks for `ElfOptions::info` for `ODK_HWAND` and `ODK_HWOR` entries.
2623
2624 #[allow(missing_docs)]
2625 pub const OHWA0_R4KEOP_CHECKED: u32 = 0x0000_0001;
2626 #[allow(missing_docs)]
2627 pub const OHWA1_R4KEOP_CLEAN: u32 = 0x0000_0002;
2628
2629 // MIPS values for `Rel*::r_type`.
2630
2631 /// No reloc
2632 pub const R_MIPS_NONE: u32 = 0;
2633 /// Direct 16 bit
2634 pub const R_MIPS_16: u32 = 1;
2635 /// Direct 32 bit
2636 pub const R_MIPS_32: u32 = 2;
2637 /// PC relative 32 bit
2638 pub const R_MIPS_REL32: u32 = 3;
2639 /// Direct 26 bit shifted
2640 pub const R_MIPS_26: u32 = 4;
2641 /// High 16 bit
2642 pub const R_MIPS_HI16: u32 = 5;
2643 /// Low 16 bit
2644 pub const R_MIPS_LO16: u32 = 6;
2645 /// GP relative 16 bit
2646 pub const R_MIPS_GPREL16: u32 = 7;
2647 /// 16 bit literal entry
2648 pub const R_MIPS_LITERAL: u32 = 8;
2649 /// 16 bit GOT entry
2650 pub const R_MIPS_GOT16: u32 = 9;
2651 /// PC relative 16 bit
2652 pub const R_MIPS_PC16: u32 = 10;
2653 /// 16 bit GOT entry for function
2654 pub const R_MIPS_CALL16: u32 = 11;
2655 /// GP relative 32 bit
2656 pub const R_MIPS_GPREL32: u32 = 12;
2657
2658 #[allow(missing_docs)]
2659 pub const R_MIPS_SHIFT5: u32 = 16;
2660 #[allow(missing_docs)]
2661 pub const R_MIPS_SHIFT6: u32 = 17;
2662 #[allow(missing_docs)]
2663 pub const R_MIPS_64: u32 = 18;
2664 #[allow(missing_docs)]
2665 pub const R_MIPS_GOT_DISP: u32 = 19;
2666 #[allow(missing_docs)]
2667 pub const R_MIPS_GOT_PAGE: u32 = 20;
2668 #[allow(missing_docs)]
2669 pub const R_MIPS_GOT_OFST: u32 = 21;
2670 #[allow(missing_docs)]
2671 pub const R_MIPS_GOT_HI16: u32 = 22;
2672 #[allow(missing_docs)]
2673 pub const R_MIPS_GOT_LO16: u32 = 23;
2674 #[allow(missing_docs)]
2675 pub const R_MIPS_SUB: u32 = 24;
2676 #[allow(missing_docs)]
2677 pub const R_MIPS_INSERT_A: u32 = 25;
2678 #[allow(missing_docs)]
2679 pub const R_MIPS_INSERT_B: u32 = 26;
2680 #[allow(missing_docs)]
2681 pub const R_MIPS_DELETE: u32 = 27;
2682 #[allow(missing_docs)]
2683 pub const R_MIPS_HIGHER: u32 = 28;
2684 #[allow(missing_docs)]
2685 pub const R_MIPS_HIGHEST: u32 = 29;
2686 #[allow(missing_docs)]
2687 pub const R_MIPS_CALL_HI16: u32 = 30;
2688 #[allow(missing_docs)]
2689 pub const R_MIPS_CALL_LO16: u32 = 31;
2690 #[allow(missing_docs)]
2691 pub const R_MIPS_SCN_DISP: u32 = 32;
2692 #[allow(missing_docs)]
2693 pub const R_MIPS_REL16: u32 = 33;
2694 #[allow(missing_docs)]
2695 pub const R_MIPS_ADD_IMMEDIATE: u32 = 34;
2696 #[allow(missing_docs)]
2697 pub const R_MIPS_PJUMP: u32 = 35;
2698 #[allow(missing_docs)]
2699 pub const R_MIPS_RELGOT: u32 = 36;
2700 #[allow(missing_docs)]
2701 pub const R_MIPS_JALR: u32 = 37;
2702 /// Module number 32 bit
2703 pub const R_MIPS_TLS_DTPMOD32: u32 = 38;
2704 /// Module-relative offset 32 bit
2705 pub const R_MIPS_TLS_DTPREL32: u32 = 39;
2706 /// Module number 64 bit
2707 pub const R_MIPS_TLS_DTPMOD64: u32 = 40;
2708 /// Module-relative offset 64 bit
2709 pub const R_MIPS_TLS_DTPREL64: u32 = 41;
2710 /// 16 bit GOT offset for GD
2711 pub const R_MIPS_TLS_GD: u32 = 42;
2712 /// 16 bit GOT offset for LDM
2713 pub const R_MIPS_TLS_LDM: u32 = 43;
2714 /// Module-relative offset, high 16 bits
2715 pub const R_MIPS_TLS_DTPREL_HI16: u32 = 44;
2716 /// Module-relative offset, low 16 bits
2717 pub const R_MIPS_TLS_DTPREL_LO16: u32 = 45;
2718 /// 16 bit GOT offset for IE
2719 pub const R_MIPS_TLS_GOTTPREL: u32 = 46;
2720 /// TP-relative offset, 32 bit
2721 pub const R_MIPS_TLS_TPREL32: u32 = 47;
2722 /// TP-relative offset, 64 bit
2723 pub const R_MIPS_TLS_TPREL64: u32 = 48;
2724 /// TP-relative offset, high 16 bits
2725 pub const R_MIPS_TLS_TPREL_HI16: u32 = 49;
2726 /// TP-relative offset, low 16 bits
2727 pub const R_MIPS_TLS_TPREL_LO16: u32 = 50;
2728 #[allow(missing_docs)]
2729 pub const R_MIPS_GLOB_DAT: u32 = 51;
2730 #[allow(missing_docs)]
2731 pub const R_MIPS_COPY: u32 = 126;
2732 #[allow(missing_docs)]
2733 pub const R_MIPS_JUMP_SLOT: u32 = 127;
2734
2735 // MIPS values for `ProgramHeader32::p_type`.
2736
2737 /// Register usage information.
2738 pub const PT_MIPS_REGINFO: u32 = 0x7000_0000;
2739 /// Runtime procedure table.
2740 pub const PT_MIPS_RTPROC: u32 = 0x7000_0001;
2741 #[allow(missing_docs)]
2742 pub const PT_MIPS_OPTIONS: u32 = 0x7000_0002;
2743 /// FP mode requirement.
2744 pub const PT_MIPS_ABIFLAGS: u32 = 0x7000_0003;
2745
2746 // MIPS values for `ProgramHeader32::p_flags`.
2747
2748 #[allow(missing_docs)]
2749 pub const PF_MIPS_LOCAL: u32 = 0x1000_0000;
2750
2751 // MIPS values for `Dyn32::d_tag`.
2752
2753 /// Runtime linker interface version
2754 pub const DT_MIPS_RLD_VERSION: u32 = 0x7000_0001;
2755 /// Timestamp
2756 pub const DT_MIPS_TIME_STAMP: u32 = 0x7000_0002;
2757 /// Checksum
2758 pub const DT_MIPS_ICHECKSUM: u32 = 0x7000_0003;
2759 /// Version string (string tbl index)
2760 pub const DT_MIPS_IVERSION: u32 = 0x7000_0004;
2761 /// Flags
2762 pub const DT_MIPS_FLAGS: u32 = 0x7000_0005;
2763 /// Base address
2764 pub const DT_MIPS_BASE_ADDRESS: u32 = 0x7000_0006;
2765 #[allow(missing_docs)]
2766 pub const DT_MIPS_MSYM: u32 = 0x7000_0007;
2767 /// Address of CONFLICT section
2768 pub const DT_MIPS_CONFLICT: u32 = 0x7000_0008;
2769 /// Address of LIBLIST section
2770 pub const DT_MIPS_LIBLIST: u32 = 0x7000_0009;
2771 /// Number of local GOT entries
2772 pub const DT_MIPS_LOCAL_GOTNO: u32 = 0x7000_000a;
2773 /// Number of CONFLICT entries
2774 pub const DT_MIPS_CONFLICTNO: u32 = 0x7000_000b;
2775 /// Number of LIBLIST entries
2776 pub const DT_MIPS_LIBLISTNO: u32 = 0x7000_0010;
2777 /// Number of DYNSYM entries
2778 pub const DT_MIPS_SYMTABNO: u32 = 0x7000_0011;
2779 /// First external DYNSYM
2780 pub const DT_MIPS_UNREFEXTNO: u32 = 0x7000_0012;
2781 /// First GOT entry in DYNSYM
2782 pub const DT_MIPS_GOTSYM: u32 = 0x7000_0013;
2783 /// Number of GOT page table entries
2784 pub const DT_MIPS_HIPAGENO: u32 = 0x7000_0014;
2785 /// Address of run time loader map.
2786 pub const DT_MIPS_RLD_MAP: u32 = 0x7000_0016;
2787 /// Delta C++ class definition.
2788 pub const DT_MIPS_DELTA_CLASS: u32 = 0x7000_0017;
2789 /// Number of entries in DT_MIPS_DELTA_CLASS.
2790 pub const DT_MIPS_DELTA_CLASS_NO: u32 = 0x7000_0018;
2791 /// Delta C++ class instances.
2792 pub const DT_MIPS_DELTA_INSTANCE: u32 = 0x7000_0019;
2793 /// Number of entries in DT_MIPS_DELTA_INSTANCE.
2794 pub const DT_MIPS_DELTA_INSTANCE_NO: u32 = 0x7000_001a;
2795 /// Delta relocations.
2796 pub const DT_MIPS_DELTA_RELOC: u32 = 0x7000_001b;
2797 /// Number of entries in DT_MIPS_DELTA_RELOC.
2798 pub const DT_MIPS_DELTA_RELOC_NO: u32 = 0x7000_001c;
2799 /// Delta symbols that Delta relocations refer to.
2800 pub const DT_MIPS_DELTA_SYM: u32 = 0x7000_001d;
2801 /// Number of entries in DT_MIPS_DELTA_SYM.
2802 pub const DT_MIPS_DELTA_SYM_NO: u32 = 0x7000_001e;
2803 /// Delta symbols that hold the class declaration.
2804 pub const DT_MIPS_DELTA_CLASSSYM: u32 = 0x7000_0020;
2805 /// Number of entries in DT_MIPS_DELTA_CLASSSYM.
2806 pub const DT_MIPS_DELTA_CLASSSYM_NO: u32 = 0x7000_0021;
2807 /// Flags indicating for C++ flavor.
2808 pub const DT_MIPS_CXX_FLAGS: u32 = 0x7000_0022;
2809 #[allow(missing_docs)]
2810 pub const DT_MIPS_PIXIE_INIT: u32 = 0x7000_0023;
2811 #[allow(missing_docs)]
2812 pub const DT_MIPS_SYMBOL_LIB: u32 = 0x7000_0024;
2813 #[allow(missing_docs)]
2814 pub const DT_MIPS_LOCALPAGE_GOTIDX: u32 = 0x7000_0025;
2815 #[allow(missing_docs)]
2816 pub const DT_MIPS_LOCAL_GOTIDX: u32 = 0x7000_0026;
2817 #[allow(missing_docs)]
2818 pub const DT_MIPS_HIDDEN_GOTIDX: u32 = 0x7000_0027;
2819 #[allow(missing_docs)]
2820 pub const DT_MIPS_PROTECTED_GOTIDX: u32 = 0x7000_0028;
2821 /// Address of .options.
2822 pub const DT_MIPS_OPTIONS: u32 = 0x7000_0029;
2823 /// Address of .interface.
2824 pub const DT_MIPS_INTERFACE: u32 = 0x7000_002a;
2825 #[allow(missing_docs)]
2826 pub const DT_MIPS_DYNSTR_ALIGN: u32 = 0x7000_002b;
2827 /// Size of the .interface section.
2828 pub const DT_MIPS_INTERFACE_SIZE: u32 = 0x7000_002c;
2829 /// Address of rld_text_rsolve function stored in GOT.
2830 pub const DT_MIPS_RLD_TEXT_RESOLVE_ADDR: u32 = 0x7000_002d;
2831 /// Default suffix of dso to be added by rld on dlopen() calls.
2832 pub const DT_MIPS_PERF_SUFFIX: u32 = 0x7000_002e;
2833 /// (O32)Size of compact rel section.
2834 pub const DT_MIPS_COMPACT_SIZE: u32 = 0x7000_002f;
2835 /// GP value for aux GOTs.
2836 pub const DT_MIPS_GP_VALUE: u32 = 0x7000_0030;
2837 /// Address of aux .dynamic.
2838 pub const DT_MIPS_AUX_DYNAMIC: u32 = 0x7000_0031;
2839 /// The address of .got.plt in an executable using the new non-PIC ABI.
2840 pub const DT_MIPS_PLTGOT: u32 = 0x7000_0032;
2841 /// The base of the PLT in an executable using the new non-PIC ABI if that PLT is writable. For a non-writable PLT, this is omitted or has a zero value.
2842 pub const DT_MIPS_RWPLT: u32 = 0x7000_0034;
2843 /// An alternative description of the classic MIPS RLD_MAP that is usable in a PIE as it stores a relative offset from the address of the tag rather than an absolute address.
2844 pub const DT_MIPS_RLD_MAP_REL: u32 = 0x7000_0035;
2845
2846 // Values for `DT_MIPS_FLAGS` `Dyn32` entry.
2847
2848 /// No flags
2849 pub const RHF_NONE: u32 = 0;
2850 /// Use quickstart
2851 pub const RHF_QUICKSTART: u32 = 1 << 0;
2852 /// Hash size not power of 2
2853 pub const RHF_NOTPOT: u32 = 1 << 1;
2854 /// Ignore LD_LIBRARY_PATH
2855 pub const RHF_NO_LIBRARY_REPLACEMENT: u32 = 1 << 2;
2856 #[allow(missing_docs)]
2857 pub const RHF_NO_MOVE: u32 = 1 << 3;
2858 #[allow(missing_docs)]
2859 pub const RHF_SGI_ONLY: u32 = 1 << 4;
2860 #[allow(missing_docs)]
2861 pub const RHF_GUARANTEE_INIT: u32 = 1 << 5;
2862 #[allow(missing_docs)]
2863 pub const RHF_DELTA_C_PLUS_PLUS: u32 = 1 << 6;
2864 #[allow(missing_docs)]
2865 pub const RHF_GUARANTEE_START_INIT: u32 = 1 << 7;
2866 #[allow(missing_docs)]
2867 pub const RHF_PIXIE: u32 = 1 << 8;
2868 #[allow(missing_docs)]
2869 pub const RHF_DEFAULT_DELAY_LOAD: u32 = 1 << 9;
2870 #[allow(missing_docs)]
2871 pub const RHF_REQUICKSTART: u32 = 1 << 10;
2872 #[allow(missing_docs)]
2873 pub const RHF_REQUICKSTARTED: u32 = 1 << 11;
2874 #[allow(missing_docs)]
2875 pub const RHF_CORD: u32 = 1 << 12;
2876 #[allow(missing_docs)]
2877 pub const RHF_NO_UNRES_UNDEF: u32 = 1 << 13;
2878 #[allow(missing_docs)]
2879 pub const RHF_RLD_ORDER_SAFE: u32 = 1 << 14;
2880
2881 // Entries found in sections of type `SHT_MIPS_LIBLIST`.
2882
2883 // TODO: Elf32_Lib, Elf64_Lib
2884
2885 // Values for `Lib*::l_flags`.
2886
2887 #[allow(missing_docs)]
2888 pub const LL_NONE: u32 = 0;
2889 /// Require exact match
2890 pub const LL_EXACT_MATCH: u32 = 1 << 0;
2891 /// Ignore interface version
2892 pub const LL_IGNORE_INT_VER: u32 = 1 << 1;
2893 #[allow(missing_docs)]
2894 pub const LL_REQUIRE_MINOR: u32 = 1 << 2;
2895 #[allow(missing_docs)]
2896 pub const LL_EXPORTS: u32 = 1 << 3;
2897 #[allow(missing_docs)]
2898 pub const LL_DELAY_LOAD: u32 = 1 << 4;
2899 #[allow(missing_docs)]
2900 pub const LL_DELTA: u32 = 1 << 5;
2901
2902 // TODO: MIPS ABI flags
2903
2904 // PA-RISC specific definitions.
2905
2906 // PA-RISC values for `FileHeader32::e_flags`.
2907
2908 /// Trap nil pointer dereference.
2909 pub const EF_PARISC_TRAPNIL: u32 = 0x0001_0000;
2910 /// Program uses arch. extensions.
2911 pub const EF_PARISC_EXT: u32 = 0x0002_0000;
2912 /// Program expects little endian.
2913 pub const EF_PARISC_LSB: u32 = 0x0004_0000;
2914 /// Program expects wide mode.
2915 pub const EF_PARISC_WIDE: u32 = 0x0008_0000;
2916 /// No kernel assisted branch prediction.
2917 pub const EF_PARISC_NO_KABP: u32 = 0x0010_0000;
2918 /// Allow lazy swapping.
2919 pub const EF_PARISC_LAZYSWAP: u32 = 0x0040_0000;
2920 /// Architecture version.
2921 pub const EF_PARISC_ARCH: u32 = 0x0000_ffff;
2922
2923 // Values for `EF_PARISC_ARCH'.
2924
2925 /// PA-RISC 1.0 big-endian.
2926 pub const EFA_PARISC_1_0: u32 = 0x020b;
2927 /// PA-RISC 1.1 big-endian.
2928 pub const EFA_PARISC_1_1: u32 = 0x0210;
2929 /// PA-RISC 2.0 big-endian.
2930 pub const EFA_PARISC_2_0: u32 = 0x0214;
2931
2932 // PA-RISC values for `Sym*::st_shndx`.
2933
2934 /// Section for tenatively declared symbols in ANSI C.
2935 pub const SHN_PARISC_ANSI_COMMON: u16 = 0xff00;
2936 /// Common blocks in huge model.
2937 pub const SHN_PARISC_HUGE_COMMON: u16 = 0xff01;
2938
2939 // PA-RISC values for `SectionHeader32::sh_type`.
2940
2941 /// Contains product specific ext.
2942 pub const SHT_PARISC_EXT: u32 = 0x7000_0000;
2943 /// Unwind information.
2944 pub const SHT_PARISC_UNWIND: u32 = 0x7000_0001;
2945 /// Debug info for optimized code.
2946 pub const SHT_PARISC_DOC: u32 = 0x7000_0002;
2947
2948 // PA-RISC values for `SectionHeader32::sh_flags`.
2949
2950 /// Section with short addressing.
2951 pub const SHF_PARISC_SHORT: u32 = 0x2000_0000;
2952 /// Section far from gp.
2953 pub const SHF_PARISC_HUGE: u32 = 0x4000_0000;
2954 /// Static branch prediction code.
2955 pub const SHF_PARISC_SBP: u32 = 0x8000_0000;
2956
2957 // PA-RISC values for `st_type` component of `Sym32::st_info`.
2958
2959 /// Millicode function entry point.
2960 pub const STT_PARISC_MILLICODE: u8 = 13;
2961
2962 #[allow(missing_docs)]
2963 pub const STT_HP_OPAQUE: u8 = STT_LOOS + 0x1;
2964 #[allow(missing_docs)]
2965 pub const STT_HP_STUB: u8 = STT_LOOS + 0x2;
2966
2967 // PA-RISC values for `Rel*::r_type`.
2968
2969 /// No reloc.
2970 pub const R_PARISC_NONE: u32 = 0;
2971 /// Direct 32-bit reference.
2972 pub const R_PARISC_DIR32: u32 = 1;
2973 /// Left 21 bits of eff. address.
2974 pub const R_PARISC_DIR21L: u32 = 2;
2975 /// Right 17 bits of eff. address.
2976 pub const R_PARISC_DIR17R: u32 = 3;
2977 /// 17 bits of eff. address.
2978 pub const R_PARISC_DIR17F: u32 = 4;
2979 /// Right 14 bits of eff. address.
2980 pub const R_PARISC_DIR14R: u32 = 6;
2981 /// 32-bit rel. address.
2982 pub const R_PARISC_PCREL32: u32 = 9;
2983 /// Left 21 bits of rel. address.
2984 pub const R_PARISC_PCREL21L: u32 = 10;
2985 /// Right 17 bits of rel. address.
2986 pub const R_PARISC_PCREL17R: u32 = 11;
2987 /// 17 bits of rel. address.
2988 pub const R_PARISC_PCREL17F: u32 = 12;
2989 /// Right 14 bits of rel. address.
2990 pub const R_PARISC_PCREL14R: u32 = 14;
2991 /// Left 21 bits of rel. address.
2992 pub const R_PARISC_DPREL21L: u32 = 18;
2993 /// Right 14 bits of rel. address.
2994 pub const R_PARISC_DPREL14R: u32 = 22;
2995 /// GP-relative, left 21 bits.
2996 pub const R_PARISC_GPREL21L: u32 = 26;
2997 /// GP-relative, right 14 bits.
2998 pub const R_PARISC_GPREL14R: u32 = 30;
2999 /// LT-relative, left 21 bits.
3000 pub const R_PARISC_LTOFF21L: u32 = 34;
3001 /// LT-relative, right 14 bits.
3002 pub const R_PARISC_LTOFF14R: u32 = 38;
3003 /// 32 bits section rel. address.
3004 pub const R_PARISC_SECREL32: u32 = 41;
3005 /// No relocation, set segment base.
3006 pub const R_PARISC_SEGBASE: u32 = 48;
3007 /// 32 bits segment rel. address.
3008 pub const R_PARISC_SEGREL32: u32 = 49;
3009 /// PLT rel. address, left 21 bits.
3010 pub const R_PARISC_PLTOFF21L: u32 = 50;
3011 /// PLT rel. address, right 14 bits.
3012 pub const R_PARISC_PLTOFF14R: u32 = 54;
3013 /// 32 bits LT-rel. function pointer.
3014 pub const R_PARISC_LTOFF_FPTR32: u32 = 57;
3015 /// LT-rel. fct ptr, left 21 bits.
3016 pub const R_PARISC_LTOFF_FPTR21L: u32 = 58;
3017 /// LT-rel. fct ptr, right 14 bits.
3018 pub const R_PARISC_LTOFF_FPTR14R: u32 = 62;
3019 /// 64 bits function address.
3020 pub const R_PARISC_FPTR64: u32 = 64;
3021 /// 32 bits function address.
3022 pub const R_PARISC_PLABEL32: u32 = 65;
3023 /// Left 21 bits of fdesc address.
3024 pub const R_PARISC_PLABEL21L: u32 = 66;
3025 /// Right 14 bits of fdesc address.
3026 pub const R_PARISC_PLABEL14R: u32 = 70;
3027 /// 64 bits PC-rel. address.
3028 pub const R_PARISC_PCREL64: u32 = 72;
3029 /// 22 bits PC-rel. address.
3030 pub const R_PARISC_PCREL22F: u32 = 74;
3031 /// PC-rel. address, right 14 bits.
3032 pub const R_PARISC_PCREL14WR: u32 = 75;
3033 /// PC rel. address, right 14 bits.
3034 pub const R_PARISC_PCREL14DR: u32 = 76;
3035 /// 16 bits PC-rel. address.
3036 pub const R_PARISC_PCREL16F: u32 = 77;
3037 /// 16 bits PC-rel. address.
3038 pub const R_PARISC_PCREL16WF: u32 = 78;
3039 /// 16 bits PC-rel. address.
3040 pub const R_PARISC_PCREL16DF: u32 = 79;
3041 /// 64 bits of eff. address.
3042 pub const R_PARISC_DIR64: u32 = 80;
3043 /// 14 bits of eff. address.
3044 pub const R_PARISC_DIR14WR: u32 = 83;
3045 /// 14 bits of eff. address.
3046 pub const R_PARISC_DIR14DR: u32 = 84;
3047 /// 16 bits of eff. address.
3048 pub const R_PARISC_DIR16F: u32 = 85;
3049 /// 16 bits of eff. address.
3050 pub const R_PARISC_DIR16WF: u32 = 86;
3051 /// 16 bits of eff. address.
3052 pub const R_PARISC_DIR16DF: u32 = 87;
3053 /// 64 bits of GP-rel. address.
3054 pub const R_PARISC_GPREL64: u32 = 88;
3055 /// GP-rel. address, right 14 bits.
3056 pub const R_PARISC_GPREL14WR: u32 = 91;
3057 /// GP-rel. address, right 14 bits.
3058 pub const R_PARISC_GPREL14DR: u32 = 92;
3059 /// 16 bits GP-rel. address.
3060 pub const R_PARISC_GPREL16F: u32 = 93;
3061 /// 16 bits GP-rel. address.
3062 pub const R_PARISC_GPREL16WF: u32 = 94;
3063 /// 16 bits GP-rel. address.
3064 pub const R_PARISC_GPREL16DF: u32 = 95;
3065 /// 64 bits LT-rel. address.
3066 pub const R_PARISC_LTOFF64: u32 = 96;
3067 /// LT-rel. address, right 14 bits.
3068 pub const R_PARISC_LTOFF14WR: u32 = 99;
3069 /// LT-rel. address, right 14 bits.
3070 pub const R_PARISC_LTOFF14DR: u32 = 100;
3071 /// 16 bits LT-rel. address.
3072 pub const R_PARISC_LTOFF16F: u32 = 101;
3073 /// 16 bits LT-rel. address.
3074 pub const R_PARISC_LTOFF16WF: u32 = 102;
3075 /// 16 bits LT-rel. address.
3076 pub const R_PARISC_LTOFF16DF: u32 = 103;
3077 /// 64 bits section rel. address.
3078 pub const R_PARISC_SECREL64: u32 = 104;
3079 /// 64 bits segment rel. address.
3080 pub const R_PARISC_SEGREL64: u32 = 112;
3081 /// PLT-rel. address, right 14 bits.
3082 pub const R_PARISC_PLTOFF14WR: u32 = 115;
3083 /// PLT-rel. address, right 14 bits.
3084 pub const R_PARISC_PLTOFF14DR: u32 = 116;
3085 /// 16 bits LT-rel. address.
3086 pub const R_PARISC_PLTOFF16F: u32 = 117;
3087 /// 16 bits PLT-rel. address.
3088 pub const R_PARISC_PLTOFF16WF: u32 = 118;
3089 /// 16 bits PLT-rel. address.
3090 pub const R_PARISC_PLTOFF16DF: u32 = 119;
3091 /// 64 bits LT-rel. function ptr.
3092 pub const R_PARISC_LTOFF_FPTR64: u32 = 120;
3093 /// LT-rel. fct. ptr., right 14 bits.
3094 pub const R_PARISC_LTOFF_FPTR14WR: u32 = 123;
3095 /// LT-rel. fct. ptr., right 14 bits.
3096 pub const R_PARISC_LTOFF_FPTR14DR: u32 = 124;
3097 /// 16 bits LT-rel. function ptr.
3098 pub const R_PARISC_LTOFF_FPTR16F: u32 = 125;
3099 /// 16 bits LT-rel. function ptr.
3100 pub const R_PARISC_LTOFF_FPTR16WF: u32 = 126;
3101 /// 16 bits LT-rel. function ptr.
3102 pub const R_PARISC_LTOFF_FPTR16DF: u32 = 127;
3103 #[allow(missing_docs)]
3104 pub const R_PARISC_LORESERVE: u32 = 128;
3105 /// Copy relocation.
3106 pub const R_PARISC_COPY: u32 = 128;
3107 /// Dynamic reloc, imported PLT
3108 pub const R_PARISC_IPLT: u32 = 129;
3109 /// Dynamic reloc, exported PLT
3110 pub const R_PARISC_EPLT: u32 = 130;
3111 /// 32 bits TP-rel. address.
3112 pub const R_PARISC_TPREL32: u32 = 153;
3113 /// TP-rel. address, left 21 bits.
3114 pub const R_PARISC_TPREL21L: u32 = 154;
3115 /// TP-rel. address, right 14 bits.
3116 pub const R_PARISC_TPREL14R: u32 = 158;
3117 /// LT-TP-rel. address, left 21 bits.
3118 pub const R_PARISC_LTOFF_TP21L: u32 = 162;
3119 /// LT-TP-rel. address, right 14 bits.
3120 pub const R_PARISC_LTOFF_TP14R: u32 = 166;
3121 /// 14 bits LT-TP-rel. address.
3122 pub const R_PARISC_LTOFF_TP14F: u32 = 167;
3123 /// 64 bits TP-rel. address.
3124 pub const R_PARISC_TPREL64: u32 = 216;
3125 /// TP-rel. address, right 14 bits.
3126 pub const R_PARISC_TPREL14WR: u32 = 219;
3127 /// TP-rel. address, right 14 bits.
3128 pub const R_PARISC_TPREL14DR: u32 = 220;
3129 /// 16 bits TP-rel. address.
3130 pub const R_PARISC_TPREL16F: u32 = 221;
3131 /// 16 bits TP-rel. address.
3132 pub const R_PARISC_TPREL16WF: u32 = 222;
3133 /// 16 bits TP-rel. address.
3134 pub const R_PARISC_TPREL16DF: u32 = 223;
3135 /// 64 bits LT-TP-rel. address.
3136 pub const R_PARISC_LTOFF_TP64: u32 = 224;
3137 /// LT-TP-rel. address, right 14 bits.
3138 pub const R_PARISC_LTOFF_TP14WR: u32 = 227;
3139 /// LT-TP-rel. address, right 14 bits.
3140 pub const R_PARISC_LTOFF_TP14DR: u32 = 228;
3141 /// 16 bits LT-TP-rel. address.
3142 pub const R_PARISC_LTOFF_TP16F: u32 = 229;
3143 /// 16 bits LT-TP-rel. address.
3144 pub const R_PARISC_LTOFF_TP16WF: u32 = 230;
3145 /// 16 bits LT-TP-rel. address.
3146 pub const R_PARISC_LTOFF_TP16DF: u32 = 231;
3147 #[allow(missing_docs)]
3148 pub const R_PARISC_GNU_VTENTRY: u32 = 232;
3149 #[allow(missing_docs)]
3150 pub const R_PARISC_GNU_VTINHERIT: u32 = 233;
3151 /// GD 21-bit left.
3152 pub const R_PARISC_TLS_GD21L: u32 = 234;
3153 /// GD 14-bit right.
3154 pub const R_PARISC_TLS_GD14R: u32 = 235;
3155 /// GD call to __t_g_a.
3156 pub const R_PARISC_TLS_GDCALL: u32 = 236;
3157 /// LD module 21-bit left.
3158 pub const R_PARISC_TLS_LDM21L: u32 = 237;
3159 /// LD module 14-bit right.
3160 pub const R_PARISC_TLS_LDM14R: u32 = 238;
3161 /// LD module call to __t_g_a.
3162 pub const R_PARISC_TLS_LDMCALL: u32 = 239;
3163 /// LD offset 21-bit left.
3164 pub const R_PARISC_TLS_LDO21L: u32 = 240;
3165 /// LD offset 14-bit right.
3166 pub const R_PARISC_TLS_LDO14R: u32 = 241;
3167 /// DTP module 32-bit.
3168 pub const R_PARISC_TLS_DTPMOD32: u32 = 242;
3169 /// DTP module 64-bit.
3170 pub const R_PARISC_TLS_DTPMOD64: u32 = 243;
3171 /// DTP offset 32-bit.
3172 pub const R_PARISC_TLS_DTPOFF32: u32 = 244;
3173 /// DTP offset 32-bit.
3174 pub const R_PARISC_TLS_DTPOFF64: u32 = 245;
3175 #[allow(missing_docs)]
3176 pub const R_PARISC_TLS_LE21L: u32 = R_PARISC_TPREL21L;
3177 #[allow(missing_docs)]
3178 pub const R_PARISC_TLS_LE14R: u32 = R_PARISC_TPREL14R;
3179 #[allow(missing_docs)]
3180 pub const R_PARISC_TLS_IE21L: u32 = R_PARISC_LTOFF_TP21L;
3181 #[allow(missing_docs)]
3182 pub const R_PARISC_TLS_IE14R: u32 = R_PARISC_LTOFF_TP14R;
3183 #[allow(missing_docs)]
3184 pub const R_PARISC_TLS_TPREL32: u32 = R_PARISC_TPREL32;
3185 #[allow(missing_docs)]
3186 pub const R_PARISC_TLS_TPREL64: u32 = R_PARISC_TPREL64;
3187 #[allow(missing_docs)]
3188 pub const R_PARISC_HIRESERVE: u32 = 255;
3189
3190 // PA-RISC values for `ProgramHeader*::p_type`.
3191
3192 #[allow(missing_docs)]
3193 pub const PT_HP_TLS: u32 = PT_LOOS + 0x0;
3194 #[allow(missing_docs)]
3195 pub const PT_HP_CORE_NONE: u32 = PT_LOOS + 0x1;
3196 #[allow(missing_docs)]
3197 pub const PT_HP_CORE_VERSION: u32 = PT_LOOS + 0x2;
3198 #[allow(missing_docs)]
3199 pub const PT_HP_CORE_KERNEL: u32 = PT_LOOS + 0x3;
3200 #[allow(missing_docs)]
3201 pub const PT_HP_CORE_COMM: u32 = PT_LOOS + 0x4;
3202 #[allow(missing_docs)]
3203 pub const PT_HP_CORE_PROC: u32 = PT_LOOS + 0x5;
3204 #[allow(missing_docs)]
3205 pub const PT_HP_CORE_LOADABLE: u32 = PT_LOOS + 0x6;
3206 #[allow(missing_docs)]
3207 pub const PT_HP_CORE_STACK: u32 = PT_LOOS + 0x7;
3208 #[allow(missing_docs)]
3209 pub const PT_HP_CORE_SHM: u32 = PT_LOOS + 0x8;
3210 #[allow(missing_docs)]
3211 pub const PT_HP_CORE_MMF: u32 = PT_LOOS + 0x9;
3212 #[allow(missing_docs)]
3213 pub const PT_HP_PARALLEL: u32 = PT_LOOS + 0x10;
3214 #[allow(missing_docs)]
3215 pub const PT_HP_FASTBIND: u32 = PT_LOOS + 0x11;
3216 #[allow(missing_docs)]
3217 pub const PT_HP_OPT_ANNOT: u32 = PT_LOOS + 0x12;
3218 #[allow(missing_docs)]
3219 pub const PT_HP_HSL_ANNOT: u32 = PT_LOOS + 0x13;
3220 #[allow(missing_docs)]
3221 pub const PT_HP_STACK: u32 = PT_LOOS + 0x14;
3222
3223 #[allow(missing_docs)]
3224 pub const PT_PARISC_ARCHEXT: u32 = 0x7000_0000;
3225 #[allow(missing_docs)]
3226 pub const PT_PARISC_UNWIND: u32 = 0x7000_0001;
3227
3228 // PA-RISC values for `ProgramHeader*::p_flags`.
3229
3230 #[allow(missing_docs)]
3231 pub const PF_PARISC_SBP: u32 = 0x0800_0000;
3232
3233 #[allow(missing_docs)]
3234 pub const PF_HP_PAGE_SIZE: u32 = 0x0010_0000;
3235 #[allow(missing_docs)]
3236 pub const PF_HP_FAR_SHARED: u32 = 0x0020_0000;
3237 #[allow(missing_docs)]
3238 pub const PF_HP_NEAR_SHARED: u32 = 0x0040_0000;
3239 #[allow(missing_docs)]
3240 pub const PF_HP_CODE: u32 = 0x0100_0000;
3241 #[allow(missing_docs)]
3242 pub const PF_HP_MODIFY: u32 = 0x0200_0000;
3243 #[allow(missing_docs)]
3244 pub const PF_HP_LAZYSWAP: u32 = 0x0400_0000;
3245 #[allow(missing_docs)]
3246 pub const PF_HP_SBP: u32 = 0x0800_0000;
3247
3248 // Alpha specific definitions.
3249
3250 // Alpha values for `FileHeader64::e_flags`.
3251
3252 /// All addresses must be < 2GB.
3253 pub const EF_ALPHA_32BIT: u32 = 1;
3254 /// Relocations for relaxing exist.
3255 pub const EF_ALPHA_CANRELAX: u32 = 2;
3256
3257 // Alpha values for `SectionHeader64::sh_type`.
3258
3259 // These two are primerily concerned with ECOFF debugging info.
3260 #[allow(missing_docs)]
3261 pub const SHT_ALPHA_DEBUG: u32 = 0x7000_0001;
3262 #[allow(missing_docs)]
3263 pub const SHT_ALPHA_REGINFO: u32 = 0x7000_0002;
3264
3265 // Alpha values for `SectionHeader64::sh_flags`.
3266
3267 #[allow(missing_docs)]
3268 pub const SHF_ALPHA_GPREL: u32 = 0x1000_0000;
3269
3270 // Alpha values for `Sym64::st_other`.
3271 /// No PV required.
3272 pub const STO_ALPHA_NOPV: u8 = 0x80;
3273 /// PV only used for initial ldgp.
3274 pub const STO_ALPHA_STD_GPLOAD: u8 = 0x88;
3275
3276 // Alpha values for `Rel64::r_type`.
3277
3278 /// No reloc
3279 pub const R_ALPHA_NONE: u32 = 0;
3280 /// Direct 32 bit
3281 pub const R_ALPHA_REFLONG: u32 = 1;
3282 /// Direct 64 bit
3283 pub const R_ALPHA_REFQUAD: u32 = 2;
3284 /// GP relative 32 bit
3285 pub const R_ALPHA_GPREL32: u32 = 3;
3286 /// GP relative 16 bit w/optimization
3287 pub const R_ALPHA_LITERAL: u32 = 4;
3288 /// Optimization hint for LITERAL
3289 pub const R_ALPHA_LITUSE: u32 = 5;
3290 /// Add displacement to GP
3291 pub const R_ALPHA_GPDISP: u32 = 6;
3292 /// PC+4 relative 23 bit shifted
3293 pub const R_ALPHA_BRADDR: u32 = 7;
3294 /// PC+4 relative 16 bit shifted
3295 pub const R_ALPHA_HINT: u32 = 8;
3296 /// PC relative 16 bit
3297 pub const R_ALPHA_SREL16: u32 = 9;
3298 /// PC relative 32 bit
3299 pub const R_ALPHA_SREL32: u32 = 10;
3300 /// PC relative 64 bit
3301 pub const R_ALPHA_SREL64: u32 = 11;
3302 /// GP relative 32 bit, high 16 bits
3303 pub const R_ALPHA_GPRELHIGH: u32 = 17;
3304 /// GP relative 32 bit, low 16 bits
3305 pub const R_ALPHA_GPRELLOW: u32 = 18;
3306 /// GP relative 16 bit
3307 pub const R_ALPHA_GPREL16: u32 = 19;
3308 /// Copy symbol at runtime
3309 pub const R_ALPHA_COPY: u32 = 24;
3310 /// Create GOT entry
3311 pub const R_ALPHA_GLOB_DAT: u32 = 25;
3312 /// Create PLT entry
3313 pub const R_ALPHA_JMP_SLOT: u32 = 26;
3314 /// Adjust by program base
3315 pub const R_ALPHA_RELATIVE: u32 = 27;
3316 #[allow(missing_docs)]
3317 pub const R_ALPHA_TLS_GD_HI: u32 = 28;
3318 #[allow(missing_docs)]
3319 pub const R_ALPHA_TLSGD: u32 = 29;
3320 #[allow(missing_docs)]
3321 pub const R_ALPHA_TLS_LDM: u32 = 30;
3322 #[allow(missing_docs)]
3323 pub const R_ALPHA_DTPMOD64: u32 = 31;
3324 #[allow(missing_docs)]
3325 pub const R_ALPHA_GOTDTPREL: u32 = 32;
3326 #[allow(missing_docs)]
3327 pub const R_ALPHA_DTPREL64: u32 = 33;
3328 #[allow(missing_docs)]
3329 pub const R_ALPHA_DTPRELHI: u32 = 34;
3330 #[allow(missing_docs)]
3331 pub const R_ALPHA_DTPRELLO: u32 = 35;
3332 #[allow(missing_docs)]
3333 pub const R_ALPHA_DTPREL16: u32 = 36;
3334 #[allow(missing_docs)]
3335 pub const R_ALPHA_GOTTPREL: u32 = 37;
3336 #[allow(missing_docs)]
3337 pub const R_ALPHA_TPREL64: u32 = 38;
3338 #[allow(missing_docs)]
3339 pub const R_ALPHA_TPRELHI: u32 = 39;
3340 #[allow(missing_docs)]
3341 pub const R_ALPHA_TPRELLO: u32 = 40;
3342 #[allow(missing_docs)]
3343 pub const R_ALPHA_TPREL16: u32 = 41;
3344
3345 // Magic values of the `R_ALPHA_LITUSE` relocation addend.
3346 #[allow(missing_docs)]
3347 pub const LITUSE_ALPHA_ADDR: u32 = 0;
3348 #[allow(missing_docs)]
3349 pub const LITUSE_ALPHA_BASE: u32 = 1;
3350 #[allow(missing_docs)]
3351 pub const LITUSE_ALPHA_BYTOFF: u32 = 2;
3352 #[allow(missing_docs)]
3353 pub const LITUSE_ALPHA_JSR: u32 = 3;
3354 #[allow(missing_docs)]
3355 pub const LITUSE_ALPHA_TLS_GD: u32 = 4;
3356 #[allow(missing_docs)]
3357 pub const LITUSE_ALPHA_TLS_LDM: u32 = 5;
3358
3359 // Alpha values for `Dyn64::d_tag`.
3360 #[allow(missing_docs)]
3361 pub const DT_ALPHA_PLTRO: u32 = DT_LOPROC + 0;
3362
3363 // PowerPC specific declarations.
3364
3365 // PowerPC values for `FileHeader*::e_flags`.
3366 /// PowerPC embedded flag
3367 pub const EF_PPC_EMB: u32 = 0x8000_0000;
3368
3369 // Cygnus local bits below .
3370 /// PowerPC -mrelocatable flag
3371 pub const EF_PPC_RELOCATABLE: u32 = 0x0001_0000;
3372 /// PowerPC -mrelocatable-lib flag
3373 pub const EF_PPC_RELOCATABLE_LIB: u32 = 0x0000_8000;
3374
3375 // PowerPC values for `Rel*::r_type` defined by the ABIs.
3376 #[allow(missing_docs)]
3377 pub const R_PPC_NONE: u32 = 0;
3378 /// 32bit absolute address
3379 pub const R_PPC_ADDR32: u32 = 1;
3380 /// 26bit address, 2 bits ignored.
3381 pub const R_PPC_ADDR24: u32 = 2;
3382 /// 16bit absolute address
3383 pub const R_PPC_ADDR16: u32 = 3;
3384 /// lower 16bit of absolute address
3385 pub const R_PPC_ADDR16_LO: u32 = 4;
3386 /// high 16bit of absolute address
3387 pub const R_PPC_ADDR16_HI: u32 = 5;
3388 /// adjusted high 16bit
3389 pub const R_PPC_ADDR16_HA: u32 = 6;
3390 /// 16bit address, 2 bits ignored
3391 pub const R_PPC_ADDR14: u32 = 7;
3392 #[allow(missing_docs)]
3393 pub const R_PPC_ADDR14_BRTAKEN: u32 = 8;
3394 #[allow(missing_docs)]
3395 pub const R_PPC_ADDR14_BRNTAKEN: u32 = 9;
3396 /// PC relative 26 bit
3397 pub const R_PPC_REL24: u32 = 10;
3398 /// PC relative 16 bit
3399 pub const R_PPC_REL14: u32 = 11;
3400 #[allow(missing_docs)]
3401 pub const R_PPC_REL14_BRTAKEN: u32 = 12;
3402 #[allow(missing_docs)]
3403 pub const R_PPC_REL14_BRNTAKEN: u32 = 13;
3404 #[allow(missing_docs)]
3405 pub const R_PPC_GOT16: u32 = 14;
3406 #[allow(missing_docs)]
3407 pub const R_PPC_GOT16_LO: u32 = 15;
3408 #[allow(missing_docs)]
3409 pub const R_PPC_GOT16_HI: u32 = 16;
3410 #[allow(missing_docs)]
3411 pub const R_PPC_GOT16_HA: u32 = 17;
3412 #[allow(missing_docs)]
3413 pub const R_PPC_PLTREL24: u32 = 18;
3414 #[allow(missing_docs)]
3415 pub const R_PPC_COPY: u32 = 19;
3416 #[allow(missing_docs)]
3417 pub const R_PPC_GLOB_DAT: u32 = 20;
3418 #[allow(missing_docs)]
3419 pub const R_PPC_JMP_SLOT: u32 = 21;
3420 #[allow(missing_docs)]
3421 pub const R_PPC_RELATIVE: u32 = 22;
3422 #[allow(missing_docs)]
3423 pub const R_PPC_LOCAL24PC: u32 = 23;
3424 #[allow(missing_docs)]
3425 pub const R_PPC_UADDR32: u32 = 24;
3426 #[allow(missing_docs)]
3427 pub const R_PPC_UADDR16: u32 = 25;
3428 #[allow(missing_docs)]
3429 pub const R_PPC_REL32: u32 = 26;
3430 #[allow(missing_docs)]
3431 pub const R_PPC_PLT32: u32 = 27;
3432 #[allow(missing_docs)]
3433 pub const R_PPC_PLTREL32: u32 = 28;
3434 #[allow(missing_docs)]
3435 pub const R_PPC_PLT16_LO: u32 = 29;
3436 #[allow(missing_docs)]
3437 pub const R_PPC_PLT16_HI: u32 = 30;
3438 #[allow(missing_docs)]
3439 pub const R_PPC_PLT16_HA: u32 = 31;
3440 #[allow(missing_docs)]
3441 pub const R_PPC_SDAREL16: u32 = 32;
3442 #[allow(missing_docs)]
3443 pub const R_PPC_SECTOFF: u32 = 33;
3444 #[allow(missing_docs)]
3445 pub const R_PPC_SECTOFF_LO: u32 = 34;
3446 #[allow(missing_docs)]
3447 pub const R_PPC_SECTOFF_HI: u32 = 35;
3448 #[allow(missing_docs)]
3449 pub const R_PPC_SECTOFF_HA: u32 = 36;
3450
3451 // PowerPC values for `Rel*::r_type` defined for the TLS access ABI.
3452 /// none (sym+add)@tls
3453 pub const R_PPC_TLS: u32 = 67;
3454 /// word32 (sym+add)@dtpmod
3455 pub const R_PPC_DTPMOD32: u32 = 68;
3456 /// half16* (sym+add)@tprel
3457 pub const R_PPC_TPREL16: u32 = 69;
3458 /// half16 (sym+add)@tprel@l
3459 pub const R_PPC_TPREL16_LO: u32 = 70;
3460 /// half16 (sym+add)@tprel@h
3461 pub const R_PPC_TPREL16_HI: u32 = 71;
3462 /// half16 (sym+add)@tprel@ha
3463 pub const R_PPC_TPREL16_HA: u32 = 72;
3464 /// word32 (sym+add)@tprel
3465 pub const R_PPC_TPREL32: u32 = 73;
3466 /// half16*(sym+add)@dtprel
3467 pub const R_PPC_DTPREL16: u32 = 74;
3468 /// half16 (sym+add)@dtprel@l
3469 pub const R_PPC_DTPREL16_LO: u32 = 75;
3470 /// half16 (sym+add)@dtprel@h
3471 pub const R_PPC_DTPREL16_HI: u32 = 76;
3472 /// half16 (sym+add)@dtprel@ha
3473 pub const R_PPC_DTPREL16_HA: u32 = 77;
3474 /// word32 (sym+add)@dtprel
3475 pub const R_PPC_DTPREL32: u32 = 78;
3476 /// half16* (sym+add)@got@tlsgd
3477 pub const R_PPC_GOT_TLSGD16: u32 = 79;
3478 /// half16 (sym+add)@got@tlsgd@l
3479 pub const R_PPC_GOT_TLSGD16_LO: u32 = 80;
3480 /// half16 (sym+add)@got@tlsgd@h
3481 pub const R_PPC_GOT_TLSGD16_HI: u32 = 81;
3482 /// half16 (sym+add)@got@tlsgd@ha
3483 pub const R_PPC_GOT_TLSGD16_HA: u32 = 82;
3484 /// half16* (sym+add)@got@tlsld
3485 pub const R_PPC_GOT_TLSLD16: u32 = 83;
3486 /// half16 (sym+add)@got@tlsld@l
3487 pub const R_PPC_GOT_TLSLD16_LO: u32 = 84;
3488 /// half16 (sym+add)@got@tlsld@h
3489 pub const R_PPC_GOT_TLSLD16_HI: u32 = 85;
3490 /// half16 (sym+add)@got@tlsld@ha
3491 pub const R_PPC_GOT_TLSLD16_HA: u32 = 86;
3492 /// half16* (sym+add)@got@tprel
3493 pub const R_PPC_GOT_TPREL16: u32 = 87;
3494 /// half16 (sym+add)@got@tprel@l
3495 pub const R_PPC_GOT_TPREL16_LO: u32 = 88;
3496 /// half16 (sym+add)@got@tprel@h
3497 pub const R_PPC_GOT_TPREL16_HI: u32 = 89;
3498 /// half16 (sym+add)@got@tprel@ha
3499 pub const R_PPC_GOT_TPREL16_HA: u32 = 90;
3500 /// half16* (sym+add)@got@dtprel
3501 pub const R_PPC_GOT_DTPREL16: u32 = 91;
3502 /// half16* (sym+add)@got@dtprel@l
3503 pub const R_PPC_GOT_DTPREL16_LO: u32 = 92;
3504 /// half16* (sym+add)@got@dtprel@h
3505 pub const R_PPC_GOT_DTPREL16_HI: u32 = 93;
3506 /// half16* (sym+add)@got@dtprel@ha
3507 pub const R_PPC_GOT_DTPREL16_HA: u32 = 94;
3508 /// none (sym+add)@tlsgd
3509 pub const R_PPC_TLSGD: u32 = 95;
3510 /// none (sym+add)@tlsld
3511 pub const R_PPC_TLSLD: u32 = 96;
3512
3513 // PowerPC values for `Rel*::r_type` from the Embedded ELF ABI.
3514 #[allow(missing_docs)]
3515 pub const R_PPC_EMB_NADDR32: u32 = 101;
3516 #[allow(missing_docs)]
3517 pub const R_PPC_EMB_NADDR16: u32 = 102;
3518 #[allow(missing_docs)]
3519 pub const R_PPC_EMB_NADDR16_LO: u32 = 103;
3520 #[allow(missing_docs)]
3521 pub const R_PPC_EMB_NADDR16_HI: u32 = 104;
3522 #[allow(missing_docs)]
3523 pub const R_PPC_EMB_NADDR16_HA: u32 = 105;
3524 #[allow(missing_docs)]
3525 pub const R_PPC_EMB_SDAI16: u32 = 106;
3526 #[allow(missing_docs)]
3527 pub const R_PPC_EMB_SDA2I16: u32 = 107;
3528 #[allow(missing_docs)]
3529 pub const R_PPC_EMB_SDA2REL: u32 = 108;
3530 /// 16 bit offset in SDA
3531 pub const R_PPC_EMB_SDA21: u32 = 109;
3532 #[allow(missing_docs)]
3533 pub const R_PPC_EMB_MRKREF: u32 = 110;
3534 #[allow(missing_docs)]
3535 pub const R_PPC_EMB_RELSEC16: u32 = 111;
3536 #[allow(missing_docs)]
3537 pub const R_PPC_EMB_RELST_LO: u32 = 112;
3538 #[allow(missing_docs)]
3539 pub const R_PPC_EMB_RELST_HI: u32 = 113;
3540 #[allow(missing_docs)]
3541 pub const R_PPC_EMB_RELST_HA: u32 = 114;
3542 #[allow(missing_docs)]
3543 pub const R_PPC_EMB_BIT_FLD: u32 = 115;
3544 /// 16 bit relative offset in SDA
3545 pub const R_PPC_EMB_RELSDA: u32 = 116;
3546
3547 // Diab tool values for `Rel*::r_type`.
3548 /// like EMB_SDA21, but lower 16 bit
3549 pub const R_PPC_DIAB_SDA21_LO: u32 = 180;
3550 /// like EMB_SDA21, but high 16 bit
3551 pub const R_PPC_DIAB_SDA21_HI: u32 = 181;
3552 /// like EMB_SDA21, adjusted high 16
3553 pub const R_PPC_DIAB_SDA21_HA: u32 = 182;
3554 /// like EMB_RELSDA, but lower 16 bit
3555 pub const R_PPC_DIAB_RELSDA_LO: u32 = 183;
3556 /// like EMB_RELSDA, but high 16 bit
3557 pub const R_PPC_DIAB_RELSDA_HI: u32 = 184;
3558 /// like EMB_RELSDA, adjusted high 16
3559 pub const R_PPC_DIAB_RELSDA_HA: u32 = 185;
3560
3561 /// GNU extension to support local ifunc.
3562 pub const R_PPC_IRELATIVE: u32 = 248;
3563
3564 // GNU relocs used in PIC code sequences.
3565 /// half16 (sym+add-.)
3566 pub const R_PPC_REL16: u32 = 249;
3567 /// half16 (sym+add-.)@l
3568 pub const R_PPC_REL16_LO: u32 = 250;
3569 /// half16 (sym+add-.)@h
3570 pub const R_PPC_REL16_HI: u32 = 251;
3571 /// half16 (sym+add-.)@ha
3572 pub const R_PPC_REL16_HA: u32 = 252;
3573
3574 /// This is a phony reloc to handle any old fashioned TOC16 references that may
3575 /// still be in object files.
3576 pub const R_PPC_TOC16: u32 = 255;
3577
3578 // PowerPC specific values for `Dyn*::d_tag`.
3579 #[allow(missing_docs)]
3580 pub const DT_PPC_GOT: u32 = DT_LOPROC + 0;
3581 #[allow(missing_docs)]
3582 pub const DT_PPC_OPT: u32 = DT_LOPROC + 1;
3583
3584 // PowerPC specific values for the `DT_PPC_OPT` entry.
3585 #[allow(missing_docs)]
3586 pub const PPC_OPT_TLS: u32 = 1;
3587
3588 // PowerPC64 values for `Rel*::r_type` defined by the ABIs.
3589 #[allow(missing_docs)]
3590 pub const R_PPC64_NONE: u32 = R_PPC_NONE;
3591 /// 32bit absolute address
3592 pub const R_PPC64_ADDR32: u32 = R_PPC_ADDR32;
3593 /// 26bit address, word aligned
3594 pub const R_PPC64_ADDR24: u32 = R_PPC_ADDR24;
3595 /// 16bit absolute address
3596 pub const R_PPC64_ADDR16: u32 = R_PPC_ADDR16;
3597 /// lower 16bits of address
3598 pub const R_PPC64_ADDR16_LO: u32 = R_PPC_ADDR16_LO;
3599 /// high 16bits of address.
3600 pub const R_PPC64_ADDR16_HI: u32 = R_PPC_ADDR16_HI;
3601 /// adjusted high 16bits.
3602 pub const R_PPC64_ADDR16_HA: u32 = R_PPC_ADDR16_HA;
3603 /// 16bit address, word aligned
3604 pub const R_PPC64_ADDR14: u32 = R_PPC_ADDR14;
3605 #[allow(missing_docs)]
3606 pub const R_PPC64_ADDR14_BRTAKEN: u32 = R_PPC_ADDR14_BRTAKEN;
3607 #[allow(missing_docs)]
3608 pub const R_PPC64_ADDR14_BRNTAKEN: u32 = R_PPC_ADDR14_BRNTAKEN;
3609 /// PC-rel. 26 bit, word aligned
3610 pub const R_PPC64_REL24: u32 = R_PPC_REL24;
3611 /// PC relative 16 bit
3612 pub const R_PPC64_REL14: u32 = R_PPC_REL14;
3613 #[allow(missing_docs)]
3614 pub const R_PPC64_REL14_BRTAKEN: u32 = R_PPC_REL14_BRTAKEN;
3615 #[allow(missing_docs)]
3616 pub const R_PPC64_REL14_BRNTAKEN: u32 = R_PPC_REL14_BRNTAKEN;
3617 #[allow(missing_docs)]
3618 pub const R_PPC64_GOT16: u32 = R_PPC_GOT16;
3619 #[allow(missing_docs)]
3620 pub const R_PPC64_GOT16_LO: u32 = R_PPC_GOT16_LO;
3621 #[allow(missing_docs)]
3622 pub const R_PPC64_GOT16_HI: u32 = R_PPC_GOT16_HI;
3623 #[allow(missing_docs)]
3624 pub const R_PPC64_GOT16_HA: u32 = R_PPC_GOT16_HA;
3625
3626 #[allow(missing_docs)]
3627 pub const R_PPC64_COPY: u32 = R_PPC_COPY;
3628 #[allow(missing_docs)]
3629 pub const R_PPC64_GLOB_DAT: u32 = R_PPC_GLOB_DAT;
3630 #[allow(missing_docs)]
3631 pub const R_PPC64_JMP_SLOT: u32 = R_PPC_JMP_SLOT;
3632 #[allow(missing_docs)]
3633 pub const R_PPC64_RELATIVE: u32 = R_PPC_RELATIVE;
3634
3635 #[allow(missing_docs)]
3636 pub const R_PPC64_UADDR32: u32 = R_PPC_UADDR32;
3637 #[allow(missing_docs)]
3638 pub const R_PPC64_UADDR16: u32 = R_PPC_UADDR16;
3639 #[allow(missing_docs)]
3640 pub const R_PPC64_REL32: u32 = R_PPC_REL32;
3641 #[allow(missing_docs)]
3642 pub const R_PPC64_PLT32: u32 = R_PPC_PLT32;
3643 #[allow(missing_docs)]
3644 pub const R_PPC64_PLTREL32: u32 = R_PPC_PLTREL32;
3645 #[allow(missing_docs)]
3646 pub const R_PPC64_PLT16_LO: u32 = R_PPC_PLT16_LO;
3647 #[allow(missing_docs)]
3648 pub const R_PPC64_PLT16_HI: u32 = R_PPC_PLT16_HI;
3649 #[allow(missing_docs)]
3650 pub const R_PPC64_PLT16_HA: u32 = R_PPC_PLT16_HA;
3651
3652 #[allow(missing_docs)]
3653 pub const R_PPC64_SECTOFF: u32 = R_PPC_SECTOFF;
3654 #[allow(missing_docs)]
3655 pub const R_PPC64_SECTOFF_LO: u32 = R_PPC_SECTOFF_LO;
3656 #[allow(missing_docs)]
3657 pub const R_PPC64_SECTOFF_HI: u32 = R_PPC_SECTOFF_HI;
3658 #[allow(missing_docs)]
3659 pub const R_PPC64_SECTOFF_HA: u32 = R_PPC_SECTOFF_HA;
3660 /// word30 (S + A - P) >> 2
3661 pub const R_PPC64_ADDR30: u32 = 37;
3662 /// doubleword64 S + A
3663 pub const R_PPC64_ADDR64: u32 = 38;
3664 /// half16 #higher(S + A)
3665 pub const R_PPC64_ADDR16_HIGHER: u32 = 39;
3666 /// half16 #highera(S + A)
3667 pub const R_PPC64_ADDR16_HIGHERA: u32 = 40;
3668 /// half16 #highest(S + A)
3669 pub const R_PPC64_ADDR16_HIGHEST: u32 = 41;
3670 /// half16 #highesta(S + A)
3671 pub const R_PPC64_ADDR16_HIGHESTA: u32 = 42;
3672 /// doubleword64 S + A
3673 pub const R_PPC64_UADDR64: u32 = 43;
3674 /// doubleword64 S + A - P
3675 pub const R_PPC64_REL64: u32 = 44;
3676 /// doubleword64 L + A
3677 pub const R_PPC64_PLT64: u32 = 45;
3678 /// doubleword64 L + A - P
3679 pub const R_PPC64_PLTREL64: u32 = 46;
3680 /// half16* S + A - .TOC
3681 pub const R_PPC64_TOC16: u32 = 47;
3682 /// half16 #lo(S + A - .TOC.)
3683 pub const R_PPC64_TOC16_LO: u32 = 48;
3684 /// half16 #hi(S + A - .TOC.)
3685 pub const R_PPC64_TOC16_HI: u32 = 49;
3686 /// half16 #ha(S + A - .TOC.)
3687 pub const R_PPC64_TOC16_HA: u32 = 50;
3688 /// doubleword64 .TOC
3689 pub const R_PPC64_TOC: u32 = 51;
3690 /// half16* M + A
3691 pub const R_PPC64_PLTGOT16: u32 = 52;
3692 /// half16 #lo(M + A)
3693 pub const R_PPC64_PLTGOT16_LO: u32 = 53;
3694 /// half16 #hi(M + A)
3695 pub const R_PPC64_PLTGOT16_HI: u32 = 54;
3696 /// half16 #ha(M + A)
3697 pub const R_PPC64_PLTGOT16_HA: u32 = 55;
3698
3699 /// half16ds* (S + A) >> 2
3700 pub const R_PPC64_ADDR16_DS: u32 = 56;
3701 /// half16ds #lo(S + A) >> 2
3702 pub const R_PPC64_ADDR16_LO_DS: u32 = 57;
3703 /// half16ds* (G + A) >> 2
3704 pub const R_PPC64_GOT16_DS: u32 = 58;
3705 /// half16ds #lo(G + A) >> 2
3706 pub const R_PPC64_GOT16_LO_DS: u32 = 59;
3707 /// half16ds #lo(L + A) >> 2
3708 pub const R_PPC64_PLT16_LO_DS: u32 = 60;
3709 /// half16ds* (R + A) >> 2
3710 pub const R_PPC64_SECTOFF_DS: u32 = 61;
3711 /// half16ds #lo(R + A) >> 2
3712 pub const R_PPC64_SECTOFF_LO_DS: u32 = 62;
3713 /// half16ds* (S + A - .TOC.) >> 2
3714 pub const R_PPC64_TOC16_DS: u32 = 63;
3715 /// half16ds #lo(S + A - .TOC.) >> 2
3716 pub const R_PPC64_TOC16_LO_DS: u32 = 64;
3717 /// half16ds* (M + A) >> 2
3718 pub const R_PPC64_PLTGOT16_DS: u32 = 65;
3719 /// half16ds #lo(M + A) >> 2
3720 pub const R_PPC64_PLTGOT16_LO_DS: u32 = 66;
3721
3722 // PowerPC64 values for `Rel*::r_type` defined for the TLS access ABI.
3723 /// none (sym+add)@tls
3724 pub const R_PPC64_TLS: u32 = 67;
3725 /// doubleword64 (sym+add)@dtpmod
3726 pub const R_PPC64_DTPMOD64: u32 = 68;
3727 /// half16* (sym+add)@tprel
3728 pub const R_PPC64_TPREL16: u32 = 69;
3729 /// half16 (sym+add)@tprel@l
3730 pub const R_PPC64_TPREL16_LO: u32 = 70;
3731 /// half16 (sym+add)@tprel@h
3732 pub const R_PPC64_TPREL16_HI: u32 = 71;
3733 /// half16 (sym+add)@tprel@ha
3734 pub const R_PPC64_TPREL16_HA: u32 = 72;
3735 /// doubleword64 (sym+add)@tprel
3736 pub const R_PPC64_TPREL64: u32 = 73;
3737 /// half16* (sym+add)@dtprel
3738 pub const R_PPC64_DTPREL16: u32 = 74;
3739 /// half16 (sym+add)@dtprel@l
3740 pub const R_PPC64_DTPREL16_LO: u32 = 75;
3741 /// half16 (sym+add)@dtprel@h
3742 pub const R_PPC64_DTPREL16_HI: u32 = 76;
3743 /// half16 (sym+add)@dtprel@ha
3744 pub const R_PPC64_DTPREL16_HA: u32 = 77;
3745 /// doubleword64 (sym+add)@dtprel
3746 pub const R_PPC64_DTPREL64: u32 = 78;
3747 /// half16* (sym+add)@got@tlsgd
3748 pub const R_PPC64_GOT_TLSGD16: u32 = 79;
3749 /// half16 (sym+add)@got@tlsgd@l
3750 pub const R_PPC64_GOT_TLSGD16_LO: u32 = 80;
3751 /// half16 (sym+add)@got@tlsgd@h
3752 pub const R_PPC64_GOT_TLSGD16_HI: u32 = 81;
3753 /// half16 (sym+add)@got@tlsgd@ha
3754 pub const R_PPC64_GOT_TLSGD16_HA: u32 = 82;
3755 /// half16* (sym+add)@got@tlsld
3756 pub const R_PPC64_GOT_TLSLD16: u32 = 83;
3757 /// half16 (sym+add)@got@tlsld@l
3758 pub const R_PPC64_GOT_TLSLD16_LO: u32 = 84;
3759 /// half16 (sym+add)@got@tlsld@h
3760 pub const R_PPC64_GOT_TLSLD16_HI: u32 = 85;
3761 /// half16 (sym+add)@got@tlsld@ha
3762 pub const R_PPC64_GOT_TLSLD16_HA: u32 = 86;
3763 /// half16ds* (sym+add)@got@tprel
3764 pub const R_PPC64_GOT_TPREL16_DS: u32 = 87;
3765 /// half16ds (sym+add)@got@tprel@l
3766 pub const R_PPC64_GOT_TPREL16_LO_DS: u32 = 88;
3767 /// half16 (sym+add)@got@tprel@h
3768 pub const R_PPC64_GOT_TPREL16_HI: u32 = 89;
3769 /// half16 (sym+add)@got@tprel@ha
3770 pub const R_PPC64_GOT_TPREL16_HA: u32 = 90;
3771 /// half16ds* (sym+add)@got@dtprel
3772 pub const R_PPC64_GOT_DTPREL16_DS: u32 = 91;
3773 /// half16ds (sym+add)@got@dtprel@l
3774 pub const R_PPC64_GOT_DTPREL16_LO_DS: u32 = 92;
3775 /// half16 (sym+add)@got@dtprel@h
3776 pub const R_PPC64_GOT_DTPREL16_HI: u32 = 93;
3777 /// half16 (sym+add)@got@dtprel@ha
3778 pub const R_PPC64_GOT_DTPREL16_HA: u32 = 94;
3779 /// half16ds* (sym+add)@tprel
3780 pub const R_PPC64_TPREL16_DS: u32 = 95;
3781 /// half16ds (sym+add)@tprel@l
3782 pub const R_PPC64_TPREL16_LO_DS: u32 = 96;
3783 /// half16 (sym+add)@tprel@higher
3784 pub const R_PPC64_TPREL16_HIGHER: u32 = 97;
3785 /// half16 (sym+add)@tprel@highera
3786 pub const R_PPC64_TPREL16_HIGHERA: u32 = 98;
3787 /// half16 (sym+add)@tprel@highest
3788 pub const R_PPC64_TPREL16_HIGHEST: u32 = 99;
3789 /// half16 (sym+add)@tprel@highesta
3790 pub const R_PPC64_TPREL16_HIGHESTA: u32 = 100;
3791 /// half16ds* (sym+add)@dtprel
3792 pub const R_PPC64_DTPREL16_DS: u32 = 101;
3793 /// half16ds (sym+add)@dtprel@l
3794 pub const R_PPC64_DTPREL16_LO_DS: u32 = 102;
3795 /// half16 (sym+add)@dtprel@higher
3796 pub const R_PPC64_DTPREL16_HIGHER: u32 = 103;
3797 /// half16 (sym+add)@dtprel@highera
3798 pub const R_PPC64_DTPREL16_HIGHERA: u32 = 104;
3799 /// half16 (sym+add)@dtprel@highest
3800 pub const R_PPC64_DTPREL16_HIGHEST: u32 = 105;
3801 /// half16 (sym+add)@dtprel@highesta
3802 pub const R_PPC64_DTPREL16_HIGHESTA: u32 = 106;
3803 /// none (sym+add)@tlsgd
3804 pub const R_PPC64_TLSGD: u32 = 107;
3805 /// none (sym+add)@tlsld
3806 pub const R_PPC64_TLSLD: u32 = 108;
3807 /// none
3808 pub const R_PPC64_TOCSAVE: u32 = 109;
3809
3810 // Added when HA and HI relocs were changed to report overflows.
3811 #[allow(missing_docs)]
3812 pub const R_PPC64_ADDR16_HIGH: u32 = 110;
3813 #[allow(missing_docs)]
3814 pub const R_PPC64_ADDR16_HIGHA: u32 = 111;
3815 #[allow(missing_docs)]
3816 pub const R_PPC64_TPREL16_HIGH: u32 = 112;
3817 #[allow(missing_docs)]
3818 pub const R_PPC64_TPREL16_HIGHA: u32 = 113;
3819 #[allow(missing_docs)]
3820 pub const R_PPC64_DTPREL16_HIGH: u32 = 114;
3821 #[allow(missing_docs)]
3822 pub const R_PPC64_DTPREL16_HIGHA: u32 = 115;
3823
3824 /// GNU extension to support local ifunc.
3825 #[allow(missing_docs)]
3826 pub const R_PPC64_JMP_IREL: u32 = 247;
3827 /// GNU extension to support local ifunc.
3828 #[allow(missing_docs)]
3829 pub const R_PPC64_IRELATIVE: u32 = 248;
3830 /// half16 (sym+add-.)
3831 pub const R_PPC64_REL16: u32 = 249;
3832 /// half16 (sym+add-.)@l
3833 pub const R_PPC64_REL16_LO: u32 = 250;
3834 /// half16 (sym+add-.)@h
3835 pub const R_PPC64_REL16_HI: u32 = 251;
3836 /// half16 (sym+add-.)@ha
3837 pub const R_PPC64_REL16_HA: u32 = 252;
3838
3839 // PowerPC64 values for `FileHeader64::e_flags.
3840 /// PowerPC64 bits specifying ABI.
3841 ///
3842 /// 1 for original function descriptor using ABI,
3843 /// 2 for revised ABI without function descriptors,
3844 /// 0 for unspecified or not using any features affected by the differences.
3845 pub const EF_PPC64_ABI: u32 = 3;
3846
3847 // PowerPC64 values for `Dyn64::d_tag.
3848 #[allow(missing_docs)]
3849 pub const DT_PPC64_GLINK: u32 = DT_LOPROC + 0;
3850 #[allow(missing_docs)]
3851 pub const DT_PPC64_OPD: u32 = DT_LOPROC + 1;
3852 #[allow(missing_docs)]
3853 pub const DT_PPC64_OPDSZ: u32 = DT_LOPROC + 2;
3854 #[allow(missing_docs)]
3855 pub const DT_PPC64_OPT: u32 = DT_LOPROC + 3;
3856
3857 // PowerPC64 bits for `DT_PPC64_OPT` entry.
3858 #[allow(missing_docs)]
3859 pub const PPC64_OPT_TLS: u32 = 1;
3860 #[allow(missing_docs)]
3861 pub const PPC64_OPT_MULTI_TOC: u32 = 2;
3862 #[allow(missing_docs)]
3863 pub const PPC64_OPT_LOCALENTRY: u32 = 4;
3864
3865 // PowerPC64 values for `Sym64::st_other.
3866 #[allow(missing_docs)]
3867 pub const STO_PPC64_LOCAL_BIT: u8 = 5;
3868 #[allow(missing_docs)]
3869 pub const STO_PPC64_LOCAL_MASK: u8 = 7 << STO_PPC64_LOCAL_BIT;
3870
3871 // ARM specific declarations.
3872
3873 // ARM values for `FileHeader*::e_flags`.
3874 #[allow(missing_docs)]
3875 pub const EF_ARM_RELEXEC: u32 = 0x01;
3876 #[allow(missing_docs)]
3877 pub const EF_ARM_HASENTRY: u32 = 0x02;
3878 #[allow(missing_docs)]
3879 pub const EF_ARM_INTERWORK: u32 = 0x04;
3880 #[allow(missing_docs)]
3881 pub const EF_ARM_APCS_26: u32 = 0x08;
3882 #[allow(missing_docs)]
3883 pub const EF_ARM_APCS_FLOAT: u32 = 0x10;
3884 #[allow(missing_docs)]
3885 pub const EF_ARM_PIC: u32 = 0x20;
3886 /// 8-bit structure alignment is in use
3887 pub const EF_ARM_ALIGN8: u32 = 0x40;
3888 #[allow(missing_docs)]
3889 pub const EF_ARM_NEW_ABI: u32 = 0x80;
3890 #[allow(missing_docs)]
3891 pub const EF_ARM_OLD_ABI: u32 = 0x100;
3892 #[allow(missing_docs)]
3893 pub const EF_ARM_SOFT_FLOAT: u32 = 0x200;
3894 #[allow(missing_docs)]
3895 pub const EF_ARM_VFP_FLOAT: u32 = 0x400;
3896 #[allow(missing_docs)]
3897 pub const EF_ARM_MAVERICK_FLOAT: u32 = 0x800;
3898
3899 /// NB conflicts with EF_ARM_SOFT_FLOAT
3900 pub const EF_ARM_ABI_FLOAT_SOFT: u32 = 0x200;
3901 /// NB conflicts with EF_ARM_VFP_FLOAT
3902 pub const EF_ARM_ABI_FLOAT_HARD: u32 = 0x400;
3903
3904 // Other constants defined in the ARM ELF spec. version B-01.
3905 // NB. These conflict with values defined above.
3906 #[allow(missing_docs)]
3907 pub const EF_ARM_SYMSARESORTED: u32 = 0x04;
3908 #[allow(missing_docs)]
3909 pub const EF_ARM_DYNSYMSUSESEGIDX: u32 = 0x08;
3910 #[allow(missing_docs)]
3911 pub const EF_ARM_MAPSYMSFIRST: u32 = 0x10;
3912
3913 // Constants defined in AAELF.
3914 #[allow(missing_docs)]
3915 pub const EF_ARM_BE8: u32 = 0x0080_0000;
3916 #[allow(missing_docs)]
3917 pub const EF_ARM_LE8: u32 = 0x0040_0000;
3918
3919 #[allow(missing_docs)]
3920 pub const EF_ARM_EABIMASK: u32 = 0xff00_0000;
3921 #[allow(missing_docs)]
3922 pub const EF_ARM_EABI_UNKNOWN: u32 = 0x0000_0000;
3923 #[allow(missing_docs)]
3924 pub const EF_ARM_EABI_VER1: u32 = 0x0100_0000;
3925 #[allow(missing_docs)]
3926 pub const EF_ARM_EABI_VER2: u32 = 0x0200_0000;
3927 #[allow(missing_docs)]
3928 pub const EF_ARM_EABI_VER3: u32 = 0x0300_0000;
3929 #[allow(missing_docs)]
3930 pub const EF_ARM_EABI_VER4: u32 = 0x0400_0000;
3931 #[allow(missing_docs)]
3932 pub const EF_ARM_EABI_VER5: u32 = 0x0500_0000;
3933
3934 // ARM Thumb values for `st_type` component of `Sym*::st_info`.
3935 /// A Thumb function.
3936 pub const STT_ARM_TFUNC: u8 = STT_LOPROC;
3937 /// A Thumb label.
3938 pub const STT_ARM_16BIT: u8 = STT_HIPROC;
3939
3940 // ARM values for `SectionHeader*::sh_flags`.
3941 /// Section contains an entry point
3942 pub const SHF_ARM_ENTRYSECT: u32 = 0x1000_0000;
3943 /// Section may be multiply defined in the input to a link step.
3944 pub const SHF_ARM_COMDEF: u32 = 0x8000_0000;
3945
3946 // ARM values for `ProgramHeader*::p_flags`.
3947 /// Segment contains the location addressed by the static base.
3948 pub const PF_ARM_SB: u32 = 0x1000_0000;
3949 /// Position-independent segment.
3950 pub const PF_ARM_PI: u32 = 0x2000_0000;
3951 /// Absolute segment.
3952 pub const PF_ARM_ABS: u32 = 0x4000_0000;
3953
3954 // ARM values for `ProgramHeader*::p_type`.
3955 /// ARM unwind segment.
3956 pub const PT_ARM_EXIDX: u32 = PT_LOPROC + 1;
3957
3958 // ARM values for `SectionHeader*::sh_type`.
3959 /// ARM unwind section.
3960 pub const SHT_ARM_EXIDX: u32 = SHT_LOPROC + 1;
3961 /// Preemption details.
3962 pub const SHT_ARM_PREEMPTMAP: u32 = SHT_LOPROC + 2;
3963 /// ARM attributes section.
3964 pub const SHT_ARM_ATTRIBUTES: u32 = SHT_LOPROC + 3;
3965
3966 // AArch64 values for `Rel*::r_type`.
3967
3968 /// No relocation.
3969 pub const R_AARCH64_NONE: u32 = 0;
3970
3971 // ILP32 AArch64 relocs.
3972 /// Direct 32 bit.
3973 pub const R_AARCH64_P32_ABS32: u32 = 1;
3974 /// Copy symbol at runtime.
3975 pub const R_AARCH64_P32_COPY: u32 = 180;
3976 /// Create GOT entry.
3977 pub const R_AARCH64_P32_GLOB_DAT: u32 = 181;
3978 /// Create PLT entry.
3979 pub const R_AARCH64_P32_JUMP_SLOT: u32 = 182;
3980 /// Adjust by program base.
3981 pub const R_AARCH64_P32_RELATIVE: u32 = 183;
3982 /// Module number, 32 bit.
3983 pub const R_AARCH64_P32_TLS_DTPMOD: u32 = 184;
3984 /// Module-relative offset, 32 bit.
3985 pub const R_AARCH64_P32_TLS_DTPREL: u32 = 185;
3986 /// TP-relative offset, 32 bit.
3987 pub const R_AARCH64_P32_TLS_TPREL: u32 = 186;
3988 /// TLS Descriptor.
3989 pub const R_AARCH64_P32_TLSDESC: u32 = 187;
3990 /// STT_GNU_IFUNC relocation.
3991 pub const R_AARCH64_P32_IRELATIVE: u32 = 188;
3992
3993 // LP64 AArch64 relocs.
3994 /// Direct 64 bit.
3995 pub const R_AARCH64_ABS64: u32 = 257;
3996 /// Direct 32 bit.
3997 pub const R_AARCH64_ABS32: u32 = 258;
3998 /// Direct 16-bit.
3999 pub const R_AARCH64_ABS16: u32 = 259;
4000 /// PC-relative 64-bit.
4001 pub const R_AARCH64_PREL64: u32 = 260;
4002 /// PC-relative 32-bit.
4003 pub const R_AARCH64_PREL32: u32 = 261;
4004 /// PC-relative 16-bit.
4005 pub const R_AARCH64_PREL16: u32 = 262;
4006 /// Dir. MOVZ imm. from bits 15:0.
4007 pub const R_AARCH64_MOVW_UABS_G0: u32 = 263;
4008 /// Likewise for MOVK; no check.
4009 pub const R_AARCH64_MOVW_UABS_G0_NC: u32 = 264;
4010 /// Dir. MOVZ imm. from bits 31:16.
4011 pub const R_AARCH64_MOVW_UABS_G1: u32 = 265;
4012 /// Likewise for MOVK; no check.
4013 pub const R_AARCH64_MOVW_UABS_G1_NC: u32 = 266;
4014 /// Dir. MOVZ imm. from bits 47:32.
4015 pub const R_AARCH64_MOVW_UABS_G2: u32 = 267;
4016 /// Likewise for MOVK; no check.
4017 pub const R_AARCH64_MOVW_UABS_G2_NC: u32 = 268;
4018 /// Dir. MOV{K,Z} imm. from 63:48.
4019 pub const R_AARCH64_MOVW_UABS_G3: u32 = 269;
4020 /// Dir. MOV{N,Z} imm. from 15:0.
4021 pub const R_AARCH64_MOVW_SABS_G0: u32 = 270;
4022 /// Dir. MOV{N,Z} imm. from 31:16.
4023 pub const R_AARCH64_MOVW_SABS_G1: u32 = 271;
4024 /// Dir. MOV{N,Z} imm. from 47:32.
4025 pub const R_AARCH64_MOVW_SABS_G2: u32 = 272;
4026 /// PC-rel. LD imm. from bits 20:2.
4027 pub const R_AARCH64_LD_PREL_LO19: u32 = 273;
4028 /// PC-rel. ADR imm. from bits 20:0.
4029 pub const R_AARCH64_ADR_PREL_LO21: u32 = 274;
4030 /// Page-rel. ADRP imm. from 32:12.
4031 pub const R_AARCH64_ADR_PREL_PG_HI21: u32 = 275;
4032 /// Likewise; no overflow check.
4033 pub const R_AARCH64_ADR_PREL_PG_HI21_NC: u32 = 276;
4034 /// Dir. ADD imm. from bits 11:0.
4035 pub const R_AARCH64_ADD_ABS_LO12_NC: u32 = 277;
4036 /// Likewise for LD/ST; no check.
4037 pub const R_AARCH64_LDST8_ABS_LO12_NC: u32 = 278;
4038 /// PC-rel. TBZ/TBNZ imm. from 15:2.
4039 pub const R_AARCH64_TSTBR14: u32 = 279;
4040 /// PC-rel. cond. br. imm. from 20:2.
4041 pub const R_AARCH64_CONDBR19: u32 = 280;
4042 /// PC-rel. B imm. from bits 27:2.
4043 pub const R_AARCH64_JUMP26: u32 = 282;
4044 /// Likewise for CALL.
4045 pub const R_AARCH64_CALL26: u32 = 283;
4046 /// Dir. ADD imm. from bits 11:1.
4047 pub const R_AARCH64_LDST16_ABS_LO12_NC: u32 = 284;
4048 /// Likewise for bits 11:2.
4049 pub const R_AARCH64_LDST32_ABS_LO12_NC: u32 = 285;
4050 /// Likewise for bits 11:3.
4051 pub const R_AARCH64_LDST64_ABS_LO12_NC: u32 = 286;
4052 /// PC-rel. MOV{N,Z} imm. from 15:0.
4053 pub const R_AARCH64_MOVW_PREL_G0: u32 = 287;
4054 /// Likewise for MOVK; no check.
4055 pub const R_AARCH64_MOVW_PREL_G0_NC: u32 = 288;
4056 /// PC-rel. MOV{N,Z} imm. from 31:16.
4057 pub const R_AARCH64_MOVW_PREL_G1: u32 = 289;
4058 /// Likewise for MOVK; no check.
4059 pub const R_AARCH64_MOVW_PREL_G1_NC: u32 = 290;
4060 /// PC-rel. MOV{N,Z} imm. from 47:32.
4061 pub const R_AARCH64_MOVW_PREL_G2: u32 = 291;
4062 /// Likewise for MOVK; no check.
4063 pub const R_AARCH64_MOVW_PREL_G2_NC: u32 = 292;
4064 /// PC-rel. MOV{N,Z} imm. from 63:48.
4065 pub const R_AARCH64_MOVW_PREL_G3: u32 = 293;
4066 /// Dir. ADD imm. from bits 11:4.
4067 pub const R_AARCH64_LDST128_ABS_LO12_NC: u32 = 299;
4068 /// GOT-rel. off. MOV{N,Z} imm. 15:0.
4069 pub const R_AARCH64_MOVW_GOTOFF_G0: u32 = 300;
4070 /// Likewise for MOVK; no check.
4071 pub const R_AARCH64_MOVW_GOTOFF_G0_NC: u32 = 301;
4072 /// GOT-rel. o. MOV{N,Z} imm. 31:16.
4073 pub const R_AARCH64_MOVW_GOTOFF_G1: u32 = 302;
4074 /// Likewise for MOVK; no check.
4075 pub const R_AARCH64_MOVW_GOTOFF_G1_NC: u32 = 303;
4076 /// GOT-rel. o. MOV{N,Z} imm. 47:32.
4077 pub const R_AARCH64_MOVW_GOTOFF_G2: u32 = 304;
4078 /// Likewise for MOVK; no check.
4079 pub const R_AARCH64_MOVW_GOTOFF_G2_NC: u32 = 305;
4080 /// GOT-rel. o. MOV{N,Z} imm. 63:48.
4081 pub const R_AARCH64_MOVW_GOTOFF_G3: u32 = 306;
4082 /// GOT-relative 64-bit.
4083 pub const R_AARCH64_GOTREL64: u32 = 307;
4084 /// GOT-relative 32-bit.
4085 pub const R_AARCH64_GOTREL32: u32 = 308;
4086 /// PC-rel. GOT off. load imm. 20:2.
4087 pub const R_AARCH64_GOT_LD_PREL19: u32 = 309;
4088 /// GOT-rel. off. LD/ST imm. 14:3.
4089 pub const R_AARCH64_LD64_GOTOFF_LO15: u32 = 310;
4090 /// P-page-rel. GOT off. ADRP 32:12.
4091 pub const R_AARCH64_ADR_GOT_PAGE: u32 = 311;
4092 /// Dir. GOT off. LD/ST imm. 11:3.
4093 pub const R_AARCH64_LD64_GOT_LO12_NC: u32 = 312;
4094 /// GOT-page-rel. GOT off. LD/ST 14:3
4095 pub const R_AARCH64_LD64_GOTPAGE_LO15: u32 = 313;
4096 /// PC-relative ADR imm. 20:0.
4097 pub const R_AARCH64_TLSGD_ADR_PREL21: u32 = 512;
4098 /// page-rel. ADRP imm. 32:12.
4099 pub const R_AARCH64_TLSGD_ADR_PAGE21: u32 = 513;
4100 /// direct ADD imm. from 11:0.
4101 pub const R_AARCH64_TLSGD_ADD_LO12_NC: u32 = 514;
4102 /// GOT-rel. MOV{N,Z} 31:16.
4103 pub const R_AARCH64_TLSGD_MOVW_G1: u32 = 515;
4104 /// GOT-rel. MOVK imm. 15:0.
4105 pub const R_AARCH64_TLSGD_MOVW_G0_NC: u32 = 516;
4106 /// Like 512; local dynamic model.
4107 pub const R_AARCH64_TLSLD_ADR_PREL21: u32 = 517;
4108 /// Like 513; local dynamic model.
4109 pub const R_AARCH64_TLSLD_ADR_PAGE21: u32 = 518;
4110 /// Like 514; local dynamic model.
4111 pub const R_AARCH64_TLSLD_ADD_LO12_NC: u32 = 519;
4112 /// Like 515; local dynamic model.
4113 pub const R_AARCH64_TLSLD_MOVW_G1: u32 = 520;
4114 /// Like 516; local dynamic model.
4115 pub const R_AARCH64_TLSLD_MOVW_G0_NC: u32 = 521;
4116 /// TLS PC-rel. load imm. 20:2.
4117 pub const R_AARCH64_TLSLD_LD_PREL19: u32 = 522;
4118 /// TLS DTP-rel. MOV{N,Z} 47:32.
4119 pub const R_AARCH64_TLSLD_MOVW_DTPREL_G2: u32 = 523;
4120 /// TLS DTP-rel. MOV{N,Z} 31:16.
4121 pub const R_AARCH64_TLSLD_MOVW_DTPREL_G1: u32 = 524;
4122 /// Likewise; MOVK; no check.
4123 pub const R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC: u32 = 525;
4124 /// TLS DTP-rel. MOV{N,Z} 15:0.
4125 pub const R_AARCH64_TLSLD_MOVW_DTPREL_G0: u32 = 526;
4126 /// Likewise; MOVK; no check.
4127 pub const R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: u32 = 527;
4128 /// DTP-rel. ADD imm. from 23:12.
4129 pub const R_AARCH64_TLSLD_ADD_DTPREL_HI12: u32 = 528;
4130 /// DTP-rel. ADD imm. from 11:0.
4131 pub const R_AARCH64_TLSLD_ADD_DTPREL_LO12: u32 = 529;
4132 /// Likewise; no ovfl. check.
4133 pub const R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC: u32 = 530;
4134 /// DTP-rel. LD/ST imm. 11:0.
4135 pub const R_AARCH64_TLSLD_LDST8_DTPREL_LO12: u32 = 531;
4136 /// Likewise; no check.
4137 pub const R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC: u32 = 532;
4138 /// DTP-rel. LD/ST imm. 11:1.
4139 pub const R_AARCH64_TLSLD_LDST16_DTPREL_LO12: u32 = 533;
4140 /// Likewise; no check.
4141 pub const R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC: u32 = 534;
4142 /// DTP-rel. LD/ST imm. 11:2.
4143 pub const R_AARCH64_TLSLD_LDST32_DTPREL_LO12: u32 = 535;
4144 /// Likewise; no check.
4145 pub const R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC: u32 = 536;
4146 /// DTP-rel. LD/ST imm. 11:3.
4147 pub const R_AARCH64_TLSLD_LDST64_DTPREL_LO12: u32 = 537;
4148 /// Likewise; no check.
4149 pub const R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC: u32 = 538;
4150 /// GOT-rel. MOV{N,Z} 31:16.
4151 pub const R_AARCH64_TLSIE_MOVW_GOTTPREL_G1: u32 = 539;
4152 /// GOT-rel. MOVK 15:0.
4153 pub const R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC: u32 = 540;
4154 /// Page-rel. ADRP 32:12.
4155 pub const R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: u32 = 541;
4156 /// Direct LD off. 11:3.
4157 pub const R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: u32 = 542;
4158 /// PC-rel. load imm. 20:2.
4159 pub const R_AARCH64_TLSIE_LD_GOTTPREL_PREL19: u32 = 543;
4160 /// TLS TP-rel. MOV{N,Z} 47:32.
4161 pub const R_AARCH64_TLSLE_MOVW_TPREL_G2: u32 = 544;
4162 /// TLS TP-rel. MOV{N,Z} 31:16.
4163 pub const R_AARCH64_TLSLE_MOVW_TPREL_G1: u32 = 545;
4164 /// Likewise; MOVK; no check.
4165 pub const R_AARCH64_TLSLE_MOVW_TPREL_G1_NC: u32 = 546;
4166 /// TLS TP-rel. MOV{N,Z} 15:0.
4167 pub const R_AARCH64_TLSLE_MOVW_TPREL_G0: u32 = 547;
4168 /// Likewise; MOVK; no check.
4169 pub const R_AARCH64_TLSLE_MOVW_TPREL_G0_NC: u32 = 548;
4170 /// TP-rel. ADD imm. 23:12.
4171 pub const R_AARCH64_TLSLE_ADD_TPREL_HI12: u32 = 549;
4172 /// TP-rel. ADD imm. 11:0.
4173 pub const R_AARCH64_TLSLE_ADD_TPREL_LO12: u32 = 550;
4174 /// Likewise; no ovfl. check.
4175 pub const R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: u32 = 551;
4176 /// TP-rel. LD/ST off. 11:0.
4177 pub const R_AARCH64_TLSLE_LDST8_TPREL_LO12: u32 = 552;
4178 /// Likewise; no ovfl. check.
4179 pub const R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: u32 = 553;
4180 /// TP-rel. LD/ST off. 11:1.
4181 pub const R_AARCH64_TLSLE_LDST16_TPREL_LO12: u32 = 554;
4182 /// Likewise; no check.
4183 pub const R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: u32 = 555;
4184 /// TP-rel. LD/ST off. 11:2.
4185 pub const R_AARCH64_TLSLE_LDST32_TPREL_LO12: u32 = 556;
4186 /// Likewise; no check.
4187 pub const R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: u32 = 557;
4188 /// TP-rel. LD/ST off. 11:3.
4189 pub const R_AARCH64_TLSLE_LDST64_TPREL_LO12: u32 = 558;
4190 /// Likewise; no check.
4191 pub const R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: u32 = 559;
4192 /// PC-rel. load immediate 20:2.
4193 pub const R_AARCH64_TLSDESC_LD_PREL19: u32 = 560;
4194 /// PC-rel. ADR immediate 20:0.
4195 pub const R_AARCH64_TLSDESC_ADR_PREL21: u32 = 561;
4196 /// Page-rel. ADRP imm. 32:12.
4197 pub const R_AARCH64_TLSDESC_ADR_PAGE21: u32 = 562;
4198 /// Direct LD off. from 11:3.
4199 pub const R_AARCH64_TLSDESC_LD64_LO12: u32 = 563;
4200 /// Direct ADD imm. from 11:0.
4201 pub const R_AARCH64_TLSDESC_ADD_LO12: u32 = 564;
4202 /// GOT-rel. MOV{N,Z} imm. 31:16.
4203 pub const R_AARCH64_TLSDESC_OFF_G1: u32 = 565;
4204 /// GOT-rel. MOVK imm. 15:0; no ck.
4205 pub const R_AARCH64_TLSDESC_OFF_G0_NC: u32 = 566;
4206 /// Relax LDR.
4207 pub const R_AARCH64_TLSDESC_LDR: u32 = 567;
4208 /// Relax ADD.
4209 pub const R_AARCH64_TLSDESC_ADD: u32 = 568;
4210 /// Relax BLR.
4211 pub const R_AARCH64_TLSDESC_CALL: u32 = 569;
4212 /// TP-rel. LD/ST off. 11:4.
4213 pub const R_AARCH64_TLSLE_LDST128_TPREL_LO12: u32 = 570;
4214 /// Likewise; no check.
4215 pub const R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC: u32 = 571;
4216 /// DTP-rel. LD/ST imm. 11:4.
4217 pub const R_AARCH64_TLSLD_LDST128_DTPREL_LO12: u32 = 572;
4218 /// Likewise; no check.
4219 pub const R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC: u32 = 573;
4220 /// Copy symbol at runtime.
4221 pub const R_AARCH64_COPY: u32 = 1024;
4222 /// Create GOT entry.
4223 pub const R_AARCH64_GLOB_DAT: u32 = 1025;
4224 /// Create PLT entry.
4225 pub const R_AARCH64_JUMP_SLOT: u32 = 1026;
4226 /// Adjust by program base.
4227 pub const R_AARCH64_RELATIVE: u32 = 1027;
4228 /// Module number, 64 bit.
4229 pub const R_AARCH64_TLS_DTPMOD: u32 = 1028;
4230 /// Module-relative offset, 64 bit.
4231 pub const R_AARCH64_TLS_DTPREL: u32 = 1029;
4232 /// TP-relative offset, 64 bit.
4233 pub const R_AARCH64_TLS_TPREL: u32 = 1030;
4234 /// TLS Descriptor.
4235 pub const R_AARCH64_TLSDESC: u32 = 1031;
4236 /// STT_GNU_IFUNC relocation.
4237 pub const R_AARCH64_IRELATIVE: u32 = 1032;
4238
4239 // AVR values for `Rel*::r_type`.
4240
4241 /// Direct 32 bit
4242 pub const R_AVR_32: u32 = 1;
4243 /// Direct 16 bit
4244 pub const R_AVR_16: u32 = 4;
4245
4246 // MSP430 values for `Rel*::r_type`.
4247
4248 /// Direct 32 bit
4249 pub const R_MSP430_32: u32 = 1;
4250 /// Direct 16 bit
4251 pub const R_MSP430_16_BYTE: u32 = 5;
4252
4253 // Hexagon values for `Rel*::r_type`.
4254
4255 /// Direct 32 bit
4256 pub const R_HEX_32: u32 = 6;
4257
4258 // ARM values for `Rel*::r_type`.
4259
4260 /// No reloc
4261 pub const R_ARM_NONE: u32 = 0;
4262 /// Deprecated PC relative 26 bit branch.
4263 pub const R_ARM_PC24: u32 = 1;
4264 /// Direct 32 bit
4265 pub const R_ARM_ABS32: u32 = 2;
4266 /// PC relative 32 bit
4267 pub const R_ARM_REL32: u32 = 3;
4268 #[allow(missing_docs)]
4269 pub const R_ARM_PC13: u32 = 4;
4270 /// Direct 16 bit
4271 pub const R_ARM_ABS16: u32 = 5;
4272 /// Direct 12 bit
4273 pub const R_ARM_ABS12: u32 = 6;
4274 /// Direct & 0x7C (LDR, STR).
4275 pub const R_ARM_THM_ABS5: u32 = 7;
4276 /// Direct 8 bit
4277 pub const R_ARM_ABS8: u32 = 8;
4278 #[allow(missing_docs)]
4279 pub const R_ARM_SBREL32: u32 = 9;
4280 /// PC relative 24 bit (Thumb32 BL).
4281 pub const R_ARM_THM_PC22: u32 = 10;
4282 /// PC relative & 0x3FC (Thumb16 LDR, ADD, ADR).
4283 pub const R_ARM_THM_PC8: u32 = 11;
4284 #[allow(missing_docs)]
4285 pub const R_ARM_AMP_VCALL9: u32 = 12;
4286 /// Obsolete static relocation.
4287 pub const R_ARM_SWI24: u32 = 13;
4288 /// Dynamic relocation.
4289 pub const R_ARM_TLS_DESC: u32 = 13;
4290 /// Reserved.
4291 pub const R_ARM_THM_SWI8: u32 = 14;
4292 /// Reserved.
4293 pub const R_ARM_XPC25: u32 = 15;
4294 /// Reserved.
4295 pub const R_ARM_THM_XPC22: u32 = 16;
4296 /// ID of module containing symbol
4297 pub const R_ARM_TLS_DTPMOD32: u32 = 17;
4298 /// Offset in TLS block
4299 pub const R_ARM_TLS_DTPOFF32: u32 = 18;
4300 /// Offset in static TLS block
4301 pub const R_ARM_TLS_TPOFF32: u32 = 19;
4302 /// Copy symbol at runtime
4303 pub const R_ARM_COPY: u32 = 20;
4304 /// Create GOT entry
4305 pub const R_ARM_GLOB_DAT: u32 = 21;
4306 /// Create PLT entry
4307 pub const R_ARM_JUMP_SLOT: u32 = 22;
4308 /// Adjust by program base
4309 pub const R_ARM_RELATIVE: u32 = 23;
4310 /// 32 bit offset to GOT
4311 pub const R_ARM_GOTOFF: u32 = 24;
4312 /// 32 bit PC relative offset to GOT
4313 pub const R_ARM_GOTPC: u32 = 25;
4314 /// 32 bit GOT entry
4315 pub const R_ARM_GOT32: u32 = 26;
4316 /// Deprecated, 32 bit PLT address.
4317 pub const R_ARM_PLT32: u32 = 27;
4318 /// PC relative 24 bit (BL, BLX).
4319 pub const R_ARM_CALL: u32 = 28;
4320 /// PC relative 24 bit (B, BL<cond>).
4321 pub const R_ARM_JUMP24: u32 = 29;
4322 /// PC relative 24 bit (Thumb32 B.W).
4323 pub const R_ARM_THM_JUMP24: u32 = 30;
4324 /// Adjust by program base.
4325 pub const R_ARM_BASE_ABS: u32 = 31;
4326 /// Obsolete.
4327 pub const R_ARM_ALU_PCREL_7_0: u32 = 32;
4328 /// Obsolete.
4329 pub const R_ARM_ALU_PCREL_15_8: u32 = 33;
4330 /// Obsolete.
4331 pub const R_ARM_ALU_PCREL_23_15: u32 = 34;
4332 /// Deprecated, prog. base relative.
4333 pub const R_ARM_LDR_SBREL_11_0: u32 = 35;
4334 /// Deprecated, prog. base relative.
4335 pub const R_ARM_ALU_SBREL_19_12: u32 = 36;
4336 /// Deprecated, prog. base relative.
4337 pub const R_ARM_ALU_SBREL_27_20: u32 = 37;
4338 #[allow(missing_docs)]
4339 pub const R_ARM_TARGET1: u32 = 38;
4340 /// Program base relative.
4341 pub const R_ARM_SBREL31: u32 = 39;
4342 #[allow(missing_docs)]
4343 pub const R_ARM_V4BX: u32 = 40;
4344 #[allow(missing_docs)]
4345 pub const R_ARM_TARGET2: u32 = 41;
4346 /// 32 bit PC relative.
4347 pub const R_ARM_PREL31: u32 = 42;
4348 /// Direct 16-bit (MOVW).
4349 pub const R_ARM_MOVW_ABS_NC: u32 = 43;
4350 /// Direct high 16-bit (MOVT).
4351 pub const R_ARM_MOVT_ABS: u32 = 44;
4352 /// PC relative 16-bit (MOVW).
4353 pub const R_ARM_MOVW_PREL_NC: u32 = 45;
4354 /// PC relative (MOVT).
4355 pub const R_ARM_MOVT_PREL: u32 = 46;
4356 /// Direct 16 bit (Thumb32 MOVW).
4357 pub const R_ARM_THM_MOVW_ABS_NC: u32 = 47;
4358 /// Direct high 16 bit (Thumb32 MOVT).
4359 pub const R_ARM_THM_MOVT_ABS: u32 = 48;
4360 /// PC relative 16 bit (Thumb32 MOVW).
4361 pub const R_ARM_THM_MOVW_PREL_NC: u32 = 49;
4362 /// PC relative high 16 bit (Thumb32 MOVT).
4363 pub const R_ARM_THM_MOVT_PREL: u32 = 50;
4364 /// PC relative 20 bit (Thumb32 B<cond>.W).
4365 pub const R_ARM_THM_JUMP19: u32 = 51;
4366 /// PC relative X & 0x7E (Thumb16 CBZ, CBNZ).
4367 pub const R_ARM_THM_JUMP6: u32 = 52;
4368 /// PC relative 12 bit (Thumb32 ADR.W).
4369 pub const R_ARM_THM_ALU_PREL_11_0: u32 = 53;
4370 /// PC relative 12 bit (Thumb32 LDR{D,SB,H,SH}).
4371 pub const R_ARM_THM_PC12: u32 = 54;
4372 /// Direct 32-bit.
4373 pub const R_ARM_ABS32_NOI: u32 = 55;
4374 /// PC relative 32-bit.
4375 pub const R_ARM_REL32_NOI: u32 = 56;
4376 /// PC relative (ADD, SUB).
4377 pub const R_ARM_ALU_PC_G0_NC: u32 = 57;
4378 /// PC relative (ADD, SUB).
4379 pub const R_ARM_ALU_PC_G0: u32 = 58;
4380 /// PC relative (ADD, SUB).
4381 pub const R_ARM_ALU_PC_G1_NC: u32 = 59;
4382 /// PC relative (ADD, SUB).
4383 pub const R_ARM_ALU_PC_G1: u32 = 60;
4384 /// PC relative (ADD, SUB).
4385 pub const R_ARM_ALU_PC_G2: u32 = 61;
4386 /// PC relative (LDR,STR,LDRB,STRB).
4387 pub const R_ARM_LDR_PC_G1: u32 = 62;
4388 /// PC relative (LDR,STR,LDRB,STRB).
4389 pub const R_ARM_LDR_PC_G2: u32 = 63;
4390 /// PC relative (STR{D,H}, LDR{D,SB,H,SH}).
4391 pub const R_ARM_LDRS_PC_G0: u32 = 64;
4392 /// PC relative (STR{D,H}, LDR{D,SB,H,SH}).
4393 pub const R_ARM_LDRS_PC_G1: u32 = 65;
4394 /// PC relative (STR{D,H}, LDR{D,SB,H,SH}).
4395 pub const R_ARM_LDRS_PC_G2: u32 = 66;
4396 /// PC relative (LDC, STC).
4397 pub const R_ARM_LDC_PC_G0: u32 = 67;
4398 /// PC relative (LDC, STC).
4399 pub const R_ARM_LDC_PC_G1: u32 = 68;
4400 /// PC relative (LDC, STC).
4401 pub const R_ARM_LDC_PC_G2: u32 = 69;
4402 /// Program base relative (ADD,SUB).
4403 pub const R_ARM_ALU_SB_G0_NC: u32 = 70;
4404 /// Program base relative (ADD,SUB).
4405 pub const R_ARM_ALU_SB_G0: u32 = 71;
4406 /// Program base relative (ADD,SUB).
4407 pub const R_ARM_ALU_SB_G1_NC: u32 = 72;
4408 /// Program base relative (ADD,SUB).
4409 pub const R_ARM_ALU_SB_G1: u32 = 73;
4410 /// Program base relative (ADD,SUB).
4411 pub const R_ARM_ALU_SB_G2: u32 = 74;
4412 /// Program base relative (LDR, STR, LDRB, STRB).
4413 pub const R_ARM_LDR_SB_G0: u32 = 75;
4414 /// Program base relative (LDR, STR, LDRB, STRB).
4415 pub const R_ARM_LDR_SB_G1: u32 = 76;
4416 /// Program base relative (LDR, STR, LDRB, STRB).
4417 pub const R_ARM_LDR_SB_G2: u32 = 77;
4418 /// Program base relative (LDR, STR, LDRB, STRB).
4419 pub const R_ARM_LDRS_SB_G0: u32 = 78;
4420 /// Program base relative (LDR, STR, LDRB, STRB).
4421 pub const R_ARM_LDRS_SB_G1: u32 = 79;
4422 /// Program base relative (LDR, STR, LDRB, STRB).
4423 pub const R_ARM_LDRS_SB_G2: u32 = 80;
4424 /// Program base relative (LDC,STC).
4425 pub const R_ARM_LDC_SB_G0: u32 = 81;
4426 /// Program base relative (LDC,STC).
4427 pub const R_ARM_LDC_SB_G1: u32 = 82;
4428 /// Program base relative (LDC,STC).
4429 pub const R_ARM_LDC_SB_G2: u32 = 83;
4430 /// Program base relative 16 bit (MOVW).
4431 pub const R_ARM_MOVW_BREL_NC: u32 = 84;
4432 /// Program base relative high 16 bit (MOVT).
4433 pub const R_ARM_MOVT_BREL: u32 = 85;
4434 /// Program base relative 16 bit (MOVW).
4435 pub const R_ARM_MOVW_BREL: u32 = 86;
4436 /// Program base relative 16 bit (Thumb32 MOVW).
4437 pub const R_ARM_THM_MOVW_BREL_NC: u32 = 87;
4438 /// Program base relative high 16 bit (Thumb32 MOVT).
4439 pub const R_ARM_THM_MOVT_BREL: u32 = 88;
4440 /// Program base relative 16 bit (Thumb32 MOVW).
4441 pub const R_ARM_THM_MOVW_BREL: u32 = 89;
4442 #[allow(missing_docs)]
4443 pub const R_ARM_TLS_GOTDESC: u32 = 90;
4444 #[allow(missing_docs)]
4445 pub const R_ARM_TLS_CALL: u32 = 91;
4446 /// TLS relaxation.
4447 pub const R_ARM_TLS_DESCSEQ: u32 = 92;
4448 #[allow(missing_docs)]
4449 pub const R_ARM_THM_TLS_CALL: u32 = 93;
4450 #[allow(missing_docs)]
4451 pub const R_ARM_PLT32_ABS: u32 = 94;
4452 /// GOT entry.
4453 pub const R_ARM_GOT_ABS: u32 = 95;
4454 /// PC relative GOT entry.
4455 pub const R_ARM_GOT_PREL: u32 = 96;
4456 /// GOT entry relative to GOT origin (LDR).
4457 pub const R_ARM_GOT_BREL12: u32 = 97;
4458 /// 12 bit, GOT entry relative to GOT origin (LDR, STR).
4459 pub const R_ARM_GOTOFF12: u32 = 98;
4460 #[allow(missing_docs)]
4461 pub const R_ARM_GOTRELAX: u32 = 99;
4462 #[allow(missing_docs)]
4463 pub const R_ARM_GNU_VTENTRY: u32 = 100;
4464 #[allow(missing_docs)]
4465 pub const R_ARM_GNU_VTINHERIT: u32 = 101;
4466 /// PC relative & 0xFFE (Thumb16 B).
4467 pub const R_ARM_THM_PC11: u32 = 102;
4468 /// PC relative & 0x1FE (Thumb16 B/B<cond>).
4469 pub const R_ARM_THM_PC9: u32 = 103;
4470 /// PC-rel 32 bit for global dynamic thread local data
4471 pub const R_ARM_TLS_GD32: u32 = 104;
4472 /// PC-rel 32 bit for local dynamic thread local data
4473 pub const R_ARM_TLS_LDM32: u32 = 105;
4474 /// 32 bit offset relative to TLS block
4475 pub const R_ARM_TLS_LDO32: u32 = 106;
4476 /// PC-rel 32 bit for GOT entry of static TLS block offset
4477 pub const R_ARM_TLS_IE32: u32 = 107;
4478 /// 32 bit offset relative to static TLS block
4479 pub const R_ARM_TLS_LE32: u32 = 108;
4480 /// 12 bit relative to TLS block (LDR, STR).
4481 pub const R_ARM_TLS_LDO12: u32 = 109;
4482 /// 12 bit relative to static TLS block (LDR, STR).
4483 pub const R_ARM_TLS_LE12: u32 = 110;
4484 /// 12 bit GOT entry relative to GOT origin (LDR).
4485 pub const R_ARM_TLS_IE12GP: u32 = 111;
4486 /// Obsolete.
4487 pub const R_ARM_ME_TOO: u32 = 128;
4488 #[allow(missing_docs)]
4489 pub const R_ARM_THM_TLS_DESCSEQ: u32 = 129;
4490 #[allow(missing_docs)]
4491 pub const R_ARM_THM_TLS_DESCSEQ16: u32 = 129;
4492 #[allow(missing_docs)]
4493 pub const R_ARM_THM_TLS_DESCSEQ32: u32 = 130;
4494 /// GOT entry relative to GOT origin, 12 bit (Thumb32 LDR).
4495 pub const R_ARM_THM_GOT_BREL12: u32 = 131;
4496 #[allow(missing_docs)]
4497 pub const R_ARM_IRELATIVE: u32 = 160;
4498 #[allow(missing_docs)]
4499 pub const R_ARM_RXPC25: u32 = 249;
4500 #[allow(missing_docs)]
4501 pub const R_ARM_RSBREL32: u32 = 250;
4502 #[allow(missing_docs)]
4503 pub const R_ARM_THM_RPC22: u32 = 251;
4504 #[allow(missing_docs)]
4505 pub const R_ARM_RREL32: u32 = 252;
4506 #[allow(missing_docs)]
4507 pub const R_ARM_RABS22: u32 = 253;
4508 #[allow(missing_docs)]
4509 pub const R_ARM_RPC24: u32 = 254;
4510 #[allow(missing_docs)]
4511 pub const R_ARM_RBASE: u32 = 255;
4512
4513 // C-SKY values for `Rel*::r_type`.
4514 /// no reloc
4515 pub const R_CKCORE_NONE: u32 = 0;
4516 /// direct 32 bit (S + A)
4517 pub const R_CKCORE_ADDR32: u32 = 1;
4518 /// disp ((S + A - P) >> 2) & 0xff
4519 pub const R_CKCORE_PCRELIMM8BY4: u32 = 2;
4520 /// disp ((S + A - P) >> 1) & 0x7ff
4521 pub const R_CKCORE_PCRELIMM11BY2: u32 = 3;
4522 /// 32-bit rel (S + A - P)
4523 pub const R_CKCORE_PCREL32: u32 = 5;
4524 /// disp ((S + A - P) >>1) & 0x7ff
4525 pub const R_CKCORE_PCRELJSR_IMM11BY2: u32 = 6;
4526 /// 32 bit adjust program base(B + A)
4527 pub const R_CKCORE_RELATIVE: u32 = 9;
4528 /// 32 bit adjust by program base
4529 pub const R_CKCORE_COPY: u32 = 10;
4530 /// off between got and sym (S)
4531 pub const R_CKCORE_GLOB_DAT: u32 = 11;
4532 /// PLT entry (S)
4533 pub const R_CKCORE_JUMP_SLOT: u32 = 12;
4534 /// offset to GOT (S + A - GOT)
4535 pub const R_CKCORE_GOTOFF: u32 = 13;
4536 /// PC offset to GOT (GOT + A - P)
4537 pub const R_CKCORE_GOTPC: u32 = 14;
4538 /// 32 bit GOT entry (G)
4539 pub const R_CKCORE_GOT32: u32 = 15;
4540 /// 32 bit PLT entry (G)
4541 pub const R_CKCORE_PLT32: u32 = 16;
4542 /// GOT entry in GLOB_DAT (GOT + G)
4543 pub const R_CKCORE_ADDRGOT: u32 = 17;
4544 /// PLT entry in GLOB_DAT (GOT + G)
4545 pub const R_CKCORE_ADDRPLT: u32 = 18;
4546 /// ((S + A - P) >> 1) & 0x3ff_ffff
4547 pub const R_CKCORE_PCREL_IMM26BY2: u32 = 19;
4548 /// disp ((S + A - P) >> 1) & 0xffff
4549 pub const R_CKCORE_PCREL_IMM16BY2: u32 = 20;
4550 /// disp ((S + A - P) >> 2) & 0xffff
4551 pub const R_CKCORE_PCREL_IMM16BY4: u32 = 21;
4552 /// disp ((S + A - P) >> 1) & 0x3ff
4553 pub const R_CKCORE_PCREL_IMM10BY2: u32 = 22;
4554 /// disp ((S + A - P) >> 2) & 0x3ff
4555 pub const R_CKCORE_PCREL_IMM10BY4: u32 = 23;
4556 /// high & low 16 bit ADDR, ((S + A) >> 16) & 0xffff
4557 pub const R_CKCORE_ADDR_HI16: u32 = 24;
4558 /// (S + A) & 0xffff
4559 pub const R_CKCORE_ADDR_LO16: u32 = 25;
4560 /// high & low 16 bit GOTPC, ((GOT + A - P) >> 16) & 0xffff
4561 pub const R_CKCORE_GOTPC_HI16: u32 = 26;
4562 /// (GOT + A - P) & 0xffff
4563 pub const R_CKCORE_GOTPC_LO16: u32 = 27;
4564 /// high & low 16 bit GOTOFF, ((S + A - GOT) >> 16) & 0xffff
4565 pub const R_CKCORE_GOTOFF_HI16: u32 = 28;
4566 /// (S + A - GOT) & 0xffff
4567 pub const R_CKCORE_GOTOFF_LO16: u32 = 29;
4568 /// 12 bit disp GOT entry (G)
4569 pub const R_CKCORE_GOT12: u32 = 30;
4570 /// high & low 16 bit GOT, (G >> 16) & 0xffff
4571 pub const R_CKCORE_GOT_HI16: u32 = 31;
4572 /// (G & 0xffff)
4573 pub const R_CKCORE_GOT_LO16: u32 = 32;
4574 /// 12 bit disp PLT entry (G)
4575 pub const R_CKCORE_PLT12: u32 = 33;
4576 /// high & low 16 bit PLT, (G >> 16) & 0xffff
4577 pub const R_CKCORE_PLT_HI16: u32 = 34;
4578 /// G & 0xffff
4579 pub const R_CKCORE_PLT_LO16: u32 = 35;
4580 /// high & low 16 bit ADDRGOT, (GOT + G * 4) & 0xffff
4581 pub const R_CKCORE_ADDRGOT_HI16: u32 = 36;
4582 /// (GOT + G * 4) & 0xffff
4583 pub const R_CKCORE_ADDRGOT_LO16: u32 = 37;
4584 /// high & low 16 bit ADDRPLT, ((GOT + G * 4) >> 16) & 0xFFFF
4585 pub const R_CKCORE_ADDRPLT_HI16: u32 = 38;
4586 /// (GOT+G*4) & 0xffff
4587 pub const R_CKCORE_ADDRPLT_LO16: u32 = 39;
4588 /// disp ((S+A-P) >>1) & x3ff_ffff
4589 pub const R_CKCORE_PCREL_JSR_IMM26BY2: u32 = 40;
4590 /// (S+A-BTEXT) & 0xffff
4591 pub const R_CKCORE_TOFFSET_LO16: u32 = 41;
4592 /// (S+A-BTEXT) & 0xffff
4593 pub const R_CKCORE_DOFFSET_LO16: u32 = 42;
4594 /// disp ((S+A-P) >>1) & 0x3ffff
4595 pub const R_CKCORE_PCREL_IMM18BY2: u32 = 43;
4596 /// disp (S+A-BDATA) & 0x3ffff
4597 pub const R_CKCORE_DOFFSET_IMM18: u32 = 44;
4598 /// disp ((S+A-BDATA)>>1) & 0x3ffff
4599 pub const R_CKCORE_DOFFSET_IMM18BY2: u32 = 45;
4600 /// disp ((S+A-BDATA)>>2) & 0x3ffff
4601 pub const R_CKCORE_DOFFSET_IMM18BY4: u32 = 46;
4602 /// disp (G >> 2)
4603 pub const R_CKCORE_GOT_IMM18BY4: u32 = 48;
4604 /// disp (G >> 2)
4605 pub const R_CKCORE_PLT_IMM18BY4: u32 = 49;
4606 /// disp ((S+A-P) >>2) & 0x7f
4607 pub const R_CKCORE_PCREL_IMM7BY4: u32 = 50;
4608 /// 32 bit offset to TLS block
4609 pub const R_CKCORE_TLS_LE32: u32 = 51;
4610 #[allow(missing_docs)]
4611 pub const R_CKCORE_TLS_IE32: u32 = 52;
4612 #[allow(missing_docs)]
4613 pub const R_CKCORE_TLS_GD32: u32 = 53;
4614 #[allow(missing_docs)]
4615 pub const R_CKCORE_TLS_LDM32: u32 = 54;
4616 #[allow(missing_docs)]
4617 pub const R_CKCORE_TLS_LDO32: u32 = 55;
4618 #[allow(missing_docs)]
4619 pub const R_CKCORE_TLS_DTPMOD32: u32 = 56;
4620 #[allow(missing_docs)]
4621 pub const R_CKCORE_TLS_DTPOFF32: u32 = 57;
4622 #[allow(missing_docs)]
4623 pub const R_CKCORE_TLS_TPOFF32: u32 = 58;
4624
4625 // C-SKY values for `FileHeader*::e_flags`.
4626 #[allow(missing_docs)]
4627 pub const EF_CSKY_ABIMASK: u32 = 0xF000_0000;
4628 #[allow(missing_docs)]
4629 pub const EF_CSKY_OTHER: u32 = 0x0FFF_0000;
4630 #[allow(missing_docs)]
4631 pub const EF_CSKY_PROCESSOR: u32 = 0x0000_FFFF;
4632
4633 #[allow(missing_docs)]
4634 pub const EF_CSKY_ABIV1: u32 = 0x1000_0000;
4635 #[allow(missing_docs)]
4636 pub const EF_CSKY_ABIV2: u32 = 0x2000_0000;
4637
4638 // C-SKY values for `SectionHeader*::sh_type`.
4639 /// C-SKY attributes section.
4640 pub const SHT_CSKY_ATTRIBUTES: u32 = SHT_LOPROC + 1;
4641
4642 // IA-64 specific declarations.
4643
4644 // IA-64 values for `FileHeader64::e_flags`.
4645 /// os-specific flags
4646 pub const EF_IA_64_MASKOS: u32 = 0x0000_000f;
4647 /// 64-bit ABI
4648 pub const EF_IA_64_ABI64: u32 = 0x0000_0010;
4649 /// arch. version mask
4650 pub const EF_IA_64_ARCH: u32 = 0xff00_0000;
4651
4652 // IA-64 values for `ProgramHeader64::p_type`.
4653 /// arch extension bits
4654 pub const PT_IA_64_ARCHEXT: u32 = PT_LOPROC + 0;
4655 /// ia64 unwind bits
4656 pub const PT_IA_64_UNWIND: u32 = PT_LOPROC + 1;
4657 #[allow(missing_docs)]
4658 pub const PT_IA_64_HP_OPT_ANOT: u32 = PT_LOOS + 0x12;
4659 #[allow(missing_docs)]
4660 pub const PT_IA_64_HP_HSL_ANOT: u32 = PT_LOOS + 0x13;
4661 #[allow(missing_docs)]
4662 pub const PT_IA_64_HP_STACK: u32 = PT_LOOS + 0x14;
4663
4664 // IA-64 values for `ProgramHeader64::p_flags`.
4665 /// spec insns w/o recovery
4666 pub const PF_IA_64_NORECOV: u32 = 0x8000_0000;
4667
4668 // IA-64 values for `SectionHeader64::sh_type`.
4669 /// extension bits
4670 pub const SHT_IA_64_EXT: u32 = SHT_LOPROC + 0;
4671 /// unwind bits
4672 pub const SHT_IA_64_UNWIND: u32 = SHT_LOPROC + 1;
4673
4674 // IA-64 values for `SectionHeader64::sh_flags`.
4675 /// section near gp
4676 pub const SHF_IA_64_SHORT: u32 = 0x1000_0000;
4677 /// spec insns w/o recovery
4678 pub const SHF_IA_64_NORECOV: u32 = 0x2000_0000;
4679
4680 // IA-64 values for `Dyn64::d_tag`.
4681 #[allow(missing_docs)]
4682 pub const DT_IA_64_PLT_RESERVE: u32 = DT_LOPROC + 0;
4683
4684 // IA-64 values for `Rel*::r_type`.
4685 /// none
4686 pub const R_IA64_NONE: u32 = 0x00;
4687 /// symbol + addend, add imm14
4688 pub const R_IA64_IMM14: u32 = 0x21;
4689 /// symbol + addend, add imm22
4690 pub const R_IA64_IMM22: u32 = 0x22;
4691 /// symbol + addend, mov imm64
4692 pub const R_IA64_IMM64: u32 = 0x23;
4693 /// symbol + addend, data4 MSB
4694 pub const R_IA64_DIR32MSB: u32 = 0x24;
4695 /// symbol + addend, data4 LSB
4696 pub const R_IA64_DIR32LSB: u32 = 0x25;
4697 /// symbol + addend, data8 MSB
4698 pub const R_IA64_DIR64MSB: u32 = 0x26;
4699 /// symbol + addend, data8 LSB
4700 pub const R_IA64_DIR64LSB: u32 = 0x27;
4701 /// @gprel(sym + add), add imm22
4702 pub const R_IA64_GPREL22: u32 = 0x2a;
4703 /// @gprel(sym + add), mov imm64
4704 pub const R_IA64_GPREL64I: u32 = 0x2b;
4705 /// @gprel(sym + add), data4 MSB
4706 pub const R_IA64_GPREL32MSB: u32 = 0x2c;
4707 /// @gprel(sym + add), data4 LSB
4708 pub const R_IA64_GPREL32LSB: u32 = 0x2d;
4709 /// @gprel(sym + add), data8 MSB
4710 pub const R_IA64_GPREL64MSB: u32 = 0x2e;
4711 /// @gprel(sym + add), data8 LSB
4712 pub const R_IA64_GPREL64LSB: u32 = 0x2f;
4713 /// @ltoff(sym + add), add imm22
4714 pub const R_IA64_LTOFF22: u32 = 0x32;
4715 /// @ltoff(sym + add), mov imm64
4716 pub const R_IA64_LTOFF64I: u32 = 0x33;
4717 /// @pltoff(sym + add), add imm22
4718 pub const R_IA64_PLTOFF22: u32 = 0x3a;
4719 /// @pltoff(sym + add), mov imm64
4720 pub const R_IA64_PLTOFF64I: u32 = 0x3b;
4721 /// @pltoff(sym + add), data8 MSB
4722 pub const R_IA64_PLTOFF64MSB: u32 = 0x3e;
4723 /// @pltoff(sym + add), data8 LSB
4724 pub const R_IA64_PLTOFF64LSB: u32 = 0x3f;
4725 /// @fptr(sym + add), mov imm64
4726 pub const R_IA64_FPTR64I: u32 = 0x43;
4727 /// @fptr(sym + add), data4 MSB
4728 pub const R_IA64_FPTR32MSB: u32 = 0x44;
4729 /// @fptr(sym + add), data4 LSB
4730 pub const R_IA64_FPTR32LSB: u32 = 0x45;
4731 /// @fptr(sym + add), data8 MSB
4732 pub const R_IA64_FPTR64MSB: u32 = 0x46;
4733 /// @fptr(sym + add), data8 LSB
4734 pub const R_IA64_FPTR64LSB: u32 = 0x47;
4735 /// @pcrel(sym + add), brl
4736 pub const R_IA64_PCREL60B: u32 = 0x48;
4737 /// @pcrel(sym + add), ptb, call
4738 pub const R_IA64_PCREL21B: u32 = 0x49;
4739 /// @pcrel(sym + add), chk.s
4740 pub const R_IA64_PCREL21M: u32 = 0x4a;
4741 /// @pcrel(sym + add), fchkf
4742 pub const R_IA64_PCREL21F: u32 = 0x4b;
4743 /// @pcrel(sym + add), data4 MSB
4744 pub const R_IA64_PCREL32MSB: u32 = 0x4c;
4745 /// @pcrel(sym + add), data4 LSB
4746 pub const R_IA64_PCREL32LSB: u32 = 0x4d;
4747 /// @pcrel(sym + add), data8 MSB
4748 pub const R_IA64_PCREL64MSB: u32 = 0x4e;
4749 /// @pcrel(sym + add), data8 LSB
4750 pub const R_IA64_PCREL64LSB: u32 = 0x4f;
4751 /// @ltoff(@fptr(s+a)), imm22
4752 pub const R_IA64_LTOFF_FPTR22: u32 = 0x52;
4753 /// @ltoff(@fptr(s+a)), imm64
4754 pub const R_IA64_LTOFF_FPTR64I: u32 = 0x53;
4755 /// @ltoff(@fptr(s+a)), data4 MSB
4756 pub const R_IA64_LTOFF_FPTR32MSB: u32 = 0x54;
4757 /// @ltoff(@fptr(s+a)), data4 LSB
4758 pub const R_IA64_LTOFF_FPTR32LSB: u32 = 0x55;
4759 /// @ltoff(@fptr(s+a)), data8 MSB
4760 pub const R_IA64_LTOFF_FPTR64MSB: u32 = 0x56;
4761 /// @ltoff(@fptr(s+a)), data8 LSB
4762 pub const R_IA64_LTOFF_FPTR64LSB: u32 = 0x57;
4763 /// @segrel(sym + add), data4 MSB
4764 pub const R_IA64_SEGREL32MSB: u32 = 0x5c;
4765 /// @segrel(sym + add), data4 LSB
4766 pub const R_IA64_SEGREL32LSB: u32 = 0x5d;
4767 /// @segrel(sym + add), data8 MSB
4768 pub const R_IA64_SEGREL64MSB: u32 = 0x5e;
4769 /// @segrel(sym + add), data8 LSB
4770 pub const R_IA64_SEGREL64LSB: u32 = 0x5f;
4771 /// @secrel(sym + add), data4 MSB
4772 pub const R_IA64_SECREL32MSB: u32 = 0x64;
4773 /// @secrel(sym + add), data4 LSB
4774 pub const R_IA64_SECREL32LSB: u32 = 0x65;
4775 /// @secrel(sym + add), data8 MSB
4776 pub const R_IA64_SECREL64MSB: u32 = 0x66;
4777 /// @secrel(sym + add), data8 LSB
4778 pub const R_IA64_SECREL64LSB: u32 = 0x67;
4779 /// data 4 + REL
4780 pub const R_IA64_REL32MSB: u32 = 0x6c;
4781 /// data 4 + REL
4782 pub const R_IA64_REL32LSB: u32 = 0x6d;
4783 /// data 8 + REL
4784 pub const R_IA64_REL64MSB: u32 = 0x6e;
4785 /// data 8 + REL
4786 pub const R_IA64_REL64LSB: u32 = 0x6f;
4787 /// symbol + addend, data4 MSB
4788 pub const R_IA64_LTV32MSB: u32 = 0x74;
4789 /// symbol + addend, data4 LSB
4790 pub const R_IA64_LTV32LSB: u32 = 0x75;
4791 /// symbol + addend, data8 MSB
4792 pub const R_IA64_LTV64MSB: u32 = 0x76;
4793 /// symbol + addend, data8 LSB
4794 pub const R_IA64_LTV64LSB: u32 = 0x77;
4795 /// @pcrel(sym + add), 21bit inst
4796 pub const R_IA64_PCREL21BI: u32 = 0x79;
4797 /// @pcrel(sym + add), 22bit inst
4798 pub const R_IA64_PCREL22: u32 = 0x7a;
4799 /// @pcrel(sym + add), 64bit inst
4800 pub const R_IA64_PCREL64I: u32 = 0x7b;
4801 /// dynamic reloc, imported PLT, MSB
4802 pub const R_IA64_IPLTMSB: u32 = 0x80;
4803 /// dynamic reloc, imported PLT, LSB
4804 pub const R_IA64_IPLTLSB: u32 = 0x81;
4805 /// copy relocation
4806 pub const R_IA64_COPY: u32 = 0x84;
4807 /// Addend and symbol difference
4808 pub const R_IA64_SUB: u32 = 0x85;
4809 /// LTOFF22, relaxable.
4810 pub const R_IA64_LTOFF22X: u32 = 0x86;
4811 /// Use of LTOFF22X.
4812 pub const R_IA64_LDXMOV: u32 = 0x87;
4813 /// @tprel(sym + add), imm14
4814 pub const R_IA64_TPREL14: u32 = 0x91;
4815 /// @tprel(sym + add), imm22
4816 pub const R_IA64_TPREL22: u32 = 0x92;
4817 /// @tprel(sym + add), imm64
4818 pub const R_IA64_TPREL64I: u32 = 0x93;
4819 /// @tprel(sym + add), data8 MSB
4820 pub const R_IA64_TPREL64MSB: u32 = 0x96;
4821 /// @tprel(sym + add), data8 LSB
4822 pub const R_IA64_TPREL64LSB: u32 = 0x97;
4823 /// @ltoff(@tprel(s+a)), imm2
4824 pub const R_IA64_LTOFF_TPREL22: u32 = 0x9a;
4825 /// @dtpmod(sym + add), data8 MSB
4826 pub const R_IA64_DTPMOD64MSB: u32 = 0xa6;
4827 /// @dtpmod(sym + add), data8 LSB
4828 pub const R_IA64_DTPMOD64LSB: u32 = 0xa7;
4829 /// @ltoff(@dtpmod(sym + add)), imm22
4830 pub const R_IA64_LTOFF_DTPMOD22: u32 = 0xaa;
4831 /// @dtprel(sym + add), imm14
4832 pub const R_IA64_DTPREL14: u32 = 0xb1;
4833 /// @dtprel(sym + add), imm22
4834 pub const R_IA64_DTPREL22: u32 = 0xb2;
4835 /// @dtprel(sym + add), imm64
4836 pub const R_IA64_DTPREL64I: u32 = 0xb3;
4837 /// @dtprel(sym + add), data4 MSB
4838 pub const R_IA64_DTPREL32MSB: u32 = 0xb4;
4839 /// @dtprel(sym + add), data4 LSB
4840 pub const R_IA64_DTPREL32LSB: u32 = 0xb5;
4841 /// @dtprel(sym + add), data8 MSB
4842 pub const R_IA64_DTPREL64MSB: u32 = 0xb6;
4843 /// @dtprel(sym + add), data8 LSB
4844 pub const R_IA64_DTPREL64LSB: u32 = 0xb7;
4845 /// @ltoff(@dtprel(s+a)), imm22
4846 pub const R_IA64_LTOFF_DTPREL22: u32 = 0xba;
4847
4848 // SH specific declarations.
4849
4850 // SH values `FileHeader*::e_flags`.
4851 #[allow(missing_docs)]
4852 pub const EF_SH_MACH_MASK: u32 = 0x1f;
4853 #[allow(missing_docs)]
4854 pub const EF_SH_UNKNOWN: u32 = 0x0;
4855 #[allow(missing_docs)]
4856 pub const EF_SH1: u32 = 0x1;
4857 #[allow(missing_docs)]
4858 pub const EF_SH2: u32 = 0x2;
4859 #[allow(missing_docs)]
4860 pub const EF_SH3: u32 = 0x3;
4861 #[allow(missing_docs)]
4862 pub const EF_SH_DSP: u32 = 0x4;
4863 #[allow(missing_docs)]
4864 pub const EF_SH3_DSP: u32 = 0x5;
4865 #[allow(missing_docs)]
4866 pub const EF_SH4AL_DSP: u32 = 0x6;
4867 #[allow(missing_docs)]
4868 pub const EF_SH3E: u32 = 0x8;
4869 #[allow(missing_docs)]
4870 pub const EF_SH4: u32 = 0x9;
4871 #[allow(missing_docs)]
4872 pub const EF_SH2E: u32 = 0xb;
4873 #[allow(missing_docs)]
4874 pub const EF_SH4A: u32 = 0xc;
4875 #[allow(missing_docs)]
4876 pub const EF_SH2A: u32 = 0xd;
4877 #[allow(missing_docs)]
4878 pub const EF_SH4_NOFPU: u32 = 0x10;
4879 #[allow(missing_docs)]
4880 pub const EF_SH4A_NOFPU: u32 = 0x11;
4881 #[allow(missing_docs)]
4882 pub const EF_SH4_NOMMU_NOFPU: u32 = 0x12;
4883 #[allow(missing_docs)]
4884 pub const EF_SH2A_NOFPU: u32 = 0x13;
4885 #[allow(missing_docs)]
4886 pub const EF_SH3_NOMMU: u32 = 0x14;
4887 #[allow(missing_docs)]
4888 pub const EF_SH2A_SH4_NOFPU: u32 = 0x15;
4889 #[allow(missing_docs)]
4890 pub const EF_SH2A_SH3_NOFPU: u32 = 0x16;
4891 #[allow(missing_docs)]
4892 pub const EF_SH2A_SH4: u32 = 0x17;
4893 #[allow(missing_docs)]
4894 pub const EF_SH2A_SH3E: u32 = 0x18;
4895
4896 // SH values `Rel*::r_type`.
4897 #[allow(missing_docs)]
4898 pub const R_SH_NONE: u32 = 0;
4899 #[allow(missing_docs)]
4900 pub const R_SH_DIR32: u32 = 1;
4901 #[allow(missing_docs)]
4902 pub const R_SH_REL32: u32 = 2;
4903 #[allow(missing_docs)]
4904 pub const R_SH_DIR8WPN: u32 = 3;
4905 #[allow(missing_docs)]
4906 pub const R_SH_IND12W: u32 = 4;
4907 #[allow(missing_docs)]
4908 pub const R_SH_DIR8WPL: u32 = 5;
4909 #[allow(missing_docs)]
4910 pub const R_SH_DIR8WPZ: u32 = 6;
4911 #[allow(missing_docs)]
4912 pub const R_SH_DIR8BP: u32 = 7;
4913 #[allow(missing_docs)]
4914 pub const R_SH_DIR8W: u32 = 8;
4915 #[allow(missing_docs)]
4916 pub const R_SH_DIR8L: u32 = 9;
4917 #[allow(missing_docs)]
4918 pub const R_SH_SWITCH16: u32 = 25;
4919 #[allow(missing_docs)]
4920 pub const R_SH_SWITCH32: u32 = 26;
4921 #[allow(missing_docs)]
4922 pub const R_SH_USES: u32 = 27;
4923 #[allow(missing_docs)]
4924 pub const R_SH_COUNT: u32 = 28;
4925 #[allow(missing_docs)]
4926 pub const R_SH_ALIGN: u32 = 29;
4927 #[allow(missing_docs)]
4928 pub const R_SH_CODE: u32 = 30;
4929 #[allow(missing_docs)]
4930 pub const R_SH_DATA: u32 = 31;
4931 #[allow(missing_docs)]
4932 pub const R_SH_LABEL: u32 = 32;
4933 #[allow(missing_docs)]
4934 pub const R_SH_SWITCH8: u32 = 33;
4935 #[allow(missing_docs)]
4936 pub const R_SH_GNU_VTINHERIT: u32 = 34;
4937 #[allow(missing_docs)]
4938 pub const R_SH_GNU_VTENTRY: u32 = 35;
4939 #[allow(missing_docs)]
4940 pub const R_SH_TLS_GD_32: u32 = 144;
4941 #[allow(missing_docs)]
4942 pub const R_SH_TLS_LD_32: u32 = 145;
4943 #[allow(missing_docs)]
4944 pub const R_SH_TLS_LDO_32: u32 = 146;
4945 #[allow(missing_docs)]
4946 pub const R_SH_TLS_IE_32: u32 = 147;
4947 #[allow(missing_docs)]
4948 pub const R_SH_TLS_LE_32: u32 = 148;
4949 #[allow(missing_docs)]
4950 pub const R_SH_TLS_DTPMOD32: u32 = 149;
4951 #[allow(missing_docs)]
4952 pub const R_SH_TLS_DTPOFF32: u32 = 150;
4953 #[allow(missing_docs)]
4954 pub const R_SH_TLS_TPOFF32: u32 = 151;
4955 #[allow(missing_docs)]
4956 pub const R_SH_GOT32: u32 = 160;
4957 #[allow(missing_docs)]
4958 pub const R_SH_PLT32: u32 = 161;
4959 #[allow(missing_docs)]
4960 pub const R_SH_COPY: u32 = 162;
4961 #[allow(missing_docs)]
4962 pub const R_SH_GLOB_DAT: u32 = 163;
4963 #[allow(missing_docs)]
4964 pub const R_SH_JMP_SLOT: u32 = 164;
4965 #[allow(missing_docs)]
4966 pub const R_SH_RELATIVE: u32 = 165;
4967 #[allow(missing_docs)]
4968 pub const R_SH_GOTOFF: u32 = 166;
4969 #[allow(missing_docs)]
4970 pub const R_SH_GOTPC: u32 = 167;
4971
4972 // S/390 specific definitions.
4973
4974 // S/390 values `FileHeader*::e_flags`.
4975
4976 /// High GPRs kernel facility needed.
4977 pub const EF_S390_HIGH_GPRS: u32 = 0x0000_0001;
4978
4979 // S/390 values `Rel*::r_type`.
4980
4981 /// No reloc.
4982 pub const R_390_NONE: u32 = 0;
4983 /// Direct 8 bit.
4984 pub const R_390_8: u32 = 1;
4985 /// Direct 12 bit.
4986 pub const R_390_12: u32 = 2;
4987 /// Direct 16 bit.
4988 pub const R_390_16: u32 = 3;
4989 /// Direct 32 bit.
4990 pub const R_390_32: u32 = 4;
4991 /// PC relative 32 bit.
4992 pub const R_390_PC32: u32 = 5;
4993 /// 12 bit GOT offset.
4994 pub const R_390_GOT12: u32 = 6;
4995 /// 32 bit GOT offset.
4996 pub const R_390_GOT32: u32 = 7;
4997 /// 32 bit PC relative PLT address.
4998 pub const R_390_PLT32: u32 = 8;
4999 /// Copy symbol at runtime.
5000 pub const R_390_COPY: u32 = 9;
5001 /// Create GOT entry.
5002 pub const R_390_GLOB_DAT: u32 = 10;
5003 /// Create PLT entry.
5004 pub const R_390_JMP_SLOT: u32 = 11;
5005 /// Adjust by program base.
5006 pub const R_390_RELATIVE: u32 = 12;
5007 /// 32 bit offset to GOT.
5008 pub const R_390_GOTOFF32: u32 = 13;
5009 /// 32 bit PC relative offset to GOT.
5010 pub const R_390_GOTPC: u32 = 14;
5011 /// 16 bit GOT offset.
5012 pub const R_390_GOT16: u32 = 15;
5013 /// PC relative 16 bit.
5014 pub const R_390_PC16: u32 = 16;
5015 /// PC relative 16 bit shifted by 1.
5016 pub const R_390_PC16DBL: u32 = 17;
5017 /// 16 bit PC rel. PLT shifted by 1.
5018 pub const R_390_PLT16DBL: u32 = 18;
5019 /// PC relative 32 bit shifted by 1.
5020 pub const R_390_PC32DBL: u32 = 19;
5021 /// 32 bit PC rel. PLT shifted by 1.
5022 pub const R_390_PLT32DBL: u32 = 20;
5023 /// 32 bit PC rel. GOT shifted by 1.
5024 pub const R_390_GOTPCDBL: u32 = 21;
5025 /// Direct 64 bit.
5026 pub const R_390_64: u32 = 22;
5027 /// PC relative 64 bit.
5028 pub const R_390_PC64: u32 = 23;
5029 /// 64 bit GOT offset.
5030 pub const R_390_GOT64: u32 = 24;
5031 /// 64 bit PC relative PLT address.
5032 pub const R_390_PLT64: u32 = 25;
5033 /// 32 bit PC rel. to GOT entry >> 1.
5034 pub const R_390_GOTENT: u32 = 26;
5035 /// 16 bit offset to GOT.
5036 pub const R_390_GOTOFF16: u32 = 27;
5037 /// 64 bit offset to GOT.
5038 pub const R_390_GOTOFF64: u32 = 28;
5039 /// 12 bit offset to jump slot.
5040 pub const R_390_GOTPLT12: u32 = 29;
5041 /// 16 bit offset to jump slot.
5042 pub const R_390_GOTPLT16: u32 = 30;
5043 /// 32 bit offset to jump slot.
5044 pub const R_390_GOTPLT32: u32 = 31;
5045 /// 64 bit offset to jump slot.
5046 pub const R_390_GOTPLT64: u32 = 32;
5047 /// 32 bit rel. offset to jump slot.
5048 pub const R_390_GOTPLTENT: u32 = 33;
5049 /// 16 bit offset from GOT to PLT.
5050 pub const R_390_PLTOFF16: u32 = 34;
5051 /// 32 bit offset from GOT to PLT.
5052 pub const R_390_PLTOFF32: u32 = 35;
5053 /// 16 bit offset from GOT to PLT.
5054 pub const R_390_PLTOFF64: u32 = 36;
5055 /// Tag for load insn in TLS code.
5056 pub const R_390_TLS_LOAD: u32 = 37;
5057 /// Tag for function call in general dynamic TLS code.
5058 pub const R_390_TLS_GDCALL: u32 = 38;
5059 /// Tag for function call in local dynamic TLS code.
5060 pub const R_390_TLS_LDCALL: u32 = 39;
5061 /// Direct 32 bit for general dynamic thread local data.
5062 pub const R_390_TLS_GD32: u32 = 40;
5063 /// Direct 64 bit for general dynamic thread local data.
5064 pub const R_390_TLS_GD64: u32 = 41;
5065 /// 12 bit GOT offset for static TLS block offset.
5066 pub const R_390_TLS_GOTIE12: u32 = 42;
5067 /// 32 bit GOT offset for static TLS block offset.
5068 pub const R_390_TLS_GOTIE32: u32 = 43;
5069 /// 64 bit GOT offset for static TLS block offset.
5070 pub const R_390_TLS_GOTIE64: u32 = 44;
5071 /// Direct 32 bit for local dynamic thread local data in LE code.
5072 pub const R_390_TLS_LDM32: u32 = 45;
5073 /// Direct 64 bit for local dynamic thread local data in LE code.
5074 pub const R_390_TLS_LDM64: u32 = 46;
5075 /// 32 bit address of GOT entry for negated static TLS block offset.
5076 pub const R_390_TLS_IE32: u32 = 47;
5077 /// 64 bit address of GOT entry for negated static TLS block offset.
5078 pub const R_390_TLS_IE64: u32 = 48;
5079 /// 32 bit rel. offset to GOT entry for negated static TLS block offset.
5080 pub const R_390_TLS_IEENT: u32 = 49;
5081 /// 32 bit negated offset relative to static TLS block.
5082 pub const R_390_TLS_LE32: u32 = 50;
5083 /// 64 bit negated offset relative to static TLS block.
5084 pub const R_390_TLS_LE64: u32 = 51;
5085 /// 32 bit offset relative to TLS block.
5086 pub const R_390_TLS_LDO32: u32 = 52;
5087 /// 64 bit offset relative to TLS block.
5088 pub const R_390_TLS_LDO64: u32 = 53;
5089 /// ID of module containing symbol.
5090 pub const R_390_TLS_DTPMOD: u32 = 54;
5091 /// Offset in TLS block.
5092 pub const R_390_TLS_DTPOFF: u32 = 55;
5093 /// Negated offset in static TLS block.
5094 pub const R_390_TLS_TPOFF: u32 = 56;
5095 /// Direct 20 bit.
5096 pub const R_390_20: u32 = 57;
5097 /// 20 bit GOT offset.
5098 pub const R_390_GOT20: u32 = 58;
5099 /// 20 bit offset to jump slot.
5100 pub const R_390_GOTPLT20: u32 = 59;
5101 /// 20 bit GOT offset for static TLS block offset.
5102 pub const R_390_TLS_GOTIE20: u32 = 60;
5103 /// STT_GNU_IFUNC relocation.
5104 pub const R_390_IRELATIVE: u32 = 61;
5105
5106 // CRIS values `Rel*::r_type`.
5107 #[allow(missing_docs)]
5108 pub const R_CRIS_NONE: u32 = 0;
5109 #[allow(missing_docs)]
5110 pub const R_CRIS_8: u32 = 1;
5111 #[allow(missing_docs)]
5112 pub const R_CRIS_16: u32 = 2;
5113 #[allow(missing_docs)]
5114 pub const R_CRIS_32: u32 = 3;
5115 #[allow(missing_docs)]
5116 pub const R_CRIS_8_PCREL: u32 = 4;
5117 #[allow(missing_docs)]
5118 pub const R_CRIS_16_PCREL: u32 = 5;
5119 #[allow(missing_docs)]
5120 pub const R_CRIS_32_PCREL: u32 = 6;
5121 #[allow(missing_docs)]
5122 pub const R_CRIS_GNU_VTINHERIT: u32 = 7;
5123 #[allow(missing_docs)]
5124 pub const R_CRIS_GNU_VTENTRY: u32 = 8;
5125 #[allow(missing_docs)]
5126 pub const R_CRIS_COPY: u32 = 9;
5127 #[allow(missing_docs)]
5128 pub const R_CRIS_GLOB_DAT: u32 = 10;
5129 #[allow(missing_docs)]
5130 pub const R_CRIS_JUMP_SLOT: u32 = 11;
5131 #[allow(missing_docs)]
5132 pub const R_CRIS_RELATIVE: u32 = 12;
5133 #[allow(missing_docs)]
5134 pub const R_CRIS_16_GOT: u32 = 13;
5135 #[allow(missing_docs)]
5136 pub const R_CRIS_32_GOT: u32 = 14;
5137 #[allow(missing_docs)]
5138 pub const R_CRIS_16_GOTPLT: u32 = 15;
5139 #[allow(missing_docs)]
5140 pub const R_CRIS_32_GOTPLT: u32 = 16;
5141 #[allow(missing_docs)]
5142 pub const R_CRIS_32_GOTREL: u32 = 17;
5143 #[allow(missing_docs)]
5144 pub const R_CRIS_32_PLT_GOTREL: u32 = 18;
5145 #[allow(missing_docs)]
5146 pub const R_CRIS_32_PLT_PCREL: u32 = 19;
5147
5148 // AMD x86-64 values `Rel*::r_type`.
5149 /// No reloc
5150 pub const R_X86_64_NONE: u32 = 0;
5151 /// Direct 64 bit
5152 pub const R_X86_64_64: u32 = 1;
5153 /// PC relative 32 bit signed
5154 pub const R_X86_64_PC32: u32 = 2;
5155 /// 32 bit GOT entry
5156 pub const R_X86_64_GOT32: u32 = 3;
5157 /// 32 bit PLT address
5158 pub const R_X86_64_PLT32: u32 = 4;
5159 /// Copy symbol at runtime
5160 pub const R_X86_64_COPY: u32 = 5;
5161 /// Create GOT entry
5162 pub const R_X86_64_GLOB_DAT: u32 = 6;
5163 /// Create PLT entry
5164 pub const R_X86_64_JUMP_SLOT: u32 = 7;
5165 /// Adjust by program base
5166 pub const R_X86_64_RELATIVE: u32 = 8;
5167 /// 32 bit signed PC relative offset to GOT
5168 pub const R_X86_64_GOTPCREL: u32 = 9;
5169 /// Direct 32 bit zero extended
5170 pub const R_X86_64_32: u32 = 10;
5171 /// Direct 32 bit sign extended
5172 pub const R_X86_64_32S: u32 = 11;
5173 /// Direct 16 bit zero extended
5174 pub const R_X86_64_16: u32 = 12;
5175 /// 16 bit sign extended pc relative
5176 pub const R_X86_64_PC16: u32 = 13;
5177 /// Direct 8 bit sign extended
5178 pub const R_X86_64_8: u32 = 14;
5179 /// 8 bit sign extended pc relative
5180 pub const R_X86_64_PC8: u32 = 15;
5181 /// ID of module containing symbol
5182 pub const R_X86_64_DTPMOD64: u32 = 16;
5183 /// Offset in module's TLS block
5184 pub const R_X86_64_DTPOFF64: u32 = 17;
5185 /// Offset in initial TLS block
5186 pub const R_X86_64_TPOFF64: u32 = 18;
5187 /// 32 bit signed PC relative offset to two GOT entries for GD symbol
5188 pub const R_X86_64_TLSGD: u32 = 19;
5189 /// 32 bit signed PC relative offset to two GOT entries for LD symbol
5190 pub const R_X86_64_TLSLD: u32 = 20;
5191 /// Offset in TLS block
5192 pub const R_X86_64_DTPOFF32: u32 = 21;
5193 /// 32 bit signed PC relative offset to GOT entry for IE symbol
5194 pub const R_X86_64_GOTTPOFF: u32 = 22;
5195 /// Offset in initial TLS block
5196 pub const R_X86_64_TPOFF32: u32 = 23;
5197 /// PC relative 64 bit
5198 pub const R_X86_64_PC64: u32 = 24;
5199 /// 64 bit offset to GOT
5200 pub const R_X86_64_GOTOFF64: u32 = 25;
5201 /// 32 bit signed pc relative offset to GOT
5202 pub const R_X86_64_GOTPC32: u32 = 26;
5203 /// 64-bit GOT entry offset
5204 pub const R_X86_64_GOT64: u32 = 27;
5205 /// 64-bit PC relative offset to GOT entry
5206 pub const R_X86_64_GOTPCREL64: u32 = 28;
5207 /// 64-bit PC relative offset to GOT
5208 pub const R_X86_64_GOTPC64: u32 = 29;
5209 /// like GOT64, says PLT entry needed
5210 pub const R_X86_64_GOTPLT64: u32 = 30;
5211 /// 64-bit GOT relative offset to PLT entry
5212 pub const R_X86_64_PLTOFF64: u32 = 31;
5213 /// Size of symbol plus 32-bit addend
5214 pub const R_X86_64_SIZE32: u32 = 32;
5215 /// Size of symbol plus 64-bit addend
5216 pub const R_X86_64_SIZE64: u32 = 33;
5217 /// GOT offset for TLS descriptor.
5218 pub const R_X86_64_GOTPC32_TLSDESC: u32 = 34;
5219 /// Marker for call through TLS descriptor.
5220 pub const R_X86_64_TLSDESC_CALL: u32 = 35;
5221 /// TLS descriptor.
5222 pub const R_X86_64_TLSDESC: u32 = 36;
5223 /// Adjust indirectly by program base
5224 pub const R_X86_64_IRELATIVE: u32 = 37;
5225 /// 64-bit adjust by program base
5226 pub const R_X86_64_RELATIVE64: u32 = 38;
5227 // 39 Reserved was R_X86_64_PC32_BND
5228 // 40 Reserved was R_X86_64_PLT32_BND
5229 /// Load from 32 bit signed pc relative offset to GOT entry without REX prefix, relaxable.
5230 pub const R_X86_64_GOTPCRELX: u32 = 41;
5231 /// Load from 32 bit signed pc relative offset to GOT entry with REX prefix, relaxable.
5232 pub const R_X86_64_REX_GOTPCRELX: u32 = 42;
5233
5234 // AMD x86-64 values `SectionHeader*::sh_type`.
5235 /// Unwind information.
5236 pub const SHT_X86_64_UNWIND: u32 = 0x7000_0001;
5237
5238 // AM33 values `Rel*::r_type`.
5239 /// No reloc.
5240 pub const R_MN10300_NONE: u32 = 0;
5241 /// Direct 32 bit.
5242 pub const R_MN10300_32: u32 = 1;
5243 /// Direct 16 bit.
5244 pub const R_MN10300_16: u32 = 2;
5245 /// Direct 8 bit.
5246 pub const R_MN10300_8: u32 = 3;
5247 /// PC-relative 32-bit.
5248 pub const R_MN10300_PCREL32: u32 = 4;
5249 /// PC-relative 16-bit signed.
5250 pub const R_MN10300_PCREL16: u32 = 5;
5251 /// PC-relative 8-bit signed.
5252 pub const R_MN10300_PCREL8: u32 = 6;
5253 /// Ancient C++ vtable garbage...
5254 pub const R_MN10300_GNU_VTINHERIT: u32 = 7;
5255 /// ... collection annotation.
5256 pub const R_MN10300_GNU_VTENTRY: u32 = 8;
5257 /// Direct 24 bit.
5258 pub const R_MN10300_24: u32 = 9;
5259 /// 32-bit PCrel offset to GOT.
5260 pub const R_MN10300_GOTPC32: u32 = 10;
5261 /// 16-bit PCrel offset to GOT.
5262 pub const R_MN10300_GOTPC16: u32 = 11;
5263 /// 32-bit offset from GOT.
5264 pub const R_MN10300_GOTOFF32: u32 = 12;
5265 /// 24-bit offset from GOT.
5266 pub const R_MN10300_GOTOFF24: u32 = 13;
5267 /// 16-bit offset from GOT.
5268 pub const R_MN10300_GOTOFF16: u32 = 14;
5269 /// 32-bit PCrel to PLT entry.
5270 pub const R_MN10300_PLT32: u32 = 15;
5271 /// 16-bit PCrel to PLT entry.
5272 pub const R_MN10300_PLT16: u32 = 16;
5273 /// 32-bit offset to GOT entry.
5274 pub const R_MN10300_GOT32: u32 = 17;
5275 /// 24-bit offset to GOT entry.
5276 pub const R_MN10300_GOT24: u32 = 18;
5277 /// 16-bit offset to GOT entry.
5278 pub const R_MN10300_GOT16: u32 = 19;
5279 /// Copy symbol at runtime.
5280 pub const R_MN10300_COPY: u32 = 20;
5281 /// Create GOT entry.
5282 pub const R_MN10300_GLOB_DAT: u32 = 21;
5283 /// Create PLT entry.
5284 pub const R_MN10300_JMP_SLOT: u32 = 22;
5285 /// Adjust by program base.
5286 pub const R_MN10300_RELATIVE: u32 = 23;
5287 /// 32-bit offset for global dynamic.
5288 pub const R_MN10300_TLS_GD: u32 = 24;
5289 /// 32-bit offset for local dynamic.
5290 pub const R_MN10300_TLS_LD: u32 = 25;
5291 /// Module-relative offset.
5292 pub const R_MN10300_TLS_LDO: u32 = 26;
5293 /// GOT offset for static TLS block offset.
5294 pub const R_MN10300_TLS_GOTIE: u32 = 27;
5295 /// GOT address for static TLS block offset.
5296 pub const R_MN10300_TLS_IE: u32 = 28;
5297 /// Offset relative to static TLS block.
5298 pub const R_MN10300_TLS_LE: u32 = 29;
5299 /// ID of module containing symbol.
5300 pub const R_MN10300_TLS_DTPMOD: u32 = 30;
5301 /// Offset in module TLS block.
5302 pub const R_MN10300_TLS_DTPOFF: u32 = 31;
5303 /// Offset in static TLS block.
5304 pub const R_MN10300_TLS_TPOFF: u32 = 32;
5305 /// Adjustment for next reloc as needed by linker relaxation.
5306 pub const R_MN10300_SYM_DIFF: u32 = 33;
5307 /// Alignment requirement for linker relaxation.
5308 pub const R_MN10300_ALIGN: u32 = 34;
5309
5310 // M32R values `Rel32::r_type`.
5311 /// No reloc.
5312 pub const R_M32R_NONE: u32 = 0;
5313 /// Direct 16 bit.
5314 pub const R_M32R_16: u32 = 1;
5315 /// Direct 32 bit.
5316 pub const R_M32R_32: u32 = 2;
5317 /// Direct 24 bit.
5318 pub const R_M32R_24: u32 = 3;
5319 /// PC relative 10 bit shifted.
5320 pub const R_M32R_10_PCREL: u32 = 4;
5321 /// PC relative 18 bit shifted.
5322 pub const R_M32R_18_PCREL: u32 = 5;
5323 /// PC relative 26 bit shifted.
5324 pub const R_M32R_26_PCREL: u32 = 6;
5325 /// High 16 bit with unsigned low.
5326 pub const R_M32R_HI16_ULO: u32 = 7;
5327 /// High 16 bit with signed low.
5328 pub const R_M32R_HI16_SLO: u32 = 8;
5329 /// Low 16 bit.
5330 pub const R_M32R_LO16: u32 = 9;
5331 /// 16 bit offset in SDA.
5332 pub const R_M32R_SDA16: u32 = 10;
5333 #[allow(missing_docs)]
5334 pub const R_M32R_GNU_VTINHERIT: u32 = 11;
5335 #[allow(missing_docs)]
5336 pub const R_M32R_GNU_VTENTRY: u32 = 12;
5337 // M32R values `Rela32::r_type`.
5338 /// Direct 16 bit.
5339 pub const R_M32R_16_RELA: u32 = 33;
5340 /// Direct 32 bit.
5341 pub const R_M32R_32_RELA: u32 = 34;
5342 /// Direct 24 bit.
5343 pub const R_M32R_24_RELA: u32 = 35;
5344 /// PC relative 10 bit shifted.
5345 pub const R_M32R_10_PCREL_RELA: u32 = 36;
5346 /// PC relative 18 bit shifted.
5347 pub const R_M32R_18_PCREL_RELA: u32 = 37;
5348 /// PC relative 26 bit shifted.
5349 pub const R_M32R_26_PCREL_RELA: u32 = 38;
5350 /// High 16 bit with unsigned low
5351 pub const R_M32R_HI16_ULO_RELA: u32 = 39;
5352 /// High 16 bit with signed low
5353 pub const R_M32R_HI16_SLO_RELA: u32 = 40;
5354 /// Low 16 bit
5355 pub const R_M32R_LO16_RELA: u32 = 41;
5356 /// 16 bit offset in SDA
5357 pub const R_M32R_SDA16_RELA: u32 = 42;
5358 #[allow(missing_docs)]
5359 pub const R_M32R_RELA_GNU_VTINHERIT: u32 = 43;
5360 #[allow(missing_docs)]
5361 pub const R_M32R_RELA_GNU_VTENTRY: u32 = 44;
5362 /// PC relative 32 bit.
5363 pub const R_M32R_REL32: u32 = 45;
5364
5365 /// 24 bit GOT entry
5366 pub const R_M32R_GOT24: u32 = 48;
5367 /// 26 bit PC relative to PLT shifted
5368 pub const R_M32R_26_PLTREL: u32 = 49;
5369 /// Copy symbol at runtime
5370 pub const R_M32R_COPY: u32 = 50;
5371 /// Create GOT entry
5372 pub const R_M32R_GLOB_DAT: u32 = 51;
5373 /// Create PLT entry
5374 pub const R_M32R_JMP_SLOT: u32 = 52;
5375 /// Adjust by program base
5376 pub const R_M32R_RELATIVE: u32 = 53;
5377 /// 24 bit offset to GOT
5378 pub const R_M32R_GOTOFF: u32 = 54;
5379 /// 24 bit PC relative offset to GOT
5380 pub const R_M32R_GOTPC24: u32 = 55;
5381 /// High 16 bit GOT entry with unsigned low
5382 pub const R_M32R_GOT16_HI_ULO: u32 = 56;
5383 /// High 16 bit GOT entry with signed low
5384 pub const R_M32R_GOT16_HI_SLO: u32 = 57;
5385 /// Low 16 bit GOT entry
5386 pub const R_M32R_GOT16_LO: u32 = 58;
5387 /// High 16 bit PC relative offset to GOT with unsigned low
5388 pub const R_M32R_GOTPC_HI_ULO: u32 = 59;
5389 /// High 16 bit PC relative offset to GOT with signed low
5390 pub const R_M32R_GOTPC_HI_SLO: u32 = 60;
5391 /// Low 16 bit PC relative offset to GOT
5392 pub const R_M32R_GOTPC_LO: u32 = 61;
5393 /// High 16 bit offset to GOT with unsigned low
5394 pub const R_M32R_GOTOFF_HI_ULO: u32 = 62;
5395 /// High 16 bit offset to GOT with signed low
5396 pub const R_M32R_GOTOFF_HI_SLO: u32 = 63;
5397 /// Low 16 bit offset to GOT
5398 pub const R_M32R_GOTOFF_LO: u32 = 64;
5399 /// Keep this the last entry.
5400 pub const R_M32R_NUM: u32 = 256;
5401
5402 // MicroBlaze values `Rel*::r_type`.
5403 /// No reloc.
5404 pub const R_MICROBLAZE_NONE: u32 = 0;
5405 /// Direct 32 bit.
5406 pub const R_MICROBLAZE_32: u32 = 1;
5407 /// PC relative 32 bit.
5408 pub const R_MICROBLAZE_32_PCREL: u32 = 2;
5409 /// PC relative 64 bit.
5410 pub const R_MICROBLAZE_64_PCREL: u32 = 3;
5411 /// Low 16 bits of PCREL32.
5412 pub const R_MICROBLAZE_32_PCREL_LO: u32 = 4;
5413 /// Direct 64 bit.
5414 pub const R_MICROBLAZE_64: u32 = 5;
5415 /// Low 16 bit.
5416 pub const R_MICROBLAZE_32_LO: u32 = 6;
5417 /// Read-only small data area.
5418 pub const R_MICROBLAZE_SRO32: u32 = 7;
5419 /// Read-write small data area.
5420 pub const R_MICROBLAZE_SRW32: u32 = 8;
5421 /// No reloc.
5422 pub const R_MICROBLAZE_64_NONE: u32 = 9;
5423 /// Symbol Op Symbol relocation.
5424 pub const R_MICROBLAZE_32_SYM_OP_SYM: u32 = 10;
5425 /// GNU C++ vtable hierarchy.
5426 pub const R_MICROBLAZE_GNU_VTINHERIT: u32 = 11;
5427 /// GNU C++ vtable member usage.
5428 pub const R_MICROBLAZE_GNU_VTENTRY: u32 = 12;
5429 /// PC-relative GOT offset.
5430 pub const R_MICROBLAZE_GOTPC_64: u32 = 13;
5431 /// GOT entry offset.
5432 pub const R_MICROBLAZE_GOT_64: u32 = 14;
5433 /// PLT offset (PC-relative).
5434 pub const R_MICROBLAZE_PLT_64: u32 = 15;
5435 /// Adjust by program base.
5436 pub const R_MICROBLAZE_REL: u32 = 16;
5437 /// Create PLT entry.
5438 pub const R_MICROBLAZE_JUMP_SLOT: u32 = 17;
5439 /// Create GOT entry.
5440 pub const R_MICROBLAZE_GLOB_DAT: u32 = 18;
5441 /// 64 bit offset to GOT.
5442 pub const R_MICROBLAZE_GOTOFF_64: u32 = 19;
5443 /// 32 bit offset to GOT.
5444 pub const R_MICROBLAZE_GOTOFF_32: u32 = 20;
5445 /// Runtime copy.
5446 pub const R_MICROBLAZE_COPY: u32 = 21;
5447 /// TLS Reloc.
5448 pub const R_MICROBLAZE_TLS: u32 = 22;
5449 /// TLS General Dynamic.
5450 pub const R_MICROBLAZE_TLSGD: u32 = 23;
5451 /// TLS Local Dynamic.
5452 pub const R_MICROBLAZE_TLSLD: u32 = 24;
5453 /// TLS Module ID.
5454 pub const R_MICROBLAZE_TLSDTPMOD32: u32 = 25;
5455 /// TLS Offset Within TLS Block.
5456 pub const R_MICROBLAZE_TLSDTPREL32: u32 = 26;
5457 /// TLS Offset Within TLS Block.
5458 pub const R_MICROBLAZE_TLSDTPREL64: u32 = 27;
5459 /// TLS Offset From Thread Pointer.
5460 pub const R_MICROBLAZE_TLSGOTTPREL32: u32 = 28;
5461 /// TLS Offset From Thread Pointer.
5462 pub const R_MICROBLAZE_TLSTPREL32: u32 = 29;
5463
5464 // Nios II values `Dyn::d_tag`.
5465 /// Address of _gp.
5466 pub const DT_NIOS2_GP: u32 = 0x7000_0002;
5467
5468 // Nios II values `Rel*::r_type`.
5469 /// No reloc.
5470 pub const R_NIOS2_NONE: u32 = 0;
5471 /// Direct signed 16 bit.
5472 pub const R_NIOS2_S16: u32 = 1;
5473 /// Direct unsigned 16 bit.
5474 pub const R_NIOS2_U16: u32 = 2;
5475 /// PC relative 16 bit.
5476 pub const R_NIOS2_PCREL16: u32 = 3;
5477 /// Direct call.
5478 pub const R_NIOS2_CALL26: u32 = 4;
5479 /// 5 bit constant expression.
5480 pub const R_NIOS2_IMM5: u32 = 5;
5481 /// 5 bit expression, shift 22.
5482 pub const R_NIOS2_CACHE_OPX: u32 = 6;
5483 /// 6 bit constant expression.
5484 pub const R_NIOS2_IMM6: u32 = 7;
5485 /// 8 bit constant expression.
5486 pub const R_NIOS2_IMM8: u32 = 8;
5487 /// High 16 bit.
5488 pub const R_NIOS2_HI16: u32 = 9;
5489 /// Low 16 bit.
5490 pub const R_NIOS2_LO16: u32 = 10;
5491 /// High 16 bit, adjusted.
5492 pub const R_NIOS2_HIADJ16: u32 = 11;
5493 /// 32 bit symbol value + addend.
5494 pub const R_NIOS2_BFD_RELOC_32: u32 = 12;
5495 /// 16 bit symbol value + addend.
5496 pub const R_NIOS2_BFD_RELOC_16: u32 = 13;
5497 /// 8 bit symbol value + addend.
5498 pub const R_NIOS2_BFD_RELOC_8: u32 = 14;
5499 /// 16 bit GP pointer offset.
5500 pub const R_NIOS2_GPREL: u32 = 15;
5501 /// GNU C++ vtable hierarchy.
5502 pub const R_NIOS2_GNU_VTINHERIT: u32 = 16;
5503 /// GNU C++ vtable member usage.
5504 pub const R_NIOS2_GNU_VTENTRY: u32 = 17;
5505 /// Unconditional branch.
5506 pub const R_NIOS2_UJMP: u32 = 18;
5507 /// Conditional branch.
5508 pub const R_NIOS2_CJMP: u32 = 19;
5509 /// Indirect call through register.
5510 pub const R_NIOS2_CALLR: u32 = 20;
5511 /// Alignment requirement for linker relaxation.
5512 pub const R_NIOS2_ALIGN: u32 = 21;
5513 /// 16 bit GOT entry.
5514 pub const R_NIOS2_GOT16: u32 = 22;
5515 /// 16 bit GOT entry for function.
5516 pub const R_NIOS2_CALL16: u32 = 23;
5517 /// %lo of offset to GOT pointer.
5518 pub const R_NIOS2_GOTOFF_LO: u32 = 24;
5519 /// %hiadj of offset to GOT pointer.
5520 pub const R_NIOS2_GOTOFF_HA: u32 = 25;
5521 /// %lo of PC relative offset.
5522 pub const R_NIOS2_PCREL_LO: u32 = 26;
5523 /// %hiadj of PC relative offset.
5524 pub const R_NIOS2_PCREL_HA: u32 = 27;
5525 /// 16 bit GOT offset for TLS GD.
5526 pub const R_NIOS2_TLS_GD16: u32 = 28;
5527 /// 16 bit GOT offset for TLS LDM.
5528 pub const R_NIOS2_TLS_LDM16: u32 = 29;
5529 /// 16 bit module relative offset.
5530 pub const R_NIOS2_TLS_LDO16: u32 = 30;
5531 /// 16 bit GOT offset for TLS IE.
5532 pub const R_NIOS2_TLS_IE16: u32 = 31;
5533 /// 16 bit LE TP-relative offset.
5534 pub const R_NIOS2_TLS_LE16: u32 = 32;
5535 /// Module number.
5536 pub const R_NIOS2_TLS_DTPMOD: u32 = 33;
5537 /// Module-relative offset.
5538 pub const R_NIOS2_TLS_DTPREL: u32 = 34;
5539 /// TP-relative offset.
5540 pub const R_NIOS2_TLS_TPREL: u32 = 35;
5541 /// Copy symbol at runtime.
5542 pub const R_NIOS2_COPY: u32 = 36;
5543 /// Create GOT entry.
5544 pub const R_NIOS2_GLOB_DAT: u32 = 37;
5545 /// Create PLT entry.
5546 pub const R_NIOS2_JUMP_SLOT: u32 = 38;
5547 /// Adjust by program base.
5548 pub const R_NIOS2_RELATIVE: u32 = 39;
5549 /// 16 bit offset to GOT pointer.
5550 pub const R_NIOS2_GOTOFF: u32 = 40;
5551 /// Direct call in .noat section.
5552 pub const R_NIOS2_CALL26_NOAT: u32 = 41;
5553 /// %lo() of GOT entry.
5554 pub const R_NIOS2_GOT_LO: u32 = 42;
5555 /// %hiadj() of GOT entry.
5556 pub const R_NIOS2_GOT_HA: u32 = 43;
5557 /// %lo() of function GOT entry.
5558 pub const R_NIOS2_CALL_LO: u32 = 44;
5559 /// %hiadj() of function GOT entry.
5560 pub const R_NIOS2_CALL_HA: u32 = 45;
5561
5562 // TILEPro values `Rel*::r_type`.
5563 /// No reloc
5564 pub const R_TILEPRO_NONE: u32 = 0;
5565 /// Direct 32 bit
5566 pub const R_TILEPRO_32: u32 = 1;
5567 /// Direct 16 bit
5568 pub const R_TILEPRO_16: u32 = 2;
5569 /// Direct 8 bit
5570 pub const R_TILEPRO_8: u32 = 3;
5571 /// PC relative 32 bit
5572 pub const R_TILEPRO_32_PCREL: u32 = 4;
5573 /// PC relative 16 bit
5574 pub const R_TILEPRO_16_PCREL: u32 = 5;
5575 /// PC relative 8 bit
5576 pub const R_TILEPRO_8_PCREL: u32 = 6;
5577 /// Low 16 bit
5578 pub const R_TILEPRO_LO16: u32 = 7;
5579 /// High 16 bit
5580 pub const R_TILEPRO_HI16: u32 = 8;
5581 /// High 16 bit, adjusted
5582 pub const R_TILEPRO_HA16: u32 = 9;
5583 /// Copy relocation
5584 pub const R_TILEPRO_COPY: u32 = 10;
5585 /// Create GOT entry
5586 pub const R_TILEPRO_GLOB_DAT: u32 = 11;
5587 /// Create PLT entry
5588 pub const R_TILEPRO_JMP_SLOT: u32 = 12;
5589 /// Adjust by program base
5590 pub const R_TILEPRO_RELATIVE: u32 = 13;
5591 /// X1 pipe branch offset
5592 pub const R_TILEPRO_BROFF_X1: u32 = 14;
5593 /// X1 pipe jump offset
5594 pub const R_TILEPRO_JOFFLONG_X1: u32 = 15;
5595 /// X1 pipe jump offset to PLT
5596 pub const R_TILEPRO_JOFFLONG_X1_PLT: u32 = 16;
5597 /// X0 pipe 8-bit
5598 pub const R_TILEPRO_IMM8_X0: u32 = 17;
5599 /// Y0 pipe 8-bit
5600 pub const R_TILEPRO_IMM8_Y0: u32 = 18;
5601 /// X1 pipe 8-bit
5602 pub const R_TILEPRO_IMM8_X1: u32 = 19;
5603 /// Y1 pipe 8-bit
5604 pub const R_TILEPRO_IMM8_Y1: u32 = 20;
5605 /// X1 pipe mtspr
5606 pub const R_TILEPRO_MT_IMM15_X1: u32 = 21;
5607 /// X1 pipe mfspr
5608 pub const R_TILEPRO_MF_IMM15_X1: u32 = 22;
5609 /// X0 pipe 16-bit
5610 pub const R_TILEPRO_IMM16_X0: u32 = 23;
5611 /// X1 pipe 16-bit
5612 pub const R_TILEPRO_IMM16_X1: u32 = 24;
5613 /// X0 pipe low 16-bit
5614 pub const R_TILEPRO_IMM16_X0_LO: u32 = 25;
5615 /// X1 pipe low 16-bit
5616 pub const R_TILEPRO_IMM16_X1_LO: u32 = 26;
5617 /// X0 pipe high 16-bit
5618 pub const R_TILEPRO_IMM16_X0_HI: u32 = 27;
5619 /// X1 pipe high 16-bit
5620 pub const R_TILEPRO_IMM16_X1_HI: u32 = 28;
5621 /// X0 pipe high 16-bit, adjusted
5622 pub const R_TILEPRO_IMM16_X0_HA: u32 = 29;
5623 /// X1 pipe high 16-bit, adjusted
5624 pub const R_TILEPRO_IMM16_X1_HA: u32 = 30;
5625 /// X0 pipe PC relative 16 bit
5626 pub const R_TILEPRO_IMM16_X0_PCREL: u32 = 31;
5627 /// X1 pipe PC relative 16 bit
5628 pub const R_TILEPRO_IMM16_X1_PCREL: u32 = 32;
5629 /// X0 pipe PC relative low 16 bit
5630 pub const R_TILEPRO_IMM16_X0_LO_PCREL: u32 = 33;
5631 /// X1 pipe PC relative low 16 bit
5632 pub const R_TILEPRO_IMM16_X1_LO_PCREL: u32 = 34;
5633 /// X0 pipe PC relative high 16 bit
5634 pub const R_TILEPRO_IMM16_X0_HI_PCREL: u32 = 35;
5635 /// X1 pipe PC relative high 16 bit
5636 pub const R_TILEPRO_IMM16_X1_HI_PCREL: u32 = 36;
5637 /// X0 pipe PC relative ha() 16 bit
5638 pub const R_TILEPRO_IMM16_X0_HA_PCREL: u32 = 37;
5639 /// X1 pipe PC relative ha() 16 bit
5640 pub const R_TILEPRO_IMM16_X1_HA_PCREL: u32 = 38;
5641 /// X0 pipe 16-bit GOT offset
5642 pub const R_TILEPRO_IMM16_X0_GOT: u32 = 39;
5643 /// X1 pipe 16-bit GOT offset
5644 pub const R_TILEPRO_IMM16_X1_GOT: u32 = 40;
5645 /// X0 pipe low 16-bit GOT offset
5646 pub const R_TILEPRO_IMM16_X0_GOT_LO: u32 = 41;
5647 /// X1 pipe low 16-bit GOT offset
5648 pub const R_TILEPRO_IMM16_X1_GOT_LO: u32 = 42;
5649 /// X0 pipe high 16-bit GOT offset
5650 pub const R_TILEPRO_IMM16_X0_GOT_HI: u32 = 43;
5651 /// X1 pipe high 16-bit GOT offset
5652 pub const R_TILEPRO_IMM16_X1_GOT_HI: u32 = 44;
5653 /// X0 pipe ha() 16-bit GOT offset
5654 pub const R_TILEPRO_IMM16_X0_GOT_HA: u32 = 45;
5655 /// X1 pipe ha() 16-bit GOT offset
5656 pub const R_TILEPRO_IMM16_X1_GOT_HA: u32 = 46;
5657 /// X0 pipe mm "start"
5658 pub const R_TILEPRO_MMSTART_X0: u32 = 47;
5659 /// X0 pipe mm "end"
5660 pub const R_TILEPRO_MMEND_X0: u32 = 48;
5661 /// X1 pipe mm "start"
5662 pub const R_TILEPRO_MMSTART_X1: u32 = 49;
5663 /// X1 pipe mm "end"
5664 pub const R_TILEPRO_MMEND_X1: u32 = 50;
5665 /// X0 pipe shift amount
5666 pub const R_TILEPRO_SHAMT_X0: u32 = 51;
5667 /// X1 pipe shift amount
5668 pub const R_TILEPRO_SHAMT_X1: u32 = 52;
5669 /// Y0 pipe shift amount
5670 pub const R_TILEPRO_SHAMT_Y0: u32 = 53;
5671 /// Y1 pipe shift amount
5672 pub const R_TILEPRO_SHAMT_Y1: u32 = 54;
5673 /// X1 pipe destination 8-bit
5674 pub const R_TILEPRO_DEST_IMM8_X1: u32 = 55;
5675 // Relocs 56-59 are currently not defined.
5676 /// "jal" for TLS GD
5677 pub const R_TILEPRO_TLS_GD_CALL: u32 = 60;
5678 /// X0 pipe "addi" for TLS GD
5679 pub const R_TILEPRO_IMM8_X0_TLS_GD_ADD: u32 = 61;
5680 /// X1 pipe "addi" for TLS GD
5681 pub const R_TILEPRO_IMM8_X1_TLS_GD_ADD: u32 = 62;
5682 /// Y0 pipe "addi" for TLS GD
5683 pub const R_TILEPRO_IMM8_Y0_TLS_GD_ADD: u32 = 63;
5684 /// Y1 pipe "addi" for TLS GD
5685 pub const R_TILEPRO_IMM8_Y1_TLS_GD_ADD: u32 = 64;
5686 /// "lw_tls" for TLS IE
5687 pub const R_TILEPRO_TLS_IE_LOAD: u32 = 65;
5688 /// X0 pipe 16-bit TLS GD offset
5689 pub const R_TILEPRO_IMM16_X0_TLS_GD: u32 = 66;
5690 /// X1 pipe 16-bit TLS GD offset
5691 pub const R_TILEPRO_IMM16_X1_TLS_GD: u32 = 67;
5692 /// X0 pipe low 16-bit TLS GD offset
5693 pub const R_TILEPRO_IMM16_X0_TLS_GD_LO: u32 = 68;
5694 /// X1 pipe low 16-bit TLS GD offset
5695 pub const R_TILEPRO_IMM16_X1_TLS_GD_LO: u32 = 69;
5696 /// X0 pipe high 16-bit TLS GD offset
5697 pub const R_TILEPRO_IMM16_X0_TLS_GD_HI: u32 = 70;
5698 /// X1 pipe high 16-bit TLS GD offset
5699 pub const R_TILEPRO_IMM16_X1_TLS_GD_HI: u32 = 71;
5700 /// X0 pipe ha() 16-bit TLS GD offset
5701 pub const R_TILEPRO_IMM16_X0_TLS_GD_HA: u32 = 72;
5702 /// X1 pipe ha() 16-bit TLS GD offset
5703 pub const R_TILEPRO_IMM16_X1_TLS_GD_HA: u32 = 73;
5704 /// X0 pipe 16-bit TLS IE offset
5705 pub const R_TILEPRO_IMM16_X0_TLS_IE: u32 = 74;
5706 /// X1 pipe 16-bit TLS IE offset
5707 pub const R_TILEPRO_IMM16_X1_TLS_IE: u32 = 75;
5708 /// X0 pipe low 16-bit TLS IE offset
5709 pub const R_TILEPRO_IMM16_X0_TLS_IE_LO: u32 = 76;
5710 /// X1 pipe low 16-bit TLS IE offset
5711 pub const R_TILEPRO_IMM16_X1_TLS_IE_LO: u32 = 77;
5712 /// X0 pipe high 16-bit TLS IE offset
5713 pub const R_TILEPRO_IMM16_X0_TLS_IE_HI: u32 = 78;
5714 /// X1 pipe high 16-bit TLS IE offset
5715 pub const R_TILEPRO_IMM16_X1_TLS_IE_HI: u32 = 79;
5716 /// X0 pipe ha() 16-bit TLS IE offset
5717 pub const R_TILEPRO_IMM16_X0_TLS_IE_HA: u32 = 80;
5718 /// X1 pipe ha() 16-bit TLS IE offset
5719 pub const R_TILEPRO_IMM16_X1_TLS_IE_HA: u32 = 81;
5720 /// ID of module containing symbol
5721 pub const R_TILEPRO_TLS_DTPMOD32: u32 = 82;
5722 /// Offset in TLS block
5723 pub const R_TILEPRO_TLS_DTPOFF32: u32 = 83;
5724 /// Offset in static TLS block
5725 pub const R_TILEPRO_TLS_TPOFF32: u32 = 84;
5726 /// X0 pipe 16-bit TLS LE offset
5727 pub const R_TILEPRO_IMM16_X0_TLS_LE: u32 = 85;
5728 /// X1 pipe 16-bit TLS LE offset
5729 pub const R_TILEPRO_IMM16_X1_TLS_LE: u32 = 86;
5730 /// X0 pipe low 16-bit TLS LE offset
5731 pub const R_TILEPRO_IMM16_X0_TLS_LE_LO: u32 = 87;
5732 /// X1 pipe low 16-bit TLS LE offset
5733 pub const R_TILEPRO_IMM16_X1_TLS_LE_LO: u32 = 88;
5734 /// X0 pipe high 16-bit TLS LE offset
5735 pub const R_TILEPRO_IMM16_X0_TLS_LE_HI: u32 = 89;
5736 /// X1 pipe high 16-bit TLS LE offset
5737 pub const R_TILEPRO_IMM16_X1_TLS_LE_HI: u32 = 90;
5738 /// X0 pipe ha() 16-bit TLS LE offset
5739 pub const R_TILEPRO_IMM16_X0_TLS_LE_HA: u32 = 91;
5740 /// X1 pipe ha() 16-bit TLS LE offset
5741 pub const R_TILEPRO_IMM16_X1_TLS_LE_HA: u32 = 92;
5742
5743 /// GNU C++ vtable hierarchy
5744 pub const R_TILEPRO_GNU_VTINHERIT: u32 = 128;
5745 /// GNU C++ vtable member usage
5746 pub const R_TILEPRO_GNU_VTENTRY: u32 = 129;
5747
5748 // TILE-Gx values `Rel*::r_type`.
5749 /// No reloc
5750 pub const R_TILEGX_NONE: u32 = 0;
5751 /// Direct 64 bit
5752 pub const R_TILEGX_64: u32 = 1;
5753 /// Direct 32 bit
5754 pub const R_TILEGX_32: u32 = 2;
5755 /// Direct 16 bit
5756 pub const R_TILEGX_16: u32 = 3;
5757 /// Direct 8 bit
5758 pub const R_TILEGX_8: u32 = 4;
5759 /// PC relative 64 bit
5760 pub const R_TILEGX_64_PCREL: u32 = 5;
5761 /// PC relative 32 bit
5762 pub const R_TILEGX_32_PCREL: u32 = 6;
5763 /// PC relative 16 bit
5764 pub const R_TILEGX_16_PCREL: u32 = 7;
5765 /// PC relative 8 bit
5766 pub const R_TILEGX_8_PCREL: u32 = 8;
5767 /// hword 0 16-bit
5768 pub const R_TILEGX_HW0: u32 = 9;
5769 /// hword 1 16-bit
5770 pub const R_TILEGX_HW1: u32 = 10;
5771 /// hword 2 16-bit
5772 pub const R_TILEGX_HW2: u32 = 11;
5773 /// hword 3 16-bit
5774 pub const R_TILEGX_HW3: u32 = 12;
5775 /// last hword 0 16-bit
5776 pub const R_TILEGX_HW0_LAST: u32 = 13;
5777 /// last hword 1 16-bit
5778 pub const R_TILEGX_HW1_LAST: u32 = 14;
5779 /// last hword 2 16-bit
5780 pub const R_TILEGX_HW2_LAST: u32 = 15;
5781 /// Copy relocation
5782 pub const R_TILEGX_COPY: u32 = 16;
5783 /// Create GOT entry
5784 pub const R_TILEGX_GLOB_DAT: u32 = 17;
5785 /// Create PLT entry
5786 pub const R_TILEGX_JMP_SLOT: u32 = 18;
5787 /// Adjust by program base
5788 pub const R_TILEGX_RELATIVE: u32 = 19;
5789 /// X1 pipe branch offset
5790 pub const R_TILEGX_BROFF_X1: u32 = 20;
5791 /// X1 pipe jump offset
5792 pub const R_TILEGX_JUMPOFF_X1: u32 = 21;
5793 /// X1 pipe jump offset to PLT
5794 pub const R_TILEGX_JUMPOFF_X1_PLT: u32 = 22;
5795 /// X0 pipe 8-bit
5796 pub const R_TILEGX_IMM8_X0: u32 = 23;
5797 /// Y0 pipe 8-bit
5798 pub const R_TILEGX_IMM8_Y0: u32 = 24;
5799 /// X1 pipe 8-bit
5800 pub const R_TILEGX_IMM8_X1: u32 = 25;
5801 /// Y1 pipe 8-bit
5802 pub const R_TILEGX_IMM8_Y1: u32 = 26;
5803 /// X1 pipe destination 8-bit
5804 pub const R_TILEGX_DEST_IMM8_X1: u32 = 27;
5805 /// X1 pipe mtspr
5806 pub const R_TILEGX_MT_IMM14_X1: u32 = 28;
5807 /// X1 pipe mfspr
5808 pub const R_TILEGX_MF_IMM14_X1: u32 = 29;
5809 /// X0 pipe mm "start"
5810 pub const R_TILEGX_MMSTART_X0: u32 = 30;
5811 /// X0 pipe mm "end"
5812 pub const R_TILEGX_MMEND_X0: u32 = 31;
5813 /// X0 pipe shift amount
5814 pub const R_TILEGX_SHAMT_X0: u32 = 32;
5815 /// X1 pipe shift amount
5816 pub const R_TILEGX_SHAMT_X1: u32 = 33;
5817 /// Y0 pipe shift amount
5818 pub const R_TILEGX_SHAMT_Y0: u32 = 34;
5819 /// Y1 pipe shift amount
5820 pub const R_TILEGX_SHAMT_Y1: u32 = 35;
5821 /// X0 pipe hword 0
5822 pub const R_TILEGX_IMM16_X0_HW0: u32 = 36;
5823 /// X1 pipe hword 0
5824 pub const R_TILEGX_IMM16_X1_HW0: u32 = 37;
5825 /// X0 pipe hword 1
5826 pub const R_TILEGX_IMM16_X0_HW1: u32 = 38;
5827 /// X1 pipe hword 1
5828 pub const R_TILEGX_IMM16_X1_HW1: u32 = 39;
5829 /// X0 pipe hword 2
5830 pub const R_TILEGX_IMM16_X0_HW2: u32 = 40;
5831 /// X1 pipe hword 2
5832 pub const R_TILEGX_IMM16_X1_HW2: u32 = 41;
5833 /// X0 pipe hword 3
5834 pub const R_TILEGX_IMM16_X0_HW3: u32 = 42;
5835 /// X1 pipe hword 3
5836 pub const R_TILEGX_IMM16_X1_HW3: u32 = 43;
5837 /// X0 pipe last hword 0
5838 pub const R_TILEGX_IMM16_X0_HW0_LAST: u32 = 44;
5839 /// X1 pipe last hword 0
5840 pub const R_TILEGX_IMM16_X1_HW0_LAST: u32 = 45;
5841 /// X0 pipe last hword 1
5842 pub const R_TILEGX_IMM16_X0_HW1_LAST: u32 = 46;
5843 /// X1 pipe last hword 1
5844 pub const R_TILEGX_IMM16_X1_HW1_LAST: u32 = 47;
5845 /// X0 pipe last hword 2
5846 pub const R_TILEGX_IMM16_X0_HW2_LAST: u32 = 48;
5847 /// X1 pipe last hword 2
5848 pub const R_TILEGX_IMM16_X1_HW2_LAST: u32 = 49;
5849 /// X0 pipe PC relative hword 0
5850 pub const R_TILEGX_IMM16_X0_HW0_PCREL: u32 = 50;
5851 /// X1 pipe PC relative hword 0
5852 pub const R_TILEGX_IMM16_X1_HW0_PCREL: u32 = 51;
5853 /// X0 pipe PC relative hword 1
5854 pub const R_TILEGX_IMM16_X0_HW1_PCREL: u32 = 52;
5855 /// X1 pipe PC relative hword 1
5856 pub const R_TILEGX_IMM16_X1_HW1_PCREL: u32 = 53;
5857 /// X0 pipe PC relative hword 2
5858 pub const R_TILEGX_IMM16_X0_HW2_PCREL: u32 = 54;
5859 /// X1 pipe PC relative hword 2
5860 pub const R_TILEGX_IMM16_X1_HW2_PCREL: u32 = 55;
5861 /// X0 pipe PC relative hword 3
5862 pub const R_TILEGX_IMM16_X0_HW3_PCREL: u32 = 56;
5863 /// X1 pipe PC relative hword 3
5864 pub const R_TILEGX_IMM16_X1_HW3_PCREL: u32 = 57;
5865 /// X0 pipe PC-rel last hword 0
5866 pub const R_TILEGX_IMM16_X0_HW0_LAST_PCREL: u32 = 58;
5867 /// X1 pipe PC-rel last hword 0
5868 pub const R_TILEGX_IMM16_X1_HW0_LAST_PCREL: u32 = 59;
5869 /// X0 pipe PC-rel last hword 1
5870 pub const R_TILEGX_IMM16_X0_HW1_LAST_PCREL: u32 = 60;
5871 /// X1 pipe PC-rel last hword 1
5872 pub const R_TILEGX_IMM16_X1_HW1_LAST_PCREL: u32 = 61;
5873 /// X0 pipe PC-rel last hword 2
5874 pub const R_TILEGX_IMM16_X0_HW2_LAST_PCREL: u32 = 62;
5875 /// X1 pipe PC-rel last hword 2
5876 pub const R_TILEGX_IMM16_X1_HW2_LAST_PCREL: u32 = 63;
5877 /// X0 pipe hword 0 GOT offset
5878 pub const R_TILEGX_IMM16_X0_HW0_GOT: u32 = 64;
5879 /// X1 pipe hword 0 GOT offset
5880 pub const R_TILEGX_IMM16_X1_HW0_GOT: u32 = 65;
5881 /// X0 pipe PC-rel PLT hword 0
5882 pub const R_TILEGX_IMM16_X0_HW0_PLT_PCREL: u32 = 66;
5883 /// X1 pipe PC-rel PLT hword 0
5884 pub const R_TILEGX_IMM16_X1_HW0_PLT_PCREL: u32 = 67;
5885 /// X0 pipe PC-rel PLT hword 1
5886 pub const R_TILEGX_IMM16_X0_HW1_PLT_PCREL: u32 = 68;
5887 /// X1 pipe PC-rel PLT hword 1
5888 pub const R_TILEGX_IMM16_X1_HW1_PLT_PCREL: u32 = 69;
5889 /// X0 pipe PC-rel PLT hword 2
5890 pub const R_TILEGX_IMM16_X0_HW2_PLT_PCREL: u32 = 70;
5891 /// X1 pipe PC-rel PLT hword 2
5892 pub const R_TILEGX_IMM16_X1_HW2_PLT_PCREL: u32 = 71;
5893 /// X0 pipe last hword 0 GOT offset
5894 pub const R_TILEGX_IMM16_X0_HW0_LAST_GOT: u32 = 72;
5895 /// X1 pipe last hword 0 GOT offset
5896 pub const R_TILEGX_IMM16_X1_HW0_LAST_GOT: u32 = 73;
5897 /// X0 pipe last hword 1 GOT offset
5898 pub const R_TILEGX_IMM16_X0_HW1_LAST_GOT: u32 = 74;
5899 /// X1 pipe last hword 1 GOT offset
5900 pub const R_TILEGX_IMM16_X1_HW1_LAST_GOT: u32 = 75;
5901 /// X0 pipe PC-rel PLT hword 3
5902 pub const R_TILEGX_IMM16_X0_HW3_PLT_PCREL: u32 = 76;
5903 /// X1 pipe PC-rel PLT hword 3
5904 pub const R_TILEGX_IMM16_X1_HW3_PLT_PCREL: u32 = 77;
5905 /// X0 pipe hword 0 TLS GD offset
5906 pub const R_TILEGX_IMM16_X0_HW0_TLS_GD: u32 = 78;
5907 /// X1 pipe hword 0 TLS GD offset
5908 pub const R_TILEGX_IMM16_X1_HW0_TLS_GD: u32 = 79;
5909 /// X0 pipe hword 0 TLS LE offset
5910 pub const R_TILEGX_IMM16_X0_HW0_TLS_LE: u32 = 80;
5911 /// X1 pipe hword 0 TLS LE offset
5912 pub const R_TILEGX_IMM16_X1_HW0_TLS_LE: u32 = 81;
5913 /// X0 pipe last hword 0 LE off
5914 pub const R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE: u32 = 82;
5915 /// X1 pipe last hword 0 LE off
5916 pub const R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE: u32 = 83;
5917 /// X0 pipe last hword 1 LE off
5918 pub const R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE: u32 = 84;
5919 /// X1 pipe last hword 1 LE off
5920 pub const R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE: u32 = 85;
5921 /// X0 pipe last hword 0 GD off
5922 pub const R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD: u32 = 86;
5923 /// X1 pipe last hword 0 GD off
5924 pub const R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD: u32 = 87;
5925 /// X0 pipe last hword 1 GD off
5926 pub const R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD: u32 = 88;
5927 /// X1 pipe last hword 1 GD off
5928 pub const R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD: u32 = 89;
5929 // Relocs 90-91 are currently not defined.
5930 /// X0 pipe hword 0 TLS IE offset
5931 pub const R_TILEGX_IMM16_X0_HW0_TLS_IE: u32 = 92;
5932 /// X1 pipe hword 0 TLS IE offset
5933 pub const R_TILEGX_IMM16_X1_HW0_TLS_IE: u32 = 93;
5934 /// X0 pipe PC-rel PLT last hword 0
5935 pub const R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL: u32 = 94;
5936 /// X1 pipe PC-rel PLT last hword 0
5937 pub const R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL: u32 = 95;
5938 /// X0 pipe PC-rel PLT last hword 1
5939 pub const R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL: u32 = 96;
5940 /// X1 pipe PC-rel PLT last hword 1
5941 pub const R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL: u32 = 97;
5942 /// X0 pipe PC-rel PLT last hword 2
5943 pub const R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL: u32 = 98;
5944 /// X1 pipe PC-rel PLT last hword 2
5945 pub const R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL: u32 = 99;
5946 /// X0 pipe last hword 0 IE off
5947 pub const R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE: u32 = 100;
5948 /// X1 pipe last hword 0 IE off
5949 pub const R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE: u32 = 101;
5950 /// X0 pipe last hword 1 IE off
5951 pub const R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE: u32 = 102;
5952 /// X1 pipe last hword 1 IE off
5953 pub const R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE: u32 = 103;
5954 // Relocs 104-105 are currently not defined.
5955 /// 64-bit ID of symbol's module
5956 pub const R_TILEGX_TLS_DTPMOD64: u32 = 106;
5957 /// 64-bit offset in TLS block
5958 pub const R_TILEGX_TLS_DTPOFF64: u32 = 107;
5959 /// 64-bit offset in static TLS block
5960 pub const R_TILEGX_TLS_TPOFF64: u32 = 108;
5961 /// 32-bit ID of symbol's module
5962 pub const R_TILEGX_TLS_DTPMOD32: u32 = 109;
5963 /// 32-bit offset in TLS block
5964 pub const R_TILEGX_TLS_DTPOFF32: u32 = 110;
5965 /// 32-bit offset in static TLS block
5966 pub const R_TILEGX_TLS_TPOFF32: u32 = 111;
5967 /// "jal" for TLS GD
5968 pub const R_TILEGX_TLS_GD_CALL: u32 = 112;
5969 /// X0 pipe "addi" for TLS GD
5970 pub const R_TILEGX_IMM8_X0_TLS_GD_ADD: u32 = 113;
5971 /// X1 pipe "addi" for TLS GD
5972 pub const R_TILEGX_IMM8_X1_TLS_GD_ADD: u32 = 114;
5973 /// Y0 pipe "addi" for TLS GD
5974 pub const R_TILEGX_IMM8_Y0_TLS_GD_ADD: u32 = 115;
5975 /// Y1 pipe "addi" for TLS GD
5976 pub const R_TILEGX_IMM8_Y1_TLS_GD_ADD: u32 = 116;
5977 /// "ld_tls" for TLS IE
5978 pub const R_TILEGX_TLS_IE_LOAD: u32 = 117;
5979 /// X0 pipe "addi" for TLS GD/IE
5980 pub const R_TILEGX_IMM8_X0_TLS_ADD: u32 = 118;
5981 /// X1 pipe "addi" for TLS GD/IE
5982 pub const R_TILEGX_IMM8_X1_TLS_ADD: u32 = 119;
5983 /// Y0 pipe "addi" for TLS GD/IE
5984 pub const R_TILEGX_IMM8_Y0_TLS_ADD: u32 = 120;
5985 /// Y1 pipe "addi" for TLS GD/IE
5986 pub const R_TILEGX_IMM8_Y1_TLS_ADD: u32 = 121;
5987
5988 /// GNU C++ vtable hierarchy
5989 pub const R_TILEGX_GNU_VTINHERIT: u32 = 128;
5990 /// GNU C++ vtable member usage
5991 pub const R_TILEGX_GNU_VTENTRY: u32 = 129;
5992
5993 // RISC-V values `FileHeader*::e_flags`.
5994 #[allow(missing_docs)]
5995 pub const EF_RISCV_RVC: u32 = 0x0001;
5996 #[allow(missing_docs)]
5997 pub const EF_RISCV_FLOAT_ABI: u32 = 0x0006;
5998 #[allow(missing_docs)]
5999 pub const EF_RISCV_FLOAT_ABI_SOFT: u32 = 0x0000;
6000 #[allow(missing_docs)]
6001 pub const EF_RISCV_FLOAT_ABI_SINGLE: u32 = 0x0002;
6002 #[allow(missing_docs)]
6003 pub const EF_RISCV_FLOAT_ABI_DOUBLE: u32 = 0x0004;
6004 #[allow(missing_docs)]
6005 pub const EF_RISCV_FLOAT_ABI_QUAD: u32 = 0x0006;
6006
6007 // RISC-V values `Rel*::r_type`.
6008 #[allow(missing_docs)]
6009 pub const R_RISCV_NONE: u32 = 0;
6010 #[allow(missing_docs)]
6011 pub const R_RISCV_32: u32 = 1;
6012 #[allow(missing_docs)]
6013 pub const R_RISCV_64: u32 = 2;
6014 #[allow(missing_docs)]
6015 pub const R_RISCV_RELATIVE: u32 = 3;
6016 #[allow(missing_docs)]
6017 pub const R_RISCV_COPY: u32 = 4;
6018 #[allow(missing_docs)]
6019 pub const R_RISCV_JUMP_SLOT: u32 = 5;
6020 #[allow(missing_docs)]
6021 pub const R_RISCV_TLS_DTPMOD32: u32 = 6;
6022 #[allow(missing_docs)]
6023 pub const R_RISCV_TLS_DTPMOD64: u32 = 7;
6024 #[allow(missing_docs)]
6025 pub const R_RISCV_TLS_DTPREL32: u32 = 8;
6026 #[allow(missing_docs)]
6027 pub const R_RISCV_TLS_DTPREL64: u32 = 9;
6028 #[allow(missing_docs)]
6029 pub const R_RISCV_TLS_TPREL32: u32 = 10;
6030 #[allow(missing_docs)]
6031 pub const R_RISCV_TLS_TPREL64: u32 = 11;
6032 #[allow(missing_docs)]
6033 pub const R_RISCV_BRANCH: u32 = 16;
6034 #[allow(missing_docs)]
6035 pub const R_RISCV_JAL: u32 = 17;
6036 #[allow(missing_docs)]
6037 pub const R_RISCV_CALL: u32 = 18;
6038 #[allow(missing_docs)]
6039 pub const R_RISCV_CALL_PLT: u32 = 19;
6040 #[allow(missing_docs)]
6041 pub const R_RISCV_GOT_HI20: u32 = 20;
6042 #[allow(missing_docs)]
6043 pub const R_RISCV_TLS_GOT_HI20: u32 = 21;
6044 #[allow(missing_docs)]
6045 pub const R_RISCV_TLS_GD_HI20: u32 = 22;
6046 #[allow(missing_docs)]
6047 pub const R_RISCV_PCREL_HI20: u32 = 23;
6048 #[allow(missing_docs)]
6049 pub const R_RISCV_PCREL_LO12_I: u32 = 24;
6050 #[allow(missing_docs)]
6051 pub const R_RISCV_PCREL_LO12_S: u32 = 25;
6052 #[allow(missing_docs)]
6053 pub const R_RISCV_HI20: u32 = 26;
6054 #[allow(missing_docs)]
6055 pub const R_RISCV_LO12_I: u32 = 27;
6056 #[allow(missing_docs)]
6057 pub const R_RISCV_LO12_S: u32 = 28;
6058 #[allow(missing_docs)]
6059 pub const R_RISCV_TPREL_HI20: u32 = 29;
6060 #[allow(missing_docs)]
6061 pub const R_RISCV_TPREL_LO12_I: u32 = 30;
6062 #[allow(missing_docs)]
6063 pub const R_RISCV_TPREL_LO12_S: u32 = 31;
6064 #[allow(missing_docs)]
6065 pub const R_RISCV_TPREL_ADD: u32 = 32;
6066 #[allow(missing_docs)]
6067 pub const R_RISCV_ADD8: u32 = 33;
6068 #[allow(missing_docs)]
6069 pub const R_RISCV_ADD16: u32 = 34;
6070 #[allow(missing_docs)]
6071 pub const R_RISCV_ADD32: u32 = 35;
6072 #[allow(missing_docs)]
6073 pub const R_RISCV_ADD64: u32 = 36;
6074 #[allow(missing_docs)]
6075 pub const R_RISCV_SUB8: u32 = 37;
6076 #[allow(missing_docs)]
6077 pub const R_RISCV_SUB16: u32 = 38;
6078 #[allow(missing_docs)]
6079 pub const R_RISCV_SUB32: u32 = 39;
6080 #[allow(missing_docs)]
6081 pub const R_RISCV_SUB64: u32 = 40;
6082 #[allow(missing_docs)]
6083 pub const R_RISCV_GNU_VTINHERIT: u32 = 41;
6084 #[allow(missing_docs)]
6085 pub const R_RISCV_GNU_VTENTRY: u32 = 42;
6086 #[allow(missing_docs)]
6087 pub const R_RISCV_ALIGN: u32 = 43;
6088 #[allow(missing_docs)]
6089 pub const R_RISCV_RVC_BRANCH: u32 = 44;
6090 #[allow(missing_docs)]
6091 pub const R_RISCV_RVC_JUMP: u32 = 45;
6092 #[allow(missing_docs)]
6093 pub const R_RISCV_RVC_LUI: u32 = 46;
6094 #[allow(missing_docs)]
6095 pub const R_RISCV_GPREL_I: u32 = 47;
6096 #[allow(missing_docs)]
6097 pub const R_RISCV_GPREL_S: u32 = 48;
6098 #[allow(missing_docs)]
6099 pub const R_RISCV_TPREL_I: u32 = 49;
6100 #[allow(missing_docs)]
6101 pub const R_RISCV_TPREL_S: u32 = 50;
6102 #[allow(missing_docs)]
6103 pub const R_RISCV_RELAX: u32 = 51;
6104 #[allow(missing_docs)]
6105 pub const R_RISCV_SUB6: u32 = 52;
6106 #[allow(missing_docs)]
6107 pub const R_RISCV_SET6: u32 = 53;
6108 #[allow(missing_docs)]
6109 pub const R_RISCV_SET8: u32 = 54;
6110 #[allow(missing_docs)]
6111 pub const R_RISCV_SET16: u32 = 55;
6112 #[allow(missing_docs)]
6113 pub const R_RISCV_SET32: u32 = 56;
6114 #[allow(missing_docs)]
6115 pub const R_RISCV_32_PCREL: u32 = 57;
6116
6117 // BPF values `Rel*::r_type`.
6118 /// No reloc
6119 pub const R_BPF_NONE: u32 = 0;
6120 #[allow(missing_docs)]
6121 pub const R_BPF_64_64: u32 = 1;
6122 #[allow(missing_docs)]
6123 pub const R_BPF_64_32: u32 = 10;
6124
6125 // Imagination Meta values `Rel*::r_type`.
6126
6127 #[allow(missing_docs)]
6128 pub const R_METAG_HIADDR16: u32 = 0;
6129 #[allow(missing_docs)]
6130 pub const R_METAG_LOADDR16: u32 = 1;
6131 /// 32bit absolute address
6132 pub const R_METAG_ADDR32: u32 = 2;
6133 /// No reloc
6134 pub const R_METAG_NONE: u32 = 3;
6135 #[allow(missing_docs)]
6136 pub const R_METAG_RELBRANCH: u32 = 4;
6137 #[allow(missing_docs)]
6138 pub const R_METAG_GETSETOFF: u32 = 5;
6139
6140 // Backward compatability
6141 #[allow(missing_docs)]
6142 pub const R_METAG_REG32OP1: u32 = 6;
6143 #[allow(missing_docs)]
6144 pub const R_METAG_REG32OP2: u32 = 7;
6145 #[allow(missing_docs)]
6146 pub const R_METAG_REG32OP3: u32 = 8;
6147 #[allow(missing_docs)]
6148 pub const R_METAG_REG16OP1: u32 = 9;
6149 #[allow(missing_docs)]
6150 pub const R_METAG_REG16OP2: u32 = 10;
6151 #[allow(missing_docs)]
6152 pub const R_METAG_REG16OP3: u32 = 11;
6153 #[allow(missing_docs)]
6154 pub const R_METAG_REG32OP4: u32 = 12;
6155
6156 #[allow(missing_docs)]
6157 pub const R_METAG_HIOG: u32 = 13;
6158 #[allow(missing_docs)]
6159 pub const R_METAG_LOOG: u32 = 14;
6160
6161 #[allow(missing_docs)]
6162 pub const R_METAG_REL8: u32 = 15;
6163 #[allow(missing_docs)]
6164 pub const R_METAG_REL16: u32 = 16;
6165
6166 #[allow(missing_docs)]
6167 pub const R_METAG_GNU_VTINHERIT: u32 = 30;
6168 #[allow(missing_docs)]
6169 pub const R_METAG_GNU_VTENTRY: u32 = 31;
6170
6171 // PIC relocations
6172 #[allow(missing_docs)]
6173 pub const R_METAG_HI16_GOTOFF: u32 = 32;
6174 #[allow(missing_docs)]
6175 pub const R_METAG_LO16_GOTOFF: u32 = 33;
6176 #[allow(missing_docs)]
6177 pub const R_METAG_GETSET_GOTOFF: u32 = 34;
6178 #[allow(missing_docs)]
6179 pub const R_METAG_GETSET_GOT: u32 = 35;
6180 #[allow(missing_docs)]
6181 pub const R_METAG_HI16_GOTPC: u32 = 36;
6182 #[allow(missing_docs)]
6183 pub const R_METAG_LO16_GOTPC: u32 = 37;
6184 #[allow(missing_docs)]
6185 pub const R_METAG_HI16_PLT: u32 = 38;
6186 #[allow(missing_docs)]
6187 pub const R_METAG_LO16_PLT: u32 = 39;
6188 #[allow(missing_docs)]
6189 pub const R_METAG_RELBRANCH_PLT: u32 = 40;
6190 #[allow(missing_docs)]
6191 pub const R_METAG_GOTOFF: u32 = 41;
6192 #[allow(missing_docs)]
6193 pub const R_METAG_PLT: u32 = 42;
6194 #[allow(missing_docs)]
6195 pub const R_METAG_COPY: u32 = 43;
6196 #[allow(missing_docs)]
6197 pub const R_METAG_JMP_SLOT: u32 = 44;
6198 #[allow(missing_docs)]
6199 pub const R_METAG_RELATIVE: u32 = 45;
6200 #[allow(missing_docs)]
6201 pub const R_METAG_GLOB_DAT: u32 = 46;
6202
6203 // TLS relocations
6204 #[allow(missing_docs)]
6205 pub const R_METAG_TLS_GD: u32 = 47;
6206 #[allow(missing_docs)]
6207 pub const R_METAG_TLS_LDM: u32 = 48;
6208 #[allow(missing_docs)]
6209 pub const R_METAG_TLS_LDO_HI16: u32 = 49;
6210 #[allow(missing_docs)]
6211 pub const R_METAG_TLS_LDO_LO16: u32 = 50;
6212 #[allow(missing_docs)]
6213 pub const R_METAG_TLS_LDO: u32 = 51;
6214 #[allow(missing_docs)]
6215 pub const R_METAG_TLS_IE: u32 = 52;
6216 #[allow(missing_docs)]
6217 pub const R_METAG_TLS_IENONPIC: u32 = 53;
6218 #[allow(missing_docs)]
6219 pub const R_METAG_TLS_IENONPIC_HI16: u32 = 54;
6220 #[allow(missing_docs)]
6221 pub const R_METAG_TLS_IENONPIC_LO16: u32 = 55;
6222 #[allow(missing_docs)]
6223 pub const R_METAG_TLS_TPOFF: u32 = 56;
6224 #[allow(missing_docs)]
6225 pub const R_METAG_TLS_DTPMOD: u32 = 57;
6226 #[allow(missing_docs)]
6227 pub const R_METAG_TLS_DTPOFF: u32 = 58;
6228 #[allow(missing_docs)]
6229 pub const R_METAG_TLS_LE: u32 = 59;
6230 #[allow(missing_docs)]
6231 pub const R_METAG_TLS_LE_HI16: u32 = 60;
6232 #[allow(missing_docs)]
6233 pub const R_METAG_TLS_LE_LO16: u32 = 61;
6234
6235 // NDS32 values `Rel*::r_type`.
6236 #[allow(missing_docs)]
6237 pub const R_NDS32_NONE: u32 = 0;
6238 #[allow(missing_docs)]
6239 pub const R_NDS32_32_RELA: u32 = 20;
6240 #[allow(missing_docs)]
6241 pub const R_NDS32_COPY: u32 = 39;
6242 #[allow(missing_docs)]
6243 pub const R_NDS32_GLOB_DAT: u32 = 40;
6244 #[allow(missing_docs)]
6245 pub const R_NDS32_JMP_SLOT: u32 = 41;
6246 #[allow(missing_docs)]
6247 pub const R_NDS32_RELATIVE: u32 = 42;
6248 #[allow(missing_docs)]
6249 pub const R_NDS32_TLS_TPOFF: u32 = 102;
6250 #[allow(missing_docs)]
6251 pub const R_NDS32_TLS_DESC: u32 = 119;
6252
6253 // LoongArch values `FileHeader*::e_flags`.
6254 /// Uses 64-bit GPRs and the stack for parameter passing
6255 pub const EF_LARCH_ABI_LP64S: u32 = 0x1;
6256 /// Uses 64-bit GPRs, 32-bit FPRs and the stack for parameter passing
6257 pub const EF_LARCH_ABI_LP64F: u32 = 0x2;
6258 /// Uses 64-bit GPRs, 64-bit FPRs and the stack for parameter passing
6259 pub const EF_LARCH_ABI_LP64D: u32 = 0x3;
6260 /// Uses 32-bit GPRs and the stack for parameter passing
6261 pub const EF_LARCH_ABI_ILP32S: u32 = 0x5;
6262 /// Uses 32-bit GPRs, 32-bit FPRs and the stack for parameter passing
6263 pub const EF_LARCH_ABI_ILP32F: u32 = 0x6;
6264 /// Uses 32-bit GPRs, 64-bit FPRs and the stack for parameter passing
6265 pub const EF_LARCH_ABI_ILP32D: u32 = 0x7;
6266
6267 // LoongArch values `Rel*::r_type`.
6268 /// No reloc
6269 pub const R_LARCH_NONE: u32 = 0;
6270 /// Runtime address resolving
6271 pub const R_LARCH_32: u32 = 1;
6272 /// Runtime address resolving
6273 pub const R_LARCH_64: u32 = 2;
6274 /// Runtime fixup for load-address
6275 pub const R_LARCH_RELATIVE: u32 = 3;
6276 /// Runtime memory copy in executable
6277 pub const R_LARCH_COPY: u32 = 4;
6278 /// Runtime PLT supporting
6279 pub const R_LARCH_JUMP_SLOT: u32 = 5;
6280 /// Runtime relocation for TLS-GD
6281 pub const R_LARCH_TLS_DTPMOD32: u32 = 6;
6282 /// Runtime relocation for TLS-GD
6283 pub const R_LARCH_TLS_DTPMOD64: u32 = 7;
6284 /// Runtime relocation for TLS-GD
6285 pub const R_LARCH_TLS_DTPREL32: u32 = 8;
6286 /// Runtime relocation for TLS-GD
6287 pub const R_LARCH_TLS_DTPREL64: u32 = 9;
6288 /// Runtime relocation for TLE-IE
6289 pub const R_LARCH_TLS_TPREL32: u32 = 10;
6290 /// Runtime relocation for TLE-IE
6291 pub const R_LARCH_TLS_TPREL64: u32 = 11;
6292 /// Runtime local indirect function resolving
6293 pub const R_LARCH_IRELATIVE: u32 = 12;
6294 /// Mark la.abs: load absolute address for static link.
6295 pub const R_LARCH_MARK_LA: u32 = 20;
6296 /// Mark external label branch: access PC relative address for static link.
6297 pub const R_LARCH_MARK_PCREL: u32 = 21;
6298 /// Push PC-relative offset
6299 pub const R_LARCH_SOP_PUSH_PCREL: u32 = 22;
6300 /// Push constant or absolute address
6301 pub const R_LARCH_SOP_PUSH_ABSOLUTE: u32 = 23;
6302 /// Duplicate stack top
6303 pub const R_LARCH_SOP_PUSH_DUP: u32 = 24;
6304 /// Push for access GOT entry
6305 pub const R_LARCH_SOP_PUSH_GPREL: u32 = 25;
6306 /// Push for TLS-LE
6307 pub const R_LARCH_SOP_PUSH_TLS_TPREL: u32 = 26;
6308 /// Push for TLS-IE
6309 pub const R_LARCH_SOP_PUSH_TLS_GOT: u32 = 27;
6310 /// Push for TLS-GD
6311 pub const R_LARCH_SOP_PUSH_TLS_GD: u32 = 28;
6312 /// Push for external function calling
6313 pub const R_LARCH_SOP_PUSH_PLT_PCREL: u32 = 29;
6314 /// Assert stack top
6315 pub const R_LARCH_SOP_ASSERT: u32 = 30;
6316 /// Stack top logical not (unary)
6317 pub const R_LARCH_SOP_NOT: u32 = 31;
6318 /// Stack top subtraction (binary)
6319 pub const R_LARCH_SOP_SUB: u32 = 32;
6320 /// Stack top left shift (binary)
6321 pub const R_LARCH_SOP_SL: u32 = 33;
6322 /// Stack top right shift (binary)
6323 pub const R_LARCH_SOP_SR: u32 = 34;
6324 /// Stack top addition (binary)
6325 pub const R_LARCH_SOP_ADD: u32 = 35;
6326 /// Stack top bitwise and (binary)
6327 pub const R_LARCH_SOP_AND: u32 = 36;
6328 /// Stack top selection (tertiary)
6329 pub const R_LARCH_SOP_IF_ELSE: u32 = 37;
6330 /// Pop stack top to fill 5-bit signed immediate operand
6331 pub const R_LARCH_SOP_POP_32_S_10_5: u32 = 38;
6332 /// Pop stack top to fill 12-bit unsigned immediate operand
6333 pub const R_LARCH_SOP_POP_32_U_10_12: u32 = 39;
6334 /// Pop stack top to fill 12-bit signed immediate operand
6335 pub const R_LARCH_SOP_POP_32_S_10_12: u32 = 40;
6336 /// Pop stack top to fill 16-bit signed immediate operand
6337 pub const R_LARCH_SOP_POP_32_S_10_16: u32 = 41;
6338 /// Pop stack top to fill 18-bit signed immediate operand with two trailing
6339 /// zeros implied
6340 pub const R_LARCH_SOP_POP_32_S_10_16_S2: u32 = 42;
6341 /// Pop stack top to fill 20-bit signed immediate operand
6342 pub const R_LARCH_SOP_POP_32_S_5_20: u32 = 43;
6343 /// Pop stack top to fill 23-bit signed immediate operand with two trailing
6344 /// zeros implied
6345 pub const R_LARCH_SOP_POP_32_S_0_5_10_16_S2: u32 = 44;
6346 /// Pop stack top to fill 28-bit signed immediate operand with two trailing
6347 /// zeros implied
6348 pub const R_LARCH_SOP_POP_32_S_0_10_10_16_S2: u32 = 45;
6349 /// Pop stack top to fill an instruction
6350 pub const R_LARCH_SOP_POP_32_U: u32 = 46;
6351 /// 8-bit in-place addition
6352 pub const R_LARCH_ADD8: u32 = 47;
6353 /// 16-bit in-place addition
6354 pub const R_LARCH_ADD16: u32 = 48;
6355 /// 24-bit in-place addition
6356 pub const R_LARCH_ADD24: u32 = 49;
6357 /// 32-bit in-place addition
6358 pub const R_LARCH_ADD32: u32 = 50;
6359 /// 64-bit in-place addition
6360 pub const R_LARCH_ADD64: u32 = 51;
6361 /// 8-bit in-place subtraction
6362 pub const R_LARCH_SUB8: u32 = 52;
6363 /// 16-bit in-place subtraction
6364 pub const R_LARCH_SUB16: u32 = 53;
6365 /// 24-bit in-place subtraction
6366 pub const R_LARCH_SUB24: u32 = 54;
6367 /// 32-bit in-place subtraction
6368 pub const R_LARCH_SUB32: u32 = 55;
6369 /// 64-bit in-place subtraction
6370 pub const R_LARCH_SUB64: u32 = 56;
6371 /// GNU C++ vtable hierarchy
6372 pub const R_LARCH_GNU_VTINHERIT: u32 = 57;
6373 /// GNU C++ vtable member usage
6374 pub const R_LARCH_GNU_VTENTRY: u32 = 58;
6375
6376 unsafe_impl_endian_pod!(
6377 FileHeader32,
6378 FileHeader64,
6379 SectionHeader32,
6380 SectionHeader64,
6381 CompressionHeader32,
6382 CompressionHeader64,
6383 Sym32,
6384 Sym64,
6385 Syminfo32,
6386 Syminfo64,
6387 Rel32,
6388 Rel64,
6389 Rela32,
6390 Rela64,
6391 ProgramHeader32,
6392 ProgramHeader64,
6393 Dyn32,
6394 Dyn64,
6395 Versym,
6396 Verdef,
6397 Verdaux,
6398 Verneed,
6399 Vernaux,
6400 NoteHeader32,
6401 NoteHeader64,
6402 HashHeader,
6403 GnuHashHeader,
6404 );