master
1/*-
2 * Copyright (c) 2010,2021 Joseph Koshy
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27/*
28 * WARNING: GENERATED FILE. DO NOT MODIFY.
29 *
30 * GENERATED FROM: Id: elfdefinitions.m4 3984 2022-05-06 11:22:42Z jkoshy
31 * GENERATED FROM: Id: elfconstants.m4 3980 2022-05-02 19:50:00Z jkoshy
32 */
33
34/*
35 * These definitions are based on:
36 * - The public specification of the ELF format as defined in the
37 * October 2009 draft of System V ABI.
38 * See: http://www.sco.com/developers/gabi/latest/ch4.intro.html
39 * - The May 1998 (version 1.5) draft of "The ELF-64 object format".
40 * - Processor-specific ELF ABI definitions for sparc, i386, amd64, mips,
41 * ia64, powerpc, and RISC-V processors.
42 * - The "Linkers and Libraries Guide", from Sun Microsystems.
43 */
44
45#ifndef _SYS_ELFDEFINITIONS_H_
46#define _SYS_ELFDEFINITIONS_H_
47
48/*
49 * Types of capabilities.
50 */
51
52#define CA_SUNW_NULL 0
53#define CA_SUNW_HW_1 1
54#define CA_SUNW_SW_1 2
55
56/*
57 * Flags used with dynamic linking entries.
58 */
59
60#define DF_ORIGIN 0x1
61#define DF_SYMBOLIC 0x2
62#define DF_TEXTREL 0x4
63#define DF_BIND_NOW 0x8
64#define DF_STATIC_TLS 0x10
65#define DF_1_BIND_NOW 0x1
66#define DF_1_GLOBAL 0x2
67#define DF_1_GROUP 0x4
68#define DF_1_NODELETE 0x8
69#define DF_1_LOADFLTR 0x10
70#define DF_1_INITFIRST 0x20
71#define DF_1_NOOPEN 0x40
72#define DF_1_ORIGIN 0x80
73#define DF_1_DIRECT 0x100
74#define DF_1_INTERPOSE 0x400
75#define DF_1_NODEFLIB 0x800
76#define DF_1_NODUMP 0x1000
77#define DF_1_CONFALT 0x2000
78#define DF_1_ENDFILTEE 0x4000
79#define DF_1_DISPRELDNE 0x8000
80#define DF_1_DISPRELPND 0x10000
81
82/*
83 * Dynamic linking entry types.
84 */
85
86#define DT_NULL 0
87#define DT_NEEDED 1
88#define DT_PLTRELSZ 2
89#define DT_PLTGOT 3
90#define DT_HASH 4
91#define DT_STRTAB 5
92#define DT_SYMTAB 6
93#define DT_RELA 7
94#define DT_RELASZ 8
95#define DT_RELAENT 9
96#define DT_STRSZ 10
97#define DT_SYMENT 11
98#define DT_INIT 12
99#define DT_FINI 13
100#define DT_SONAME 14
101#define DT_RPATH 15
102#define DT_SYMBOLIC 16
103#define DT_REL 17
104#define DT_RELSZ 18
105#define DT_RELENT 19
106#define DT_PLTREL 20
107#define DT_DEBUG 21
108#define DT_TEXTREL 22
109#define DT_JMPREL 23
110#define DT_BIND_NOW 24
111#define DT_INIT_ARRAY 25
112#define DT_FINI_ARRAY 26
113#define DT_INIT_ARRAYSZ 27
114#define DT_FINI_ARRAYSZ 28
115#define DT_RUNPATH 29
116#define DT_FLAGS 30
117#define DT_ENCODING 32
118#define DT_PREINIT_ARRAY 32
119#define DT_PREINIT_ARRAYSZ 33
120#define DT_MAXPOSTAGS 34
121#define DT_LOOS 0x6000000DUL
122#define DT_SUNW_AUXILIARY 0x6000000DUL
123#define DT_SUNW_RTLDINF 0x6000000EUL
124#define DT_SUNW_FILTER 0x6000000FUL
125#define DT_SUNW_CAP 0x60000010UL
126#define DT_SUNW_ASLR 0x60000023UL
127#define DT_HIOS 0x6FFFF000UL
128#define DT_VALRNGLO 0x6FFFFD00UL
129#define DT_GNU_PRELINKED 0x6FFFFDF5UL
130#define DT_GNU_CONFLICTSZ 0x6FFFFDF6UL
131#define DT_GNU_LIBLISTSZ 0x6FFFFDF7UL
132#define DT_CHECKSUM 0x6FFFFDF8UL
133#define DT_PLTPADSZ 0x6FFFFDF9UL
134#define DT_MOVEENT 0x6FFFFDFAUL
135#define DT_MOVESZ 0x6FFFFDFBUL
136#define DT_FEATURE 0x6FFFFDFCUL
137#define DT_POSFLAG_1 0x6FFFFDFDUL
138#define DT_SYMINSZ 0x6FFFFDFEUL
139#define DT_SYMINENT 0x6FFFFDFFUL
140#define DT_VALRNGHI 0x6FFFFDFFUL
141#define DT_ADDRRNGLO 0x6FFFFE00UL
142#define DT_GNU_HASH 0x6FFFFEF5UL
143#define DT_TLSDESC_PLT 0x6FFFFEF6UL
144#define DT_TLSDESC_GOT 0x6FFFFEF7UL
145#define DT_GNU_CONFLICT 0x6FFFFEF8UL
146#define DT_GNU_LIBLIST 0x6FFFFEF9UL
147#define DT_CONFIG 0x6FFFFEFAUL
148#define DT_DEPAUDIT 0x6FFFFEFBUL
149#define DT_AUDIT 0x6FFFFEFCUL
150#define DT_PLTPAD 0x6FFFFEFDUL
151#define DT_MOVETAB 0x6FFFFEFEUL
152#define DT_SYMINFO 0x6FFFFEFFUL
153#define DT_ADDRRNGHI 0x6FFFFEFFUL
154#define DT_VERSYM 0x6FFFFFF0UL
155#define DT_RELACOUNT 0x6FFFFFF9UL
156#define DT_RELCOUNT 0x6FFFFFFAUL
157#define DT_FLAGS_1 0x6FFFFFFBUL
158#define DT_VERDEF 0x6FFFFFFCUL
159#define DT_VERDEFNUM 0x6FFFFFFDUL
160#define DT_VERNEED 0x6FFFFFFEUL
161#define DT_VERNEEDNUM 0x6FFFFFFFUL
162#define DT_LOPROC 0x70000000UL
163#define DT_ARM_SYMTABSZ 0x70000001UL
164#define DT_SPARC_REGISTER 0x70000001UL
165#define DT_ARM_PREEMPTMAP 0x70000002UL
166#define DT_MIPS_RLD_VERSION 0x70000001UL
167#define DT_MIPS_TIME_STAMP 0x70000002UL
168#define DT_MIPS_ICHECKSUM 0x70000003UL
169#define DT_MIPS_IVERSION 0x70000004UL
170#define DT_MIPS_FLAGS 0x70000005UL
171#define DT_MIPS_BASE_ADDRESS 0x70000006UL
172#define DT_MIPS_CONFLICT 0x70000008UL
173#define DT_MIPS_LIBLIST 0x70000009UL
174#define DT_MIPS_LOCAL_GOTNO 0x7000000AUL
175#define DT_MIPS_CONFLICTNO 0x7000000BUL
176#define DT_MIPS_LIBLISTNO 0x70000010UL
177#define DT_MIPS_SYMTABNO 0x70000011UL
178#define DT_MIPS_UNREFEXTNO 0x70000012UL
179#define DT_MIPS_GOTSYM 0x70000013UL
180#define DT_MIPS_HIPAGENO 0x70000014UL
181#define DT_MIPS_RLD_MAP 0x70000016UL
182#define DT_MIPS_DELTA_CLASS 0x70000017UL
183#define DT_MIPS_DELTA_CLASS_NO 0x70000018UL
184#define DT_MIPS_DELTA_INSTANCE 0x70000019UL
185#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001AUL
186#define DT_MIPS_DELTA_RELOC 0x7000001BUL
187#define DT_MIPS_DELTA_RELOC_NO 0x7000001CUL
188#define DT_MIPS_DELTA_SYM 0x7000001DUL
189#define DT_MIPS_DELTA_SYM_NO 0x7000001EUL
190#define DT_MIPS_DELTA_CLASSSYM 0x70000020UL
191#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021UL
192#define DT_MIPS_CXX_FLAGS 0x70000022UL
193#define DT_MIPS_PIXIE_INIT 0x70000023UL
194#define DT_MIPS_SYMBOL_LIB 0x70000024UL
195#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025UL
196#define DT_MIPS_LOCAL_GOTIDX 0x70000026UL
197#define DT_MIPS_HIDDEN_GOTIDX 0x70000027UL
198#define DT_MIPS_PROTECTED_GOTIDX 0x70000028UL
199#define DT_MIPS_OPTIONS 0x70000029UL
200#define DT_MIPS_INTERFACE 0x7000002AUL
201#define DT_MIPS_DYNSTR_ALIGN 0x7000002BUL
202#define DT_MIPS_INTERFACE_SIZE 0x7000002CUL
203#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002DUL
204#define DT_MIPS_PERF_SUFFIX 0x7000002EUL
205#define DT_MIPS_COMPACT_SIZE 0x7000002FUL
206#define DT_MIPS_GP_VALUE 0x70000030UL
207#define DT_MIPS_AUX_DYNAMIC 0x70000031UL
208#define DT_MIPS_PLTGOT 0x70000032UL
209#define DT_MIPS_RLD_OBJ_UPDATE 0x70000033UL
210#define DT_MIPS_RWPLT 0x70000034UL
211#define DT_PPC_GOT 0x70000000UL
212#define DT_PPC_TLSOPT 0x70000001UL
213#define DT_PPC64_GLINK 0x70000000UL
214#define DT_PPC64_OPD 0x70000001UL
215#define DT_PPC64_OPDSZ 0x70000002UL
216#define DT_PPC64_TLSOPT 0x70000003UL
217#define DT_AUXILIARY 0x7FFFFFFDUL
218#define DT_USED 0x7FFFFFFEUL
219#define DT_FILTER 0x7FFFFFFFUL
220#define DT_HIPROC 0x7FFFFFFFUL
221
222
223/* Aliases for dynamic linking entry symbols. */
224
225#define DT_DEPRECATED_SPARC_REGISTER DT_SPARC_REGISTER
226
227
228/*
229 * Flags used in the executable header (field: e_flags).
230 */
231
232#define EF_ARM_RELEXEC 0x00000001UL
233#define EF_ARM_HASENTRY 0x00000002UL
234#define EF_ARM_SYMSARESORTED 0x00000004UL
235#define EF_ARM_DYNSYMSUSESEGIDX 0x00000008UL
236#define EF_ARM_MAPSYMSFIRST 0x00000010UL
237#define EF_ARM_BE8 0x00800000UL
238#define EF_ARM_LE8 0x00400000UL
239#define EF_ARM_EABIMASK 0xFF000000UL
240#define EF_ARM_EABI_UNKNOWN 0x00000000UL
241#define EF_ARM_EABI_VER1 0x01000000UL
242#define EF_ARM_EABI_VER2 0x02000000UL
243#define EF_ARM_EABI_VER3 0x03000000UL
244#define EF_ARM_EABI_VER4 0x04000000UL
245#define EF_ARM_EABI_VER5 0x05000000UL
246#define EF_ARM_INTERWORK 0x00000004UL
247#define EF_ARM_APCS_26 0x00000008UL
248#define EF_ARM_APCS_FLOAT 0x00000010UL
249#define EF_ARM_PIC 0x00000020UL
250#define EF_ARM_ALIGN8 0x00000040UL
251#define EF_ARM_NEW_ABI 0x00000080UL
252#define EF_ARM_OLD_ABI 0x00000100UL
253#define EF_ARM_SOFT_FLOAT 0x00000200UL
254#define EF_ARM_VFP_FLOAT 0x00000400UL
255#define EF_ARM_MAVERICK_FLOAT 0x00000800UL
256#define EF_MIPS_NOREORDER 0x00000001UL
257#define EF_MIPS_PIC 0x00000002UL
258#define EF_MIPS_CPIC 0x00000004UL
259#define EF_MIPS_UCODE 0x00000010UL
260#define EF_MIPS_ABI 0x00007000UL
261#define EF_MIPS_ABI2 0x00000020UL
262#define EF_MIPS_OPTIONS_FIRST 0x00000080UL
263#define EF_MIPS_ARCH_ASE 0x0F000000UL
264#define EF_MIPS_ARCH_ASE_MDMX 0x08000000UL
265#define EF_MIPS_ARCH_ASE_M16 0x04000000UL
266#define EF_MIPS_ARCH_ASE_MICROMIPS 0x02000000UL
267#define EF_MIPS_ARCH 0xF0000000UL
268#define EF_MIPS_ARCH_1 0x00000000UL
269#define EF_MIPS_ARCH_2 0x10000000UL
270#define EF_MIPS_ARCH_3 0x20000000UL
271#define EF_MIPS_ARCH_4 0x30000000UL
272#define EF_MIPS_ARCH_5 0x40000000UL
273#define EF_MIPS_ARCH_32 0x50000000UL
274#define EF_MIPS_ARCH_64 0x60000000UL
275#define EF_MIPS_ARCH_32R2 0x70000000UL
276#define EF_MIPS_ARCH_64R2 0x80000000UL
277#define EF_PPC_EMB 0x80000000UL
278#define EF_PPC_RELOCATABLE 0x00010000UL
279#define EF_PPC_RELOCATABLE_LIB 0x00008000UL
280#define EF_RISCV_RVC 0x00000001UL
281#define EF_RISCV_FLOAT_ABI_MASK 0x00000006UL
282#define EF_RISCV_FLOAT_ABI_SOFT 0x00000000UL
283#define EF_RISCV_FLOAT_ABI_SINGLE 0x00000002UL
284#define EF_RISCV_FLOAT_ABI_DOUBLE 0x00000004UL
285#define EF_RISCV_FLOAT_ABI_QUAD 0x00000006UL
286#define EF_RISCV_RVE 0x00000008UL
287#define EF_RISCV_TSO 0x00000010UL
288#define EF_SPARC_EXT_MASK 0x00ffff00UL
289#define EF_SPARC_32PLUS 0x00000100UL
290#define EF_SPARC_SUN_US1 0x00000200UL
291#define EF_SPARC_HAL_R1 0x00000400UL
292#define EF_SPARC_SUN_US3 0x00000800UL
293#define EF_SPARCV9_MM 0x00000003UL
294#define EF_SPARCV9_TSO 0x00000000UL
295#define EF_SPARCV9_PSO 0x00000001UL
296#define EF_SPARCV9_RMO 0x00000002UL
297
298
299/*
300 * Offsets in the ei_ident[] field of an ELF executable header.
301 */
302
303#define EI_MAG0 0
304#define EI_MAG1 1
305#define EI_MAG2 2
306#define EI_MAG3 3
307#define EI_CLASS 4
308#define EI_DATA 5
309#define EI_VERSION 6
310#define EI_OSABI 7
311#define EI_ABIVERSION 8
312#define EI_PAD 9
313#define EI_NIDENT 16
314
315
316/*
317 * The ELF class of an object.
318 */
319
320#define ELFCLASSNONE 0
321#define ELFCLASS32 1
322#define ELFCLASS64 2
323
324
325/*
326 * Endianness of data in an ELF object.
327 */
328
329#define ELFDATANONE 0
330#define ELFDATA2LSB 1
331#define ELFDATA2MSB 2
332
333
334/*
335 * The magic numbers used in the initial four bytes of an ELF object.
336 *
337 * These numbers are: 0x7F, 'E', 'L' and 'F'.
338 */
339
340#define ELFMAG0 0x7FU
341#define ELFMAG1 0x45U
342#define ELFMAG2 0x4CU
343#define ELFMAG3 0x46U
344
345/* Additional magic-related constants. */
346
347#define ELFMAG "\177ELF"
348#define SELFMAG 4
349
350
351/*
352 * ELF OS ABI field.
353 */
354
355#define ELFOSABI_NONE 0
356#define ELFOSABI_SYSV 0
357#define ELFOSABI_HPUX 1
358#define ELFOSABI_NETBSD 2
359#define ELFOSABI_GNU 3
360#define ELFOSABI_HURD 4
361#define ELFOSABI_86OPEN 5
362#define ELFOSABI_SOLARIS 6
363#define ELFOSABI_AIX 7
364#define ELFOSABI_IRIX 8
365#define ELFOSABI_FREEBSD 9
366#define ELFOSABI_TRU64 10
367#define ELFOSABI_MODESTO 11
368#define ELFOSABI_OPENBSD 12
369#define ELFOSABI_OPENVMS 13
370#define ELFOSABI_NSK 14
371#define ELFOSABI_AROS 15
372#define ELFOSABI_FENIXOS 16
373#define ELFOSABI_CLOUDABI 17
374#define ELFOSABI_OPENVOS 18
375#define ELFOSABI_ARM_AEABI 64
376#define ELFOSABI_ARM 97
377#define ELFOSABI_STANDALONE 255
378
379
380/* OS ABI Aliases. */
381
382#define ELFOSABI_LINUX ELFOSABI_GNU
383
384
385/*
386 * ELF Machine types: (EM_*).
387 */
388
389#define EM_NONE 0
390#define EM_M32 1
391#define EM_SPARC 2
392#define EM_386 3
393#define EM_68K 4
394#define EM_88K 5
395#define EM_IAMCU 6
396#define EM_860 7
397#define EM_MIPS 8
398#define EM_S370 9
399#define EM_MIPS_RS3_LE 10
400#define EM_PARISC 15
401#define EM_VPP500 17
402#define EM_SPARC32PLUS 18
403#define EM_960 19
404#define EM_PPC 20
405#define EM_PPC64 21
406#define EM_S390 22
407#define EM_SPU 23
408#define EM_V800 36
409#define EM_FR20 37
410#define EM_RH32 38
411#define EM_RCE 39
412#define EM_ARM 40
413#define EM_ALPHA 41
414#define EM_SH 42
415#define EM_SPARCV9 43
416#define EM_TRICORE 44
417#define EM_ARC 45
418#define EM_H8_300 46
419#define EM_H8_300H 47
420#define EM_H8S 48
421#define EM_H8_500 49
422#define EM_IA_64 50
423#define EM_MIPS_X 51
424#define EM_COLDFIRE 52
425#define EM_68HC12 53
426#define EM_MMA 54
427#define EM_PCP 55
428#define EM_NCPU 56
429#define EM_NDR1 57
430#define EM_STARCORE 58
431#define EM_ME16 59
432#define EM_ST100 60
433#define EM_TINYJ 61
434#define EM_X86_64 62
435#define EM_PDSP 63
436#define EM_PDP10 64
437#define EM_PDP11 65
438#define EM_FX66 66
439#define EM_ST9PLUS 67
440#define EM_ST7 68
441#define EM_68HC16 69
442#define EM_68HC11 70
443#define EM_68HC08 71
444#define EM_68HC05 72
445#define EM_SVX 73
446#define EM_ST19 74
447#define EM_VAX 75
448#define EM_CRIS 76
449#define EM_JAVELIN 77
450#define EM_FIREPATH 78
451#define EM_ZSP 79
452#define EM_MMIX 80
453#define EM_HUANY 81
454#define EM_PRISM 82
455#define EM_AVR 83
456#define EM_FR30 84
457#define EM_D10V 85
458#define EM_D30V 86
459#define EM_V850 87
460#define EM_M32R 88
461#define EM_MN10300 89
462#define EM_MN10200 90
463#define EM_PJ 91
464#define EM_OPENRISC 92
465#define EM_ARC_COMPACT 93
466#define EM_XTENSA 94
467#define EM_VIDEOCORE 95
468#define EM_TMM_GPP 96
469#define EM_NS32K 97
470#define EM_TPC 98
471#define EM_SNP1K 99
472#define EM_ST200 100
473#define EM_IP2K 101
474#define EM_MAX 102
475#define EM_CR 103
476#define EM_F2MC16 104
477#define EM_MSP430 105
478#define EM_BLACKFIN 106
479#define EM_SE_C33 107
480#define EM_SEP 108
481#define EM_ARCA 109
482#define EM_UNICORE 110
483#define EM_EXCESS 111
484#define EM_DXP 112
485#define EM_ALTERA_NIOS2 113
486#define EM_CRX 114
487#define EM_XGATE 115
488#define EM_C166 116
489#define EM_M16C 117
490#define EM_DSPIC30F 118
491#define EM_CE 119
492#define EM_M32C 120
493#define EM_TSK3000 131
494#define EM_RS08 132
495#define EM_SHARC 133
496#define EM_ECOG2 134
497#define EM_SCORE7 135
498#define EM_DSP24 136
499#define EM_VIDEOCORE3 137
500#define EM_LATTICEMICO32 138
501#define EM_SE_C17 139
502#define EM_TI_C6000 140
503#define EM_TI_C2000 141
504#define EM_TI_C5500 142
505#define EM_MMDSP_PLUS 160
506#define EM_CYPRESS_M8C 161
507#define EM_R32C 162
508#define EM_TRIMEDIA 163
509#define EM_QDSP6 164
510#define EM_8051 165
511#define EM_STXP7X 166
512#define EM_NDS32 167
513#define EM_ECOG1 168
514#define EM_ECOG1X 168
515#define EM_MAXQ30 169
516#define EM_XIMO16 170
517#define EM_MANIK 171
518#define EM_CRAYNV2 172
519#define EM_RX 173
520#define EM_METAG 174
521#define EM_MCST_ELBRUS 175
522#define EM_ECOG16 176
523#define EM_CR16 177
524#define EM_ETPU 178
525#define EM_SLE9X 179
526#define EM_AARCH64 183
527#define EM_AVR32 185
528#define EM_STM8 186
529#define EM_TILE64 187
530#define EM_TILEPRO 188
531#define EM_MICROBLAZE 189
532#define EM_CUDA 190
533#define EM_TILEGX 191
534#define EM_CLOUDSHIELD 192
535#define EM_COREA_1ST 193
536#define EM_COREA_2ND 194
537#define EM_ARC_COMPACT2 195
538#define EM_OPEN8 196
539#define EM_RL78 197
540#define EM_VIDEOCORE5 198
541#define EM_78KOR 199
542#define EM_56800EX 200
543#define EM_BA1 201
544#define EM_BA2 202
545#define EM_XCORE 203
546#define EM_MCHP_PIC 204
547#define EM_INTELGT 205
548#define EM_INTEL206 206
549#define EM_INTEL207 207
550#define EM_INTEL208 208
551#define EM_INTEL209 209
552#define EM_KM32 210
553#define EM_KMX32 211
554#define EM_KMX16 212
555#define EM_KMX8 213
556#define EM_KVARC 214
557#define EM_CDP 215
558#define EM_COGE 216
559#define EM_COOL 217
560#define EM_NORC 218
561#define EM_CSR_KALIMBA 219
562#define EM_Z80 220
563#define EM_VISIUM 221
564#define EM_FT32 222
565#define EM_MOXIE 223
566#define EM_AMDGPU 224
567#define EM_RISCV 243
568#define EM_LANAI 244
569#define EM_CEVA 245
570#define EM_CEVA_X2 246
571#define EM_BPF 247
572#define EM_GRAPHCORE_IPU 248
573#define EM_IMG1 249
574#define EM_NFP 250
575#define EM_CSKY 252
576#define EM_65816 257
577#define EM_KF32 259
578
579/* Other synonyms. */
580
581#define EM_AMD64 EM_X86_64
582#define EM_ARC_A5 EM_ARC_COMPACT
583
584
585/*
586 * ELF file types: (ET_*).
587 */
588
589#define ET_NONE 0
590#define ET_REL 1
591#define ET_EXEC 2
592#define ET_DYN 3
593#define ET_CORE 4
594#define ET_LOOS 0xFE00U
595#define ET_HIOS 0xFEFFU
596#define ET_LOPROC 0xFF00U
597#define ET_HIPROC 0xFFFFU
598
599
600/* ELF file format version numbers. */
601
602#define EV_NONE 0
603#define EV_CURRENT 1
604
605
606/*
607 * Flags for section groups.
608 */
609
610#define GRP_COMDAT 0x1
611#define GRP_MASKOS 0x0ff00000
612#define GRP_MASKPROC 0xf0000000
613
614
615/*
616 * Flags / mask for .gnu.versym sections.
617 */
618
619#define VERSYM_VERSION 0x7fff
620#define VERSYM_HIDDEN 0x8000
621
622
623/*
624 * Flags used by program header table entries.
625 */
626
627#define PF_X 0x1
628#define PF_W 0x2
629#define PF_R 0x4
630#define PF_MASKOS 0x0ff00000
631#define PF_MASKPROC 0xf0000000
632#define PF_ARM_SB 0x10000000
633#define PF_ARM_PI 0x20000000
634#define PF_ARM_ABS 0x40000000
635
636
637/*
638 * Types of program header table entries.
639 */
640
641#define PT_NULL 0UL
642#define PT_LOAD 1UL
643#define PT_DYNAMIC 2UL
644#define PT_INTERP 3UL
645#define PT_NOTE 4UL
646#define PT_SHLIB 5UL
647#define PT_PHDR 6UL
648#define PT_TLS 7UL
649#define PT_LOOS 0x60000000UL
650#define PT_SUNW_UNWIND 0x6464E550UL
651#define PT_GNU_EH_FRAME 0x6474E550UL
652#define PT_GNU_STACK 0x6474E551UL
653#define PT_GNU_RELRO 0x6474E552UL
654#define PT_OPENBSD_RANDOMIZE 0x65A3DBE6UL
655#define PT_OPENBSD_WXNEEDED 0x65A3DBE7UL
656#define PT_OPENBSD_BOOTDATA 0x65A41BE6UL
657#define PT_SUNWBSS 0x6FFFFFFAUL
658#define PT_SUNWSTACK 0x6FFFFFFBUL
659#define PT_SUNWDTRACE 0x6FFFFFFCUL
660#define PT_SUNWCAP 0x6FFFFFFDUL
661#define PT_HIOS 0x6FFFFFFFUL
662#define PT_LOPROC 0x70000000UL
663#define PT_ARM_ARCHEXT 0x70000000UL
664#define PT_ARM_EXIDX 0x70000001UL
665#define PT_MIPS_REGINFO 0x70000000UL
666#define PT_MIPS_RTPROC 0x70000001UL
667#define PT_MIPS_OPTIONS 0x70000002UL
668#define PT_HIPROC 0x7FFFFFFFUL
669
670/* synonyms. */
671
672#define PT_ARM_UNWIND PT_ARM_EXIDX
673#define PT_HISUNW PT_HIOS
674#define PT_LOSUNW PT_SUNWBSS
675
676
677/*
678 * Section flags.
679 */
680
681#define SHF_WRITE 0x1
682#define SHF_ALLOC 0x2
683#define SHF_EXECINSTR 0x4
684#define SHF_MERGE 0x10
685#define SHF_STRINGS 0x20
686#define SHF_INFO_LINK 0x40
687#define SHF_LINK_ORDER 0x80
688#define SHF_OS_NONCONFORMING 0x100
689#define SHF_GROUP 0x200
690#define SHF_TLS 0x400
691#define SHF_COMPRESSED 0x800
692#define SHF_MASKOS 0x0FF00000UL
693#define SHF_AMD64_LARGE 0x10000000UL
694#define SHF_ENTRYSECT 0x10000000UL
695#define SHF_COMDEF 0x80000000UL
696#define SHF_MIPS_GPREL 0x10000000UL
697#define SHF_MIPS_MERGE 0x20000000UL
698#define SHF_MIPS_ADDR 0x40000000UL
699#define SHF_MIPS_STRING 0x80000000UL
700#define SHF_MIPS_NOSTRIP 0x08000000UL
701#define SHF_MIPS_LOCAL 0x04000000UL
702#define SHF_MIPS_NAMES 0x02000000UL
703#define SHF_MIPS_NODUPE 0x01000000UL
704#define SHF_ORDERED 0x40000000UL
705#define SHF_EXCLUDE 0x80000000UL
706#define SHF_MASKPROC 0xF0000000UL
707
708
709/*
710 * Special section indices.
711 */
712
713#define SHN_UNDEF 0
714#define SHN_LORESERVE 0xFF00U
715#define SHN_LOPROC 0xFF00U
716#define SHN_BEFORE 0xFF00U
717#define SHN_AFTER 0xFF01U
718#define SHN_AMD64_LCOMMON 0xFF02U
719#define SHN_MIPS_ACOMMON 0xFF00U
720#define SHN_MIPS_TEXT 0xFF01U
721#define SHN_MIPS_DATA 0xFF02U
722#define SHN_MIPS_SCOMMON 0xFF03U
723#define SHN_MIPS_SUNDEFINED 0xFF04U
724#define SHN_MIPS_LCOMMON 0xFF05U
725#define SHN_MIPS_LUNDEFINED 0xFF06U
726#define SHN_HIPROC 0xFF1FU
727#define SHN_LOOS 0xFF20U
728#define SHN_SUNW_IGNORE 0xFF3FU
729#define SHN_HIOS 0xFF3FU
730#define SHN_ABS 0xFFF1U
731#define SHN_COMMON 0xFFF2U
732#define SHN_XINDEX 0xFFFFU
733#define SHN_HIRESERVE 0xFFFFU
734
735
736/*
737 * Section types.
738 */
739
740#define SHT_NULL 0
741#define SHT_PROGBITS 1
742#define SHT_SYMTAB 2
743#define SHT_STRTAB 3
744#define SHT_RELA 4
745#define SHT_HASH 5
746#define SHT_DYNAMIC 6
747#define SHT_NOTE 7
748#define SHT_NOBITS 8
749#define SHT_REL 9
750#define SHT_SHLIB 10
751#define SHT_DYNSYM 11
752#define SHT_INIT_ARRAY 14
753#define SHT_FINI_ARRAY 15
754#define SHT_PREINIT_ARRAY 16
755#define SHT_GROUP 17
756#define SHT_SYMTAB_SHNDX 18
757#define SHT_LOOS 0x60000000UL
758#define SHT_SUNW_dof 0x6FFFFFF4UL
759#define SHT_SUNW_cap 0x6FFFFFF5UL
760#define SHT_GNU_ATTRIBUTES 0x6FFFFFF5UL
761#define SHT_SUNW_SIGNATURE 0x6FFFFFF6UL
762#define SHT_GNU_HASH 0x6FFFFFF6UL
763#define SHT_GNU_LIBLIST 0x6FFFFFF7UL
764#define SHT_SUNW_ANNOTATE 0x6FFFFFF7UL
765#define SHT_SUNW_DEBUGSTR 0x6FFFFFF8UL
766#define SHT_CHECKSUM 0x6FFFFFF8UL
767#define SHT_SUNW_DEBUG 0x6FFFFFF9UL
768#define SHT_SUNW_move 0x6FFFFFFAUL
769#define SHT_SUNW_COMDAT 0x6FFFFFFBUL
770#define SHT_SUNW_syminfo 0x6FFFFFFCUL
771#define SHT_SUNW_verdef 0x6FFFFFFDUL
772#define SHT_SUNW_verneed 0x6FFFFFFEUL
773#define SHT_SUNW_versym 0x6FFFFFFFUL
774#define SHT_HIOS 0x6FFFFFFFUL
775#define SHT_LOPROC 0x70000000UL
776#define SHT_ARM_EXIDX 0x70000001UL
777#define SHT_ARM_PREEMPTMAP 0x70000002UL
778#define SHT_ARM_ATTRIBUTES 0x70000003UL
779#define SHT_ARM_DEBUGOVERLAY 0x70000004UL
780#define SHT_ARM_OVERLAYSECTION 0x70000005UL
781#define SHT_MIPS_LIBLIST 0x70000000UL
782#define SHT_MIPS_MSYM 0x70000001UL
783#define SHT_MIPS_CONFLICT 0x70000002UL
784#define SHT_MIPS_GPTAB 0x70000003UL
785#define SHT_MIPS_UCODE 0x70000004UL
786#define SHT_MIPS_DEBUG 0x70000005UL
787#define SHT_MIPS_REGINFO 0x70000006UL
788#define SHT_MIPS_PACKAGE 0x70000007UL
789#define SHT_MIPS_PACKSYM 0x70000008UL
790#define SHT_MIPS_RELD 0x70000009UL
791#define SHT_MIPS_IFACE 0x7000000BUL
792#define SHT_MIPS_CONTENT 0x7000000CUL
793#define SHT_MIPS_OPTIONS 0x7000000DUL
794#define SHT_MIPS_DELTASYM 0x7000001BUL
795#define SHT_MIPS_DELTAINST 0x7000001CUL
796#define SHT_MIPS_DELTACLASS 0x7000001DUL
797#define SHT_MIPS_DWARF 0x7000001EUL
798#define SHT_MIPS_DELTADECL 0x7000001FUL
799#define SHT_MIPS_SYMBOL_LIB 0x70000020UL
800#define SHT_MIPS_EVENTS 0x70000021UL
801#define SHT_MIPS_TRANSLATE 0x70000022UL
802#define SHT_MIPS_PIXIE 0x70000023UL
803#define SHT_MIPS_XLATE 0x70000024UL
804#define SHT_MIPS_XLATE_DEBUG 0x70000025UL
805#define SHT_MIPS_WHIRL 0x70000026UL
806#define SHT_MIPS_EH_REGION 0x70000027UL
807#define SHT_MIPS_XLATE_OLD 0x70000028UL
808#define SHT_MIPS_PDR_EXCEPTION 0x70000029UL
809#define SHT_MIPS_ABIFLAGS 0x7000002AUL
810#define SHT_SPARC_GOTDATA 0x70000000UL
811#define SHT_X86_64_UNWIND 0x70000001UL
812#define SHT_ORDERED 0x7FFFFFFFUL
813#define SHT_HIPROC 0x7FFFFFFFUL
814#define SHT_LOUSER 0x80000000UL
815#define SHT_HIUSER 0xFFFFFFFFUL
816
817/* Aliases for section types. */
818
819#define SHT_AMD64_UNWIND SHT_X86_64_UNWIND
820#define SHT_GNU_verdef SHT_SUNW_verdef
821#define SHT_GNU_verneed SHT_SUNW_verneed
822#define SHT_GNU_versym SHT_SUNW_versym
823
824
825#define PN_XNUM 0xFFFFU /* Use extended section numbering. */
826
827/*
828 * Symbol binding information.
829 */
830
831#define STB_LOCAL 0
832#define STB_GLOBAL 1
833#define STB_WEAK 2
834#define STB_LOOS 10
835#define STB_GNU_UNIQUE 10
836#define STB_HIOS 12
837#define STB_LOPROC 13
838#define STB_HIPROC 15
839
840
841/*
842 * Symbol types
843 */
844
845#define STT_NOTYPE 0
846#define STT_OBJECT 1
847#define STT_FUNC 2
848#define STT_SECTION 3
849#define STT_FILE 4
850#define STT_COMMON 5
851#define STT_TLS 6
852#define STT_LOOS 10
853#define STT_GNU_IFUNC 10
854#define STT_HIOS 12
855#define STT_LOPROC 13
856#define STT_ARM_TFUNC 13
857#define STT_ARM_16BIT 15
858#define STT_SPARC_REGISTER 13
859#define STT_HIPROC 15
860
861/* Additional constants related to symbol types. */
862
863#define STT_NUM 7
864
865
866/*
867 * Symbol binding.
868 */
869
870#define SYMINFO_BT_SELF 0xFFFFU
871#define SYMINFO_BT_PARENT 0xFFFEU
872#define SYMINFO_BT_NONE 0xFFFDU
873
874
875/*
876 * Symbol visibility.
877 */
878
879#define STV_DEFAULT 0
880#define STV_INTERNAL 1
881#define STV_HIDDEN 2
882#define STV_PROTECTED 3
883
884
885/*
886 * Symbol flags.
887 */
888
889#define SYMINFO_FLG_DIRECT 0x01
890#define SYMINFO_FLG_COPY 0x04
891#define SYMINFO_FLG_LAZYLOAD 0x08
892#define SYMINFO_FLG_DIRECTBIND 0x10
893#define SYMINFO_FLG_NOEXTDIRECT 0x20
894
895
896/*
897 * Versioning dependencies.
898 */
899
900#define VER_NDX_LOCAL 0
901#define VER_NDX_GLOBAL 1
902
903
904/*
905 * Versioning flags.
906 */
907
908#define VER_FLG_BASE 0x1
909#define VER_FLG_WEAK 0x2
910
911
912/*
913 * Versioning needs
914 */
915
916#define VER_NEED_NONE 0
917#define VER_NEED_CURRENT 1
918
919
920/*
921 * Versioning numbers.
922 */
923
924#define VER_DEF_NONE 0
925#define VER_DEF_CURRENT 1
926
927
928/**
929 ** Relocation types.
930 **/
931
932
933#define R_386_NONE 0
934#define R_386_32 1
935#define R_386_PC32 2
936#define R_386_GOT32 3
937#define R_386_PLT32 4
938#define R_386_COPY 5
939#define R_386_GLOB_DAT 6
940#define R_386_JUMP_SLOT 7
941#define R_386_RELATIVE 8
942#define R_386_GOTOFF 9
943#define R_386_GOTPC 10
944#define R_386_32PLT 11
945#define R_386_TLS_TPOFF 14
946#define R_386_TLS_IE 15
947#define R_386_TLS_GOTIE 16
948#define R_386_TLS_LE 17
949#define R_386_TLS_GD 18
950#define R_386_TLS_LDM 19
951#define R_386_16 20
952#define R_386_PC16 21
953#define R_386_8 22
954#define R_386_PC8 23
955#define R_386_TLS_GD_32 24
956#define R_386_TLS_GD_PUSH 25
957#define R_386_TLS_GD_CALL 26
958#define R_386_TLS_GD_POP 27
959#define R_386_TLS_LDM_32 28
960#define R_386_TLS_LDM_PUSH 29
961#define R_386_TLS_LDM_CALL 30
962#define R_386_TLS_LDM_POP 31
963#define R_386_TLS_LDO_32 32
964#define R_386_TLS_IE_32 33
965#define R_386_TLS_LE_32 34
966#define R_386_TLS_DTPMOD32 35
967#define R_386_TLS_DTPOFF32 36
968#define R_386_TLS_TPOFF32 37
969#define R_386_SIZE32 38
970#define R_386_TLS_GOTDESC 39
971#define R_386_TLS_DESC_CALL 40
972#define R_386_TLS_DESC 41
973#define R_386_IRELATIVE 42
974#define R_386_GOT32X 43
975
976
977#define R_AARCH64_NONE 0
978#define R_AARCH64_ABS64 257
979#define R_AARCH64_ABS32 258
980#define R_AARCH64_ABS16 259
981#define R_AARCH64_PREL64 260
982#define R_AARCH64_PREL32 261
983#define R_AARCH64_PREL16 262
984#define R_AARCH64_MOVW_UABS_G0 263
985#define R_AARCH64_MOVW_UABS_G0_NC 264
986#define R_AARCH64_MOVW_UABS_G1 265
987#define R_AARCH64_MOVW_UABS_G1_NC 266
988#define R_AARCH64_MOVW_UABS_G2 267
989#define R_AARCH64_MOVW_UABS_G2_NC 268
990#define R_AARCH64_MOVW_UABS_G3 269
991#define R_AARCH64_MOVW_SABS_G0 270
992#define R_AARCH64_MOVW_SABS_G1 271
993#define R_AARCH64_MOVW_SABS_G2 272
994#define R_AARCH64_LD_PREL_LO19 273
995#define R_AARCH64_ADR_PREL_LO21 274
996#define R_AARCH64_ADR_PREL_PG_HI21 275
997#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
998#define R_AARCH64_ADD_ABS_LO12_NC 277
999#define R_AARCH64_LDST8_ABS_LO12_NC 278
1000#define R_AARCH64_TSTBR14 279
1001#define R_AARCH64_CONDBR19 280
1002#define R_AARCH64_JUMP26 282
1003#define R_AARCH64_CALL26 283
1004#define R_AARCH64_LDST16_ABS_LO12_NC 284
1005#define R_AARCH64_LDST32_ABS_LO12_NC 285
1006#define R_AARCH64_LDST64_ABS_LO12_NC 286
1007#define R_AARCH64_MOVW_PREL_G0 287
1008#define R_AARCH64_MOVW_PREL_G0_NC 288
1009#define R_AARCH64_MOVW_PREL_G1 289
1010#define R_AARCH64_MOVW_PREL_G1_NC 290
1011#define R_AARCH64_MOVW_PREL_G2 291
1012#define R_AARCH64_MOVW_PREL_G2_NC 292
1013#define R_AARCH64_MOVW_PREL_G3 293
1014#define R_AARCH64_LDST128_ABS_LO12_NC 299
1015#define R_AARCH64_MOVW_GOTOFF_G0 300
1016#define R_AARCH64_MOVW_GOTOFF_G0_NC 301
1017#define R_AARCH64_MOVW_GOTOFF_G1 302
1018#define R_AARCH64_MOVW_GOTOFF_G1_NC 303
1019#define R_AARCH64_MOVW_GOTOFF_G2 304
1020#define R_AARCH64_MOVW_GOTOFF_G2_NC 305
1021#define R_AARCH64_MOVW_GOTOFF_G3 306
1022#define R_AARCH64_GOTREL64 307
1023#define R_AARCH64_GOTREL32 308
1024#define R_AARCH64_GOT_LD_PREL19 309
1025#define R_AARCH64_LD64_GOTOFF_LO15 310
1026#define R_AARCH64_ADR_GOT_PAGE 311
1027#define R_AARCH64_LD64_GOT_LO12_NC 312
1028#define R_AARCH64_LD64_GOTPAGE_LO15 313
1029#define R_AARCH64_TLSGD_ADR_PREL21 512
1030#define R_AARCH64_TLSGD_ADR_PAGE21 513
1031#define R_AARCH64_TLSGD_ADD_LO12_NC 514
1032#define R_AARCH64_TLSGD_MOVW_G1 515
1033#define R_AARCH64_TLSGD_MOVW_G0_NC 516
1034#define R_AARCH64_TLSLD_ADR_PREL21 517
1035#define R_AARCH64_TLSLD_ADR_PAGE21 518
1036#define R_AARCH64_TLSLD_ADD_LO12_NC 519
1037#define R_AARCH64_TLSLD_MOVW_G1 520
1038#define R_AARCH64_TLSLD_MOVW_G0_NC 521
1039#define R_AARCH64_TLSLD_LD_PREL19 522
1040#define R_AARCH64_TLSLD_MOVW_DTPREL_G2 523
1041#define R_AARCH64_TLSLD_MOVW_DTPREL_G1 524
1042#define R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC 525
1043#define R_AARCH64_TLSLD_MOVW_DTPREL_G0 526
1044#define R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC 527
1045#define R_AARCH64_TLSLD_ADD_DTPREL_HI12 529
1046#define R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC 530
1047#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12 531
1048#define R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC 532
1049#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12 533
1050#define R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC 534
1051#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12 535
1052#define R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC 536
1053#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12 537
1054#define R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC 538
1055#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 539
1056#define R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC 540
1057#define R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 541
1058#define R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC 542
1059#define R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 543
1060#define R_AARCH64_TLSLE_MOVW_TPREL_G2 544
1061#define R_AARCH64_TLSLE_MOVW_TPREL_G1 545
1062#define R_AARCH64_TLSLE_MOVW_TPREL_G1_NC 546
1063#define R_AARCH64_TLSLE_MOVW_TPREL_G0 547
1064#define R_AARCH64_TLSLE_MOVW_TPREL_G0_NC 548
1065#define R_AARCH64_TLSLE_ADD_TPREL_HI12 549
1066#define R_AARCH64_TLSLE_ADD_TPREL_LO12 550
1067#define R_AARCH64_TLSLE_ADD_TPREL_LO12_NC 551
1068#define R_AARCH64_TLSLE_LDST8_TPREL_LO12 552
1069#define R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC 553
1070#define R_AARCH64_TLSLE_LDST16_TPREL_LO12 554
1071#define R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC 555
1072#define R_AARCH64_TLSLE_LDST32_TPREL_LO12 556
1073#define R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC 557
1074#define R_AARCH64_TLSLE_LDST64_TPREL_LO12 558
1075#define R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC 559
1076#define R_AARCH64_TLSDESC_LD_PREL19 560
1077#define R_AARCH64_TLSDESC_ADR_PREL21 561
1078#define R_AARCH64_TLSDESC_ADR_PAGE21 562
1079#define R_AARCH64_TLSDESC_LD64_LO12 563
1080#define R_AARCH64_TLSDESC_ADD_LO12 564
1081#define R_AARCH64_TLSDESC_OFF_G1 565
1082#define R_AARCH64_TLSDESC_OFF_G0_NC 566
1083#define R_AARCH64_TLSDESC_LDR 567
1084#define R_AARCH64_TLSDESC_ADD 568
1085#define R_AARCH64_TLSDESC_CALL 569
1086#define R_AARCH64_TLSLE_LDST128_TPREL_LO12 570
1087#define R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC 571
1088#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12 572
1089#define R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC 573
1090#define R_AARCH64_COPY 1024
1091#define R_AARCH64_GLOB_DAT 1025
1092#define R_AARCH64_JUMP_SLOT 1026
1093#define R_AARCH64_RELATIVE 1027
1094#define R_AARCH64_TLS_DTPREL64 1028
1095#define R_AARCH64_TLS_DTPMOD64 1029
1096#define R_AARCH64_TLS_TPREL64 1030
1097#define R_AARCH64_TLSDESC 1031
1098#define R_AARCH64_IRELATIVE 1032
1099
1100
1101#define R_AMD64_NONE 0
1102#define R_AMD64_64 1
1103#define R_AMD64_PC32 2
1104#define R_AMD64_GOT32 3
1105#define R_AMD64_PLT32 4
1106#define R_AMD64_COPY 5
1107#define R_AMD64_GLOB_DAT 6
1108#define R_AMD64_JUMP_SLOT 7
1109#define R_AMD64_RELATIVE 8
1110#define R_AMD64_GOTPCREL 9
1111#define R_AMD64_32 10
1112#define R_AMD64_32S 11
1113#define R_AMD64_16 12
1114#define R_AMD64_PC16 13
1115#define R_AMD64_8 14
1116#define R_AMD64_PC8 15
1117#define R_AMD64_PC64 24
1118#define R_AMD64_GOTOFF64 25
1119#define R_AMD64_GOTPC32 26
1120
1121
1122#define R_ARM_NONE 0
1123#define R_ARM_PC24 1
1124#define R_ARM_ABS32 2
1125#define R_ARM_REL32 3
1126#define R_ARM_LDR_PC_G0 4
1127#define R_ARM_ABS16 5
1128#define R_ARM_ABS12 6
1129#define R_ARM_THM_ABS5 7
1130#define R_ARM_ABS8 8
1131#define R_ARM_SBREL32 9
1132#define R_ARM_THM_CALL 10
1133#define R_ARM_THM_PC8 11
1134#define R_ARM_BREL_ADJ 12
1135#define R_ARM_SWI24 13
1136#define R_ARM_TLS_DESC 13
1137#define R_ARM_THM_SWI8 14
1138#define R_ARM_XPC25 15
1139#define R_ARM_THM_XPC22 16
1140#define R_ARM_TLS_DTPMOD32 17
1141#define R_ARM_TLS_DTPOFF32 18
1142#define R_ARM_TLS_TPOFF32 19
1143#define R_ARM_COPY 20
1144#define R_ARM_GLOB_DAT 21
1145#define R_ARM_JUMP_SLOT 22
1146#define R_ARM_RELATIVE 23
1147#define R_ARM_GOTOFF32 24
1148#define R_ARM_BASE_PREL 25
1149#define R_ARM_GOT_BREL 26
1150#define R_ARM_PLT32 27
1151#define R_ARM_CALL 28
1152#define R_ARM_JUMP24 29
1153#define R_ARM_THM_JUMP24 30
1154#define R_ARM_BASE_ABS 31
1155#define R_ARM_ALU_PCREL_7_0 32
1156#define R_ARM_ALU_PCREL_15_8 33
1157#define R_ARM_ALU_PCREL_23_15 34
1158#define R_ARM_LDR_SBREL_11_0_NC 35
1159#define R_ARM_ALU_SBREL_19_12_NC 36
1160#define R_ARM_ALU_SBREL_27_20_CK 37
1161#define R_ARM_TARGET1 38
1162#define R_ARM_SBREL31 39
1163#define R_ARM_V4BX 40
1164#define R_ARM_TARGET2 41
1165#define R_ARM_PREL31 42
1166#define R_ARM_MOVW_ABS_NC 43
1167#define R_ARM_MOVT_ABS 44
1168#define R_ARM_MOVW_PREL_NC 45
1169#define R_ARM_MOVT_PREL 46
1170#define R_ARM_THM_MOVW_ABS_NC 47
1171#define R_ARM_THM_MOVT_ABS 48
1172#define R_ARM_THM_MOVW_PREL_NC 49
1173#define R_ARM_THM_MOVT_PREL 50
1174#define R_ARM_THM_JUMP19 51
1175#define R_ARM_THM_JUMP6 52
1176#define R_ARM_THM_ALU_PREL_11_0 53
1177#define R_ARM_THM_PC12 54
1178#define R_ARM_ABS32_NOI 55
1179#define R_ARM_REL32_NOI 56
1180#define R_ARM_ALU_PC_G0_NC 57
1181#define R_ARM_ALU_PC_G0 58
1182#define R_ARM_ALU_PC_G1_NC 59
1183#define R_ARM_ALU_PC_G1 60
1184#define R_ARM_ALU_PC_G2 61
1185#define R_ARM_LDR_PC_G1 62
1186#define R_ARM_LDR_PC_G2 63
1187#define R_ARM_LDRS_PC_G0 64
1188#define R_ARM_LDRS_PC_G1 65
1189#define R_ARM_LDRS_PC_G2 66
1190#define R_ARM_LDC_PC_G0 67
1191#define R_ARM_LDC_PC_G1 68
1192#define R_ARM_LDC_PC_G2 69
1193#define R_ARM_ALU_SB_G0_NC 70
1194#define R_ARM_ALU_SB_G0 71
1195#define R_ARM_ALU_SB_G1_NC 72
1196#define R_ARM_ALU_SB_G1 73
1197#define R_ARM_ALU_SB_G2 74
1198#define R_ARM_LDR_SB_G0 75
1199#define R_ARM_LDR_SB_G1 76
1200#define R_ARM_LDR_SB_G2 77
1201#define R_ARM_LDRS_SB_G0 78
1202#define R_ARM_LDRS_SB_G1 79
1203#define R_ARM_LDRS_SB_G2 80
1204#define R_ARM_LDC_SB_G0 81
1205#define R_ARM_LDC_SB_G1 82
1206#define R_ARM_LDC_SB_G2 83
1207#define R_ARM_MOVW_BREL_NC 84
1208#define R_ARM_MOVT_BREL 85
1209#define R_ARM_MOVW_BREL 86
1210#define R_ARM_THM_MOVW_BREL_NC 87
1211#define R_ARM_THM_MOVT_BREL 88
1212#define R_ARM_THM_MOVW_BREL 89
1213#define R_ARM_TLS_GOTDESC 90
1214#define R_ARM_TLS_CALL 91
1215#define R_ARM_TLS_DESCSEQ 92
1216#define R_ARM_THM_TLS_CALL 93
1217#define R_ARM_PLT32_ABS 94
1218#define R_ARM_GOT_ABS 95
1219#define R_ARM_GOT_PREL 96
1220#define R_ARM_GOT_BREL12 97
1221#define R_ARM_GOTOFF12 98
1222#define R_ARM_GOTRELAX 99
1223#define R_ARM_GNU_VTENTRY 100
1224#define R_ARM_GNU_VTINHERIT 101
1225#define R_ARM_THM_JUMP11 102
1226#define R_ARM_THM_JUMP8 103
1227#define R_ARM_TLS_GD32 104
1228#define R_ARM_TLS_LDM32 105
1229#define R_ARM_TLS_LDO32 106
1230#define R_ARM_TLS_IE32 107
1231#define R_ARM_TLS_LE32 108
1232#define R_ARM_TLS_LDO12 109
1233#define R_ARM_TLS_LE12 110
1234#define R_ARM_TLS_IE12GP 111
1235#define R_ARM_PRIVATE_0 112
1236#define R_ARM_PRIVATE_1 113
1237#define R_ARM_PRIVATE_2 114
1238#define R_ARM_PRIVATE_3 115
1239#define R_ARM_PRIVATE_4 116
1240#define R_ARM_PRIVATE_5 117
1241#define R_ARM_PRIVATE_6 118
1242#define R_ARM_PRIVATE_7 119
1243#define R_ARM_PRIVATE_8 120
1244#define R_ARM_PRIVATE_9 121
1245#define R_ARM_PRIVATE_10 122
1246#define R_ARM_PRIVATE_11 123
1247#define R_ARM_PRIVATE_12 124
1248#define R_ARM_PRIVATE_13 125
1249#define R_ARM_PRIVATE_14 126
1250#define R_ARM_PRIVATE_15 127
1251#define R_ARM_ME_TOO 128
1252#define R_ARM_THM_TLS_DESCSEQ16 129
1253#define R_ARM_THM_TLS_DESCSEQ32 130
1254#define R_ARM_THM_GOT_BREL12 131
1255#define R_ARM_IRELATIVE 140
1256
1257
1258#define R_IA_64_NONE 0
1259#define R_IA_64_IMM14 0x21
1260#define R_IA_64_IMM22 0x22
1261#define R_IA_64_IMM64 0x23
1262#define R_IA_64_DIR32MSB 0x24
1263#define R_IA_64_DIR32LSB 0x25
1264#define R_IA_64_DIR64MSB 0x26
1265#define R_IA_64_DIR64LSB 0x27
1266#define R_IA_64_GPREL22 0x2a
1267#define R_IA_64_GPREL64I 0x2b
1268#define R_IA_64_GPREL32MSB 0x2c
1269#define R_IA_64_GPREL32LSB 0x2d
1270#define R_IA_64_GPREL64MSB 0x2e
1271#define R_IA_64_GPREL64LSB 0x2f
1272#define R_IA_64_LTOFF22 0x32
1273#define R_IA_64_LTOFF64I 0x33
1274#define R_IA_64_PLTOFF22 0x3a
1275#define R_IA_64_PLTOFF64I 0x3b
1276#define R_IA_64_PLTOFF64MSB 0x3e
1277#define R_IA_64_PLTOFF64LSB 0x3f
1278#define R_IA_64_FPTR64I 0x43
1279#define R_IA_64_FPTR32MSB 0x44
1280#define R_IA_64_FPTR32LSB 0x45
1281#define R_IA_64_FPTR64MSB 0x46
1282#define R_IA_64_FPTR64LSB 0x47
1283#define R_IA_64_PCREL60B 0x48
1284#define R_IA_64_PCREL21B 0x49
1285#define R_IA_64_PCREL21M 0x4a
1286#define R_IA_64_PCREL21F 0x4b
1287#define R_IA_64_PCREL32MSB 0x4c
1288#define R_IA_64_PCREL32LSB 0x4d
1289#define R_IA_64_PCREL64MSB 0x4e
1290#define R_IA_64_PCREL64LSB 0x4f
1291#define R_IA_64_LTOFF_FPTR22 0x52
1292#define R_IA_64_LTOFF_FPTR64I 0x53
1293#define R_IA_64_LTOFF_FPTR32MSB 0x54
1294#define R_IA_64_LTOFF_FPTR32LSB 0x55
1295#define R_IA_64_LTOFF_FPTR64MSB 0x56
1296#define R_IA_64_LTOFF_FPTR64LSB 0x57
1297#define R_IA_64_SEGREL32MSB 0x5c
1298#define R_IA_64_SEGREL32LSB 0x5d
1299#define R_IA_64_SEGREL64MSB 0x5e
1300#define R_IA_64_SEGREL64LSB 0x5f
1301#define R_IA_64_SECREL32MSB 0x64
1302#define R_IA_64_SECREL32LSB 0x65
1303#define R_IA_64_SECREL64MSB 0x66
1304#define R_IA_64_SECREL64LSB 0x67
1305#define R_IA_64_REL32MSB 0x6c
1306#define R_IA_64_REL32LSB 0x6d
1307#define R_IA_64_REL64MSB 0x6e
1308#define R_IA_64_REL64LSB 0x6f
1309#define R_IA_64_LTV32MSB 0x74
1310#define R_IA_64_LTV32LSB 0x75
1311#define R_IA_64_LTV64MSB 0x76
1312#define R_IA_64_LTV64LSB 0x77
1313#define R_IA_64_PCREL21BI 0x79
1314#define R_IA_64_PCREL22 0x7A
1315#define R_IA_64_PCREL64I 0x7B
1316#define R_IA_64_IPLTMSB 0x80
1317#define R_IA_64_IPLTLSB 0x81
1318#define R_IA_64_SUB 0x85
1319#define R_IA_64_LTOFF22X 0x86
1320#define R_IA_64_LDXMOV 0x87
1321#define R_IA_64_TPREL14 0x91
1322#define R_IA_64_TPREL22 0x92
1323#define R_IA_64_TPREL64I 0x93
1324#define R_IA_64_TPREL64MSB 0x96
1325#define R_IA_64_TPREL64LSB 0x97
1326#define R_IA_64_LTOFF_TPREL22 0x9A
1327#define R_IA_64_DTPMOD64MSB 0xA6
1328#define R_IA_64_DTPMOD64LSB 0xA7
1329#define R_IA_64_LTOFF_DTPMOD22 0xAA
1330#define R_IA_64_DTPREL14 0xB1
1331#define R_IA_64_DTPREL22 0xB2
1332#define R_IA_64_DTPREL64I 0xB3
1333#define R_IA_64_DTPREL32MSB 0xB4
1334#define R_IA_64_DTPREL32LSB 0xB5
1335#define R_IA_64_DTPREL64MSB 0xB6
1336#define R_IA_64_DTPREL64LSB 0xB7
1337#define R_IA_64_LTOFF_DTPREL22 0xBA
1338
1339
1340#define R_MIPS_NONE 0
1341#define R_MIPS_16 1
1342#define R_MIPS_32 2
1343#define R_MIPS_REL32 3
1344#define R_MIPS_26 4
1345#define R_MIPS_HI16 5
1346#define R_MIPS_LO16 6
1347#define R_MIPS_GPREL16 7
1348#define R_MIPS_LITERAL 8
1349#define R_MIPS_GOT16 9
1350#define R_MIPS_PC16 10
1351#define R_MIPS_CALL16 11
1352#define R_MIPS_GPREL32 12
1353#define R_MIPS_SHIFT5 16
1354#define R_MIPS_SHIFT6 17
1355#define R_MIPS_64 18
1356#define R_MIPS_GOT_DISP 19
1357#define R_MIPS_GOT_PAGE 20
1358#define R_MIPS_GOT_OFST 21
1359#define R_MIPS_GOT_HI16 22
1360#define R_MIPS_GOT_LO16 23
1361#define R_MIPS_SUB 24
1362#define R_MIPS_CALLHI16 30
1363#define R_MIPS_CALLLO16 31
1364#define R_MIPS_JALR 37
1365#define R_MIPS_TLS_DTPMOD32 38
1366#define R_MIPS_TLS_DTPREL32 39
1367#define R_MIPS_TLS_DTPMOD64 40
1368#define R_MIPS_TLS_DTPREL64 41
1369#define R_MIPS_TLS_GD 42
1370#define R_MIPS_TLS_LDM 43
1371#define R_MIPS_TLS_DTPREL_HI16 44
1372#define R_MIPS_TLS_DTPREL_LO16 45
1373#define R_MIPS_TLS_GOTTPREL 46
1374#define R_MIPS_TLS_TPREL32 47
1375#define R_MIPS_TLS_TPREL64 48
1376#define R_MIPS_TLS_TPREL_HI16 49
1377#define R_MIPS_TLS_TPREL_LO16 50
1378
1379
1380#define R_PPC_NONE 0
1381#define R_PPC_ADDR32 1
1382#define R_PPC_ADDR24 2
1383#define R_PPC_ADDR16 3
1384#define R_PPC_ADDR16_LO 4
1385#define R_PPC_ADDR16_HI 5
1386#define R_PPC_ADDR16_HA 6
1387#define R_PPC_ADDR14 7
1388#define R_PPC_ADDR14_BRTAKEN 8
1389#define R_PPC_ADDR14_BRNTAKEN 9
1390#define R_PPC_REL24 10
1391#define R_PPC_REL14 11
1392#define R_PPC_REL14_BRTAKEN 12
1393#define R_PPC_REL14_BRNTAKEN 13
1394#define R_PPC_GOT16 14
1395#define R_PPC_GOT16_LO 15
1396#define R_PPC_GOT16_HI 16
1397#define R_PPC_GOT16_HA 17
1398#define R_PPC_PLTREL24 18
1399#define R_PPC_COPY 19
1400#define R_PPC_GLOB_DAT 20
1401#define R_PPC_JMP_SLOT 21
1402#define R_PPC_RELATIVE 22
1403#define R_PPC_LOCAL24PC 23
1404#define R_PPC_UADDR32 24
1405#define R_PPC_UADDR16 25
1406#define R_PPC_REL32 26
1407#define R_PPC_PLT32 27
1408#define R_PPC_PLTREL32 28
1409#define R_PPC_PLT16_LO 29
1410#define R_PPC_PLT16_HI 30
1411#define R_PPC_PLT16_HA 31
1412#define R_PPC_SDAREL16 32
1413#define R_PPC_SECTOFF 33
1414#define R_PPC_SECTOFF_LO 34
1415#define R_PPC_SECTOFF_HI 35
1416#define R_PPC_SECTOFF_HA 36
1417#define R_PPC_ADDR30 37
1418#define R_PPC_TLS 67
1419#define R_PPC_DTPMOD32 68
1420#define R_PPC_TPREL16 69
1421#define R_PPC_TPREL16_LO 70
1422#define R_PPC_TPREL16_HI 71
1423#define R_PPC_TPREL16_HA 72
1424#define R_PPC_TPREL32 73
1425#define R_PPC_DTPREL16 74
1426#define R_PPC_DTPREL16_LO 75
1427#define R_PPC_DTPREL16_HI 76
1428#define R_PPC_DTPREL16_HA 77
1429#define R_PPC_DTPREL32 78
1430#define R_PPC_GOT_TLSGD16 79
1431#define R_PPC_GOT_TLSGD16_LO 80
1432#define R_PPC_GOT_TLSGD16_HI 81
1433#define R_PPC_GOT_TLSGD16_HA 82
1434#define R_PPC_GOT_TLSLD16 83
1435#define R_PPC_GOT_TLSLD16_LO 84
1436#define R_PPC_GOT_TLSLD16_HI 85
1437#define R_PPC_GOT_TLSLD16_HA 86
1438#define R_PPC_GOT_TPREL16 87
1439#define R_PPC_GOT_TPREL16_LO 88
1440#define R_PPC_GOT_TPREL16_HI 89
1441#define R_PPC_GOT_TPREL16_HA 90
1442#define R_PPC_GOT_DTPREL16 91
1443#define R_PPC_GOT_DTPREL16_LO 92
1444#define R_PPC_GOT_DTPREL16_HI 93
1445#define R_PPC_GOT_DTPREL16_HA 94
1446#define R_PPC_TLSGD 95
1447#define R_PPC_TLSLD 96
1448#define R_PPC_EMB_NADDR32 101
1449#define R_PPC_EMB_NADDR16 102
1450#define R_PPC_EMB_NADDR16_LO 103
1451#define R_PPC_EMB_NADDR16_HI 104
1452#define R_PPC_EMB_NADDR16_HA 105
1453#define R_PPC_EMB_SDAI16 106
1454#define R_PPC_EMB_SDA2I16 107
1455#define R_PPC_EMB_SDA2REL 108
1456#define R_PPC_EMB_SDA21 109
1457#define R_PPC_EMB_MRKREF 110
1458#define R_PPC_EMB_RELSEC16 111
1459#define R_PPC_EMB_RELST_LO 112
1460#define R_PPC_EMB_RELST_HI 113
1461#define R_PPC_EMB_RELST_HA 114
1462#define R_PPC_EMB_BIT_FLD 115
1463#define R_PPC_EMB_RELSDA 116
1464
1465
1466#define R_PPC64_NONE 0
1467#define R_PPC64_ADDR32 1
1468#define R_PPC64_ADDR24 2
1469#define R_PPC64_ADDR16 3
1470#define R_PPC64_ADDR16_LO 4
1471#define R_PPC64_ADDR16_HI 5
1472#define R_PPC64_ADDR16_HA 6
1473#define R_PPC64_ADDR14 7
1474#define R_PPC64_ADDR14_BRTAKEN 8
1475#define R_PPC64_ADDR14_BRNTAKEN 9
1476#define R_PPC64_REL24 10
1477#define R_PPC64_REL14 11
1478#define R_PPC64_REL14_BRTAKEN 12
1479#define R_PPC64_REL14_BRNTAKEN 13
1480#define R_PPC64_GOT16 14
1481#define R_PPC64_GOT16_LO 15
1482#define R_PPC64_GOT16_HI 16
1483#define R_PPC64_GOT16_HA 17
1484#define R_PPC64_COPY 19
1485#define R_PPC64_GLOB_DAT 20
1486#define R_PPC64_JMP_SLOT 21
1487#define R_PPC64_RELATIVE 22
1488#define R_PPC64_UADDR32 24
1489#define R_PPC64_UADDR16 25
1490#define R_PPC64_REL32 26
1491#define R_PPC64_PLT32 27
1492#define R_PPC64_PLTREL32 28
1493#define R_PPC64_PLT16_LO 29
1494#define R_PPC64_PLT16_HI 30
1495#define R_PPC64_PLT16_HA 31
1496#define R_PPC64_SECTOFF 33
1497#define R_PPC64_SECTOFF_LO 34
1498#define R_PPC64_SECTOFF_HI 35
1499#define R_PPC64_SECTOFF_HA 36
1500#define R_PPC64_ADDR30 37
1501#define R_PPC64_ADDR64 38
1502#define R_PPC64_ADDR16_HIGHER 39
1503#define R_PPC64_ADDR16_HIGHERA 40
1504#define R_PPC64_ADDR16_HIGHEST 41
1505#define R_PPC64_ADDR16_HIGHESTA 42
1506#define R_PPC64_UADDR64 43
1507#define R_PPC64_REL64 44
1508#define R_PPC64_PLT64 45
1509#define R_PPC64_PLTREL64 46
1510#define R_PPC64_TOC16 47
1511#define R_PPC64_TOC16_LO 48
1512#define R_PPC64_TOC16_HI 49
1513#define R_PPC64_TOC16_HA 50
1514#define R_PPC64_TOC 51
1515#define R_PPC64_PLTGOT16 52
1516#define R_PPC64_PLTGOT16_LO 53
1517#define R_PPC64_PLTGOT16_HI 54
1518#define R_PPC64_PLTGOT16_HA 55
1519#define R_PPC64_ADDR16_DS 56
1520#define R_PPC64_ADDR16_LO_DS 57
1521#define R_PPC64_GOT16_DS 58
1522#define R_PPC64_GOT16_LO_DS 59
1523#define R_PPC64_PLT16_LO_DS 60
1524#define R_PPC64_SECTOFF_DS 61
1525#define R_PPC64_SECTOFF_LO_DS 62
1526#define R_PPC64_TOC16_DS 63
1527#define R_PPC64_TOC16_LO_DS 64
1528#define R_PPC64_PLTGOT16_DS 65
1529#define R_PPC64_PLTGOT16_LO_DS 66
1530#define R_PPC64_TLS 67
1531#define R_PPC64_DTPMOD64 68
1532#define R_PPC64_TPREL16 69
1533#define R_PPC64_TPREL16_LO 60
1534#define R_PPC64_TPREL16_HI 71
1535#define R_PPC64_TPREL16_HA 72
1536#define R_PPC64_TPREL64 73
1537#define R_PPC64_DTPREL16 74
1538#define R_PPC64_DTPREL16_LO 75
1539#define R_PPC64_DTPREL16_HI 76
1540#define R_PPC64_DTPREL16_HA 77
1541#define R_PPC64_DTPREL64 78
1542#define R_PPC64_GOT_TLSGD16 79
1543#define R_PPC64_GOT_TLSGD16_LO 80
1544#define R_PPC64_GOT_TLSGD16_HI 81
1545#define R_PPC64_GOT_TLSGD16_HA 82
1546#define R_PPC64_GOT_TLSLD16 83
1547#define R_PPC64_GOT_TLSLD16_LO 84
1548#define R_PPC64_GOT_TLSLD16_HI 85
1549#define R_PPC64_GOT_TLSLD16_HA 86
1550#define R_PPC64_GOT_TPREL16_DS 87
1551#define R_PPC64_GOT_TPREL16_LO_DS 88
1552#define R_PPC64_GOT_TPREL16_HI 89
1553#define R_PPC64_GOT_TPREL16_HA 90
1554#define R_PPC64_GOT_DTPREL16_DS 91
1555#define R_PPC64_GOT_DTPREL16_LO_DS 92
1556#define R_PPC64_GOT_DTPREL16_HI 93
1557#define R_PPC64_GOT_DTPREL16_HA 94
1558#define R_PPC64_TPREL16_DS 95
1559#define R_PPC64_TPREL16_LO_DS 96
1560#define R_PPC64_TPREL16_HIGHER 97
1561#define R_PPC64_TPREL16_HIGHERA 98
1562#define R_PPC64_TPREL16_HIGHEST 99
1563#define R_PPC64_TPREL16_HIGHESTA 100
1564#define R_PPC64_DTPREL16_DS 101
1565#define R_PPC64_DTPREL16_LO_DS 102
1566#define R_PPC64_DTPREL16_HIGHER 103
1567#define R_PPC64_DTPREL16_HIGHERA 104
1568#define R_PPC64_DTPREL16_HIGHEST 105
1569#define R_PPC64_DTPREL16_HIGHESTA 106
1570#define R_PPC64_TLSGD 107
1571#define R_PPC64_TLSLD 108
1572
1573
1574#define R_RISCV_NONE 0
1575#define R_RISCV_32 1
1576#define R_RISCV_64 2
1577#define R_RISCV_RELATIVE 3
1578#define R_RISCV_COPY 4
1579#define R_RISCV_JUMP_SLOT 5
1580#define R_RISCV_TLS_DTPMOD32 6
1581#define R_RISCV_TLS_DTPMOD64 7
1582#define R_RISCV_TLS_DTPREL32 8
1583#define R_RISCV_TLS_DTPREL64 9
1584#define R_RISCV_TLS_TPREL32 10
1585#define R_RISCV_TLS_TPREL64 11
1586#define R_RISCV_BRANCH 16
1587#define R_RISCV_JAL 17
1588#define R_RISCV_CALL 18
1589#define R_RISCV_CALL_PLT 19
1590#define R_RISCV_GOT_HI20 20
1591#define R_RISCV_TLS_GOT_HI20 21
1592#define R_RISCV_TLS_GD_HI20 22
1593#define R_RISCV_PCREL_HI20 23
1594#define R_RISCV_PCREL_LO12_I 24
1595#define R_RISCV_PCREL_LO12_S 25
1596#define R_RISCV_HI20 26
1597#define R_RISCV_LO12_I 27
1598#define R_RISCV_LO12_S 28
1599#define R_RISCV_TPREL_HI20 29
1600#define R_RISCV_TPREL_LO12_I 30
1601#define R_RISCV_TPREL_LO12_S 31
1602#define R_RISCV_TPREL_ADD 32
1603#define R_RISCV_ADD8 33
1604#define R_RISCV_ADD16 34
1605#define R_RISCV_ADD32 35
1606#define R_RISCV_ADD64 36
1607#define R_RISCV_SUB8 37
1608#define R_RISCV_SUB16 38
1609#define R_RISCV_SUB32 39
1610#define R_RISCV_SUB64 40
1611#define R_RISCV_GNU_VTINHERIT 41
1612#define R_RISCV_GNU_VTENTRY 42
1613#define R_RISCV_ALIGN 43
1614#define R_RISCV_RVC_BRANCH 44
1615#define R_RISCV_RVC_JUMP 45
1616#define R_RISCV_RVC_LUI 46
1617#define R_RISCV_GPREL_I 47
1618#define R_RISCV_GPREL_S 48
1619#define R_RISCV_TPREL_I 49
1620#define R_RISCV_TPREL_S 50
1621#define R_RISCV_RELAX 51
1622#define R_RISCV_SUB6 52
1623#define R_RISCV_SET6 53
1624#define R_RISCV_SET8 54
1625#define R_RISCV_SET16 55
1626#define R_RISCV_SET32 56
1627#define R_RISCV_32_PCREL 57
1628#define R_RISCV_IRELATIVE 58
1629
1630
1631#define R_SPARC_NONE 0
1632#define R_SPARC_8 1
1633#define R_SPARC_16 2
1634#define R_SPARC_32 3
1635#define R_SPARC_DISP8 4
1636#define R_SPARC_DISP16 5
1637#define R_SPARC_DISP32 6
1638#define R_SPARC_WDISP30 7
1639#define R_SPARC_WDISP22 8
1640#define R_SPARC_HI22 9
1641#define R_SPARC_22 10
1642#define R_SPARC_13 11
1643#define R_SPARC_LO10 12
1644#define R_SPARC_GOT10 13
1645#define R_SPARC_GOT13 14
1646#define R_SPARC_GOT22 15
1647#define R_SPARC_PC10 16
1648#define R_SPARC_PC22 17
1649#define R_SPARC_WPLT30 18
1650#define R_SPARC_COPY 19
1651#define R_SPARC_GLOB_DAT 20
1652#define R_SPARC_JMP_SLOT 21
1653#define R_SPARC_RELATIVE 22
1654#define R_SPARC_UA32 23
1655#define R_SPARC_PLT32 24
1656#define R_SPARC_HIPLT22 25
1657#define R_SPARC_LOPLT10 26
1658#define R_SPARC_PCPLT32 27
1659#define R_SPARC_PCPLT22 28
1660#define R_SPARC_PCPLT10 29
1661#define R_SPARC_10 30
1662#define R_SPARC_11 31
1663#define R_SPARC_64 32
1664#define R_SPARC_OLO10 33
1665#define R_SPARC_HH22 34
1666#define R_SPARC_HM10 35
1667#define R_SPARC_LM22 36
1668#define R_SPARC_PC_HH22 37
1669#define R_SPARC_PC_HM10 38
1670#define R_SPARC_PC_LM22 39
1671#define R_SPARC_WDISP16 40
1672#define R_SPARC_WDISP19 41
1673#define R_SPARC_GLOB_JMP 42
1674#define R_SPARC_7 43
1675#define R_SPARC_5 44
1676#define R_SPARC_6 45
1677#define R_SPARC_DISP64 46
1678#define R_SPARC_PLT64 47
1679#define R_SPARC_HIX22 48
1680#define R_SPARC_LOX10 49
1681#define R_SPARC_H44 50
1682#define R_SPARC_M44 51
1683#define R_SPARC_L44 52
1684#define R_SPARC_REGISTER 53
1685#define R_SPARC_UA64 54
1686#define R_SPARC_UA16 55
1687#define R_SPARC_TLS_GD_HI22 56
1688#define R_SPARC_TLS_GD_LO10 57
1689#define R_SPARC_TLS_GD_ADD 58
1690#define R_SPARC_TLS_GD_CALL 59
1691#define R_SPARC_TLS_LDM_HI22 60
1692#define R_SPARC_TLS_LDM_LO10 61
1693#define R_SPARC_TLS_LDM_ADD 62
1694#define R_SPARC_TLS_LDM_CALL 63
1695#define R_SPARC_TLS_LDO_HIX22 64
1696#define R_SPARC_TLS_LDO_LOX10 65
1697#define R_SPARC_TLS_LDO_ADD 66
1698#define R_SPARC_TLS_IE_HI22 67
1699#define R_SPARC_TLS_IE_LO10 68
1700#define R_SPARC_TLS_IE_LD 69
1701#define R_SPARC_TLS_IE_LDX 70
1702#define R_SPARC_TLS_IE_ADD 71
1703#define R_SPARC_TLS_LE_HIX22 72
1704#define R_SPARC_TLS_LE_LOX10 73
1705#define R_SPARC_TLS_DTPMOD32 74
1706#define R_SPARC_TLS_DTPMOD64 75
1707#define R_SPARC_TLS_DTPOFF32 76
1708#define R_SPARC_TLS_DTPOFF64 77
1709#define R_SPARC_TLS_TPOFF32 78
1710#define R_SPARC_TLS_TPOFF64 79
1711#define R_SPARC_GOTDATA_HIX22 80
1712#define R_SPARC_GOTDATA_LOX10 81
1713#define R_SPARC_GOTDATA_OP_HIX22 82
1714#define R_SPARC_GOTDATA_OP_LOX10 83
1715#define R_SPARC_GOTDATA_OP 84
1716#define R_SPARC_H34 85
1717
1718
1719#define R_X86_64_NONE 0
1720#define R_X86_64_64 1
1721#define R_X86_64_PC32 2
1722#define R_X86_64_GOT32 3
1723#define R_X86_64_PLT32 4
1724#define R_X86_64_COPY 5
1725#define R_X86_64_GLOB_DAT 6
1726#define R_X86_64_JUMP_SLOT 7
1727#define R_X86_64_RELATIVE 8
1728#define R_X86_64_GOTPCREL 9
1729#define R_X86_64_32 10
1730#define R_X86_64_32S 11
1731#define R_X86_64_16 12
1732#define R_X86_64_PC16 13
1733#define R_X86_64_8 14
1734#define R_X86_64_PC8 15
1735#define R_X86_64_DTPMOD64 16
1736#define R_X86_64_DTPOFF64 17
1737#define R_X86_64_TPOFF64 18
1738#define R_X86_64_TLSGD 19
1739#define R_X86_64_TLSLD 20
1740#define R_X86_64_DTPOFF32 21
1741#define R_X86_64_GOTTPOFF 22
1742#define R_X86_64_TPOFF32 23
1743#define R_X86_64_PC64 24
1744#define R_X86_64_GOTOFF64 25
1745#define R_X86_64_GOTPC32 26
1746#define R_X86_64_GOT64 27
1747#define R_X86_64_GOTPCREL64 28
1748#define R_X86_64_GOTPC64 29
1749#define R_X86_64_GOTPLT64 30
1750#define R_X86_64_PLTOFF64 31
1751#define R_X86_64_SIZE32 32
1752#define R_X86_64_SIZE64 33
1753#define R_X86_64_GOTPC32_TLSDESC 34
1754#define R_X86_64_TLSDESC_CALL 35
1755#define R_X86_64_TLSDESC 36
1756#define R_X86_64_IRELATIVE 37
1757#define R_X86_64_RELATIVE64 38
1758#define R_X86_64_GOTPCRELX 41
1759#define R_X86_64_REX_GOTPCRELX 42
1760
1761
1762
1763/*
1764 * MIPS ABI related.
1765 */
1766
1767#define E_MIPS_ABI_O32 0x00001000
1768#define E_MIPS_ABI_O64 0x00002000
1769#define E_MIPS_ABI_EABI32 0x00003000
1770#define E_MIPS_ABI_EABI64 0x00004000
1771
1772
1773/**
1774 ** ELF Types.
1775 **/
1776
1777typedef uint32_t Elf32_Addr; /* Program address. */
1778typedef uint8_t Elf32_Byte; /* Unsigned tiny integer. */
1779typedef uint16_t Elf32_Half; /* Unsigned medium integer. */
1780typedef uint32_t Elf32_Off; /* File offset. */
1781typedef uint16_t Elf32_Section; /* Section index. */
1782typedef int32_t Elf32_Sword; /* Signed integer. */
1783typedef uint32_t Elf32_Word; /* Unsigned integer. */
1784typedef uint64_t Elf32_Lword; /* Unsigned long integer. */
1785
1786typedef uint64_t Elf64_Addr; /* Program address. */
1787typedef uint8_t Elf64_Byte; /* Unsigned tiny integer. */
1788typedef uint16_t Elf64_Half; /* Unsigned medium integer. */
1789typedef uint64_t Elf64_Off; /* File offset. */
1790typedef uint16_t Elf64_Section; /* Section index. */
1791typedef int32_t Elf64_Sword; /* Signed integer. */
1792typedef uint32_t Elf64_Word; /* Unsigned integer. */
1793typedef uint64_t Elf64_Lword; /* Unsigned long integer. */
1794typedef uint64_t Elf64_Xword; /* Unsigned long integer. */
1795typedef int64_t Elf64_Sxword; /* Signed long integer. */
1796
1797
1798/*
1799 * Capability descriptors.
1800 */
1801
1802/* 32-bit capability descriptor. */
1803typedef struct {
1804 Elf32_Word c_tag; /* Type of entry. */
1805 union {
1806 Elf32_Word c_val; /* Integer value. */
1807 Elf32_Addr c_ptr; /* Pointer value. */
1808 } c_un;
1809} Elf32_Cap;
1810
1811/* 64-bit capability descriptor. */
1812typedef struct {
1813 Elf64_Xword c_tag; /* Type of entry. */
1814 union {
1815 Elf64_Xword c_val; /* Integer value. */
1816 Elf64_Addr c_ptr; /* Pointer value. */
1817 } c_un;
1818} Elf64_Cap;
1819
1820/*
1821 * MIPS .conflict section entries.
1822 */
1823
1824/* 32-bit entry. */
1825typedef struct {
1826 Elf32_Addr c_index;
1827} Elf32_Conflict;
1828
1829/* 64-bit entry. */
1830typedef struct {
1831 Elf64_Addr c_index;
1832} Elf64_Conflict;
1833
1834/*
1835 * Dynamic section entries.
1836 */
1837
1838/* 32-bit entry. */
1839typedef struct {
1840 Elf32_Sword d_tag; /* Type of entry. */
1841 union {
1842 Elf32_Word d_val; /* Integer value. */
1843 Elf32_Addr d_ptr; /* Pointer value. */
1844 } d_un;
1845} Elf32_Dyn;
1846
1847/* 64-bit entry. */
1848typedef struct {
1849 Elf64_Sxword d_tag; /* Type of entry. */
1850 union {
1851 Elf64_Xword d_val; /* Integer value. */
1852 Elf64_Addr d_ptr; /* Pointer value; */
1853 } d_un;
1854} Elf64_Dyn;
1855
1856
1857/*
1858 * The executable header (EHDR).
1859 */
1860
1861/* 32 bit EHDR. */
1862typedef struct {
1863 unsigned char e_ident[EI_NIDENT]; /* ELF identification. */
1864 Elf32_Half e_type; /* Object file type (ET_*). */
1865 Elf32_Half e_machine; /* Machine type (EM_*). */
1866 Elf32_Word e_version; /* File format version (EV_*). */
1867 Elf32_Addr e_entry; /* Start address. */
1868 Elf32_Off e_phoff; /* File offset to the PHDR table. */
1869 Elf32_Off e_shoff; /* File offset to the SHDRheader. */
1870 Elf32_Word e_flags; /* Flags (EF_*). */
1871 Elf32_Half e_ehsize; /* Elf header size in bytes. */
1872 Elf32_Half e_phentsize; /* PHDR table entry size in bytes. */
1873 Elf32_Half e_phnum; /* Number of PHDR entries. */
1874 Elf32_Half e_shentsize; /* SHDR table entry size in bytes. */
1875 Elf32_Half e_shnum; /* Number of SHDR entries. */
1876 Elf32_Half e_shstrndx; /* Index of section name string table. */
1877} Elf32_Ehdr;
1878
1879
1880/* 64 bit EHDR. */
1881typedef struct {
1882 unsigned char e_ident[EI_NIDENT]; /* ELF identification. */
1883 Elf64_Half e_type; /* Object file type (ET_*). */
1884 Elf64_Half e_machine; /* Machine type (EM_*). */
1885 Elf64_Word e_version; /* File format version (EV_*). */
1886 Elf64_Addr e_entry; /* Start address. */
1887 Elf64_Off e_phoff; /* File offset to the PHDR table. */
1888 Elf64_Off e_shoff; /* File offset to the SHDRheader. */
1889 Elf64_Word e_flags; /* Flags (EF_*). */
1890 Elf64_Half e_ehsize; /* Elf header size in bytes. */
1891 Elf64_Half e_phentsize; /* PHDR table entry size in bytes. */
1892 Elf64_Half e_phnum; /* Number of PHDR entries. */
1893 Elf64_Half e_shentsize; /* SHDR table entry size in bytes. */
1894 Elf64_Half e_shnum; /* Number of SHDR entries. */
1895 Elf64_Half e_shstrndx; /* Index of section name string table. */
1896} Elf64_Ehdr;
1897
1898
1899/*
1900 * Shared object information.
1901 */
1902
1903/* 32-bit entry. */
1904typedef struct {
1905 Elf32_Word l_name; /* The name of a shared object. */
1906 Elf32_Word l_time_stamp; /* 32-bit timestamp. */
1907 Elf32_Word l_checksum; /* Checksum of visible symbols, sizes. */
1908 Elf32_Word l_version; /* Interface version string index. */
1909 Elf32_Word l_flags; /* Flags (LL_*). */
1910} Elf32_Lib;
1911
1912/* 64-bit entry. */
1913typedef struct {
1914 Elf64_Word l_name; /* The name of a shared object. */
1915 Elf64_Word l_time_stamp; /* 32-bit timestamp. */
1916 Elf64_Word l_checksum; /* Checksum of visible symbols, sizes. */
1917 Elf64_Word l_version; /* Interface version string index. */
1918 Elf64_Word l_flags; /* Flags (LL_*). */
1919} Elf64_Lib;
1920
1921
1922#define LL_NONE 0
1923#define LL_EXACT_MATCH 0x1
1924#define LL_IGNORE_INT_VER 0x2
1925#define LL_REQUIRE_MINOR 0x4
1926#define LL_EXPORTS 0x8
1927#define LL_DELAY_LOAD 0x10
1928#define LL_DELTA 0x20
1929
1930
1931/*
1932 * Note tags
1933 */
1934
1935#define NT_ABI_TAG 1
1936#define NT_GNU_HWCAP 2
1937#define NT_GNU_BUILD_ID 3
1938#define NT_GNU_GOLD_VERSION 4
1939#define NT_PRSTATUS 1
1940#define NT_FPREGSET 2
1941#define NT_PRPSINFO 3
1942#define NT_AUXV 6
1943#define NT_PRXFPREG 0x46E62B7FUL
1944#define NT_PSTATUS 10
1945#define NT_FPREGS 12
1946#define NT_PSINFO 13
1947#define NT_LWPSTATUS 16
1948#define NT_LWPSINFO 17
1949#define NT_FREEBSD_NOINIT_TAG 2
1950#define NT_FREEBSD_ARCH_TAG 3
1951#define NT_FREEBSD_FEATURE_CTL 4
1952
1953/* Aliases for the ABI tag. */
1954
1955#define NT_FREEBSD_ABI_TAG NT_ABI_TAG
1956#define NT_GNU_ABI_TAG NT_ABI_TAG
1957#define NT_NETBSD_IDENT NT_ABI_TAG
1958#define NT_OPENBSD_IDENT NT_ABI_TAG
1959
1960
1961/*
1962 * Note descriptors.
1963 */
1964
1965typedef struct {
1966 uint32_t n_namesz; /* Length of note's name. */
1967 uint32_t n_descsz; /* Length of note's value. */
1968 uint32_t n_type; /* Type of note. */
1969} Elf_Note;
1970
1971typedef Elf_Note Elf32_Nhdr; /* 32-bit note header. */
1972typedef Elf_Note Elf64_Nhdr; /* 64-bit note header. */
1973
1974/*
1975 * MIPS ELF options descriptor header.
1976 */
1977
1978typedef struct {
1979 Elf64_Byte kind; /* Type of options. */
1980 Elf64_Byte size; /* Size of option descriptor. */
1981 Elf64_Half section; /* Index of section affected. */
1982 Elf64_Word info; /* Kind-specific information. */
1983} Elf_Options;
1984
1985/*
1986 * Option kinds.
1987 */
1988
1989#define ODK_NULL 0
1990#define ODK_REGINFO 1
1991#define ODK_EXCEPTIONS 2
1992#define ODK_PAD 3
1993#define ODK_HWPATCH 4
1994#define ODK_FILL 5
1995#define ODK_TAGS 6
1996#define ODK_HWAND 7
1997#define ODK_HWOR 8
1998#define ODK_GP_GROUP 9
1999#define ODK_IDENT 10
2000#define ODK_PAGESIZE 11
2001
2002
2003/*
2004 * ODK_EXCEPTIONS info field masks.
2005 */
2006
2007#define OEX_FPU_MIN 0x0000001FUL
2008#define OEX_FPU_MAX 0x00001F00UL
2009#define OEX_PAGE0 0x00010000UL
2010#define OEX_SMM 0x00020000UL
2011#define OEX_PRECISEFP 0x00040000UL
2012#define OEX_DISMISS 0x00080000UL
2013
2014
2015/*
2016 * ODK_PAD info field masks.
2017 */
2018
2019#define OPAD_PREFIX 0x0001
2020#define OPAD_POSTFIX 0x0002
2021#define OPAD_SYMBOL 0x0004
2022
2023
2024/*
2025 * ODK_HWPATCH info field masks and ODK_HWAND/ODK_HWOR info field
2026 * and hwp_flags[12] masks.
2027 */
2028
2029#define OHW_R4KEOP 0x00000001UL
2030#define OHW_R8KPFETCH 0x00000002UL
2031#define OHW_R5KEOP 0x00000004UL
2032#define OHW_R5KCVTL 0x00000008UL
2033#define OHW_R10KLDL 0x00000010UL
2034#define OHWA0_R4KEOP_CHECKED 0x00000001UL
2035#define OHWA0_R4KEOP_CLEAN 0x00000002UL
2036#define OHWO0_FIXADE 0x00000001UL
2037
2038
2039/*
2040 * ODK_IDENT/ODK_GP_GROUP info field masks.
2041 */
2042
2043#define OGP_GROUP 0x0000FFFFUL
2044#define OGP_SELF 0x00010000UL
2045
2046
2047/*
2048 * MIPS ELF register info descriptor.
2049 */
2050
2051/* 32 bit RegInfo entry. */
2052typedef struct {
2053 Elf32_Word ri_gprmask; /* Mask of general register used. */
2054 Elf32_Word ri_cprmask[4]; /* Mask of coprocessor register used. */
2055 Elf32_Addr ri_gp_value; /* GP register value. */
2056} Elf32_RegInfo;
2057
2058/* 64 bit RegInfo entry. */
2059typedef struct {
2060 Elf64_Word ri_gprmask; /* Mask of general register used. */
2061 Elf64_Word ri_pad; /* Padding. */
2062 Elf64_Word ri_cprmask[4]; /* Mask of coprocessor register used. */
2063 Elf64_Addr ri_gp_value; /* GP register value. */
2064} Elf64_RegInfo;
2065
2066/*
2067 * Program Header Table (PHDR) entries.
2068 */
2069
2070/* 32 bit PHDR entry. */
2071typedef struct {
2072 Elf32_Word p_type; /* Type of segment. */
2073 Elf32_Off p_offset; /* File offset to segment. */
2074 Elf32_Addr p_vaddr; /* Virtual address in memory. */
2075 Elf32_Addr p_paddr; /* Physical address (if relevant). */
2076 Elf32_Word p_filesz; /* Size of segment in file. */
2077 Elf32_Word p_memsz; /* Size of segment in memory. */
2078 Elf32_Word p_flags; /* Segment flags. */
2079 Elf32_Word p_align; /* Alignment constraints. */
2080} Elf32_Phdr;
2081
2082/* 64 bit PHDR entry. */
2083typedef struct {
2084 Elf64_Word p_type; /* Type of segment. */
2085 Elf64_Word p_flags; /* Segment flags. */
2086 Elf64_Off p_offset; /* File offset to segment. */
2087 Elf64_Addr p_vaddr; /* Virtual address in memory. */
2088 Elf64_Addr p_paddr; /* Physical address (if relevant). */
2089 Elf64_Xword p_filesz; /* Size of segment in file. */
2090 Elf64_Xword p_memsz; /* Size of segment in memory. */
2091 Elf64_Xword p_align; /* Alignment constraints. */
2092} Elf64_Phdr;
2093
2094
2095/*
2096 * Move entries, for describing data in COMMON blocks in a compact
2097 * manner.
2098 */
2099
2100/* 32-bit move entry. */
2101typedef struct {
2102 Elf32_Lword m_value; /* Initialization value. */
2103 Elf32_Word m_info; /* Encoded size and index. */
2104 Elf32_Word m_poffset; /* Offset relative to symbol. */
2105 Elf32_Half m_repeat; /* Repeat count. */
2106 Elf32_Half m_stride; /* Number of units to skip. */
2107} Elf32_Move;
2108
2109/* 64-bit move entry. */
2110typedef struct {
2111 Elf64_Lword m_value; /* Initialization value. */
2112 Elf64_Xword m_info; /* Encoded size and index. */
2113 Elf64_Xword m_poffset; /* Offset relative to symbol. */
2114 Elf64_Half m_repeat; /* Repeat count. */
2115 Elf64_Half m_stride; /* Number of units to skip. */
2116} Elf64_Move;
2117
2118#define ELF32_M_SYM(I) ((I) >> 8)
2119#define ELF32_M_SIZE(I) ((unsigned char) (I))
2120#define ELF32_M_INFO(M, S) (((M) << 8) + (unsigned char) (S))
2121
2122#define ELF64_M_SYM(I) ((I) >> 8)
2123#define ELF64_M_SIZE(I) ((unsigned char) (I))
2124#define ELF64_M_INFO(M, S) (((M) << 8) + (unsigned char) (S))
2125
2126/*
2127 * Section Header Table (SHDR) entries.
2128 */
2129
2130/* 32 bit SHDR */
2131typedef struct {
2132 Elf32_Word sh_name; /* index of section name */
2133 Elf32_Word sh_type; /* section type */
2134 Elf32_Word sh_flags; /* section flags */
2135 Elf32_Addr sh_addr; /* in-memory address of section */
2136 Elf32_Off sh_offset; /* file offset of section */
2137 Elf32_Word sh_size; /* section size in bytes */
2138 Elf32_Word sh_link; /* section header table link */
2139 Elf32_Word sh_info; /* extra information */
2140 Elf32_Word sh_addralign; /* alignment constraint */
2141 Elf32_Word sh_entsize; /* size for fixed-size entries */
2142} Elf32_Shdr;
2143
2144/* 64 bit SHDR */
2145typedef struct {
2146 Elf64_Word sh_name; /* index of section name */
2147 Elf64_Word sh_type; /* section type */
2148 Elf64_Xword sh_flags; /* section flags */
2149 Elf64_Addr sh_addr; /* in-memory address of section */
2150 Elf64_Off sh_offset; /* file offset of section */
2151 Elf64_Xword sh_size; /* section size in bytes */
2152 Elf64_Word sh_link; /* section header table link */
2153 Elf64_Word sh_info; /* extra information */
2154 Elf64_Xword sh_addralign; /* alignment constraint */
2155 Elf64_Xword sh_entsize; /* size for fixed-size entries */
2156} Elf64_Shdr;
2157
2158
2159/*
2160 * Symbol table entries.
2161 */
2162
2163typedef struct {
2164 Elf32_Word st_name; /* index of symbol's name */
2165 Elf32_Addr st_value; /* value for the symbol */
2166 Elf32_Word st_size; /* size of associated data */
2167 unsigned char st_info; /* type and binding attributes */
2168 unsigned char st_other; /* visibility */
2169 Elf32_Half st_shndx; /* index of related section */
2170} Elf32_Sym;
2171
2172typedef struct {
2173 Elf64_Word st_name; /* index of symbol's name */
2174 unsigned char st_info; /* type and binding attributes */
2175 unsigned char st_other; /* visibility */
2176 Elf64_Half st_shndx; /* index of related section */
2177 Elf64_Addr st_value; /* value for the symbol */
2178 Elf64_Xword st_size; /* size of associated data */
2179} Elf64_Sym;
2180
2181#define ELF32_ST_BIND(I) ((I) >> 4)
2182#define ELF32_ST_TYPE(I) ((I) & 0xFU)
2183#define ELF32_ST_INFO(B,T) (((B) << 4) + ((T) & 0xF))
2184
2185#define ELF64_ST_BIND(I) ((I) >> 4)
2186#define ELF64_ST_TYPE(I) ((I) & 0xFU)
2187#define ELF64_ST_INFO(B,T) (((B) << 4) + ((T) & 0xF))
2188
2189#define ELF32_ST_VISIBILITY(O) ((O) & 0x3)
2190#define ELF64_ST_VISIBILITY(O) ((O) & 0x3)
2191
2192/*
2193 * Syminfo descriptors, containing additional symbol information.
2194 */
2195
2196/* 32-bit entry. */
2197typedef struct {
2198 Elf32_Half si_boundto; /* Entry index with additional flags. */
2199 Elf32_Half si_flags; /* Flags. */
2200} Elf32_Syminfo;
2201
2202/* 64-bit entry. */
2203typedef struct {
2204 Elf64_Half si_boundto; /* Entry index with additional flags. */
2205 Elf64_Half si_flags; /* Flags. */
2206} Elf64_Syminfo;
2207
2208/*
2209 * Relocation descriptors.
2210 */
2211
2212typedef struct {
2213 Elf32_Addr r_offset; /* location to apply relocation to */
2214 Elf32_Word r_info; /* type+section for relocation */
2215} Elf32_Rel;
2216
2217typedef struct {
2218 Elf32_Addr r_offset; /* location to apply relocation to */
2219 Elf32_Word r_info; /* type+section for relocation */
2220 Elf32_Sword r_addend; /* constant addend */
2221} Elf32_Rela;
2222
2223typedef struct {
2224 Elf64_Addr r_offset; /* location to apply relocation to */
2225 Elf64_Xword r_info; /* type+section for relocation */
2226} Elf64_Rel;
2227
2228typedef struct {
2229 Elf64_Addr r_offset; /* location to apply relocation to */
2230 Elf64_Xword r_info; /* type+section for relocation */
2231 Elf64_Sxword r_addend; /* constant addend */
2232} Elf64_Rela;
2233
2234
2235#define ELF32_R_SYM(I) ((I) >> 8)
2236#define ELF32_R_TYPE(I) ((unsigned char) (I))
2237#define ELF32_R_INFO(S,T) (((S) << 8) + (unsigned char) (T))
2238
2239#define ELF64_R_SYM(I) ((I) >> 32)
2240#define ELF64_R_TYPE(I) ((I) & 0xFFFFFFFFUL)
2241#define ELF64_R_INFO(S,T) \
2242 (((Elf64_Xword) (S) << 32) + ((T) & 0xFFFFFFFFUL))
2243
2244/*
2245 * Symbol versioning structures.
2246 */
2247
2248/* 32-bit structures. */
2249typedef struct
2250{
2251 Elf32_Word vda_name; /* Index to name. */
2252 Elf32_Word vda_next; /* Offset to next entry. */
2253} Elf32_Verdaux;
2254
2255typedef struct
2256{
2257 Elf32_Word vna_hash; /* Hash value of dependency name. */
2258 Elf32_Half vna_flags; /* Flags. */
2259 Elf32_Half vna_other; /* Unused. */
2260 Elf32_Word vna_name; /* Offset to dependency name. */
2261 Elf32_Word vna_next; /* Offset to next vernaux entry. */
2262} Elf32_Vernaux;
2263
2264typedef struct
2265{
2266 Elf32_Half vd_version; /* Version information. */
2267 Elf32_Half vd_flags; /* Flags. */
2268 Elf32_Half vd_ndx; /* Index into the versym section. */
2269 Elf32_Half vd_cnt; /* Number of aux entries. */
2270 Elf32_Word vd_hash; /* Hash value of name. */
2271 Elf32_Word vd_aux; /* Offset to aux entries. */
2272 Elf32_Word vd_next; /* Offset to next version definition. */
2273} Elf32_Verdef;
2274
2275typedef struct
2276{
2277 Elf32_Half vn_version; /* Version number. */
2278 Elf32_Half vn_cnt; /* Number of aux entries. */
2279 Elf32_Word vn_file; /* Offset of associated file name. */
2280 Elf32_Word vn_aux; /* Offset of vernaux array. */
2281 Elf32_Word vn_next; /* Offset of next verneed entry. */
2282} Elf32_Verneed;
2283
2284typedef Elf32_Half Elf32_Versym;
2285
2286/* 64-bit structures. */
2287
2288typedef struct {
2289 Elf64_Word vda_name; /* Index to name. */
2290 Elf64_Word vda_next; /* Offset to next entry. */
2291} Elf64_Verdaux;
2292
2293typedef struct {
2294 Elf64_Word vna_hash; /* Hash value of dependency name. */
2295 Elf64_Half vna_flags; /* Flags. */
2296 Elf64_Half vna_other; /* Unused. */
2297 Elf64_Word vna_name; /* Offset to dependency name. */
2298 Elf64_Word vna_next; /* Offset to next vernaux entry. */
2299} Elf64_Vernaux;
2300
2301typedef struct {
2302 Elf64_Half vd_version; /* Version information. */
2303 Elf64_Half vd_flags; /* Flags. */
2304 Elf64_Half vd_ndx; /* Index into the versym section. */
2305 Elf64_Half vd_cnt; /* Number of aux entries. */
2306 Elf64_Word vd_hash; /* Hash value of name. */
2307 Elf64_Word vd_aux; /* Offset to aux entries. */
2308 Elf64_Word vd_next; /* Offset to next version definition. */
2309} Elf64_Verdef;
2310
2311typedef struct {
2312 Elf64_Half vn_version; /* Version number. */
2313 Elf64_Half vn_cnt; /* Number of aux entries. */
2314 Elf64_Word vn_file; /* Offset of associated file name. */
2315 Elf64_Word vn_aux; /* Offset of vernaux array. */
2316 Elf64_Word vn_next; /* Offset of next verneed entry. */
2317} Elf64_Verneed;
2318
2319typedef Elf64_Half Elf64_Versym;
2320
2321
2322/*
2323 * The header for GNU-style hash sections.
2324 */
2325
2326typedef struct {
2327 uint32_t gh_nbuckets; /* Number of hash buckets. */
2328 uint32_t gh_symndx; /* First visible symbol in .dynsym. */
2329 uint32_t gh_maskwords; /* #maskwords used in bloom filter. */
2330 uint32_t gh_shift2; /* Bloom filter count. */
2331} Elf_GNU_Hash_Header;
2332
2333#endif /* _SYS_ELFDEFINITIONS_H_ */