object/
elf.rs

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