Debian Codegraph @

third_party/rust/object/src/elf.rs

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