Coverage Report

Created: 2025-12-28 06:31

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