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