elf/abi.rs
1//! Contains ELF constants defined in the ELF gABI and various extensions
2// See <http://www.sco.com/developers/gabi/latest/ch4.eheader.html#elfid>
3// Note: At least in 2022, it seems like the above site is not being updated. Official communication
4// occurs on the Generic System V Application Binary Interface mailing list:
5// <https://groups.google.com/g/generic-abi>
6
7// EI_* define indexes into the ELF File Header's e_ident[] byte array.
8// We define them as usize in order to use them to easily index into [u8].
9
10/// Location of first ELF magic number byte
11pub const EI_MAG0: usize = 0;
12/// Location of second ELF magic number byte
13pub const EI_MAG1: usize = 1;
14/// Location of third ELF magic number byte
15pub const EI_MAG2: usize = 2;
16/// Location of fourth ELF magic number byte
17pub const EI_MAG3: usize = 3;
18/// Location of ELF class field in ELF file header ident array
19pub const EI_CLASS: usize = 4;
20/// Location of data format field in ELF file header ident array
21pub const EI_DATA: usize = 5;
22/// Location of ELF version field in ELF file header ident array
23pub const EI_VERSION: usize = 6;
24/// Location of OS ABI field in ELF file header ident array
25pub const EI_OSABI: usize = 7;
26/// Location of ABI version field in ELF file header ident array
27pub const EI_ABIVERSION: usize = 8;
28/// Start of padding bytes
29pub const EI_PAD: usize = 9;
30/// Length of ELF file header platform-independent identification fields (e_ident[])
31pub const EI_NIDENT: usize = 16;
32
33/// ELF magic number byte 1
34pub const ELFMAG0: u8 = 0x7f;
35/// ELF magic number byte 2
36pub const ELFMAG1: u8 = 0x45;
37/// ELF magic number byte 3
38pub const ELFMAG2: u8 = 0x4c;
39/// ELF magic number byte 4
40pub const ELFMAG3: u8 = 0x46;
41pub const ELFMAGIC: [u8; 4] = [ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3];
42
43// ELFCLASS* define constants for e_ident[EI_CLASS]
44
45/// Invalid ELF file class
46pub const ELFCLASSNONE: u8 = 0;
47/// 32-bit ELF file
48pub const ELFCLASS32: u8 = 1;
49/// 64-bit ELF file
50pub const ELFCLASS64: u8 = 2;
51
52// ELFDATA* define constants for e_ident[EI_DATA]
53
54/// Invalid ELF data format
55pub const ELFDATANONE: u8 = 0;
56/// 2's complement values, with the least significant byte occupying the lowest address.
57pub const ELFDATA2LSB: u8 = 1;
58/// 2's complement values, with the most significant byte occupying the lowest address.
59pub const ELFDATA2MSB: u8 = 2;
60
61// ELFOSABI* define constants for e_ident[EI_OSABI]
62
63/// No extensions or unspecified
64pub const ELFOSABI_NONE: u8 = 0;
65/// Alias of unspecified for UNIX System V ABI
66pub const ELFOSABI_SYSV: u8 = 0;
67/// Hewlett-Packard HP-UX
68pub const ELFOSABI_HPUX: u8 = 1;
69/// NetBSD
70pub const ELFOSABI_NETBSD: u8 = 2;
71/// GNU
72pub const ELFOSABI_GNU: u8 = 3;
73/// Linux historical - alias for ELFOSABI_GNU
74pub const ELFOSABI_LINUX: u8 = 3;
75/// Sun Solaris
76pub const ELFOSABI_SOLARIS: u8 = 6;
77/// AIX
78pub const ELFOSABI_AIX: u8 = 7;
79/// IRIX
80pub const ELFOSABI_IRIX: u8 = 8;
81/// FreeBSD
82pub const ELFOSABI_FREEBSD: u8 = 9;
83/// Compaq TRU64 UNIX
84pub const ELFOSABI_TRU64: u8 = 10;
85/// Novell Modesto
86pub const ELFOSABI_MODESTO: u8 = 11;
87/// Open BSD
88pub const ELFOSABI_OPENBSD: u8 = 12;
89/// Open VMS
90pub const ELFOSABI_OPENVMS: u8 = 13;
91/// Hewlett-Packard Non-Stop Kernel
92pub const ELFOSABI_NSK: u8 = 14;
93/// Amiga Research OS
94pub const ELFOSABI_AROS: u8 = 15;
95/// The FenixOS highly scalable multi-core OS
96pub const ELFOSABI_FENIXOS: u8 = 16;
97/// Nuxi CloudABI
98pub const ELFOSABI_CLOUDABI: u8 = 17;
99/// Stratus Technologies OpenVOS
100pub const ELFOSABI_OPENVOS: u8 = 18;
101/// 64-255 Architecture-specific value range
102
103// ET_* define constants for the ELF File Header's e_type field.
104// Represented as Elf32_Half in Elf32_Ehdr and Elf64_Half in Elf64_Ehdr which
105// are both are 2-byte unsigned integers with 2-byte alignment
106
107/// No file type
108pub const ET_NONE: u16 = 0;
109/// Relocatable file
110pub const ET_REL: u16 = 1;
111/// Executable file
112pub const ET_EXEC: u16 = 2;
113/// Shared object file
114pub const ET_DYN: u16 = 3;
115/// Core file
116pub const ET_CORE: u16 = 4;
117/// Operating system-specific
118pub const ET_LOOS: u16 = 0xfe00;
119/// Operating system-specific
120pub const ET_HIOS: u16 = 0xfeff;
121/// Processor-specific
122pub const ET_LOPROC: u16 = 0xff00;
123/// Processor-specific
124pub const ET_HIPROC: u16 = 0xffff;
125
126// EM_* define constants for the ELF File Header's e_machine field.
127// Represented as Elf32_Half in Elf32_Ehdr and Elf64_Half in Elf64_Ehdr which
128// are both 2-byte unsigned integers with 2-byte alignment
129
130/// No machine
131pub const EM_NONE: u16 = 0;
132/// AT&T WE 32100
133pub const EM_M32: u16 = 1;
134/// SPARC
135pub const EM_SPARC: u16 = 2;
136/// Intel 80386
137pub const EM_386: u16 = 3;
138/// Motorola 68000
139pub const EM_68K: u16 = 4;
140/// Motorola 88000
141pub const EM_88K: u16 = 5;
142/// Intel MCU
143pub const EM_IAMCU: u16 = 6;
144/// Intel 80860
145pub const EM_860: u16 = 7;
146/// MIPS I Architecture
147pub const EM_MIPS: u16 = 8;
148/// IBM System/370 Processor
149pub const EM_S370: u16 = 9;
150/// MIPS RS3000 Little-endian
151pub const EM_MIPS_RS3_LE: u16 = 10;
152// 11-14 Reserved for future use
153/// Hewlett-Packard PA-RISC
154pub const EM_PARISC: u16 = 15;
155// 16 Reserved for future use
156/// Fujitsu VPP500
157pub const EM_VPP500: u16 = 17;
158/// Enhanced instruction set SPARC
159pub const EM_SPARC32PLUS: u16 = 18;
160/// Intel 80960
161pub const EM_960: u16 = 19;
162/// PowerPC
163pub const EM_PPC: u16 = 20;
164/// 64-bit PowerPC
165pub const EM_PPC64: u16 = 21;
166/// IBM System/390 Processor
167pub const EM_S390: u16 = 22;
168/// IBM SPU/SPC
169pub const EM_SPU: u16 = 23;
170// 24-35 Reserved for future use
171/// NEC V800
172pub const EM_V800: u16 = 36;
173/// Fujitsu FR20
174pub const EM_FR20: u16 = 37;
175/// TRW RH-32
176pub const EM_RH32: u16 = 38;
177/// Motorola RCE
178pub const EM_RCE: u16 = 39;
179/// ARM 32-bit architecture (AARCH32)
180pub const EM_ARM: u16 = 40;
181/// Digital Alpha
182pub const EM_ALPHA: u16 = 41;
183/// Hitachi SH
184pub const EM_SH: u16 = 42;
185/// SPARC Version 9
186pub const EM_SPARCV9: u16 = 43;
187/// Siemens TriCore embedded processor
188pub const EM_TRICORE: u16 = 44;
189/// Argonaut RISC Core, Argonaut Technologies Inc.
190pub const EM_ARC: u16 = 45;
191/// Hitachi H8/300
192pub const EM_H8_300: u16 = 46;
193/// Hitachi H8/300H
194pub const EM_H8_300H: u16 = 47;
195/// Hitachi H8S
196pub const EM_H8S: u16 = 48;
197/// Hitachi H8/500
198pub const EM_H8_500: u16 = 49;
199/// Intel IA-64 processor architecture
200pub const EM_IA_64: u16 = 50;
201/// Stanford MIPS-X
202pub const EM_MIPS_X: u16 = 51;
203/// Motorola ColdFire
204pub const EM_COLDFIRE: u16 = 52;
205/// Motorola M68HC12
206pub const EM_68HC12: u16 = 53;
207/// Fujitsu MMA Multimedia Accelerator
208pub const EM_MMA: u16 = 54;
209/// Siemens PCP
210pub const EM_PCP: u16 = 55;
211/// Sony nCPU embedded RISC processor
212pub const EM_NCPU: u16 = 56;
213/// Denso NDR1 microprocessor
214pub const EM_NDR1: u16 = 57;
215/// Motorola Star*Core processor
216pub const EM_STARCORE: u16 = 58;
217/// Toyota ME16 processor
218pub const EM_ME16: u16 = 59;
219/// STMicroelectronics ST100 processor
220pub const EM_ST100: u16 = 60;
221/// Advanced Logic Corp. TinyJ embedded processor family
222pub const EM_TINYJ: u16 = 61;
223/// AMD x86-64 architecture
224pub const EM_X86_64: u16 = 62;
225/// Sony DSP Processor
226pub const EM_PDSP: u16 = 63;
227/// Digital Equipment Corp. PDP-10
228pub const EM_PDP10: u16 = 64;
229/// Digital Equipment Corp. PDP-11
230pub const EM_PDP11: u16 = 65;
231/// Siemens FX66 microcontroller
232pub const EM_FX66: u16 = 66;
233/// STMicroelectronics ST9+ 8/16 bit microcontroller
234pub const EM_ST9PLUS: u16 = 67;
235/// STMicroelectronics ST7 8-bit microcontroller
236pub const EM_ST7: u16 = 68;
237/// Motorola MC68HC16 Microcontroller
238pub const EM_68HC16: u16 = 69;
239/// Motorola MC68HC11 Microcontroller
240pub const EM_68HC11: u16 = 70;
241/// Motorola MC68HC08 Microcontroller
242pub const EM_68HC08: u16 = 71;
243/// Motorola MC68HC05 Microcontroller
244pub const EM_68HC05: u16 = 72;
245/// Silicon Graphics SVx
246pub const EM_SVX: u16 = 73;
247/// STMicroelectronics ST19 8-bit microcontroller
248pub const EM_ST19: u16 = 74;
249/// Digital VAX
250pub const EM_VAX: u16 = 75;
251/// Axis Communications 32-bit embedded processor
252pub const EM_CRIS: u16 = 76;
253/// Infineon Technologies 32-bit embedded processor
254pub const EM_JAVELIN: u16 = 77;
255/// Element 14 64-bit DSP Processor
256pub const EM_FIREPATH: u16 = 78;
257/// LSI Logic 16-bit DSP Processor
258pub const EM_ZSP: u16 = 79;
259/// Donald Knuth's educational 64-bit processor
260pub const EM_MMIX: u16 = 80;
261/// Harvard University machine-independent object files
262pub const EM_HUANY: u16 = 81;
263/// SiTera Prism
264pub const EM_PRISM: u16 = 82;
265/// Atmel AVR 8-bit microcontroller
266pub const EM_AVR: u16 = 83;
267/// Fujitsu FR30
268pub const EM_FR30: u16 = 84;
269/// Mitsubishi D10V
270pub const EM_D10V: u16 = 85;
271/// Mitsubishi D30V
272pub const EM_D30V: u16 = 86;
273/// NEC v850
274pub const EM_V850: u16 = 87;
275/// Mitsubishi M32R
276pub const EM_M32R: u16 = 88;
277/// Matsushita MN10300
278pub const EM_MN10300: u16 = 89;
279/// Matsushita MN10200
280pub const EM_MN10200: u16 = 90;
281/// picoJava
282pub const EM_PJ: u16 = 91;
283/// OpenRISC 32-bit embedded processor
284pub const EM_OPENRISC: u16 = 92;
285/// ARC International ARCompact processor (old spelling/synonym: EM_ARC_A5)
286pub const EM_ARC_COMPACT: u16 = 93;
287/// Tensilica Xtensa Architecture
288pub const EM_XTENSA: u16 = 94;
289/// Alphamosaic VideoCore processor
290pub const EM_VIDEOCORE: u16 = 95;
291/// Thompson Multimedia General Purpose Processor
292pub const EM_TMM_GPP: u16 = 96;
293/// National Semiconductor 32000 series
294pub const EM_NS32K: u16 = 97;
295/// Tenor Network TPC processor
296pub const EM_TPC: u16 = 98;
297/// Trebia SNP 1000 processor
298pub const EM_SNP1K: u16 = 99;
299/// STMicroelectronics (www.st.com) ST200 microcontroller
300pub const EM_ST200: u16 = 100;
301/// Ubicom IP2xxx microcontroller family
302pub const EM_IP2K: u16 = 101;
303/// MAX Processor
304pub const EM_MAX: u16 = 102;
305/// National Semiconductor CompactRISC microprocessor
306pub const EM_CR: u16 = 103;
307/// Fujitsu F2MC16
308pub const EM_F2MC16: u16 = 104;
309/// Texas Instruments embedded microcontroller msp430
310pub const EM_MSP430: u16 = 105;
311/// Analog Devices Blackfin (DSP) processor
312pub const EM_BLACKFIN: u16 = 106;
313/// S1C33 Family of Seiko Epson processors
314pub const EM_SE_C33: u16 = 107;
315/// Sharp embedded microprocessor
316pub const EM_SEP: u16 = 108;
317/// Arca RISC Microprocessor
318pub const EM_ARCA: u16 = 109;
319/// Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University
320pub const EM_UNICORE: u16 = 110;
321/// eXcess: 16/32/64-bit configurable embedded CPU
322pub const EM_EXCESS: u16 = 111;
323/// Icera Semiconductor Inc. Deep Execution Processor
324pub const EM_DXP: u16 = 112;
325/// Altera Nios II soft-core processor
326pub const EM_ALTERA_NIOS2: u16 = 113;
327/// National Semiconductor CompactRISC CRX microprocessor
328pub const EM_CRX: u16 = 114;
329/// Motorola XGATE embedded processor
330pub const EM_XGATE: u16 = 115;
331/// Infineon C16x/XC16x processor
332pub const EM_C166: u16 = 116;
333/// Renesas M16C series microprocessors
334pub const EM_M16C: u16 = 117;
335/// Microchip Technology dsPIC30F Digital Signal Controller
336pub const EM_DSPIC30F: u16 = 118;
337/// Freescale Communication Engine RISC core
338pub const EM_CE: u16 = 119;
339/// Renesas M32C series microprocessors
340pub const EM_M32C: u16 = 120;
341// 121-130 Reserved for future use
342/// Altium TSK3000 core
343pub const EM_TSK3000: u16 = 131;
344/// Freescale RS08 embedded processor
345pub const EM_RS08: u16 = 132;
346/// Analog Devices SHARC family of 32-bit DSP processors
347pub const EM_SHARC: u16 = 133;
348/// Cyan Technology eCOG2 microprocessor
349pub const EM_ECOG2: u16 = 134;
350/// Sunplus S+core7 RISC processor
351pub const EM_SCORE7: u16 = 135;
352/// New Japan Radio (NJR) 24-bit DSP Processor
353pub const EM_DSP24: u16 = 136;
354/// Broadcom VideoCore III processor
355pub const EM_VIDEOCORE3: u16 = 137;
356/// RISC processor for Lattice FPGA architecture
357pub const EM_LATTICEMICO32: u16 = 138;
358/// Seiko Epson C17 family
359pub const EM_SE_C17: u16 = 139;
360/// The Texas Instruments TMS320C6000 DSP family
361pub const EM_TI_C6000: u16 = 140;
362/// The Texas Instruments TMS320C2000 DSP family
363pub const EM_TI_C2000: u16 = 141;
364/// The Texas Instruments TMS320C55x DSP family
365pub const EM_TI_C5500: u16 = 142;
366/// Texas Instruments Application Specific RISC Processor, 32bit fetch
367pub const EM_TI_ARP32: u16 = 143;
368/// Texas Instruments Programmable Realtime Unit
369pub const EM_TI_PRU: u16 = 144;
370// 145-159 Reserved for future use
371/// STMicroelectronics 64bit VLIW Data Signal Processor
372pub const EM_MMDSP_PLUS: u16 = 160;
373/// Cypress M8C microprocessor
374pub const EM_CYPRESS_M8C: u16 = 161;
375/// Renesas R32C series microprocessors
376pub const EM_R32C: u16 = 162;
377/// NXP Semiconductors TriMedia architecture family
378pub const EM_TRIMEDIA: u16 = 163;
379/// QUALCOMM DSP6 Processor
380pub const EM_QDSP6: u16 = 164;
381/// Intel 8051 and variants
382pub const EM_8051: u16 = 165;
383/// STMicroelectronics STxP7x family of configurable and extensible RISC processors
384pub const EM_STXP7X: u16 = 166;
385/// Andes Technology compact code size embedded RISC processor family
386pub const EM_NDS32: u16 = 167;
387/// Cyan Technology eCOG1X family
388pub const EM_ECOG1: u16 = 168;
389/// Cyan Technology eCOG1X family
390pub const EM_ECOG1X: u16 = 168;
391/// Dallas Semiconductor MAXQ30 Core Micro-controllers
392pub const EM_MAXQ30: u16 = 169;
393/// New Japan Radio (NJR) 16-bit DSP Processor
394pub const EM_XIMO16: u16 = 170;
395/// M2000 Reconfigurable RISC Microprocessor
396pub const EM_MANIK: u16 = 171;
397/// Cray Inc. NV2 vector architecture
398pub const EM_CRAYNV2: u16 = 172;
399/// Renesas RX family
400pub const EM_RX: u16 = 173;
401/// Imagination Technologies META processor architecture
402pub const EM_METAG: u16 = 174;
403/// MCST Elbrus general purpose hardware architecture
404pub const EM_MCST_ELBRUS: u16 = 175;
405/// Cyan Technology eCOG16 family
406pub const EM_ECOG16: u16 = 176;
407/// National Semiconductor CompactRISC CR16 16-bit microprocessor
408pub const EM_CR16: u16 = 177;
409/// Freescale Extended Time Processing Unit
410pub const EM_ETPU: u16 = 178;
411/// Infineon Technologies SLE9X core
412pub const EM_SLE9X: u16 = 179;
413/// Intel L10M
414pub const EM_L10M: u16 = 180;
415/// Intel K10M
416pub const EM_K10M: u16 = 181;
417// 182 Reserved for future Intel use
418/// ARM 64-bit architecture (AARCH64)
419pub const EM_AARCH64: u16 = 183;
420// 184 Reserved for future ARM use
421/// Atmel Corporation 32-bit microprocessor family
422pub const EM_AVR32: u16 = 185;
423/// STMicroeletronics STM8 8-bit microcontroller
424pub const EM_STM8: u16 = 186;
425/// Tilera TILE64 multicore architecture family
426pub const EM_TILE64: u16 = 187;
427/// Tilera TILEPro multicore architecture family
428pub const EM_TILEPRO: u16 = 188;
429/// Xilinx MicroBlaze 32-bit RISC soft processor core
430pub const EM_MICROBLAZE: u16 = 189;
431/// NVIDIA CUDA architecture
432pub const EM_CUDA: u16 = 190;
433/// Tilera TILE-Gx multicore architecture family
434pub const EM_TILEGX: u16 = 191;
435/// CloudShield architecture family
436pub const EM_CLOUDSHIELD: u16 = 192;
437/// KIPO-KAIST Core-A 1st generation processor family
438pub const EM_COREA_1ST: u16 = 193;
439/// KIPO-KAIST Core-A 2nd generation processor family
440pub const EM_COREA_2ND: u16 = 194;
441/// Synopsys ARCompact V2
442pub const EM_ARC_COMPACT2: u16 = 195;
443/// Open8 8-bit RISC soft processor core
444pub const EM_OPEN8: u16 = 196;
445/// Renesas RL78 family
446pub const EM_RL78: u16 = 197;
447/// Broadcom VideoCore V processor
448pub const EM_VIDEOCORE5: u16 = 198;
449/// Renesas 78KOR family
450pub const EM_78KOR: u16 = 199;
451/// Freescale 56800EX Digital Signal Controller (DSC)
452pub const EM_56800EX: u16 = 200;
453/// Beyond BA1 CPU architecture
454pub const EM_BA1: u16 = 201;
455/// Beyond BA2 CPU architecture
456pub const EM_BA2: u16 = 202;
457/// XMOS xCORE processor family
458pub const EM_XCORE: u16 = 203;
459/// Microchip 8-bit PIC(r) family
460pub const EM_MCHP_PIC: u16 = 204;
461/// Reserved by Intel
462pub const EM_INTEL205: u16 = 205;
463/// Reserved by Intel
464pub const EM_INTEL206: u16 = 206;
465/// Reserved by Intel
466pub const EM_INTEL207: u16 = 207;
467/// Reserved by Intel
468pub const EM_INTEL208: u16 = 208;
469/// Reserved by Intel
470pub const EM_INTEL209: u16 = 209;
471/// KM211 KM32 32-bit processor
472pub const EM_KM32: u16 = 210;
473/// KM211 KMX32 32-bit processor
474pub const EM_KMX32: u16 = 211;
475/// KM211 KMX16 16-bit processor
476pub const EM_KMX16: u16 = 212;
477/// KM211 KMX8 8-bit processor
478pub const EM_KMX8: u16 = 213;
479/// KM211 KVARC processor
480pub const EM_KVARC: u16 = 214;
481/// Paneve CDP architecture family
482pub const EM_CDP: u16 = 215;
483/// Cognitive Smart Memory Processor
484pub const EM_COGE: u16 = 216;
485/// Bluechip Systems CoolEngine
486pub const EM_COOL: u16 = 217;
487/// Nanoradio Optimized RISC
488pub const EM_NORC: u16 = 218;
489/// CSR Kalimba architecture family
490pub const EM_CSR_KALIMBA: u16 = 219;
491/// Zilog Z80
492pub const EM_Z80: u16 = 220;
493/// Controls and Data Services VISIUMcore processor
494pub const EM_VISIUM: u16 = 221;
495/// FTDI Chip FT32 high performance 32-bit RISC architecture
496pub const EM_FT32: u16 = 222;
497/// Moxie processor family
498pub const EM_MOXIE: u16 = 223;
499/// AMD GPU architecture
500pub const EM_AMDGPU: u16 = 224;
501/// RISC-V
502pub const EM_RISCV: u16 = 243;
503/// Linux BPF
504pub const EM_BPF: u16 = 247;
505
506// EV_* define constants for the ELF File Header's e_version field.
507// Represented as Elf32_Word in Elf32_Ehdr and Elf64_Word in Elf64_Ehdr which
508// are both 4-byte unsigned integers with 4-byte alignment
509
510/// Invalid version
511pub const EV_NONE: u8 = 0;
512/// Current version
513pub const EV_CURRENT: u8 = 1;
514
515/// If the number of program headers is greater than or equal to PN_XNUM (0xffff),
516/// this member has the value PN_XNUM (0xffff). The actual number of
517/// program header table entries is contained in the sh_info field of the
518/// section header at index 0. Otherwise, the sh_info member of the initial
519/// section header entry contains the value zero.
520pub const PN_XNUM: u16 = 0xffff;
521
522// PF_* define constants for the ELF Program Header's p_flags field.
523// Represented as Elf32_Word in Elf32_Ehdr and Elf64_Word in Elf64_Ehdr which
524// are both 4-byte unsigned integers with 4-byte alignment
525
526pub const PF_NONE: u32 = 0;
527/// Executable program segment
528pub const PF_X: u32 = 1;
529/// Writable program segment
530pub const PF_W: u32 = 2;
531/// Readable program segment
532pub const PF_R: u32 = 4;
533// All bits included in the PF_MASKOS mask are reserved for operating system-specific semantics.
534pub const PF_MASKOS: u32 = 0x0ff00000;
535// All bits included in the PF_MASKPROC mask are reserved for processor-specific semantics.
536pub const PF_MASKPROC: u32 = 0xf0000000;
537
538// PT_* define constants for the ELF Program Header's p_type field.
539// Represented as Elf32_Word in Elf32_Ehdr and Elf64_Word in Elf64_Ehdr which
540// are both 4-byte unsigned integers with 4-byte alignment
541
542/// Program header table entry unused
543pub const PT_NULL: u32 = 0;
544/// Loadable program segment
545pub const PT_LOAD: u32 = 1;
546/// Dynamic linking information
547pub const PT_DYNAMIC: u32 = 2;
548/// Program interpreter
549pub const PT_INTERP: u32 = 3;
550/// Auxiliary information
551pub const PT_NOTE: u32 = 4;
552/// Unused
553pub const PT_SHLIB: u32 = 5;
554/// The program header table
555pub const PT_PHDR: u32 = 6;
556/// Thread-local storage segment
557pub const PT_TLS: u32 = 7;
558/// GCC .eh_frame_hdr segment
559pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
560/// Indicates stack executability
561pub const PT_GNU_STACK: u32 = 0x6474e551;
562/// Read-only after relocation
563pub const PT_GNU_RELRO: u32 = 0x6474e552;
564/// The segment contains .note.gnu.property section
565pub const PT_GNU_PROPERTY: u32 = 0x6474e553;
566/// Values between [PT_LOOS, PT_HIOS] in this inclusive range are reserved for
567/// operating system-specific semantics.
568pub const PT_LOOS: u32 = 0x60000000;
569/// Values between [PT_LOOS, PT_HIOS] in this inclusive range are reserved for
570/// operating system-specific semantics.
571pub const PT_HIOS: u32 = 0x6fffffff;
572/// Values between [PT_LOPROC, PT_HIPROC] in this inclusive range are reserved
573/// for processor-specific semantics.
574pub const PT_LOPROC: u32 = 0x70000000;
575/// Values between [PT_LOPROC, PT_HIPROC] in this inclusive range are reserved
576/// for processor-specific semantics.
577pub const PT_HIPROC: u32 = 0x7fffffff;
578
579// SHT_* define constants for the ELF Section Header's p_type field.
580// Represented as Elf32_Word in Elf32_Ehdr and Elf64_Word in Elf64_Ehdr which
581// are both 4-byte unsigned integers with 4-byte alignment
582
583/// Inactive section with undefined values
584pub const SHT_NULL: u32 = 0;
585/// Information defined by the program, includes executable code and data
586pub const SHT_PROGBITS: u32 = 1;
587/// Section data contains a symbol table
588pub const SHT_SYMTAB: u32 = 2;
589/// Section data contains a string table
590pub const SHT_STRTAB: u32 = 3;
591/// Section data contains relocation entries with explicit addends
592pub const SHT_RELA: u32 = 4;
593/// Section data contains a symbol hash table. Must be present for dynamic linking
594pub const SHT_HASH: u32 = 5;
595/// Section data contains information for dynamic linking
596pub const SHT_DYNAMIC: u32 = 6;
597/// Section data contains information that marks the file in some way
598pub const SHT_NOTE: u32 = 7;
599/// Section data occupies no space in the file but otherwise resembles SHT_PROGBITS
600pub const SHT_NOBITS: u32 = 8;
601/// Section data contains relocation entries without explicit addends
602pub const SHT_REL: u32 = 9;
603/// Section is reserved but has unspecified semantics
604pub const SHT_SHLIB: u32 = 10;
605/// Section data contains a minimal set of dynamic linking symbols
606pub const SHT_DYNSYM: u32 = 11;
607/// Section data contains an array of constructors
608pub const SHT_INIT_ARRAY: u32 = 14;
609/// Section data contains an array of destructors
610pub const SHT_FINI_ARRAY: u32 = 15;
611/// Section data contains an array of pre-constructors
612pub const SHT_PREINIT_ARRAY: u32 = 16;
613/// Section group
614pub const SHT_GROUP: u32 = 17;
615/// Extended symbol table section index
616pub const SHT_SYMTAB_SHNDX: u32 = 18;
617/// Values in [SHT_LOOS, SHT_HIOS] are reserved for operating system-specific semantics.
618pub const SHT_LOOS: u32 = 0x60000000;
619/// Object attributes
620pub const SHT_GNU_ATTRIBUTES: u32 = 0x6ffffff5;
621/// GNU-style hash section
622pub const SHT_GNU_HASH: u32 = 0x6ffffff6;
623/// Pre-link library list
624pub const SHT_GNU_LIBLIST: u32 = 0x6ffffff7;
625/// Version definition section
626pub const SHT_GNU_VERDEF: u32 = 0x6ffffffd;
627/// Version needs section
628pub const SHT_GNU_VERNEED: u32 = 0x6ffffffe;
629/// Version symbol table
630pub const SHT_GNU_VERSYM: u32 = 0x6fffffff;
631/// Values in [SHT_LOOS, SHT_HIOS] are reserved for operating system-specific semantics.
632pub const SHT_HIOS: u32 = 0x6fffffff;
633/// Values in [SHT_LOPROC, SHT_HIPROC] are reserved for processor-specific semantics.
634pub const SHT_LOPROC: u32 = 0x70000000;
635/// IA_64 extension bits
636pub const SHT_IA_64_EXT: u32 = 0x70000000; // SHT_LOPROC + 0;
637/// IA_64 unwind section
638pub const SHT_IA_64_UNWIND: u32 = 0x70000001; // SHT_LOPROC + 1;
639/// Values in [SHT_LOPROC, SHT_HIPROC] are reserved for processor-specific semantics.
640pub const SHT_HIPROC: u32 = 0x7fffffff;
641/// Values in [SHT_LOUSER, SHT_HIUSER] are reserved for application-specific semantics.
642pub const SHT_LOUSER: u32 = 0x80000000;
643/// Values in [SHT_LOUSER, SHT_HIUSER] are reserved for application-specific semantics.
644pub const SHT_HIUSER: u32 = 0x8fffffff;
645
646/// This value marks an undefined, missing, irrelevant, or otherwise meaningless
647/// section reference.
648pub const SHN_UNDEF: u16 = 0;
649/// Symbols with st_shndx=SHN_ABS are absolute and are not affected by relocation.
650pub const SHN_ABS: u16 = 0xfff1;
651/// Symbols with st_shndx=SHN_COMMON are sometimes used for unallocated C external variables.
652pub const SHN_COMMON: u16 = 0xfff2;
653pub const SHN_XINDEX: u16 = 0xffff;
654
655// SHF_* define constants for the ELF Section Header's sh_flags field.
656// Represented as Elf32_Word in Elf32_Ehdr and Elf64_Xword in Elf64_Ehdr which
657// are both 4-byte and 8-byte unsigned integers, respectively.
658// All of the constants are < 32-bits, so we use a u32 to represent these in order
659// to make working with them easier.
660
661/// Empty flags
662pub const SHF_NONE: u32 = 0;
663/// The section contains data that should be writable during process execution.
664pub const SHF_WRITE: u32 = 1;
665/// The section occupies memory during process execution. Some control sections
666/// do not reside in the memory image of an object file; this attribute is off for
667/// those sections.
668pub const SHF_ALLOC: u32 = 1 << 1;
669/// The section contains executable machine instructions.
670pub const SHF_EXECINSTR: u32 = 1 << 2;
671/// The data in the section may be merged to eliminate duplication. Unless the
672/// SHF_STRINGS flag is also set, the data elements in the section are of a uniform size.
673/// The size of each element is specified in the section header's sh_entsize field. If
674/// the SHF_STRINGS flag is also set, the data elements consist of null-terminated
675/// character strings. The size of each character is specified in the section header's
676/// sh_entsize field.
677///
678/// Each element in the section is compared against other elements in sections with the
679/// same name, type and flags. Elements that would have identical values at program
680/// run-time may be merged. Relocations referencing elements of such sections must be
681/// resolved to the merged locations of the referenced values. Note that any relocatable
682/// values, including values that would result in run-time relocations, must be analyzed
683/// to determine whether the run-time values would actually be identical. An
684/// ABI-conforming object file may not depend on specific elements being merged, and an
685/// ABI-conforming link editor may choose not to merge specific elements.
686pub const SHF_MERGE: u32 = 1 << 4;
687/// The data elements in the section consist of null-terminated character strings.
688/// The size of each character is specified in the section header's sh_entsize field.
689pub const SHF_STRINGS: u32 = 1 << 5;
690/// The sh_info field of this section header holds a section header table index.
691pub const SHF_INFO_LINK: u32 = 1 << 6;
692/// This flag adds special ordering requirements for link editors. The requirements
693/// apply if the sh_link field of this section's header references another section (the
694/// linked-to section). If this section is combined with other sections in the output
695/// file, it must appear in the same relative order with respect to those sections,
696/// as the linked-to section appears with respect to sections the linked-to section is
697/// combined with.
698pub const SHF_LINK_ORDER: u32 = 1 << 7;
699/// This section requires special OS-specific processing (beyond the standard linking
700/// rules) to avoid incorrect behavior. If this section has either an sh_type value or
701/// contains sh_flags bits in the OS-specific ranges for those fields, and a link
702/// editor processing this section does not recognize those values, then the link editor
703/// should reject the object file containing this section with an error.
704pub const SHF_OS_NONCONFORMING: u32 = 1 << 8;
705/// This section is a member (perhaps the only one) of a section group. The section must
706/// be referenced by a section of type SHT_GROUP. The SHF_GROUP flag may be set only for
707/// sections contained in relocatable objects (objects with the ELF header e_type member
708/// set to ET_REL).
709pub const SHF_GROUP: u32 = 1 << 9;
710/// This section holds Thread-Local Storage, meaning that each separate execution flow
711/// has its own distinct instance of this data. Implementations need not support this flag.
712pub const SHF_TLS: u32 = 1 << 10;
713/// This flag identifies a section containing compressed data. SHF_COMPRESSED applies only
714/// to non-allocable sections, and cannot be used in conjunction with SHF_ALLOC. In
715/// addition, SHF_COMPRESSED cannot be applied to sections of type SHT_NOBITS.
716///
717/// All relocations to a compressed section specifiy offsets to the uncompressed section
718/// data. It is therefore necessary to decompress the section data before relocations can
719/// be applied. Each compressed section specifies the algorithm independently. It is
720/// permissible for different sections in a given ELF object to employ different
721/// compression algorithms.
722///
723/// Compressed sections begin with a compression header structure that identifies the
724/// compression algorithm.
725pub const SHF_COMPRESSED: u32 = 1 << 11;
726/// Masked bits are reserved for operating system-specific semantics.
727pub const SHF_MASKOS: u32 = 0x0ff00000;
728/// Masked bits are reserved for processor-specific semantics.
729pub const SHF_MASKPROC: u32 = 0xf0000000;
730
731// STT_* define constants for the ELF Symbol's st_type (encoded in the st_info field).
732
733/// Unspecified symbol type
734pub const STT_NOTYPE: u8 = 0;
735/// Data object symbol
736pub const STT_OBJECT: u8 = 1;
737/// Code object symbol
738pub const STT_FUNC: u8 = 2;
739/// Section symbol
740pub const STT_SECTION: u8 = 3;
741/// File name symbol
742pub const STT_FILE: u8 = 4;
743/// Common data object symbol
744pub const STT_COMMON: u8 = 5;
745/// Thread-local data object symbol
746pub const STT_TLS: u8 = 6;
747/// Indirect code object symbol
748pub const STT_GNU_IFUNC: u8 = 10;
749/// Values between [STT_LOOS, STT_HIOS] in this inclusive range are reserved for
750/// operating system-specific semantics.
751pub const STT_LOOS: u8 = 10;
752/// Values between [STT_LOOS, STT_HIOS] in this inclusive range are reserved for
753/// operating system-specific semantics.
754pub const STT_HIOS: u8 = 12;
755/// Values between [STT_LOPROC, STT_HIPROC] in this inclusive range are reserved
756/// for processor-specific semantics.
757pub const STT_LOPROC: u8 = 13;
758/// Values between [STT_LOPROC, STT_HIPROC] in this inclusive range are reserved
759/// for processor-specific semantics.
760pub const STT_HIPROC: u8 = 15;
761
762// STB_* define constants for the ELF Symbol's st_bind (encoded in the st_info field).
763
764/// Local symbols are not visible outside the object file containing their
765/// definition. Local symbols of the same name may exist in multiple files
766/// without interfering with each other.
767pub const STB_LOCAL: u8 = 0;
768/// Global symbols are visible to all object files being combined. One file's
769/// definition of a global symbol will satisfy another file's undefined
770/// reference to the same global symbol.
771pub const STB_GLOBAL: u8 = 1;
772/// Weak symbols resemble global symbols, but their definitions have lower
773/// precedence.
774pub const STB_WEAK: u8 = 2;
775/// Unique symbol
776pub const STB_GNU_UNIQUE: u8 = 10;
777/// Values between [STB_LOOS, STB_HIOS] in this inclusive range are reserved for
778/// operating system-specific semantics.
779pub const STB_LOOS: u8 = 10;
780/// Values between [STB_LOOS, STB_HIOS] in this inclusive range are reserved for
781/// operating system-specific semantics.
782pub const STB_HIOS: u8 = 12;
783/// Values between [STB_LOPROC, STB_HIPROC] in this inclusive range are reserved
784/// for processor-specific semantics.
785pub const STB_LOPROC: u8 = 13;
786/// Values between [STB_LOPROC, STB_HIPROC] in this inclusive range are reserved
787/// for processor-specific semantics.
788pub const STB_HIPROC: u8 = 15;
789
790/// STV_* define constants for the ELF Symbol's st_visibility (encoded in the st_other field).
791
792/// The visibility of symbols with the STV_DEFAULT attribute is as specified by
793/// the symbol's binding type. That is, global and weak symbols are visible
794/// outside of their defining component (executable file or shared object).
795/// Local symbols are hidden, as described below. Global and weak symbols are
796/// also preemptable, that is, they may by preempted by definitions of the same
797/// name in another component.
798pub const STV_DEFAULT: u8 = 0;
799/// The meaning of this visibility attribute may be defined by processor
800/// supplements to further constrain hidden symbols. A processor supplement's
801/// definition should be such that generic tools can safely treat internal
802/// symbols as hidden.
803pub const STV_INTERNAL: u8 = 1;
804/// A symbol defined in the current component is hidden if its name is not
805/// visible to other components. Such a symbol is necessarily protected. This
806/// attribute may be used to control the external interface of a component. Note
807/// that an object named by such a symbol may still be referenced from another
808/// component if its address is passed outside.
809pub const STV_HIDDEN: u8 = 2;
810/// A symbol defined in the current component is protected if it is visible in
811/// other components but not preemptable, meaning that any reference to such a
812/// symbol from within the defining component must be resolved to the definition
813/// in that component, even if there is a definition in another component that
814/// would preempt by the default rules.
815pub const STV_PROTECTED: u8 = 3;
816
817/// An entry with a DT_NULL tag marks the end of the _DYNAMIC array.
818pub const DT_NULL: i64 = 0;
819/// This element holds the string table offset of a null-terminated string,
820/// giving the name of a needed library. The offset is an index into the table
821/// recorded in the DT_STRTAB code. The dynamic array may contain multiple
822/// entries with this type. These entries' relative order is significant, though
823/// their relation to entries of other types is not.
824pub const DT_NEEDED: i64 = 1;
825/// This element holds the total size, in bytes, of the relocation entries
826/// associated with the procedure linkage table. If an entry of type DT_JMPREL
827/// is present, a DT_PLTRELSZ must accompany it.
828pub const DT_PLTRELSZ: i64 = 2;
829/// This element holds an address associated with the procedure linkage table
830/// and/or the global offset table.
831pub const DT_PLTGOT: i64 = 3;
832/// This element holds the address of the symbol hash table. This hash table
833/// refers to the symbol table referenced by the DT_SYMTAB element.
834pub const DT_HASH: i64 = 4;
835/// This element holds the address of the string table. Symbol names, library
836/// names, and other strings reside in this table.
837pub const DT_STRTAB: i64 = 5;
838/// This element holds the address of the symbol table.
839pub const DT_SYMTAB: i64 = 6;
840/// This element holds the address of a relocation table. Entries in the table
841/// have explicit addends, (Rela). An object file may have multiple relocation
842/// sections. When building the relocation table for an executable or shared
843/// object file, the link editor catenates those sections to form a single
844/// table. Although the sections remain independent in the object file, the
845/// dynamic linker sees a single table. When the dynamic linker creates the
846/// process image for an executable file or adds a shared object to the process
847/// image, it reads the relocation table and performs the associated actions.
848/// If this element is present, the dynamic structure must also have DT_RELASZ
849/// and DT_RELAENT elements. When relocation is mandatory for a file, either
850/// DT_RELA or DT_REL may occur (both are permitted but not required).
851pub const DT_RELA: i64 = 7;
852/// This element holds the total size, in bytes, of the DT_RELA relocation table.
853pub const DT_RELASZ: i64 = 8;
854/// This element holds the size, in bytes, of the DT_RELA relocation entry.
855pub const DT_RELAENT: i64 = 9;
856/// This element holds the size, in bytes, of the string table.
857pub const DT_STRSZ: i64 = 10;
858/// This element holds the size, in bytes, of a symbol table entry.
859pub const DT_SYMENT: i64 = 11;
860/// This element holds the address of the initialization function.
861pub const DT_INIT: i64 = 12;
862/// This element holds the address of the termination function.
863pub const DT_FINI: i64 = 13;
864/// This element holds the string table offset of a null-terminated string,
865/// giving the name of the shared object. The offset is an index into the table
866/// recorded in the DT_STRTAB entry.
867pub const DT_SONAME: i64 = 14;
868/// This element holds the string table offset of a null-terminated search
869/// library search path string. The offset is an index into the table recorded
870/// in the DT_STRTAB entry. Its use has been superseded by DT_RUNPATH.
871pub const DT_RPATH: i64 = 15;
872/// This element's presence in a shared object library alters the dynamic
873/// linker's symbol resolution algorithm for references within the library.
874/// Instead of starting a symbol search with the executable file, the dynamic
875/// linker starts from the shared object itself. If the shared object fails to
876/// supply the referenced symbol, the dynamic linker then searches the
877/// executable file and other shared objects as usual. Its use has been
878/// superseded by the DF_SYMBOLIC flag.
879pub const DT_SYMBOLIC: i64 = 16;
880/// This element is similar to DT_RELA, except its table has implicit addends (Rel).
881/// If this element is present, the dynamic structure must also have DT_RELSZ
882/// and DT_RELENT elements.
883pub const DT_REL: i64 = 17;
884/// This element holds the total size, in bytes, of the DT_REL relocation table.
885pub const DT_RELSZ: i64 = 18;
886/// This element holds the size, in bytes, of the DT_REL relocation entry.
887pub const DT_RELENT: i64 = 19;
888/// This member specifies the type of relocation entry to which the procedure
889/// linkage table refers. The d_val member holds DT_REL or DT_RELA, as
890/// appropriate. All relocations in a procedure linkage table must use the same
891/// relocation.
892pub const DT_PLTREL: i64 = 20;
893/// This member is used for debugging. Its contents are not specified for the
894/// ABI; programs that access this entry are not ABI-conforming.
895pub const DT_DEBUG: i64 = 21;
896/// This member's absence signifies that no relocation entry should cause a
897/// modification to a non-writable segment, as specified by the segment
898/// permissions in the program header table. If this member is present, one or
899/// more relocation entries might request modifications to a non-writable
900/// segment, and the dynamic linker can prepare accordingly. Its use has been
901/// superseded by the DF_TEXTREL flag.
902pub const DT_TEXTREL: i64 = 22;
903/// If present, this entry's d_ptr member holds the address of relocation
904/// entries associated solely with the procedure linkage table. Separating these
905/// relocation entries lets the dynamic linker ignore them during process
906/// initialization, if lazy binding is enabled. If this entry is present, the
907/// related entries of types DT_PLTRELSZ and DT_PLTREL must also be present.
908pub const DT_JMPREL: i64 = 23;
909/// If present in a shared object or executable, this entry instructs the
910/// dynamic linker to process all relocations for the object containing this
911/// entry before transferring control to the program. The presence of this entry
912/// takes precedence over a directive to use lazy binding for this object when
913/// specified through the environment or via dlopen(BA_LIB). Its use has been
914/// superseded by the DF_BIND_NOW flag.
915pub const DT_BIND_NOW: i64 = 24;
916/// This element holds the address of the array of pointers to initialization functions.
917pub const DT_INIT_ARRAY: i64 = 25;
918/// This element holds the address of the array of pointers to termination functions.
919pub const DT_FINI_ARRAY: i64 = 26;
920/// This element holds the size in bytes of the array of initialization
921/// functions pointed to by the DT_INIT_ARRAY entry. If an object has a
922/// DT_INIT_ARRAY entry, it must also have a DT_INIT_ARRAYSZ entry.
923pub const DT_INIT_ARRAYSZ: i64 = 27;
924/// This element holds the size in bytes of the array of termination functions
925/// pointed to by the DT_FINI_ARRAY entry. If an object has a DT_FINI_ARRAY
926/// entry, it must also have a DT_FINI_ARRAYSZ entry.
927pub const DT_FINI_ARRAYSZ: i64 = 28;
928/// This element holds the string table offset of a null-terminated library
929/// search path string. The offset is an index into the table recorded in the
930/// DT_STRTAB entry.
931pub const DT_RUNPATH: i64 = 29;
932/// This element holds flag values specific to the object being loaded. Each
933/// flag value will have the name DF_flag_name. Defined values and their
934/// meanings are described below. All other values are reserved.
935pub const DT_FLAGS: i64 = 30;
936/// This element holds the address of the array of pointers to
937/// pre-initialization functions. The DT_PREINIT_ARRAY table is processed only
938/// in an executable file; it is ignored if contained in a shared object.
939pub const DT_PREINIT_ARRAY: i64 = 32;
940/// This element holds the size in bytes of the array of pre-initialization
941/// functions pointed to by the DT_PREINIT_ARRAY entry. If an object has a
942/// DT_PREINIT_ARRAY entry, it must also have a DT_PREINIT_ARRAYSZ entry. As
943/// with DT_PREINIT_ARRAY, this entry is ignored if it appears in a shared
944/// object.
945pub const DT_PREINIT_ARRAYSZ: i64 = 33;
946/// This element holds the address of the SHT_SYMTAB_SHNDX section associated
947/// with the dynamic symbol table referenced by the DT_SYMTAB element.
948pub const DT_SYMTAB_SHNDX: i64 = 34;
949/// Guile offset of GC roots
950pub const DT_GUILE_GC_ROOT: i64 = 0x37146000;
951/// Guile size in machine words of GC roots
952pub const DT_GUILE_GC_ROOT_SZ: i64 = 0x37146001;
953/// Guile address of entry thunk
954pub const DT_GUILE_ENTRY: i64 = 0x37146002;
955/// Guile bytecode version
956pub const DT_GUILE_VM_VERSION: i64 = 0x37146003;
957/// Guile frame maps
958pub const DT_GUILE_FRAME_MAPS: i64 = 0x37146004;
959/// Values in [DT_LOOS, DT_HIOS] are reserved for operating system-specific semantics.
960pub const DT_LOOS: i64 = 0x6000000D;
961/// Prelinking timestamp
962pub const DT_GNU_PRELINKED: i64 = 0x6ffffdf5;
963/// Size of conflict section
964pub const DT_GNU_CONFLICTSZ: i64 = 0x6ffffdf6;
965/// Size of library list
966pub const DT_GNU_LIBLISTSZ: i64 = 0x6ffffdf7;
967pub const DT_CHECKSUM: i64 = 0x6ffffdf8;
968pub const DT_PLTPADSZ: i64 = 0x6ffffdf9;
969pub const DT_MOVEENT: i64 = 0x6ffffdfa;
970pub const DT_MOVESZ: i64 = 0x6ffffdfb;
971/// Feature selection (DTF_*)
972pub const DT_FEATURE_1: i64 = 0x6ffffdfc;
973/// Flags for DT_* entries, effecting the following DT_* entry
974pub const DT_POSFLAG_1: i64 = 0x6ffffdfd;
975/// Size of syminfo table (in bytes)
976pub const DT_SYMINSZ: i64 = 0x6ffffdfe;
977/// Entry size of syminfo table
978pub const DT_SYMINENT: i64 = 0x6ffffdff;
979/// GNU-style hash table
980pub const DT_GNU_HASH: i64 = 0x6ffffef5;
981pub const DT_TLSDESC_PLT: i64 = 0x6ffffef6;
982pub const DT_TLSDESC_GOT: i64 = 0x6ffffef7;
983/// Start of conflict section
984pub const DT_GNU_CONFLICT: i64 = 0x6ffffef8;
985/// Library list
986pub const DT_GNU_LIBLIST: i64 = 0x6ffffef9;
987/// Configuration information
988pub const DT_CONFIG: i64 = 0x6ffffefa;
989/// Dependency auditing
990pub const DT_DEPAUDIT: i64 = 0x6ffffefb;
991/// Object auditing
992pub const DT_AUDIT: i64 = 0x6ffffefc;
993/// PLT padding
994pub const DT_PLTPAD: i64 = 0x6ffffefd;
995/// Move table
996pub const DT_MOVETAB: i64 = 0x6ffffefe;
997/// Syminfo table
998pub const DT_SYMINFO: i64 = 0x6ffffeff;
999pub const DT_VERSYM: i64 = 0x6ffffff0;
1000pub const DT_RELACOUNT: i64 = 0x6ffffff9;
1001pub const DT_RELCOUNT: i64 = 0x6ffffffa;
1002/// State flags, see DF_1_* below.
1003pub const DT_FLAGS_1: i64 = 0x6ffffffb;
1004/// Address of version definition table
1005pub const DT_VERDEF: i64 = 0x6ffffffc;
1006/// Number of version definitions
1007pub const DT_VERDEFNUM: i64 = 0x6ffffffd;
1008/// Address of table with needed versions
1009pub const DT_VERNEED: i64 = 0x6ffffffe;
1010/// Number of needed versions
1011pub const DT_VERNEEDNUM: i64 = 0x6fffffff;
1012/// Values in [DT_LOOS, DT_HIOS] are reserved for operating system-specific semantics.
1013pub const DT_HIOS: i64 = 0x6ffff000;
1014/// Values in [DT_LOPROC, DT_HIPROC] are reserved for processor-specific semantics.
1015pub const DT_LOPROC: i64 = 0x70000000;
1016/// Values in [DT_LOPROC, DT_HIPROC] are reserved for processor-specific semantics.
1017pub const DT_HIPROC: i64 = 0x7fffffff;
1018
1019/// This flag signifies that the object being loaded may make reference to the
1020/// $ORIGIN substitution string. The dynamic linker must determine the pathname
1021/// of the object containing this entry when the object is loaded.
1022pub const DF_ORIGIN: i64 = 0x1;
1023/// If this flag is set in a shared object library, the dynamic linker's symbol
1024/// resolution algorithm for references within the library is changed. Instead
1025/// of starting a symbol search with the executable file, the dynamic linker
1026/// starts from the shared object itself. If the shared object fails to supply
1027/// the referenced symbol, the dynamic linker then searches the executable file
1028/// and other shared objects as usual.
1029pub const DF_SYMBOLIC: i64 = 0x2;
1030/// If this flag is not set, no relocation entry should cause a modification to
1031/// a non-writable segment, as specified by the segment permissions in the
1032/// program header table. If this flag is set, one or more relocation entries
1033/// might request modifications to a non-writable segment, and the dynamic
1034/// linker can prepare accordingly.
1035pub const DF_TEXTREL: i64 = 0x4;
1036/// If set in a shared object or executable, this flag instructs the dynamic
1037/// linker to process all relocations for the object containing this entry
1038/// before transferring control to the program. The presence of this entry takes
1039/// precedence over a directive to use lazy binding for this object when
1040/// specified through the environment or via dlopen(BA_LIB).
1041pub const DF_BIND_NOW: i64 = 0x8;
1042/// If set in a shared object or executable, this flag instructs the dynamic
1043/// linker to reject attempts to load this file dynamically. It indicates that
1044/// the shared object or executable contains code using a static thread-local
1045/// storage scheme. Implementations need not support any form of thread-local
1046/// storage.
1047pub const DF_STATIC_TLS: i64 = 0x10;
1048
1049// State flags selectable in Dyn.d_val() of the DT_FLAGS_1 entries in the dynamic section
1050
1051/// Set RTLD_NOW for this object
1052pub const DF_1_NOW: i64 = 0x00000001;
1053/// Set RTLD_GLOBAL for this object
1054pub const DF_1_GLOBAL: i64 = 0x00000002;
1055/// Set RTLD_GROUP for this object
1056pub const DF_1_GROUP: i64 = 0x00000004;
1057/// Set RTLD_NODELETE for this object
1058pub const DF_1_NODELETE: i64 = 0x00000008;
1059/// Trigger filtee loading at runtime
1060pub const DF_1_LOADFLTR: i64 = 0x00000010;
1061/// Set RTLD_INITFIRST for this object
1062pub const DF_1_INITFIRST: i64 = 0x00000020;
1063/// Set RTLD_NOOPEN for this object
1064pub const DF_1_NOOPEN: i64 = 0x00000040;
1065/// $ORIGIN must be handled
1066pub const DF_1_ORIGIN: i64 = 0x00000080;
1067/// Direct binding enabled
1068pub const DF_1_DIRECT: i64 = 0x00000100;
1069pub const DF_1_TRANS: i64 = 0x00000200;
1070/// Object is used to interpose
1071pub const DF_1_INTERPOSE: i64 = 0x00000400;
1072/// Ignore default lib search path
1073pub const DF_1_NODEFLIB: i64 = 0x00000800;
1074/// Object can't be dldump'ed
1075pub const DF_1_NODUMP: i64 = 0x00001000;
1076/// Configuration alternative created
1077pub const DF_1_CONFALT: i64 = 0x00002000;
1078/// Filtee terminates filters search
1079pub const DF_1_ENDFILTEE: i64 = 0x00004000;
1080/// Disp reloc applied at build time
1081pub const DF_1_DISPRELDNE: i64 = 0x00008000;
1082/// Disp reloc applied at run-time
1083pub const DF_1_DISPRELPND: i64 = 0x00010000;
1084/// Object has no-direct binding
1085pub const DF_1_NODIRECT: i64 = 0x00020000;
1086pub const DF_1_IGNMULDEF: i64 = 0x00040000;
1087pub const DF_1_NOKSYMS: i64 = 0x00080000;
1088pub const DF_1_NOHDR: i64 = 0x00100000;
1089/// Object is modified after built
1090pub const DF_1_EDITED: i64 = 0x00200000;
1091pub const DF_1_NORELOC: i64 = 0x00400000;
1092/// Object has individual interposers
1093pub const DF_1_SYMINTPOSE: i64 = 0x00800000;
1094/// Global auditing required
1095pub const DF_1_GLOBAUDIT: i64 = 0x01000000;
1096/// Singleton symbols are used
1097pub const DF_1_SINGLETON: i64 = 0x02000000;
1098pub const DF_1_STUB: i64 = 0x04000000;
1099pub const DF_1_PIE: i64 = 0x08000000;
1100pub const DF_1_KMOD: i64 = 0x10000000;
1101pub const DF_1_WEAKFILTER: i64 = 0x20000000;
1102pub const DF_1_NOCOMMON: i64 = 0x40000000;
1103
1104// Flags for the feature selection in DT_FEATURE_1
1105pub const DTF_1_PARINIT: i64 = 0x00000001;
1106pub const DTF_1_CONFEXP: i64 = 0x00000002;
1107
1108// Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry
1109/// Lazyload following object
1110pub const DF_P1_LAZYLOAD: i64 = 0x00000001;
1111/// Symbols from next object are not generally available
1112pub const DF_P1_GROUPPERM: i64 = 0x00000002;
1113
1114// .gnu.version index reserved values
1115/// Symbol is local
1116pub const VER_NDX_LOCAL: u16 = 0;
1117/// Symbol is global
1118pub const VER_NDX_GLOBAL: u16 = 1;
1119/// .gnu.version index mask
1120pub const VER_NDX_VERSION: u16 = 0x7fff;
1121/// Symbol is hidden
1122pub const VER_NDX_HIDDEN: u16 = 0x8000;
1123
1124// .gnu.version_d VerDef.vd_version reserved values
1125/// Only defined valid vd_version value
1126pub const VER_DEF_CURRENT: u16 = 1;
1127
1128// .gnu.version_r VerNeed.vn_version reserved values
1129/// Only defined valid vn_version value
1130pub const VER_NEED_CURRENT: u16 = 1;
1131
1132// Bit flags which appear in vd_flags of VerDef and vna_flags of VerNeedAux.
1133pub const VER_FLG_BASE: u16 = 0x1;
1134pub const VER_FLG_WEAK: u16 = 0x2;
1135pub const VER_FLG_INFO: u16 = 0x4;
1136
1137/// ZLIB/DEFLATE
1138pub const ELFCOMPRESS_ZLIB: u32 = 1;
1139/// zstd algorithm
1140pub const ELFCOMPRESS_ZSTD: u32 = 2;
1141/// Values in [ELFCOMPRESS_LOOS, ELFCOMPRESS_HIOS] are reserved for operating system-specific semantics.
1142pub const ELFCOMPRESS_LOOS: u32 = 0x60000000;
1143/// Values in [ELFCOMPRESS_LOOS, ELFCOMPRESS_HIOS] are reserved for operating system-specific semantics.
1144pub const ELFCOMPRESS_HIOS: u32 = 0x6fffffff;
1145/// Values in [ELFCOMPRESS_LOPROC, ELFCOMPRESS_HIPROC] are reserved for processor-specific semantics.
1146pub const ELFCOMPRESS_LOPROC: u32 = 0x70000000;
1147/// Values in [ELFCOMPRESS_LOPROC, ELFCOMPRESS_HIPROC] are reserved for processor-specific semantics.
1148pub const ELFCOMPRESS_HIPROC: u32 = 0x7fffffff;
1149
1150/// GNU-extension notes have this name
1151pub const ELF_NOTE_GNU: &str = "GNU";
1152
1153// Note header descriptor types constants (n_type)
1154
1155/// Contains copy of prstatus struct
1156pub const NT_PRSTATUS: u64 = 1;
1157/// Contains copy of fpregset struct
1158pub const NT_PRFPREG: u64 = 2;
1159/// Contains copy of fpregset struct
1160pub const NT_FPREGSET: u64 = 2;
1161/// Contains copy of prpsinfo struct
1162pub const NT_PRPSINFO: u64 = 3;
1163/// Contains copy of prxregset struct
1164pub const NT_PRXREG: u64 = 4;
1165/// Contains copy of task structure
1166pub const NT_TASKSTRUCT: u64 = 4;
1167/// String from sysinfo(SI_PLATFORM)
1168pub const NT_PLATFORM: u64 = 5;
1169/// Contains copy of auxv array
1170pub const NT_AUXV: u64 = 6;
1171/// Contains copy of gwindows struct
1172pub const NT_GWINDOWS: u64 = 7;
1173/// Contains copy of asrset struct
1174pub const NT_ASRS: u64 = 8;
1175/// Contains copy of pstatus struct
1176pub const NT_PSTATUS: u64 = 10;
1177/// Contains copy of psinfo struct
1178pub const NT_PSINFO: u64 = 13;
1179/// Contains copy of prcred struct
1180pub const NT_PRCRED: u64 = 14;
1181/// Contains copy of utsname struct
1182pub const NT_UTSNAME: u64 = 15;
1183/// Contains copy of lwpstatus struct
1184pub const NT_LWPSTATUS: u64 = 16;
1185/// Contains copy of lwpinfo struct
1186pub const NT_LWPSINFO: u64 = 17;
1187/// Contains copy of fprxregset struct
1188pub const NT_PRFPXREG: u64 = 20;
1189/// Contains copy of siginfo_t, size might increase
1190pub const NT_SIGINFO: u64 = 0x53494749;
1191/// Contains information about mapped files
1192pub const NT_FILE: u64 = 0x46494c45;
1193/// Contains copy of user_fxsr_struct
1194pub const NT_PRXFPREG: u64 = 0x46e62b7f;
1195/// /// PowerPC Altivec/VMX registers
1196pub const NT_PPC_VMX: u64 = 0x100;
1197/// PowerPC SPE/EVR registers
1198pub const NT_PPC_SPE: u64 = 0x101;
1199/// PowerPC VSX registers
1200pub const NT_PPC_VSX: u64 = 0x102;
1201/// Target Address Register
1202pub const NT_PPC_TAR: u64 = 0x103;
1203/// Program Priority Register
1204pub const NT_PPC_PPR: u64 = 0x104;
1205/// Data Stream Control Register
1206pub const NT_PPC_DSCR: u64 = 0x105;
1207/// Event Based Branch Registers
1208pub const NT_PPC_EBB: u64 = 0x106;
1209/// Performance Monitor Registers
1210pub const NT_PPC_PMU: u64 = 0x107;
1211/// TM checkpointed GPR Registers
1212pub const NT_PPC_TM_CGPR: u64 = 0x108;
1213/// TM checkpointed FPR Registers
1214pub const NT_PPC_TM_CFPR: u64 = 0x109;
1215/// TM checkpointed VMX Registers
1216pub const NT_PPC_TM_CVMX: u64 = 0x10a;
1217/// TM checkpointed VSX Registers
1218pub const NT_PPC_TM_CVSX: u64 = 0x10b;
1219/// TM Special Purpose Registers
1220pub const NT_PPC_TM_SPR: u64 = 0x10c;
1221/// TM checkpointed Target Address Register
1222pub const NT_PPC_TM_CTAR: u64 = 0x10d;
1223/// TM checkpointed Program Priority Register
1224pub const NT_PPC_TM_CPPR: u64 = 0x10e;
1225/// TM checkpointed Data Stream Control Register
1226pub const NT_PPC_TM_CDSCR: u64 = 0x10f;
1227/// Memory Protection Keys registers
1228pub const NT_PPC_PKEY: u64 = 0x110;
1229/// i386 TLS slots (struct user_desc)
1230pub const NT_386_TLS: u64 = 0x200;
1231/// x86 io permission bitmap (1=deny)
1232pub const NT_386_IOPERM: u64 = 0x201;
1233/// x86 extended state using xsave
1234pub const NT_X86_XSTATE: u64 = 0x202;
1235/// ARM VFP/NEON registers
1236pub const NT_ARM_VFP: u64 = 0x400;
1237/// ARM TLS register
1238pub const NT_ARM_TLS: u64 = 0x401;
1239/// ARM hardware breakpoint registers
1240pub const NT_ARM_HW_BREAK: u64 = 0x402;
1241/// ARM hardware watchpoint registers
1242pub const NT_ARM_HW_WATCH: u64 = 0x403;
1243/// ARM system call number
1244pub const NT_ARM_SYSTEM_CALL: u64 = 0x404;
1245/// ARM Scalable Vector Extension registers
1246pub const NT_ARM_SVE: u64 = 0x405;
1247/// ARM pointer authentication code masks
1248pub const NT_ARM_PAC_MASK: u64 = 0x406;
1249/// ARM pointer authentication address keys
1250pub const NT_ARM_PACA_KEYS: u64 = 0x407;
1251/// ARM pointer authentication generic key
1252pub const NT_ARM_PACG_KEYS: u64 = 0x408;
1253/// AArch64 tagged address control.
1254pub const NT_ARM_TAGGED_ADDR_CTRL: u64 = 0x409;
1255/// AArch64 pointer authentication enabled keys
1256pub const NT_ARM_PAC_ENABLED_KEYS: u64 = 0x40a;
1257/// Vmcore Device Dump Note
1258pub const NT_VMCOREDD: u64 = 0x700;
1259
1260/// ABI information
1261/// The descriptor consists of words:
1262/// word 0: OS descriptor
1263/// word 1: major version of the ABI
1264/// word 2: minor version of the ABI
1265/// word 3: subminor version of the ABI
1266pub const NT_GNU_ABI_TAG: u64 = 1;
1267/// Synthetic hwcap information
1268pub const NT_GNU_HWCAP: u64 = 2;
1269/// Build ID bits as generated by ld --build-id.
1270pub const NT_GNU_BUILD_ID: u64 = 3;
1271/// Version note generated by GNU gold containing a version string
1272pub const NT_GNU_GOLD_VERSION: u64 = 4;
1273/// Program property note which describes special handling requirements for linker and run-time loader.
1274pub const NT_GNU_PROPERTY_TYPE_0: u64 = 5;
1275
1276// These values can appear in word 0 of an NT_GNU_ABI_TAG note section entry.
1277pub const ELF_NOTE_GNU_ABI_TAG_OS_LINUX: u32 = 0;
1278pub const ELF_NOTE_GNU_ABI_TAG_OS_GNU: u32 = 1;
1279pub const ELF_NOTE_GNU_ABI_TAG_OS_SOLARIS2: u32 = 2;
1280pub const ELF_NOTE_GNU_ABI_TAG_OS_FREEBSD: u32 = 3;
1281
1282// _ ____ __ __
1283// / \ | _ \| \/ |
1284// / _ \ | |_) | |\/| |
1285// / ___ \| _ <| | | |
1286// /_/ \_\_| \_\_| |_|
1287//
1288// ARM-specific declarations (ABI v5)
1289// See: https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst
1290// See: https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst
1291
1292/// Set in executable file headers (e_type = ET_EXEC or ET_DYN) to note explicitly that the
1293/// executable file was built to conform to the software floating-point procedure-call standard
1294/// (the base standard). If both EF_ARM_ABI_FLOAT_XXXX bits are clear, conformance to the base
1295/// procedure-call standard is implied.
1296pub const EF_ARM_ABI_FLOAT_SOFT: u32 = 0x200;
1297/// Compatible with legacy (pre version 5) gcc use as EF_ARM_SOFT_FLOAT
1298pub const EF_ARM_SOFT_FLOAT: u32 = EF_ARM_ABI_FLOAT_SOFT;
1299/// Set in executable file headers (e_type = ET_EXEC or ET_DYN) to note that the executable file
1300/// was built to conform to the hardware floating-point procedure-call standard.
1301pub const EF_ARM_ABI_FLOAT_HARD: u32 = 0x400;
1302/// Compatible with legacy (pre version 5) gcc use as EF_ARM_VFP_FLOAT.
1303pub const EF_ARM_VFP_FLOAT: u32 = EF_ARM_ABI_FLOAT_HARD;
1304
1305/// The ELF file contains BE-8 code, suitable for execution on an Arm Architecture v6 processor.
1306/// This flag must only be set on an executable file.
1307pub const EF_ARM_BE8: u32 = 0x00800000;
1308
1309/// Legacy code (ABI version 4 and earlier) generated by gcc-arm-xxx might use these bits.
1310pub const EF_ARM_GCCMASK: u32 = 0x00400FFF;
1311
1312/// This masks an 8-bit version number, the version of the ABI to which this ELF
1313/// file conforms. This ABI is version 5. A value of 0 denotes unknown conformance.
1314pub const EF_ARM_EABIMASK: u32 = 0xFF000000;
1315pub const EF_ARM_EABI_UNKNOWN: u32 = 0x00000000;
1316pub const EF_ARM_EABI_VER1: u32 = 0x01000000;
1317pub const EF_ARM_EABI_VER2: u32 = 0x02000000;
1318pub const EF_ARM_EABI_VER3: u32 = 0x03000000;
1319pub const EF_ARM_EABI_VER4: u32 = 0x04000000;
1320pub const EF_ARM_EABI_VER5: u32 = 0x05000000;
1321
1322/// Section contains index information for exception unwinding
1323pub const SHT_ARM_EXIDX: u32 = 0x70000001;
1324/// BPABI DLL dynamic linking pre-emption map
1325pub const SHT_ARM_PREEMPTMAP: u32 = 0x70000002;
1326/// Object file compatibility attributes
1327pub const SHT_ARM_ATTRIBUTES: u32 = 0x70000003;
1328/// See <https://github.com/ARM-software/abi-aa/blob/main/dbgovl32/dbgovl32.rst>
1329pub const SHT_ARM_DEBUGOVERLAY: u32 = 0x70000004;
1330/// See <https://github.com/ARM-software/abi-aa/blob/main/dbgovl32/dbgovl32.rst>
1331pub const SHT_ARM_OVERLAYSECTION: u32 = 0x70000005;
1332
1333/// The contents of this section contains only program instructions and no program data.
1334///
1335/// If any section contained by a segment does not have the SHF_ARM_PURECODE
1336/// section flag set, the PF_R segment flag must be set in the program header
1337/// for the segment. If all sections contained by a segment have the
1338/// SHF_ARM_PURECODE section flag, a linker may optionally clear the PF_R
1339/// segment flag in the program header of the segment, to signal to the runtime
1340/// that the program does not rely on being able to read that segment.
1341pub const SHF_ARM_PURECODE: u64 = 0x20000000;
1342
1343/// Architecture compatibility information.
1344///
1345/// A segment of type PT_ARM_ARCHEXT contains information describing the
1346/// platform capabilities required by the executable file. The segment is
1347/// optional, but if present it must appear before segment of type PT_LOAD.
1348pub const PT_ARM_ARCHEXT: u32 = 0x70000000;
1349/// alias for unwind
1350pub const PT_ARM_EXIDX: u32 = 0x70000001;
1351/// Exception unwind tables
1352pub const PT_ARM_UNWIND: u32 = 0x70000001;
1353
1354// Contents of a PT_ARM_ARCHEXT segment shall contain at least one 32-bit word with meanings:
1355/// Masks bits describing the format of data in subsequent words.
1356pub const PT_ARM_ARCHEXT_FMTMSK: u32 = 0xff000000;
1357/// There are no additional words of data. However, if EF_OSABI is non-zero, the
1358/// relevant platform ABI may define additional data that follows the initial word.
1359pub const PT_ARM_ARCHEXT_FMT_OS: u32 = 0x00000000;
1360/// See <https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst#platform-architecture-compatibility-data>
1361/// and <https://github.com/ARM-software/abi-aa/blob/main/addenda32/addenda32.rst>
1362pub const PT_ARM_ARCHEXT_FMT_ABI: u32 = 0x01000000;
1363
1364/// Masks bits describing the architecture profile required by the executable.
1365pub const PT_ARM_ARCHEXT_PROFMSK: u32 = 0x00ff0000;
1366/// The architecture has no profile variants, or the image has no profile-specific constraints
1367pub const PT_ARM_ARCHEXT_PROF_NONE: u32 = 0x00000000;
1368/// (‘A’<<16) The executable file requires the Application profile
1369pub const PT_ARM_ARCHEXT_PROF_ARM: u32 = 0x00410000;
1370/// (‘R’<<16) The executable file requires the Real-Time profile
1371pub const PT_ARM_ARCHEXT_PROF_RT: u32 = 0x00520000;
1372/// (‘M’<<16) The executable file requires the Microcontroller profile
1373pub const PT_ARM_ARCHEXT_PROF_MC: u32 = 0x004D0000;
1374/// (‘S’<<16) The executable file requires the ‘classic’ (‘A’ or ‘R’ profile) exception model.
1375pub const PT_ARM_ARCHEXT_PROF_CLASSIC: u32 = 0x00530000;
1376
1377/// Masks bits describing the base architecture required by the executable.
1378pub const PT_ARM_ARCHEXT_ARCHMSK: u32 = 0x000000ff;
1379/// The needed architecture is unknown or specified in some other way
1380pub const PT_ARM_ARCHEXT_ARCH_UNKN: u32 = 0x00;
1381/// Architecture v4
1382pub const PT_ARM_ARCHEXT_ARCHV4: u32 = 0x01;
1383/// Architecture v4T
1384pub const PT_ARM_ARCHEXT_ARCHV4T: u32 = 0x02;
1385/// Architecture v5T
1386pub const PT_ARM_ARCHEXT_ARCHV5T: u32 = 0x03;
1387/// Architecture v5TE
1388pub const PT_ARM_ARCHEXT_ARCHV5TE: u32 = 0x04;
1389/// Architecture v5TEJ
1390pub const PT_ARM_ARCHEXT_ARCHV5TEJ: u32 = 0x05;
1391/// Architecture v6
1392pub const PT_ARM_ARCHEXT_ARCHV6: u32 = 0x06;
1393/// Architecture v6KZ
1394pub const PT_ARM_ARCHEXT_ARCHV6KZ: u32 = 0x07;
1395/// Architecture v6T2
1396pub const PT_ARM_ARCHEXT_ARCHV6T2: u32 = 0x08;
1397/// Architecture v6K
1398pub const PT_ARM_ARCHEXT_ARCHV6K: u32 = 0x09;
1399/// Architecture v7 (in this case the architecture profile may also be
1400/// required to fully specify the needed execution environment).
1401pub const PT_ARM_ARCHEXT_ARCHV7: u32 = 0x0A;
1402/// Architecture v6M (e.g. Cortex-M0)
1403pub const PT_ARM_ARCHEXT_ARCHV6M: u32 = 0x0B;
1404/// Architecture v6S-M (e.g. Cortex-M0)
1405pub const PT_ARM_ARCHEXT_ARCHV6SM: u32 = 0x0C;
1406/// Architecture v7E-M
1407pub const PT_ARM_ARCHEXT_ARCHV7EM: u32 = 0x0D;
1408
1409/// gives the number of entries in the dynamic symbol table, including the initial dummy symbol
1410pub const DT_ARM_SYMTABSZ: i64 = 0x70000001;
1411/// holds the address of the pre-emption map for platforms that use the DLL static binding mode
1412pub const DT_ARM_PREEMPTMAP: i64 = 0x70000002;
1413
1414// ARM relocs
1415//
1416// * S (when used on its own) is the address of the symbol.
1417// * A is the addend for the relocation.
1418// * P is the address of the place being relocated (derived from r_offset).
1419// * Pa is the adjusted address of the place being relocated, defined as (P & 0xFFFFFFFC).
1420// * T is 1 if the target symbol S has type STT_FUNC and the symbol addresses a Thumb instruction; 0 otherwise.
1421// * B(S) is the addressing origin of the output segment defining the symbol S.
1422// The origin is not required to be the base address of the segment. This value must always be word-aligned.
1423// * GOT_ORG is the addressing origin of the Global Offset Table (the indirection table for imported data addresses).
1424// This value must always be word-aligned.
1425// * GOT(S) is the address of the GOT entry for the symbol S
1426
1427/// no reloc
1428pub const R_ARM_NONE: u32 = 0;
1429/// Deprecated PC relative 26 bit branch. `((S + A) | T) – P`
1430pub const R_ARM_PC24: u32 = 1;
1431/// Direct 32 bit. `(S + A) | T`
1432pub const R_ARM_ABS32: u32 = 2;
1433/// PC relative 32 bit. `((S + A) | T) | – P`
1434pub const R_ARM_REL32: u32 = 3;
1435/// `S + A – P`
1436pub const R_ARM_LDR_PC_G0: u32 = 4;
1437/// Direct 16 bit. `S + A`
1438pub const R_ARM_ABS16: u32 = 5;
1439/// Direct 12 bit. `S + A`
1440pub const R_ARM_ABS12: u32 = 6;
1441/// Direct & 0x7C `(LDR, STR). S + A`
1442pub const R_ARM_THM_ABS5: u32 = 7;
1443/// Direct 8 bit. `S + A`
1444pub const R_ARM_ABS8: u32 = 8;
1445/// `((S + A) | T) – B(S)`
1446pub const R_ARM_SBREL32: u32 = 9;
1447/// PC relative 24 bit (Thumb32 BL). `((S + A) | T) – P`
1448pub const R_ARM_THM_CALL: u32 = 10;
1449/// PC relative & 0x3FC (Thumb16 LDR, ADD, ADR). `S + A – Pa`
1450pub const R_ARM_THM_PC8: u32 = 11;
1451pub const R_ARM_BREL_ADJ: u32 = 12;
1452/// dynamic reloc
1453pub const R_ARM_TLS_DESC: u32 = 13;
1454/// obsolete/reserved
1455pub const R_ARM_THM_SWI8: u32 = 14;
1456/// obsolete/reserved
1457pub const R_ARM_XPC25: u32 = 15;
1458/// obsolete/reserved
1459pub const R_ARM_THM_XPC22: u32 = 16;
1460/// ID of module containing symbol.
1461pub const R_ARM_TLS_DTPMOD32: u32 = 17;
1462/// Offset in TLS block. `S + A – TLS`
1463pub const R_ARM_TLS_DTPOFF32: u32 = 18;
1464/// Offset in static TLS block. `S + A – Tp`
1465pub const R_ARM_TLS_TPOFF32: u32 = 19;
1466/// dynamic reloc Copy symbol at runtime.
1467pub const R_ARM_COPY: u32 = 20;
1468/// Create GOT entry. `(S + A) | T`
1469pub const R_ARM_GLOB_DAT: u32 = 21;
1470/// Create PLT entry. `(S + A) | T`
1471pub const R_ARM_JUMP_SLOT: u32 = 22;
1472/// Adjust by program base. `B(S) + A`
1473pub const R_ARM_RELATIVE: u32 = 23;
1474/// 32 bit offset to GOT. `((S + A) | T) – GOT_ORG`
1475pub const R_ARM_GOTOFF32: u32 = 24;
1476/// 32 bit PC relative offset to GOT. `B(S) + A – P`
1477pub const R_ARM_BASE_PREL: u32 = 25;
1478/// 32 bit GOT entry. `GOT(S) + A – GOT_ORG`
1479pub const R_ARM_BASE_BREL: u32 = 26;
1480/// Deprecated, 32 bit PLT address.
1481pub const R_ARM_PLT32: u32 = 27;
1482/// PC relative 24 bit (BL, BLX). `((S + A) | T) – P`
1483pub const R_ARM_CALL: u32 = 28;
1484/// PC relative 24 bit (B, BL{cond}). `((S + A) | T) – P`
1485pub const R_ARM_JUMP24: u32 = 29;
1486/// PC relative 24 bit (Thumb32 B.W). `((S + A) | T) – P`
1487pub const R_ARM_THM_JUMP24: u32 = 30;
1488/// Adjust by program base. `B(S) + A`
1489pub const R_ARM_BASE_ABS: u32 = 31;
1490/// Obsolete.
1491pub const R_ARM_ALU_PCREL_7_0: u32 = 32;
1492/// Obsolete.
1493pub const R_ARM_ALU_PCREL_15_8: u32 = 33;
1494/// Obsolete.
1495pub const R_ARM_ALU_PCREL_23_15: u32 = 34;
1496/// Deprecated, prog. base relative.
1497pub const R_ARM_LDR_SBREL_11_0: u32 = 35;
1498/// Deprecated, prog. base relative.
1499pub const R_ARM_ALU_SBREL_19_12: u32 = 36;
1500/// Deprecated, prog. base relative.
1501pub const R_ARM_ALU_SBREL_27_20: u32 = 37;
1502pub const R_ARM_TARGET1: u32 = 38;
1503/// Program base relative. `((S + A) | T) – B(S)`
1504pub const R_ARM_SBREL31: u32 = 39;
1505pub const R_ARM_V4BX: u32 = 40;
1506pub const R_ARM_TARGET2: u32 = 41;
1507/// 32 bit PC relative. `((S + A) | T) – P`
1508pub const R_ARM_PREL31: u32 = 42;
1509/// Direct 16-bit (MOVW). `(S + A) | T`
1510pub const R_ARM_MOVW_ABS_NC: u32 = 43;
1511/// Direct high 16-bit (MOVT). `S + A`
1512pub const R_ARM_MOVT_ABS: u32 = 44;
1513/// PC relative 16-bit (MOVW). `((S + A) | T) – P`
1514pub const R_ARM_MOVW_PREL_NC: u32 = 45;
1515/// PC relative (MOVT). `S + A - P`
1516pub const R_ARM_MOVT_PREL: u32 = 46;
1517/// Direct 16 bit (Thumb32 MOVW). `(S + A) | T`
1518pub const R_ARM_THM_MOVW_ABS_NC: u32 = 47;
1519/// Direct high 16 bit (Thumb32 MOVT). `S + A`
1520pub const R_ARM_THM_MOVT_ABS: u32 = 48;
1521/// PC relative 16 bit (Thumb32 MOVW). `((S + A) | T) – P`
1522pub const R_ARM_THM_MOVW_PREL_NC: u32 = 49;
1523/// PC relative high 16 bit (Thumb32 MOVT). `S + A – P`
1524pub const R_ARM_THM_MOVT_PREL: u32 = 50;
1525/// PC relative 20 bit (Thumb32 B{cond}.W). `((S + A) | T) – P`
1526pub const R_ARM_THM_JUMP19: u32 = 51;
1527/// PC relative X & 0x7E (Thumb16 CBZ, CBNZ). `S + A – P`
1528pub const R_ARM_THM_JUMP6: u32 = 52;
1529/// PC relative 12 bit (Thumb32 ADR.W). `((S + A) | T) – Pa`
1530pub const R_ARM_THM_ALU_PREL_11_0: u32 = 53;
1531/// PC relative 12 bit (Thumb32 LDR{D,SB,H,SH}). `S + A – Pa`
1532pub const R_ARM_THM_PC12: u32 = 54;
1533/// Direct 32-bit. `S + A`
1534pub const R_ARM_ABS32_NOI: u32 = 55;
1535/// PC relative 32-bit. `S + A - P`
1536pub const R_ARM_REL32_NOI: u32 = 56;
1537/// PC relative (ADD, SUB). `((S + A) | T) – P`
1538pub const R_ARM_ALU_PC_G0_NC: u32 = 57;
1539/// PC relative (ADD, SUB). `((S + A) | T) – P`
1540pub const R_ARM_ALU_PC_G0: u32 = 58;
1541/// PC relative (ADD, SUB). `((S + A) | T) – P`
1542pub const R_ARM_ALU_PC_G1_NC: u32 = 59;
1543/// PC relative (ADD, SUB). `((S + A) | T) – P`
1544pub const R_ARM_ALU_PC_G1: u32 = 60;
1545/// PC relative (ADD, SUB). `((S + A) | T) – P`
1546pub const R_ARM_ALU_PC_G2: u32 = 61;
1547/// PC relative (LDR,STR,LDRB,STRB). `S + A – P`
1548pub const R_ARM_LDR_PC_G1: u32 = 62;
1549/// PC relative (LDR,STR,LDRB,STRB). `S + A – P`
1550pub const R_ARM_LDR_PC_G2: u32 = 63;
1551/// PC relative (STR{D,H}, LDR{D,SB,H,SH}). `S + A – P`
1552pub const R_ARM_LDRS_PC_G0: u32 = 64;
1553/// PC relative (STR{D,H}, LDR{D,SB,H,SH}). `S + A – P`
1554pub const R_ARM_LDRS_PC_G1: u32 = 65;
1555/// PC relative (STR{D,H}, LDR{D,SB,H,SH}). `S + A – P`
1556pub const R_ARM_LDRS_PC_G2: u32 = 66;
1557/// PC relative (LDC, STC). `S + A – P`
1558pub const R_ARM_LDC_PC_G0: u32 = 67;
1559/// PC relative (LDC, STC). `S + A – P`
1560pub const R_ARM_LDC_PC_G1: u32 = 68;
1561/// PC relative (LDC, STC). `S + A – P`
1562pub const R_ARM_LDC_PC_G2: u32 = 69;
1563/// Program base relative (ADD,SUB). `((S + A) | T) – B(S)`
1564pub const R_ARM_ALU_SB_G0_NC: u32 = 70;
1565/// Program base relative (ADD,SUB). `((S + A) | T) – B(S)`
1566pub const R_ARM_ALU_SB_G0: u32 = 71;
1567/// Program base relative (ADD,SUB). `((S + A) | T) – B(S)`
1568pub const R_ARM_ALU_SB_G1_NC: u32 = 72;
1569/// Program base relative (ADD,SUB). `((S + A) | T) – B(S)`
1570pub const R_ARM_ALU_SB_G1: u32 = 73;
1571/// Program base relative (ADD,SUB). `((S + A) | T) – B(S)`
1572pub const R_ARM_ALU_SB_G2: u32 = 74;
1573/// Program base relative (LDR, STR, LDRB, STRB). `S + A – B(S)`
1574pub const R_ARM_LDR_SB_G0: u32 = 75;
1575/// Program base relative (LDR, STR, LDRB, STRB). `S + A – B(S)`
1576pub const R_ARM_LDR_SB_G1: u32 = 76;
1577/// Program base relative (LDR, STR, LDRB, STRB). `S + A – B(S)`
1578pub const R_ARM_LDR_SB_G2: u32 = 77;
1579/// Program base relative (LDR, STR, LDRB, STRB). `S + A – B(S)`
1580pub const R_ARM_LDRS_SB_G0: u32 = 78;
1581/// Program base relative (LDR, STR, LDRB, STRB). `S + A – B(S)`
1582pub const R_ARM_LDRS_SB_G1: u32 = 79;
1583/// Program base relative (LDR, STR, LDRB, STRB). `S + A – B(S)`
1584pub const R_ARM_LDRS_SB_G2: u32 = 80;
1585/// Program base relative (LDC,STC). `S + A – B(S)`
1586pub const R_ARM_LDC_SB_G0: u32 = 81;
1587/// Program base relative (LDC,STC). `S + A – B(S)`
1588pub const R_ARM_LDC_SB_G1: u32 = 82;
1589/// Program base relative (LDC,STC). `S + A – B(S)`
1590pub const R_ARM_LDC_SB_G2: u32 = 83;
1591/// Program base relative 16 bit (MOVW). `((S + A) | T) – B(S)`
1592pub const R_ARM_MOVW_BREL_NC: u32 = 84;
1593/// Program base relative high 16 bit (MOVT). `S + A – B(S)`
1594pub const R_ARM_MOVT_BREL: u32 = 85;
1595/// Program base relative 16 bit (MOVW). `((S + A) | T) – B(S)`
1596pub const R_ARM_MOVW_BREL: u32 = 86;
1597/// Program base relative 16 bit (Thumb32 MOVW). `((S + A) | T) – B(S)`
1598pub const R_ARM_THM_MOVW_BREL_NC: u32 = 87;
1599/// Program base relative high 16 bit (Thumb32 MOVT). `S + A – B(S)`
1600pub const R_ARM_THM_MOVT_BREL: u32 = 88;
1601/// Program base relative 16 bit (Thumb32 MOVW). `((S + A) | T) – B(S)`
1602pub const R_ARM_THM_MOVW_BREL: u32 = 89;
1603pub const R_ARM_TLS_GOTDESC: u32 = 90;
1604pub const R_ARM_TLS_CALL: u32 = 91;
1605/// TLS relaxation.
1606pub const R_ARM_TLS_DESCSEQ: u32 = 92;
1607pub const R_ARM_THM_TLS_CALL: u32 = 93;
1608/// `PLT(S) + A`
1609pub const R_ARM_PLT32_ABS: u32 = 94;
1610/// GOT entry. `GOT(S) + A`
1611pub const R_ARM_GOT_ABS: u32 = 95;
1612/// PC relative GOT entry. `GOT(S) + A – P`
1613pub const R_ARM_GOT_PREL: u32 = 96;
1614/// GOT entry relative to GOT origin (LDR). `GOT(S) + A – GOT_ORG`
1615pub const R_ARM_GOT_BREL12: u32 = 97;
1616/// 12 bit, GOT entry relative to GOT origin (LDR, STR). `S + A – GOT_ORG`
1617pub const R_ARM_GOTOFF12: u32 = 98;
1618pub const R_ARM_GOTRELAX: u32 = 99;
1619pub const R_ARM_GNU_VTENTRY: u32 = 100;
1620pub const R_ARM_GNU_VTINHERIT: u32 = 101;
1621/// PC relative & 0xFFE (Thumb16 B). `S + A – P`
1622pub const R_ARM_THM_JUMP11: u32 = 102;
1623/// PC relative & 0x1FE (Thumb16 B/B{cond}). `S + A – P`
1624pub const R_ARM_THM_JUMP8: u32 = 103;
1625/// PC-rel 32 bit for global dynamic thread local data. `GOT(S) + A – P`
1626pub const R_ARM_TLS_GD32: u32 = 104;
1627/// PC-rel 32 bit for local dynamic thread local data. `GOT(S) + A – P`
1628pub const R_ARM_TLS_LDM32: u32 = 105;
1629/// 32 bit offset relative to TLS block. `S + A – TLS`
1630pub const R_ARM_TLS_LDO32: u32 = 106;
1631/// PC-rel 32 bit for GOT entry of static TLS block offset. `GOT(S) + A – P`
1632pub const R_ARM_TLS_IE32: u32 = 107;
1633/// 32 bit offset relative to static TLS block. `S + A – tp`
1634pub const R_ARM_TLS_LE32: u32 = 108;
1635/// 12 bit relative to TLS block (LDR, STR). `S + A – TLS`
1636pub const R_ARM_TLS_LDO12: u32 = 109;
1637/// 12 bit relative to static TLS block (LDR, STR). `S + A – tp`
1638pub const R_ARM_TLS_LE12: u32 = 110;
1639/// 12 bit GOT entry relative to GOT origin (LDR). `GOT(S) + A – GOT_ORG`
1640pub const R_ARM_TLS_IE12GP: u32 = 111;
1641/// Obsolete.
1642pub const R_ARM_ME_TOO: u32 = 128;
1643pub const R_ARM_THM_TLS_DESCSEQ16: u32 = 129;
1644pub const R_ARM_THM_TLS_DESCSEQ32: u32 = 130;
1645/// GOT entry relative to GOT origin, 12 bit (Thumb32 LDR). `GOT(S) + A – GOT_ORG`
1646pub const R_ARM_THM_GOT_BREL12: u32 = 131;
1647/// Static Thumb16 `(S + A) | T`
1648pub const R_ARM_THM_ALU_ABS_G0_NC: u32 = 132;
1649/// Static Thumb16 `S + A`
1650pub const R_ARM_THM_ALU_ABS_G1_NC: u32 = 133;
1651/// Static Thumb16 `S + A`
1652pub const R_ARM_THM_ALU_ABS_G2_NC: u32 = 134;
1653/// Static Thumb16 `S + A`
1654pub const R_ARM_THM_ALU_ABS_G3: u32 = 135;
1655/// Static Arm `((S + A) | T) – P`
1656pub const R_ARM_THM_BF16: u32 = 136;
1657/// Static Arm `((S + A) | T) – P`
1658pub const R_ARM_THM_BF12: u32 = 137;
1659/// Static Arm `((S + A) | T) – P`
1660pub const R_ARM_THM_BF18: u32 = 138;
1661pub const R_ARM_IRELATIVE: u32 = 160;
1662
1663/// Object file compatibility attributes
1664pub const SHT_AARCH64_ATTRIBUTES: u32 = 0x70000003;
1665pub const SHT_AARCH64_ATTRIBUTES_SECTION_NAME: &str = ".ARM.attributes";
1666
1667/// Architecture compatibility information.
1668///
1669/// A segment of type PT_AARCH64_ARCHEXT (if present) contains information
1670/// describing the architecture capabilities required by the executable file.
1671/// Not all platform ABIs require this segment; the Linux ABI does not. If the
1672/// segment is present it must appear before segment of type PT_LOAD.
1673pub const PT_AARCH64_ARCHEXT: u32 = 0x70000000;
1674/// (if present) describes the location of a program’s exception unwind tables.
1675pub const PT_AARCH64_UNWIND: u32 = 0x70000001;
1676/// Reserved for MTE memory tag data dumps in core files
1677/// (if present) hold MTE memory tags for a particular memory range.
1678/// At present they are defined for core dump files of type ET_CORE
1679/// See <https://www.kernel.org/doc/html/latest/arm64/memory-tagging-extension.html#core-dump-support>
1680pub const PT_AARCH64_MEMTAG_MTE: u32 = 0x70000002;
1681
1682/// The function associated with the symbol may follow a variant procedure call
1683/// standard with different register usage convention.
1684/// Found in Symbol's st_other field
1685pub const STO_AARCH64_VARIANT_PCS: u8 = 0x80;
1686
1687pub const GNU_PROPERTY_AARCH64_FEATURE_1_AND: u32 = 0xc0000000;
1688pub const GNU_PROPERTY_AARCH64_FEATURE_1_BTI: u32 = 0x1;
1689pub const GNU_PROPERTY_AARCH64_FEATURE_1_PAC: u32 = 0x2;
1690
1691// AArch64 specific values for the Dyn d_tag field.
1692/// indicates PLTs enabled with Branch Target Identification mechanism
1693pub const DT_AARCH64_BTI_PLT: i64 = 0x70000001;
1694/// indicates PLTs enabled with Pointer Authentication.
1695pub const DT_AARCH64_PAC_PLT: i64 = 0x70000003;
1696/// must be present if there are R_{CLS}_JUMP_SLOT relocations that reference
1697/// symbols marked with the STO_AARCH64_VARIANT_PCS flag set in their st_other field
1698pub const DT_AARCH64_VARIANT_PCS: i64 = 0x70000005;
1699
1700/// No relocation.
1701pub const R_AARCH64_NONE: u32 = 0;
1702/// Direct 32 bit.
1703pub const R_AARCH64_P32_ABS32: u32 = 1;
1704/// Copy symbol at runtime.
1705pub const R_AARCH64_P32_COPY: u32 = 180;
1706/// Create GOT entry.
1707pub const R_AARCH64_P32_GLOB_DAT: u32 = 181;
1708/// Create PLT entry.
1709pub const R_AARCH64_P32_JUMP_SLOT: u32 = 182;
1710/// Adjust by program base.
1711pub const R_AARCH64_P32_RELATIVE: u32 = 183;
1712/// Module number, 32 bit.
1713pub const R_AARCH64_P32_TLS_DTPMOD: u32 = 184;
1714/// Module-relative offset, 32 bit.
1715pub const R_AARCH64_P32_TLS_DTPREL: u32 = 185;
1716/// TP-relative offset, 32 bit.
1717pub const R_AARCH64_P32_TLS_TPREL: u32 = 186;
1718/// TLS Descriptor.
1719pub const R_AARCH64_P32_TLSDESC: u32 = 187;
1720/// STT_GNU_IFUNC relocation
1721pub const R_AARCH64_P32_IRELATIVE: u32 = 188;
1722/// Direct 64 bit.
1723pub const R_AARCH64_ABS64: u32 = 257;
1724/// Direct 32 bit.
1725pub const R_AARCH64_ABS32: u32 = 258;
1726/// Direct 16-bit.
1727pub const R_AARCH64_ABS16: u32 = 259;
1728/// PC-relative 64-bit.
1729pub const R_AARCH64_PREL64: u32 = 260;
1730/// PC-relative 32-bit.
1731pub const R_AARCH64_PREL32: u32 = 261;
1732/// PC-relative 16-bit.
1733pub const R_AARCH64_PREL16: u32 = 262;
1734/// Dir. MOVZ imm. from bits 15:0.
1735pub const R_AARCH64_MOVW_UABS_G0: u32 = 263;
1736/// Likewise for MOVK; no check.
1737pub const R_AARCH64_MOVW_UABS_G0_NC: u32 = 264;
1738/// Dir. MOVZ imm. from bits 31:16.
1739pub const R_AARCH64_MOVW_UABS_G1: u32 = 265;
1740/// Likewise for MOVK; no check.
1741pub const R_AARCH64_MOVW_UABS_G1_NC: u32 = 266;
1742/// Dir. MOVZ imm. from bits 47:32.
1743pub const R_AARCH64_MOVW_UABS_G2: u32 = 267;
1744/// Likewise for MOVK; no check.
1745pub const R_AARCH64_MOVW_UABS_G2_NC: u32 = 268;
1746/// Dir. MOV{K,Z} imm. from 63:48.
1747pub const R_AARCH64_MOVW_UABS_G3: u32 = 269;
1748/// Dir. MOV{N,Z} imm. from 15:0.
1749pub const R_AARCH64_MOVW_SABS_G0: u32 = 270;
1750/// Dir. MOV{N,Z} imm. from 31:16.
1751pub const R_AARCH64_MOVW_SABS_G1: u32 = 271;
1752/// Dir. MOV{N,Z} imm. from 47:32.
1753pub const R_AARCH64_MOVW_SABS_G2: u32 = 272;
1754/// PC-rel. LD imm. from bits 20:2.
1755pub const R_AARCH64_LD_PREL_LO19: u32 = 273;
1756/// PC-rel. ADR imm. from bits 20:0.
1757pub const R_AARCH64_ADR_PREL_LO21: u32 = 274;
1758/// Page-rel. ADRP imm. from 32:12.
1759pub const R_AARCH64_ADR_PREL_PG_HI21: u32 = 275;
1760/// Likewise; no overflow check.
1761pub const R_AARCH64_ADR_PREL_PG_HI21_NC: u32 = 276;
1762/// Dir. ADD imm. from bits 11:0.
1763pub const R_AARCH64_ADD_ABS_LO12_NC: u32 = 277;
1764/// Likewise for LD/ST; no check.
1765pub const R_AARCH64_LDST8_ABS_LO12_NC: u32 = 278;
1766/// PC-rel. TBZ/TBNZ imm. from 15:2.
1767pub const R_AARCH64_TSTBR14: u32 = 279;
1768/// PC-rel. cond. br. imm. from 20:2.
1769pub const R_AARCH64_CONDBR19: u32 = 280;
1770/// PC-rel. B imm. from bits 27:2.
1771pub const R_AARCH64_JUMP26: u32 = 282;
1772/// Likewise for CALL.
1773pub const R_AARCH64_CALL26: u32 = 283;
1774/// Dir. ADD imm. from bits 11:1.
1775pub const R_AARCH64_LDST16_ABS_LO12_NC: u32 = 284;
1776/// Likewise for bits 11:2.
1777pub const R_AARCH64_LDST32_ABS_LO12_NC: u32 = 285;
1778/// Likewise for bits 11:3.
1779pub const R_AARCH64_LDST64_ABS_LO12_NC: u32 = 286;
1780/// PC-rel. MOV{N,Z} imm. from 15:0.
1781pub const R_AARCH64_MOVW_PREL_G0: u32 = 287;
1782/// Likewise for MOVK; no check.
1783pub const R_AARCH64_MOVW_PREL_G0_NC: u32 = 288;
1784/// PC-rel. MOV{N,Z} imm. from 31:16.
1785pub const R_AARCH64_MOVW_PREL_G1: u32 = 289;
1786/// Likewise for MOVK; no check.
1787pub const R_AARCH64_MOVW_PREL_G1_NC: u32 = 290;
1788/// PC-rel. MOV{N,Z} imm. from 47:32.
1789pub const R_AARCH64_MOVW_PREL_G2: u32 = 291;
1790/// Likewise for MOVK; no check.
1791pub const R_AARCH64_MOVW_PREL_G2_NC: u32 = 292;
1792/// PC-rel. MOV{N,Z} imm. from 63:48.
1793pub const R_AARCH64_MOVW_PREL_G3: u32 = 293;
1794/// Dir. ADD imm. from bits 11:4.
1795pub const R_AARCH64_LDST128_ABS_LO12_NC: u32 = 299;
1796/// GOT-rel. off. MOV{N,Z} imm. 15:0.
1797pub const R_AARCH64_MOVW_GOTOFF_G0: u32 = 300;
1798/// Likewise for MOVK; no check.
1799pub const R_AARCH64_MOVW_GOTOFF_G0_NC: u32 = 301;
1800/// GOT-rel. o. MOV{N,Z} imm. 31:16.
1801pub const R_AARCH64_MOVW_GOTOFF_G1: u32 = 302;
1802/// Likewise for MOVK; no check.
1803pub const R_AARCH64_MOVW_GOTOFF_G1_NC: u32 = 303;
1804/// GOT-rel. o. MOV{N,Z} imm. 47:32.
1805pub const R_AARCH64_MOVW_GOTOFF_G2: u32 = 304;
1806/// Likewise for MOVK; no check.
1807pub const R_AARCH64_MOVW_GOTOFF_G2_NC: u32 = 305;
1808/// GOT-rel. o. MOV{N,Z} imm. 63:48.
1809pub const R_AARCH64_MOVW_GOTOFF_G3: u32 = 306;
1810/// GOT-relative 64-bit.
1811pub const R_AARCH64_GOTREL64: u32 = 307;
1812/// GOT-relative 32-bit.
1813pub const R_AARCH64_GOTREL32: u32 = 308;
1814/// PC-rel. GOT off. load imm. 20:2.
1815pub const R_AARCH64_GOT_LD_PREL19: u32 = 309;
1816/// GOT-rel. off. LD/ST imm. 14:3.
1817pub const R_AARCH64_LD64_GOTOFF_LO15: u32 = 310;
1818/// P-page-rel. GOT off. ADRP: u32 = 32:12.
1819pub const R_AARCH64_ADR_GOT_PAGE: u32 = 311;
1820/// Dir. GOT off. LD/ST imm. 11:3.
1821pub const R_AARCH64_LD64_GOT_LO12_NC: u32 = 312;
1822/// GOT-page-rel. GOT off. LD/ST: u32 = 14:3
1823pub const R_AARCH64_LD64_GOTPAGE_LO15: u32 = 313;
1824/// PC-relative ADR imm. 20:0.
1825pub const R_AARCH64_TLSGD_ADR_PREL21: u32 = 512;
1826/// page-rel. ADRP imm. 32:12.
1827pub const R_AARCH64_TLSGD_ADR_PAGE21: u32 = 513;
1828/// direct ADD imm. from 11:0.
1829pub const R_AARCH64_TLSGD_ADD_LO12_NC: u32 = 514;
1830/// GOT-rel. MOV{N,Z} 31:16.
1831pub const R_AARCH64_TLSGD_MOVW_G1: u32 = 515;
1832/// GOT-rel. MOVK imm. 15:0.
1833pub const R_AARCH64_TLSGD_MOVW_G0_NC: u32 = 516;
1834/// Like 512; local dynamic model.
1835pub const R_AARCH64_TLSLD_ADR_PREL21: u32 = 517;
1836/// Like 513; local dynamic model.
1837pub const R_AARCH64_TLSLD_ADR_PAGE21: u32 = 518;
1838/// Like 514; local dynamic model.
1839pub const R_AARCH64_TLSLD_ADD_LO12_NC: u32 = 519;
1840/// Like 515; local dynamic model.
1841pub const R_AARCH64_TLSLD_MOVW_G1: u32 = 520;
1842/// Like 516; local dynamic model.
1843pub const R_AARCH64_TLSLD_MOVW_G0_NC: u32 = 521;
1844/// TLS PC-rel. load imm. 20:2.
1845pub const R_AARCH64_TLSLD_LD_PREL19: u32 = 522;
1846/// TLS DTP-rel. MOV{N,Z} 47:32.
1847pub const R_AARCH64_TLSLD_MOVW_DTPREL_G2: u32 = 523;
1848/// TLS DTP-rel. MOV{N,Z} 31:16.
1849pub const R_AARCH64_TLSLD_MOVW_DTPREL_G1: u32 = 524;
1850/// Likewise; MOVK; no check.
1851pub const R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC: u32 = 525;
1852/// TLS DTP-rel. MOV{N,Z} 15:0.
1853pub const R_AARCH64_TLSLD_MOVW_DTPREL_G0: u32 = 526;
1854/// Likewise; MOVK; no check.
1855pub const R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC: u32 = 527;
1856/// DTP-rel. ADD imm. from 23:12.
1857pub const R_AARCH64_TLSLD_ADD_DTPREL_HI12: u32 = 528;
1858/// DTP-rel. ADD imm. from 11:0.
1859pub const R_AARCH64_TLSLD_ADD_DTPREL_LO12: u32 = 529;
1860/// Likewise; no ovfl. check.
1861pub const R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC: u32 = 530;
1862/// DTP-rel. LD/ST imm. 11:0.
1863pub const R_AARCH64_TLSLD_LDST8_DTPREL_LO12: u32 = 531;
1864/// Likewise; no check.
1865pub const R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC: u32 = 532;
1866/// DTP-rel. LD/ST imm. 11:1.
1867pub const R_AARCH64_TLSLD_LDST16_DTPREL_LO12: u32 = 533;
1868/// Likewise; no check.
1869pub const R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC: u32 = 534;
1870/// DTP-rel. LD/ST imm. 11:2.
1871pub const R_AARCH64_TLSLD_LDST32_DTPREL_LO12: u32 = 535;
1872/// Likewise; no check.
1873pub const R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC: u32 = 536;
1874/// DTP-rel. LD/ST imm. 11:3.
1875pub const R_AARCH64_TLSLD_LDST64_DTPREL_LO12: u32 = 537;
1876/// Likewise; no check.
1877pub const R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC: u32 = 538;
1878/// GOT-rel. MOV{N,Z} 31:16.
1879pub const R_AARCH64_TLSIE_MOVW_GOTTPREL_G1: u32 = 539;
1880/// GOT-rel. MOVK: u32 = 15:0.
1881pub const R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC: u32 = 540;
1882/// Page-rel. ADRP: u32 = 32:12.
1883pub const R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21: u32 = 541;
1884/// Direct LD off. 11:3.
1885pub const R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC: u32 = 542;
1886/// PC-rel. load imm. 20:2.
1887pub const R_AARCH64_TLSIE_LD_GOTTPREL_PREL19: u32 = 543;
1888/// TLS TP-rel. MOV{N,Z} 47:32.
1889pub const R_AARCH64_TLSLE_MOVW_TPREL_G2: u32 = 544;
1890/// TLS TP-rel. MOV{N,Z} 31:16.
1891pub const R_AARCH64_TLSLE_MOVW_TPREL_G1: u32 = 545;
1892/// Likewise; MOVK; no check.
1893pub const R_AARCH64_TLSLE_MOVW_TPREL_G1_NC: u32 = 546;
1894/// TLS TP-rel. MOV{N,Z} 15:0.
1895pub const R_AARCH64_TLSLE_MOVW_TPREL_G0: u32 = 547;
1896/// Likewise; MOVK; no check.
1897pub const R_AARCH64_TLSLE_MOVW_TPREL_G0_NC: u32 = 548;
1898/// TP-rel. ADD imm. 23:12.
1899pub const R_AARCH64_TLSLE_ADD_TPREL_HI12: u32 = 549;
1900/// TP-rel. ADD imm. 11:0.
1901pub const R_AARCH64_TLSLE_ADD_TPREL_LO12: u32 = 550;
1902/// Likewise; no ovfl. check.
1903pub const R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: u32 = 551;
1904/// TP-rel. LD/ST off. 11:0.
1905pub const R_AARCH64_TLSLE_LDST8_TPREL_LO12: u32 = 552;
1906/// Likewise; no ovfl. check.
1907pub const R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: u32 = 553;
1908/// TP-rel. LD/ST off. 11:1.
1909pub const R_AARCH64_TLSLE_LDST16_TPREL_LO12: u32 = 554;
1910/// Likewise; no check.
1911pub const R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: u32 = 555;
1912/// TP-rel. LD/ST off. 11:2.
1913pub const R_AARCH64_TLSLE_LDST32_TPREL_LO12: u32 = 556;
1914/// Likewise; no check.
1915pub const R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: u32 = 557;
1916/// TP-rel. LD/ST off. 11:3.
1917pub const R_AARCH64_TLSLE_LDST64_TPREL_LO12: u32 = 558;
1918/// Likewise; no check.
1919pub const R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: u32 = 559;
1920/// PC-rel. load immediate 20:2.
1921pub const R_AARCH64_TLSDESC_LD_PREL19: u32 = 560;
1922/// PC-rel. ADR immediate 20:0.
1923pub const R_AARCH64_TLSDESC_ADR_PREL21: u32 = 561;
1924/// Page-rel. ADRP imm. 32:12.
1925pub const R_AARCH64_TLSDESC_ADR_PAGE21: u32 = 562;
1926/// Direct LD off. from 11:3.
1927pub const R_AARCH64_TLSDESC_LD64_LO12: u32 = 563;
1928/// Direct ADD imm. from 11:0.
1929pub const R_AARCH64_TLSDESC_ADD_LO12: u32 = 564;
1930/// GOT-rel. MOV{N,Z} imm. 31:16.
1931pub const R_AARCH64_TLSDESC_OFF_G1: u32 = 565;
1932/// GOT-rel. MOVK imm. 15:0; no ck.
1933pub const R_AARCH64_TLSDESC_OFF_G0_NC: u32 = 566;
1934/// Relax LDR.
1935pub const R_AARCH64_TLSDESC_LDR: u32 = 567;
1936/// Relax ADD.
1937pub const R_AARCH64_TLSDESC_ADD: u32 = 568;
1938/// Relax BLR.
1939pub const R_AARCH64_TLSDESC_CALL: u32 = 569;
1940/// TP-rel. LD/ST off. 11:4.
1941pub const R_AARCH64_TLSLE_LDST128_TPREL_LO12: u32 = 570;
1942/// Likewise; no check.
1943pub const R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC: u32 = 571;
1944/// DTP-rel. LD/ST imm. 11:4.
1945pub const R_AARCH64_TLSLD_LDST128_DTPREL_LO12: u32 = 572;
1946/// Likewise; no check.
1947pub const R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC: u32 = 573;
1948/// Copy symbol at runtime.
1949pub const R_AARCH64_COPY: u32 = 1024;
1950/// Create GOT entry.
1951pub const R_AARCH64_GLOB_DAT: u32 = 1025;
1952/// Create PLT entry.
1953pub const R_AARCH64_JUMP_SLOT: u32 = 1026;
1954/// Adjust by program base.
1955pub const R_AARCH64_RELATIVE: u32 = 1027;
1956/// Module number, 64 bit.
1957pub const R_AARCH64_TLS_DTPMOD: u32 = 1028;
1958/// Module-relative offset, 64 bit.
1959pub const R_AARCH64_TLS_DTPREL: u32 = 1029;
1960/// TP-relative offset, 64 bit.
1961pub const R_AARCH64_TLS_TPREL: u32 = 1030;
1962/// TLS Descriptor.
1963pub const R_AARCH64_TLSDESC: u32 = 1031;
1964/// STT_GNU_IFUNC relocation.
1965pub const R_AARCH64_IRELATIVE: u32 = 1032;
1966
1967// ____ ____ ____
1968// | _ \ _____ _____ _ __| _ \ / ___|
1969// | |_) / _ \ \ /\ / / _ \ '__| |_) | |
1970// | __/ (_) \ V V / __/ | | __/| |___
1971// |_| \___/ \_/\_/ \___|_| |_| \____|
1972//
1973// See: https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#ELF-HEAD
1974
1975/// PowerPC embedded flag
1976pub const EF_PPC_EMB: u32 = 0x80000000;
1977/// PowerPC -mrelocatable flag
1978pub const EF_PPC_RELOCATABLE: u32 = 0x00010000;
1979/// PowerPC -mrelocatable-lib flag
1980pub const EF_PPC_RELOCATABLE_LIB: u32 = 0x00008000;
1981
1982// PowerPC relocations types
1983pub const R_PPC_NONE: u32 = 0;
1984/// 32bit absolute address
1985pub const R_PPC_ADDR32: u32 = 1;
1986/// 26bit address, 2 bits ignored.
1987pub const R_PPC_ADDR24: u32 = 2;
1988/// 16bit absolute address
1989pub const R_PPC_ADDR16: u32 = 3;
1990/// lower 16bit of absolute address
1991pub const R_PPC_ADDR16_LO: u32 = 4;
1992/// high 16bit of absolute address
1993pub const R_PPC_ADDR16_HI: u32 = 5;
1994/// adjusted high 16bit
1995pub const R_PPC_ADDR16_HA: u32 = 6;
1996/// 16bit address, 2 bits ignored
1997pub const R_PPC_ADDR14: u32 = 7;
1998pub const R_PPC_ADDR14_BRTAKEN: u32 = 8;
1999pub const R_PPC_ADDR14_BRNTAKEN: u32 = 9;
2000/// PC relative 26 bit
2001pub const R_PPC_REL24: u32 = 10;
2002/// PC relative 16 bit
2003pub const R_PPC_REL14: u32 = 11;
2004pub const R_PPC_REL14_BRTAKEN: u32 = 12;
2005pub const R_PPC_REL14_BRNTAKEN: u32 = 13;
2006pub const R_PPC_GOT16: u32 = 14;
2007pub const R_PPC_GOT16_LO: u32 = 15;
2008pub const R_PPC_GOT16_HI: u32 = 16;
2009pub const R_PPC_GOT16_HA: u32 = 17;
2010pub const R_PPC_PLTREL24: u32 = 18;
2011pub const R_PPC_COPY: u32 = 19;
2012pub const R_PPC_GLOB_DAT: u32 = 20;
2013pub const R_PPC_JMP_SLOT: u32 = 21;
2014pub const R_PPC_RELATIVE: u32 = 22;
2015pub const R_PPC_LOCAL24PC: u32 = 23;
2016pub const R_PPC_UADDR32: u32 = 24;
2017pub const R_PPC_UADDR16: u32 = 25;
2018pub const R_PPC_REL32: u32 = 26;
2019pub const R_PPC_PLT32: u32 = 27;
2020pub const R_PPC_PLTREL32: u32 = 28;
2021pub const R_PPC_PLT16_LO: u32 = 29;
2022pub const R_PPC_PLT16_HI: u32 = 30;
2023pub const R_PPC_PLT16_HA: u32 = 31;
2024pub const R_PPC_SDAREL16: u32 = 32;
2025pub const R_PPC_SECTOFF: u32 = 33;
2026pub const R_PPC_SECTOFF_LO: u32 = 34;
2027pub const R_PPC_SECTOFF_HI: u32 = 35;
2028pub const R_PPC_SECTOFF_HA: u32 = 36;
2029
2030/// (sym+add)@tls
2031pub const R_PPC_TLS: u32 = 67;
2032/// (sym+add)@dtpmod
2033pub const R_PPC_DTPMOD32: u32 = 68;
2034/// (sym+add)@tprel
2035pub const R_PPC_TPREL16: u32 = 69;
2036/// (sym+add)@tprel@l
2037pub const R_PPC_TPREL16_LO: u32 = 70;
2038/// (sym+add)@tprel@h
2039pub const R_PPC_TPREL16_HI: u32 = 71;
2040/// (sym+add)@tprel@ha
2041pub const R_PPC_TPREL16_HA: u32 = 72;
2042/// (sym+add)@tprel
2043pub const R_PPC_TPREL32: u32 = 73;
2044/// (sym+add)@dtprel
2045pub const R_PPC_DTPREL16: u32 = 74;
2046/// (sym+add)@dtprel@l
2047pub const R_PPC_DTPREL16_LO: u32 = 75;
2048/// (sym+add)@dtprel@h
2049pub const R_PPC_DTPREL16_HI: u32 = 76;
2050/// (sym+add)@dtprel@ha
2051pub const R_PPC_DTPREL16_HA: u32 = 77;
2052/// (sym+add)@dtprel
2053pub const R_PPC_DTPREL32: u32 = 78;
2054/// (sym+add)@got@tlsgd
2055pub const R_PPC_GOT_TLSGD16: u32 = 79;
2056/// (sym+add)@got@tlsgd@l
2057pub const R_PPC_GOT_TLSGD16_LO: u32 = 80;
2058/// (sym+add)@got@tlsgd@h
2059pub const R_PPC_GOT_TLSGD16_HI: u32 = 81;
2060/// (sym+add)@got@tlsgd@ha
2061pub const R_PPC_GOT_TLSGD16_HA: u32 = 82;
2062/// (sym+add)@got@tlsld
2063pub const R_PPC_GOT_TLSLD16: u32 = 83;
2064/// (sym+add)@got@tlsld@l
2065pub const R_PPC_GOT_TLSLD16_LO: u32 = 84;
2066/// (sym+add)@got@tlsld@h
2067pub const R_PPC_GOT_TLSLD16_HI: u32 = 85;
2068/// (sym+add)@got@tlsld@ha
2069pub const R_PPC_GOT_TLSLD16_HA: u32 = 86;
2070/// (sym+add)@got@tprel
2071pub const R_PPC_GOT_TPREL16: u32 = 87;
2072/// (sym+add)@got@tprel@l
2073pub const R_PPC_GOT_TPREL16_LO: u32 = 88;
2074/// (sym+add)@got@tprel@h
2075pub const R_PPC_GOT_TPREL16_HI: u32 = 89;
2076/// (sym+add)@got@tprel@ha
2077pub const R_PPC_GOT_TPREL16_HA: u32 = 90;
2078/// (sym+add)@got@dtprel
2079pub const R_PPC_GOT_DTPREL16: u32 = 91;
2080/// (sym+add)@got@dtprel@l
2081pub const R_PPC_GOT_DTPREL16_LO: u32 = 92;
2082/// (sym+add)@got@dtprel@h
2083pub const R_PPC_GOT_DTPREL16_HI: u32 = 93;
2084/// (sym+add)@got@dtprel@ha
2085pub const R_PPC_GOT_DTPREL16_HA: u32 = 94;
2086/// (sym+add)@tlsgd
2087pub const R_PPC_TLSGD: u32 = 95;
2088/// (sym+add)@tlsld
2089pub const R_PPC_TLSLD: u32 = 96;
2090
2091// The remaining relocs are from the Embedded ELF ABI, and are not in the SVR4 ELF ABI.
2092pub const R_PPC_EMB_NADDR32: u32 = 101;
2093pub const R_PPC_EMB_NADDR16: u32 = 102;
2094pub const R_PPC_EMB_NADDR16_LO: u32 = 103;
2095pub const R_PPC_EMB_NADDR16_HI: u32 = 104;
2096pub const R_PPC_EMB_NADDR16_HA: u32 = 105;
2097pub const R_PPC_EMB_SDAI16: u32 = 106;
2098pub const R_PPC_EMB_SDA2I16: u32 = 107;
2099pub const R_PPC_EMB_SDA2REL: u32 = 108;
2100/// 16 bit offset in SDA
2101pub const R_PPC_EMB_SDA21: u32 = 109;
2102pub const R_PPC_EMB_MRKREF: u32 = 110;
2103pub const R_PPC_EMB_RELSEC16: u32 = 111;
2104pub const R_PPC_EMB_RELST_LO: u32 = 112;
2105pub const R_PPC_EMB_RELST_HI: u32 = 113;
2106pub const R_PPC_EMB_RELST_HA: u32 = 114;
2107pub const R_PPC_EMB_BIT_FLD: u32 = 115;
2108pub const R_PPC_EMB_RELSDA: u32 = 116;
2109
2110/// like EMB_SDA21, but lower 16 bit
2111pub const R_PPC_DIAB_SDA21_LO: u32 = 180;
2112/// like EMB_SDA21, but high 16 bit
2113pub const R_PPC_DIAB_SDA21_HI: u32 = 181;
2114/// like EMB_SDA21, adjusted high 16
2115pub const R_PPC_DIAB_SDA21_HA: u32 = 182;
2116/// like EMB_RELSDA, but lower 16 bit
2117pub const R_PPC_DIAB_RELSDA_LO: u32 = 183;
2118/// like EMB_RELSDA, but high 16 bit
2119pub const R_PPC_DIAB_RELSDA_HI: u32 = 184;
2120/// like EMB_RELSDA, adjusted high 16
2121pub const R_PPC_DIAB_RELSDA_HA: u32 = 185;
2122
2123// GNU extension to support local ifunc.
2124pub const R_PPC_IRELATIVE: u32 = 248;
2125
2126// GNU relocs used in PIC code sequences.
2127/// (sym+add-.)
2128pub const R_PPC_REL16: u32 = 249;
2129/// (sym+add-.)@l
2130pub const R_PPC_REL16_LO: u32 = 250;
2131/// (sym+add-.)@h
2132pub const R_PPC_REL16_HI: u32 = 251;
2133/// (sym+add-.)@ha
2134pub const R_PPC_REL16_HA: u32 = 252;
2135
2136/// This is a phony reloc to handle any old fashioned TOC16 references that may still be in object files.
2137pub const R_PPC_TOC16: u32 = 255;
2138
2139// PowerPC specific values for the Dyn d_tag field.
2140pub const DT_PPC_GOT: i64 = 0x70000000;
2141pub const DT_PPC_OPT: i64 = 0x70000001;
2142
2143/// PowerPC specific values for the DT_PPC_OPT Dyn entry.
2144pub const PPC_OPT_TLS: u64 = 1;
2145
2146// e_flags bits specifying ABI.
2147// 1 for original function descriptor using ABI,
2148// 2 for revised ABI without function descriptors,
2149// 0 for unspecified or not using any features affected by the differences.
2150pub const EF_PPC64_ABI: u32 = 3;
2151
2152// PowerPC64 specific values for the Dyn d_tag field.
2153pub const DT_PPC64_GLINK: i64 = 0x70000000;
2154pub const DT_PPC64_OPD: i64 = 0x70000001;
2155pub const DT_PPC64_OPDSZ: i64 = 0x70000002;
2156pub const DT_PPC64_OPT: i64 = 0x70000003;
2157
2158// PowerPC64 specific bits in the DT_PPC64_OPT Dyn entry.
2159pub const PPC64_OPT_TLS: u64 = 1;
2160pub const PPC64_OPT_MULTI_TOC: u64 = 2;
2161pub const PPC64_OPT_LOCALENTRY: u64 = 4;
2162
2163// PowerPC64 specific values for the Elf64_Sym st_other field.
2164pub const STO_PPC64_LOCAL_BIT: u8 = 5;
2165pub const STO_PPC64_LOCAL_MASK: u8 = 7 << STO_PPC64_LOCAL_BIT;
2166
2167// Relocation types
2168//
2169// A Represents the addend used to compute the value of the relocatable field.
2170// B Represents the base address at which a shared object has been loaded into memory during execution.
2171// G Represents the offset into the global offset table, relative to
2172// the TOC base, at which the address of the relocation entry's symbol
2173// plus addend will reside during execution.
2174// L Represents the section offset or address of the procedure linkage
2175// table entry for the symbol plus addend.
2176// M Similar to G, except that the address which is stored may be the
2177// address of the procedure linkage table entry for the symbol.
2178// P Represents the place (section offset or address) of the storage
2179// unit being relocated (computed using r_offset).
2180// R Represents the offset of the symbol within the section in which
2181// the symbol is defined (its section-relative address).
2182// S Represents the value of the symbol whose index resides in the relocation entry.
2183
2184/// none
2185pub const R_PPC64_NONE: u32 = 0;
2186/// `S + A`
2187pub const R_PPC64_ADDR32: u32 = 1;
2188/// `(S + A) >> 2`
2189pub const R_PPC64_ADDR24: u32 = 2;
2190/// `S + A`
2191pub const R_PPC64_ADDR16: u32 = 3;
2192/// `#lo(S + A)`
2193pub const R_PPC64_ADDR16_LO: u32 = 4;
2194/// `#hi(S + A)`
2195pub const R_PPC64_ADDR16_HI: u32 = 5;
2196/// `#ha(S + A)`
2197pub const R_PPC64_ADDR16_HA: u32 = 6;
2198/// `(S + A) >> 2`
2199pub const R_PPC64_ADDR14: u32 = 7;
2200/// `(S + A) >> 2`
2201pub const R_PPC64_ADDR14_BRTAKEN: u32 = 8;
2202/// `(S + A) >> 2`
2203pub const R_PPC64_ADDR14_BRNTAKEN: u32 = 9;
2204/// `(S + A - P) >> 2`
2205pub const R_PPC64_REL24: u32 = 10;
2206/// `(S + A - P) >> 2`
2207pub const R_PPC64_REL14: u32 = 11;
2208/// `(S + A - P) >> 2`
2209pub const R_PPC64_REL14_BRTAKEN: u32 = 12;
2210/// `(S + A - P) >> 2`
2211pub const R_PPC64_REL14_BRNTAKEN: u32 = 13;
2212/// `G`
2213pub const R_PPC64_GOT16: u32 = 14;
2214/// `#lo(G)`
2215pub const R_PPC64_GOT16_LO: u32 = 15;
2216/// `#hi(G)`
2217pub const R_PPC64_GOT16_HI: u32 = 16;
2218/// `#ha(G)`
2219pub const R_PPC64_GOT16_HA: u32 = 17;
2220/// none
2221pub const R_PPC64_COPY: u32 = 19;
2222/// `S + A`
2223pub const R_PPC64_GLOB_DAT: u32 = 20;
2224/// see below
2225pub const R_PPC64_JMP_SLOT: u32 = 21;
2226/// `B + A`
2227pub const R_PPC64_RELATIVE: u32 = 22;
2228/// `S + A`
2229pub const R_PPC64_UADDR32: u32 = 24;
2230/// `S + A`
2231pub const R_PPC64_UADDR16: u32 = 25;
2232/// `S + A - P`
2233pub const R_PPC64_REL32: u32 = 26;
2234/// `L`
2235pub const R_PPC64_PLT32: u32 = 27;
2236/// `L - P`
2237pub const R_PPC64_PLTREL32: u32 = 28;
2238/// `#lo(L)`
2239pub const R_PPC64_PLT16_LO: u32 = 29;
2240/// `#hi(L)`
2241pub const R_PPC64_PLT16_HI: u32 = 30;
2242/// `#ha(L)`
2243pub const R_PPC64_PLT16_HA: u32 = 31;
2244/// `R + A`
2245pub const R_PPC64_SECTOFF: u32 = 33;
2246/// `#lo(R + A)`
2247pub const R_PPC64_SECTOFF_LO: u32 = 34;
2248/// `#hi(R + A)`
2249pub const R_PPC64_SECTOFF_HI: u32 = 35;
2250/// `#ha(R + A)`
2251pub const R_PPC64_SECTOFF_HA: u32 = 36;
2252/// `(S + A - P) >> 2`
2253pub const R_PPC64_ADDR30: u32 = 37;
2254/// `S + A`
2255pub const R_PPC64_ADDR64: u32 = 38;
2256/// `#higher(S + A)`
2257pub const R_PPC64_ADDR16_HIGHER: u32 = 39;
2258/// `#highera(S + A)`
2259pub const R_PPC64_ADDR16_HIGHERA: u32 = 40;
2260/// `#highest(S + A)`
2261pub const R_PPC64_ADDR16_HIGHEST: u32 = 41;
2262/// `#highesta(S + A)`
2263pub const R_PPC64_ADDR16_HIGHESTA: u32 = 42;
2264/// `S + A`
2265pub const R_PPC64_UADDR64: u32 = 43;
2266/// `S + A - P`
2267pub const R_PPC64_REL64: u32 = 44;
2268/// `L`
2269pub const R_PPC64_PLT64: u32 = 45;
2270/// `L - P`
2271pub const R_PPC64_PLTREL64: u32 = 46;
2272/// `S + A - .TOC.`
2273pub const R_PPC64_TOC16: u32 = 47;
2274/// `#lo(S + A - .TOC.)`
2275pub const R_PPC64_TOC16_LO: u32 = 48;
2276/// `#hi(S + A - .TOC.)`
2277pub const R_PPC64_TOC16_HI: u32 = 49;
2278/// `#ha(S + A - .TOC.)`
2279pub const R_PPC64_TOC16_HA: u32 = 50;
2280/// `.TOC.`
2281pub const R_PPC64_TOC: u32 = 51;
2282/// `M`
2283pub const R_PPC64_PLTGOT16: u32 = 52;
2284/// `#lo(M)`
2285pub const R_PPC64_PLTGOT16_LO: u32 = 53;
2286/// `#hi(M)`
2287pub const R_PPC64_PLTGOT16_HI: u32 = 54;
2288/// `#ha(M)`
2289pub const R_PPC64_PLTGOT16_HA: u32 = 55;
2290/// `(S + A) >> 2`
2291pub const R_PPC64_ADDR16_DS: u32 = 56;
2292/// `#lo(S + A) >> 2`
2293pub const R_PPC64_ADDR16_LO_DS: u32 = 57;
2294/// `G >> 2`
2295pub const R_PPC64_GOT16_DS: u32 = 58;
2296/// `#lo(G) >> 2`
2297pub const R_PPC64_GOT16_LO_DS: u32 = 59;
2298/// `#lo(L) >> 2`
2299pub const R_PPC64_PLT16_LO_DS: u32 = 60;
2300/// `(R + A) >> 2`
2301pub const R_PPC64_SECTOFF_DS: u32 = 61;
2302/// `#lo(R + A) >> 2`
2303pub const R_PPC64_SECTOFF_LO_DS: u32 = 62;
2304/// `(S + A - .TOC.) >> 2`
2305pub const R_PPC64_TOC16_DS: u32 = 63;
2306/// `#lo(S + A - .TOC.) >> 2`
2307pub const R_PPC64_TOC16_LO_DS: u32 = 64;
2308/// `M >> 2`
2309pub const R_PPC64_PLTGOT16_DS: u32 = 65;
2310/// `#lo(M) >> 2`
2311pub const R_PPC64_PLTGOT16_LO_DS: u32 = 66;
2312/// none
2313pub const R_PPC64_TLS: u32 = 67;
2314/// `@dtpmod`
2315pub const R_PPC64_DTPMOD64: u32 = 68;
2316/// `@tprel`
2317pub const R_PPC64_TPREL16: u32 = 69;
2318/// `#lo(@tprel)`
2319pub const R_PPC64_TPREL16_LO: u32 = 60;
2320/// `#hi(@tprel)`
2321pub const R_PPC64_TPREL16_HI: u32 = 71;
2322/// `#ha(@tprel)`
2323pub const R_PPC64_TPREL16_HA: u32 = 72;
2324/// `@tprel`
2325pub const R_PPC64_TPREL64: u32 = 73;
2326/// `@dtprel`
2327pub const R_PPC64_DTPREL16: u32 = 74;
2328/// `#lo(@dtprel)`
2329pub const R_PPC64_DTPREL16_LO: u32 = 75;
2330/// `#hi(@dtprel)`
2331pub const R_PPC64_DTPREL16_HI: u32 = 76;
2332/// `#ha(@dtprel)`
2333pub const R_PPC64_DTPREL16_HA: u32 = 77;
2334/// `@dtprel`
2335pub const R_PPC64_DTPREL64: u32 = 78;
2336/// `@got@tlsgd`
2337pub const R_PPC64_GOT_TLSGD16: u32 = 79;
2338/// `#lo(@got@tlsgd)`
2339pub const R_PPC64_GOT_TLSGD16_LO: u32 = 80;
2340/// `#hi(@got@tlsgd)`
2341pub const R_PPC64_GOT_TLSGD16_HI: u32 = 81;
2342/// `#ha(@got@tlsgd)`
2343pub const R_PPC64_GOT_TLSGD16_HA: u32 = 82;
2344/// `@got@tlsld`
2345pub const R_PPC64_GOT_TLSLD16: u32 = 83;
2346/// `#lo(@got@tlsld)`
2347pub const R_PPC64_GOT_TLSLD16_LO: u32 = 84;
2348/// `#hi(@got@tlsld)`
2349pub const R_PPC64_GOT_TLSLD16_HI: u32 = 85;
2350/// `#ha(@got@tlsld)`
2351pub const R_PPC64_GOT_TLSLD16_HA: u32 = 86;
2352/// `@got@tprel`
2353pub const R_PPC64_GOT_TPREL16_DS: u32 = 87;
2354/// `#lo(@got@tprel)`
2355pub const R_PPC64_GOT_TPREL16_LO_DS: u32 = 88;
2356/// `#hi(@got@tprel)`
2357pub const R_PPC64_GOT_TPREL16_HI: u32 = 89;
2358/// `#ha(@got@tprel)`
2359pub const R_PPC64_GOT_TPREL16_HA: u32 = 90;
2360/// `@got@dtprel`
2361pub const R_PPC64_GOT_DTPREL16_DS: u32 = 91;
2362/// `#lo(@got@dtprel)`
2363pub const R_PPC64_GOT_DTPREL16_LO_DS: u32 = 92;
2364/// `#hi(@got@dtprel)`
2365pub const R_PPC64_GOT_DTPREL16_HI: u32 = 93;
2366/// `#ha(@got@dtprel)`
2367pub const R_PPC64_GOT_DTPREL16_HA: u32 = 94;
2368/// `@tprel`
2369pub const R_PPC64_TPREL16_DS: u32 = 95;
2370/// `#lo(@tprel)`
2371pub const R_PPC64_TPREL16_LO_DS: u32 = 96;
2372/// `#higher(@tprel)`
2373pub const R_PPC64_TPREL16_HIGHER: u32 = 97;
2374/// `#highera(@tprel)`
2375pub const R_PPC64_TPREL16_HIGHERA: u32 = 98;
2376/// `#highest(@tprel)`
2377pub const R_PPC64_TPREL16_HIGHEST: u32 = 99;
2378/// `#highesta(@tprel)`
2379pub const R_PPC64_TPREL16_HIGHESTA: u32 = 100;
2380/// `@dtprel`
2381pub const R_PPC64_DTPREL16_DS: u32 = 101;
2382/// `#lo(@dtprel)`
2383pub const R_PPC64_DTPREL16_LO_DS: u32 = 102;
2384/// `#higher(@dtprel)`
2385pub const R_PPC64_DTPREL16_HIGHER: u32 = 103;
2386/// `#highera(@dtprel)`
2387pub const R_PPC64_DTPREL16_HIGHERA: u32 = 104;
2388/// `#highest(@dtprel)`
2389pub const R_PPC64_DTPREL16_HIGHEST: u32 = 105;
2390/// `#highesta(@dtprel)`
2391pub const R_PPC64_DTPREL16_HIGHESTA: u32 = 106;
2392/// `(sym+add)@tlsgd`
2393pub const R_PPC64_TLSGD: u32 = 107;
2394/// `(sym+add)@tlsld`
2395pub const R_PPC64_TLSLD: u32 = 108;
2396pub const R_PPC64_TOCSAVE: u32 = 109;
2397pub const R_PPC64_ADDR16_HIGH: u32 = 110;
2398pub const R_PPC64_ADDR16_HIGHA: u32 = 111;
2399pub const R_PPC64_TPREL16_HIGH: u32 = 112;
2400pub const R_PPC64_TPREL16_HIGHA: u32 = 113;
2401pub const R_PPC64_DTPREL16_HIGH: u32 = 114;
2402pub const R_PPC64_DTPREL16_HIGHA: u32 = 115;
2403
2404// GNU extension to support local ifunc.
2405pub const R_PPC64_JMP_IREL: u32 = 247;
2406pub const R_PPC64_IRELATIVE: u32 = 248;
2407/// `(sym+add-.)`
2408pub const R_PPC64_REL16: u32 = 249;
2409/// `(sym+add-.)@l`
2410pub const R_PPC64_REL16_LO: u32 = 250;
2411/// `(sym+add-.)@h`
2412pub const R_PPC64_REL16_HI: u32 = 251;
2413/// `(sym+add-.)@ha`
2414pub const R_PPC64_REL16_HA: u32 = 252;
2415
2416// ____ ___ ____ ____ __ __
2417// | _ \|_ _/ ___| / ___| \ \ / /
2418// | |_) || |\___ \| | ____\ \ / /
2419// | _ < | | ___) | |__|_____\ V /
2420// |_| \_\___|____/ \____| \_/
2421//
2422// See: https://github.com/riscv-non-isa/riscv-elf-psabi-doc
2423
2424/// This bit is set when the binary targets the C ABI.
2425pub const EF_RISCV_RVC: u32 = 0x0001;
2426pub const EF_RISCV_FLOAT_ABI_SOFT: u32 = 0x0000;
2427pub const EF_RISCV_FLOAT_ABI_SINGLE: u32 = 0x0002;
2428pub const EF_RISCV_FLOAT_ABI_DOUBLE: u32 = 0x0004;
2429pub const EF_RISCV_FLOAT_ABI_QUAD: u32 = 0x0006;
2430/// This is used as a mask to test for one of the above floating-point ABIs,
2431/// e.g., (e_flags & EF_RISCV_FLOAT_ABI) == EF_RISCV_FLOAT_ABI_DOUBLE.
2432pub const EF_RISCV_FLOAT_ABI_MASK: u32 = 0x0006;
2433/// This bit is set when the binary targets the E ABI.
2434pub const EF_RISCV_RVE: u32 = 0x0008;
2435/// This bit is set when the binary requires the RVTSO memory consistency model.
2436pub const EF_RISCV_TSO: u32 = 0x0010;
2437
2438pub const SHT_RISCV_ATTRIBUTES: u32 = 0x70000003; // SHT_LOPROC + 3;
2439pub const SHT_RISCV_ATTRIBUTES_SECTION_NAME: &str = ".riscv.attributes";
2440
2441pub const PT_RISCV_ATTRIBUTES: u32 = 0x70000003;
2442
2443/// Any functions that use registers in a way that is incompatible with the
2444/// calling convention of the ABI in use must be annotated with STO_RISCV_VARIANT_CC
2445pub const STO_RISCV_VARIANT_CC: u8 = 0x80;
2446
2447/// An object must have the dynamic tag DT_RISCV_VARIANT_CC if it has one or more R_RISCV_JUMP_SLOT
2448/// relocations against symbols with the STO_RISCV_VARIANT_CC attribute.
2449pub const DT_RISCV_VARIANT_CC: i64 = 0x70000001;
2450
2451// RISC-V relocation types
2452//
2453// A Addend field in the relocation entry associated with the symbol
2454// B Base address of a shared object loaded into memory
2455// G Offset of the symbol into the GOT (Global Offset Table)
2456// GOT Address of the GOT (Global Offset Table)
2457// P Position of the relocation
2458// S Value of the symbol in the symbol table
2459// V Value at the position of the relocation
2460// GP Value of __global_pointer$ symbol
2461// TLSMODULE TLS module index for the object containing the symbol
2462// TLSOFFSET TLS static block offset (relative to tp) for the object containing the symbol
2463
2464pub const R_RISCV_NONE: u32 = 0;
2465/// 32-bit relocation: `S + A`
2466pub const R_RISCV_32: u32 = 1;
2467/// 64-bit relocation: `S + A`
2468pub const R_RISCV_64: u32 = 2;
2469/// Adjust a link address (A) to its load address: `(B + A).`
2470pub const R_RISCV_RELATIVE: u32 = 3;
2471/// Must be in executable; not allowed in shared library
2472pub const R_RISCV_COPY: u32 = 4;
2473/// Indicates the symbol associated with a PLT entry: `S`
2474pub const R_RISCV_JUMP_SLOT: u32 = 5;
2475/// `TLSMODULE`
2476pub const R_RISCV_TLS_DTPMOD32: u32 = 6;
2477/// `TLSMODULE`
2478pub const R_RISCV_TLS_DTPMOD64: u32 = 7;
2479/// `S + A - TLS_DTV_OFFSET`
2480pub const R_RISCV_TLS_DTPREL32: u32 = 8;
2481/// `S + A - TLS_DTV_OFFSET`
2482pub const R_RISCV_TLS_DTPREL64: u32 = 9;
2483/// `S + A + TLSOFFSET`
2484pub const R_RISCV_TLS_TPREL32: u32 = 10;
2485/// `S + A + TLSOFFSET`
2486pub const R_RISCV_TLS_TPREL64: u32 = 11;
2487/// 12-bit PC-relative branch offset `S + A - P`
2488pub const R_RISCV_BRANCH: u32 = 16;
2489/// 20-bit PC-relative jump offset `S + A - P`
2490pub const R_RISCV_JAL: u32 = 17;
2491/// Deprecated, please use CALL_PLT instead 32-bit PC-relative function call, macros call, tail: `S + A - P`
2492pub const R_RISCV_CALL: u32 = 18;
2493/// 32-bit PC-relative function call, macros call, tail (PIC): `S + A - P`
2494pub const R_RISCV_CALL_PLT: u32 = 19;
2495/// High 20 bits of 32-bit PC-relative GOT access, %got_pcrel_hi(symbol): `G + GOT + A - P`
2496pub const R_RISCV_GOT_HI20: u32 = 20;
2497/// High 20 bits of 32-bit PC-relative TLS IE GOT access, macro la.tls.ie
2498pub const R_RISCV_TLS_GOT_HI20: u32 = 21;
2499/// High 20 bits of 32-bit PC-relative TLS GD GOT reference, macro la.tls.gd
2500pub const R_RISCV_TLS_GD_HI20: u32 = 22;
2501/// High 20 bits of 32-bit PC-relative reference, %pcrel_hi(symbol): `S + A - P`
2502pub const R_RISCV_PCREL_HI20: u32 = 23;
2503/// Low 12 bits of a 32-bit PC-relative, %pcrel_lo(address of %pcrel_hi), the addend must be 0: `S - P`
2504pub const R_RISCV_PCREL_LO12_I: u32 = 24;
2505/// Low 12 bits of a 32-bit PC-relative, %pcrel_lo(address of %pcrel_hi), the addend must be 0: `S - P`
2506pub const R_RISCV_PCREL_LO12_S: u32 = 25;
2507/// High 20 bits of 32-bit absolute address, %hi(symbol): `S + A`
2508pub const R_RISCV_HI20: u32 = 26;
2509/// Low 12 bits of 32-bit absolute address, %lo(symbol): `S + A`
2510pub const R_RISCV_LO12_I: u32 = 27;
2511/// Low 12 bits of 32-bit absolute address, %lo(symbol): `S + A`
2512pub const R_RISCV_LO12_S: u32 = 28;
2513/// High 20 bits of TLS LE thread pointer offset, `%tprel_hi(symbol)`
2514pub const R_RISCV_TPREL_HI20: u32 = 29;
2515/// Low 12 bits of TLS LE thread pointer offset, `%tprel_lo(symbol)`
2516pub const R_RISCV_TPREL_LO12_I: u32 = 30;
2517/// Low 12 bits of TLS LE thread pointer offset, `%tprel_lo(symbol)`
2518pub const R_RISCV_TPREL_LO12_S: u32 = 31;
2519/// TLS LE thread pointer usage, `%tprel_add(symbol)`
2520pub const R_RISCV_TPREL_ADD: u32 = 32;
2521/// 8-bit label addition: `V + S + A`
2522pub const R_RISCV_ADD8: u32 = 33;
2523/// 16-bit label addition: `V + S + A`
2524pub const R_RISCV_ADD16: u32 = 34;
2525/// 32-bit label addition: `V + S + A`
2526pub const R_RISCV_ADD32: u32 = 35;
2527/// 64-bit label addition: `V + S + A`
2528pub const R_RISCV_ADD64: u32 = 36;
2529/// 8-bit label subtraction: `V - S - A`
2530pub const R_RISCV_SUB8: u32 = 37;
2531/// 16-bit label subtraction: `V - S - A`
2532pub const R_RISCV_SUB16: u32 = 38;
2533/// 32-bit label subtraction: `V - S - A`
2534pub const R_RISCV_SUB32: u32 = 39;
2535/// 64-bit label subtraction: `V - S - A`
2536pub const R_RISCV_SUB64: u32 = 40;
2537/// Alignment statement. The addend indicates the number of bytes occupied by
2538/// nop instructions at the relocation offset. The alignment boundary is
2539/// specified by the addend rounded up to the next power of two.
2540pub const R_RISCV_ALIGN: u32 = 43;
2541/// 8-bit PC-relative branch offset: `S + A - P`
2542pub const R_RISCV_RVC_BRANCH: u32 = 44;
2543/// 11-bit PC-relative jump offset: `S + A - P`
2544pub const R_RISCV_RVC_JUMP: u32 = 45;
2545/// High 6 bits of 18-bit absolute address: `S + A`
2546pub const R_RISCV_RVC_LUI: u32 = 46;
2547/// Instruction can be relaxed, paired with a normal relocation at the same address
2548pub const R_RISCV_RELAX: u32 = 51;
2549/// Local label subtraction: `V - S - A`
2550pub const R_RISCV_SUB6: u32 = 52;
2551/// Local label assignment: `S + A`
2552pub const R_RISCV_SET6: u32 = 53;
2553/// Local label assignment: `S + A`
2554pub const R_RISCV_SET8: u32 = 54;
2555/// Local label assignment: `S + A`
2556pub const R_RISCV_SET16: u32 = 55;
2557/// Local label assignment: `S + A`
2558pub const R_RISCV_SET32: u32 = 56;
2559/// 32-bit PC relative: `S + A - P`
2560pub const R_RISCV_32_PCREL: u32 = 57;
2561/// Relocation against a non-preemptible ifunc symbolifunc_resolver: `(B + A)`
2562pub const R_RISCV_IRELATIVE: u32 = 58;
2563
2564// ___ __ __ _ _
2565// __ _( _ ) / /_ / /_ | || |
2566// \ \/ / _ \| '_ \ | '_ \| || |_
2567// > < (_) | (_) | | (_) |__ _|
2568// /_/\_\___/ \___/___\___/ |_|
2569// |_____|
2570//
2571// See: https://gitlab.com/x86-psABIs/x86-64-ABI
2572
2573/// If an object file section does not have this flag set, then it may not hold
2574/// more than 2GB and can be freely referred to in objects using smaller code models.
2575pub const SHF_X86_64_LARGE: u64 = 0x10000000;
2576
2577/// This section contains unwind function table entries for stack unwinding.
2578pub const SHT_X86_64_UNWIND: u32 = 0x70000001; // SHT_LOPROC + 1;
2579
2580// x86_64 reloc types
2581//
2582// A Represents the addend used to compute the value of the relocatable field.
2583// B Represents the base address at which a shared object has been loaded into memory
2584// during execution. Generally, a shared object is built with a 0 base virtual address,
2585// but the execution address will be different.
2586// G Represents the offset into the global offset table at which the relocation entry’s symbol
2587// will reside during execution.
2588// GOT Represents the address of the global offset table.
2589// L Represents the place (section offset or address) of the Procedure Linkage Table entry for a symbol.
2590// P Represents the place (section offset or address) of the storage unit being relocated (computed using r_offset).
2591// S Represents the value of the symbol whose index resides in the relocation entry.
2592// Z Represents the size of the symbol whose index resides in the relocation entry.
2593
2594pub const R_X86_64_NONE: u32 = 0;
2595/// `S + A`
2596pub const R_X86_64_64: u32 = 1;
2597/// `S + A - P`
2598pub const R_X86_64_PC32: u32 = 2;
2599/// `G + A`
2600pub const R_X86_64_GOT32: u32 = 3;
2601/// `L + A - P`
2602pub const R_X86_64_PLT32: u32 = 4;
2603pub const R_X86_64_COPY: u32 = 5;
2604/// `S`
2605pub const R_X86_64_GLOB_DAT: u32 = 6;
2606/// `S`
2607pub const R_X86_64_JUMP_SLOT: u32 = 7;
2608/// `B + A`
2609pub const R_X86_64_RELATIVE: u32 = 8;
2610/// `G + GOT + A - P`
2611pub const R_X86_64_GOTPCREL: u32 = 9;
2612/// `S + A`
2613pub const R_X86_64_32: u32 = 10;
2614/// `S + A`
2615pub const R_X86_64_32S: u32 = 11;
2616/// `S + A`
2617pub const R_X86_64_16: u32 = 12;
2618/// `S + A - P`
2619pub const R_X86_64_PC16: u32 = 13;
2620/// `S + A`
2621pub const R_X86_64_8: u32 = 14;
2622/// `S + A - P`
2623pub const R_X86_64_PC8: u32 = 15;
2624pub const R_X86_64_DTPMOD64: u32 = 16;
2625pub const R_X86_64_DTPOFF64: u32 = 17;
2626pub const R_X86_64_TPOFF64: u32 = 18;
2627pub const R_X86_64_TLSGD: u32 = 19;
2628pub const R_X86_64_TLSLD: u32 = 20;
2629pub const R_X86_64_DTPOFF32: u32 = 21;
2630pub const R_X86_64_GOTTPOFF: u32 = 22;
2631pub const R_X86_64_TPOFF32: u32 = 23;
2632/// `S + A - P`
2633pub const R_X86_64_PC64: u32 = 24;
2634/// `S + A - GOT`
2635pub const R_X86_64_GOTOFF64: u32 = 25;
2636/// `GOT + A - P`
2637pub const R_X86_64_GOTPC32: u32 = 26;
2638/// `G + A`
2639pub const R_X86_64_GOT64: u32 = 27;
2640/// `G + GOT - P + A`
2641pub const R_X86_64_GOTPCREL64: u32 = 28;
2642/// `GOT - P + A`
2643pub const R_X86_64_GOTPC64: u32 = 29;
2644/// `L - GOT + A`
2645pub const R_X86_64_PLTOFF64: u32 = 31;
2646/// `Z + A`
2647pub const R_X86_64_SIZE32: u32 = 32;
2648/// `Z + A`
2649pub const R_X86_64_SIZE64: u32 = 33;
2650pub const R_X86_64_GOTPC32_TLSDESC: u32 = 34;
2651pub const R_X86_64_TLSDESC_CALL: u32 = 35;
2652pub const R_X86_64_TLSDESC: u32 = 36;
2653/// `indirect (B + A)`
2654pub const R_X86_64_IRELATIVE: u32 = 37;
2655/// `B + A`
2656pub const R_X86_64_RELATIVE64: u32 = 38;
2657/// `G + GOT + A - P`
2658pub const R_X86_64_GOTPCRELX: u32 = 41;
2659/// `G + GOT + A - P`
2660pub const R_X86_64_REX_GOTPCRELX: u32 = 42;