1 /* This file defines standard ELF types, structures, and macros.
2 Copyright (C) 1995-2003,2004,2005,2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include <palacios/vmm_types.h>
28 #define ElfW(type) _ElfW (Elf, __ELF_SIZE, type)
29 #define _ElfW(e,w,t) _ElfW_1 (e, w, _##t)
30 #define _ElfW_1(e,w,t) e##w##t
32 /* Standard ELF types. */
34 /* Type for a 16-bit quantity. */
35 typedef uint16_t Elf32_Half;
36 typedef uint16_t Elf64_Half;
38 /* Types for signed and unsigned 32-bit quantities. */
39 typedef uint32_t Elf32_Word;
40 typedef sint32_t Elf32_Sword;
41 typedef uint32_t Elf64_Word;
42 typedef sint32_t Elf64_Sword;
44 /* Types for signed and unsigned 64-bit quantities. */
45 typedef uint64_t Elf32_Xword;
46 typedef sint64_t Elf32_Sxword;
47 typedef uint64_t Elf64_Xword;
48 typedef sint64_t Elf64_Sxword;
50 /* Type of addresses. */
51 typedef uint32_t Elf32_Addr;
52 typedef uint64_t Elf64_Addr;
54 /* Type of file offsets. */
55 typedef uint32_t Elf32_Off;
56 typedef uint64_t Elf64_Off;
58 /* Type for section indices, which are 16-bit quantities. */
59 typedef uint16_t Elf32_Section;
60 typedef uint16_t Elf64_Section;
62 /* Type for version symbol information. */
63 typedef Elf32_Half Elf32_Versym;
64 typedef Elf64_Half Elf64_Versym;
68 /* The ELF file header. This appears at the start of every ELF file. */
70 #define EI_NIDENT (16)
74 unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
75 Elf32_Half e_type; /* Object file type */
76 Elf32_Half e_machine; /* Architecture */
77 Elf32_Word e_version; /* Object file version */
78 Elf32_Addr e_entry; /* Entry point virtual address */
79 Elf32_Off e_phoff; /* Program header table file offset */
80 Elf32_Off e_shoff; /* Section header table file offset */
81 Elf32_Word e_flags; /* Processor-specific flags */
82 Elf32_Half e_ehsize; /* ELF header size in bytes */
83 Elf32_Half e_phentsize; /* Program header table entry size */
84 Elf32_Half e_phnum; /* Program header table entry count */
85 Elf32_Half e_shentsize; /* Section header table entry size */
86 Elf32_Half e_shnum; /* Section header table entry count */
87 Elf32_Half e_shstrndx; /* Section header string table index */
92 unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
93 Elf64_Half e_type; /* Object file type */
94 Elf64_Half e_machine; /* Architecture */
95 Elf64_Word e_version; /* Object file version */
96 Elf64_Addr e_entry; /* Entry point virtual address */
97 Elf64_Off e_phoff; /* Program header table file offset */
98 Elf64_Off e_shoff; /* Section header table file offset */
99 Elf64_Word e_flags; /* Processor-specific flags */
100 Elf64_Half e_ehsize; /* ELF header size in bytes */
101 Elf64_Half e_phentsize; /* Program header table entry size */
102 Elf64_Half e_phnum; /* Program header table entry count */
103 Elf64_Half e_shentsize; /* Section header table entry size */
104 Elf64_Half e_shnum; /* Section header table entry count */
105 Elf64_Half e_shstrndx; /* Section header string table index */
108 /* Fields in the e_ident array. The EI_* macros are indices into the
109 array. The macros under each EI_* macro are the values the byte
112 #define EI_MAG0 0 /* File identification byte 0 index */
113 #define ELFMAG0 0x7f /* Magic number byte 0 */
115 #define EI_MAG1 1 /* File identification byte 1 index */
116 #define ELFMAG1 'E' /* Magic number byte 1 */
118 #define EI_MAG2 2 /* File identification byte 2 index */
119 #define ELFMAG2 'L' /* Magic number byte 2 */
121 #define EI_MAG3 3 /* File identification byte 3 index */
122 #define ELFMAG3 'F' /* Magic number byte 3 */
124 /* Conglomeration of the identification bytes, for easy testing as a word. */
125 #define ELFMAG "\177ELF"
128 #define EI_CLASS 4 /* File class byte index */
129 #define ELFCLASSNONE 0 /* Invalid class */
130 #define ELFCLASS32 1 /* 32-bit objects */
131 #define ELFCLASS64 2 /* 64-bit objects */
132 #define ELFCLASSNUM 3
134 #define EI_DATA 5 /* Data encoding byte index */
135 #define ELFDATANONE 0 /* Invalid data encoding */
136 #define ELFDATA2LSB 1 /* 2's complement, little endian */
137 #define ELFDATA2MSB 2 /* 2's complement, big endian */
140 #define EI_VERSION 6 /* File version byte index */
141 /* Value must be EV_CURRENT */
143 #define EI_OSABI 7 /* OS ABI identification */
144 #define ELFOSABI_NONE 0 /* UNIX System V ABI */
145 #define ELFOSABI_SYSV 0 /* Alias. */
146 #define ELFOSABI_HPUX 1 /* HP-UX */
147 #define ELFOSABI_NETBSD 2 /* NetBSD. */
148 #define ELFOSABI_LINUX 3 /* Linux. */
149 #define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
150 #define ELFOSABI_AIX 7 /* IBM AIX. */
151 #define ELFOSABI_IRIX 8 /* SGI Irix. */
152 #define ELFOSABI_FREEBSD 9 /* FreeBSD. */
153 #define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
154 #define ELFOSABI_MODESTO 11 /* Novell Modesto. */
155 #define ELFOSABI_OPENBSD 12 /* OpenBSD. */
156 #define ELFOSABI_ARM 97 /* ARM */
157 #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
159 #define EI_ABIVERSION 8 /* ABI version */
161 #define EI_PAD 9 /* Byte index of padding bytes */
163 /* Legal values for e_type (object file type). */
165 #define ET_NONE 0 /* No file type */
166 #define ET_REL 1 /* Relocatable file */
167 #define ET_EXEC 2 /* Executable file */
168 #define ET_DYN 3 /* Shared object file */
169 #define ET_CORE 4 /* Core file */
170 #define ET_NUM 5 /* Number of defined types */
171 #define ET_LOOS 0xfe00 /* OS-specific range start */
172 #define ET_HIOS 0xfeff /* OS-specific range end */
173 #define ET_LOPROC 0xff00 /* Processor-specific range start */
174 #define ET_HIPROC 0xffff /* Processor-specific range end */
176 /* Legal values for e_machine (architecture). */
178 #define EM_NONE 0 /* No machine */
179 #define EM_M32 1 /* AT&T WE 32100 */
180 #define EM_SPARC 2 /* SUN SPARC */
181 #define EM_386 3 /* Intel 80386 */
182 #define EM_68K 4 /* Motorola m68k family */
183 #define EM_88K 5 /* Motorola m88k family */
184 #define EM_860 7 /* Intel 80860 */
185 #define EM_MIPS 8 /* MIPS R3000 big-endian */
186 #define EM_S370 9 /* IBM System/370 */
187 #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
189 #define EM_PARISC 15 /* HPPA */
190 #define EM_VPP500 17 /* Fujitsu VPP500 */
191 #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
192 #define EM_960 19 /* Intel 80960 */
193 #define EM_PPC 20 /* PowerPC */
194 #define EM_PPC64 21 /* PowerPC 64-bit */
195 #define EM_S390 22 /* IBM S390 */
197 #define EM_V800 36 /* NEC V800 series */
198 #define EM_FR20 37 /* Fujitsu FR20 */
199 #define EM_RH32 38 /* TRW RH-32 */
200 #define EM_RCE 39 /* Motorola RCE */
201 #define EM_ARM 40 /* ARM */
202 #define EM_FAKE_ALPHA 41 /* Digital Alpha */
203 #define EM_SH 42 /* Hitachi SH */
204 #define EM_SPARCV9 43 /* SPARC v9 64-bit */
205 #define EM_TRICORE 44 /* Siemens Tricore */
206 #define EM_ARC 45 /* Argonaut RISC Core */
207 #define EM_H8_300 46 /* Hitachi H8/300 */
208 #define EM_H8_300H 47 /* Hitachi H8/300H */
209 #define EM_H8S 48 /* Hitachi H8S */
210 #define EM_H8_500 49 /* Hitachi H8/500 */
211 #define EM_IA_64 50 /* Intel Merced */
212 #define EM_MIPS_X 51 /* Stanford MIPS-X */
213 #define EM_COLDFIRE 52 /* Motorola Coldfire */
214 #define EM_68HC12 53 /* Motorola M68HC12 */
215 #define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
216 #define EM_PCP 55 /* Siemens PCP */
217 #define EM_NCPU 56 /* Sony nCPU embeeded RISC */
218 #define EM_NDR1 57 /* Denso NDR1 microprocessor */
219 #define EM_STARCORE 58 /* Motorola Start*Core processor */
220 #define EM_ME16 59 /* Toyota ME16 processor */
221 #define EM_ST100 60 /* STMicroelectronic ST100 processor */
222 #define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
223 #define EM_X86_64 62 /* AMD x86-64 architecture */
224 #define EM_PDSP 63 /* Sony DSP Processor */
226 #define EM_FX66 66 /* Siemens FX66 microcontroller */
227 #define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
228 #define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
229 #define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
230 #define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
231 #define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
232 #define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
233 #define EM_SVX 73 /* Silicon Graphics SVx */
234 #define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */
235 #define EM_VAX 75 /* Digital VAX */
236 #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
237 #define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
238 #define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
239 #define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
240 #define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
241 #define EM_HUANY 81 /* Harvard University machine-independent object files */
242 #define EM_PRISM 82 /* SiTera Prism */
243 #define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
244 #define EM_FR30 84 /* Fujitsu FR30 */
245 #define EM_D10V 85 /* Mitsubishi D10V */
246 #define EM_D30V 86 /* Mitsubishi D30V */
247 #define EM_V850 87 /* NEC v850 */
248 #define EM_M32R 88 /* Mitsubishi M32R */
249 #define EM_MN10300 89 /* Matsushita MN10300 */
250 #define EM_MN10200 90 /* Matsushita MN10200 */
251 #define EM_PJ 91 /* picoJava */
252 #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
253 #define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
254 #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
257 /* If it is necessary to assign new unofficial EM_* values, please
258 pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
259 chances of collision with official or non-GNU unofficial values. */
261 #define EM_ALPHA 0x9026
263 /* Legal values for e_version (version). */
265 #define EV_NONE 0 /* Invalid ELF version */
266 #define EV_CURRENT 1 /* Current version */
269 /* Section header. */
273 Elf32_Word sh_name; /* Section name (string tbl index) */
274 Elf32_Word sh_type; /* Section type */
275 Elf32_Word sh_flags; /* Section flags */
276 Elf32_Addr sh_addr; /* Section virtual addr at execution */
277 Elf32_Off sh_offset; /* Section file offset */
278 Elf32_Word sh_size; /* Section size in bytes */
279 Elf32_Word sh_link; /* Link to another section */
280 Elf32_Word sh_info; /* Additional section information */
281 Elf32_Word sh_addralign; /* Section alignment */
282 Elf32_Word sh_entsize; /* Entry size if section holds table */
287 Elf64_Word sh_name; /* Section name (string tbl index) */
288 Elf64_Word sh_type; /* Section type */
289 Elf64_Xword sh_flags; /* Section flags */
290 Elf64_Addr sh_addr; /* Section virtual addr at execution */
291 Elf64_Off sh_offset; /* Section file offset */
292 Elf64_Xword sh_size; /* Section size in bytes */
293 Elf64_Word sh_link; /* Link to another section */
294 Elf64_Word sh_info; /* Additional section information */
295 Elf64_Xword sh_addralign; /* Section alignment */
296 Elf64_Xword sh_entsize; /* Entry size if section holds table */
299 /* Special section indices. */
301 #define SHN_UNDEF 0 /* Undefined section */
302 #define SHN_LORESERVE 0xff00 /* Start of reserved indices */
303 #define SHN_LOPROC 0xff00 /* Start of processor-specific */
304 #define SHN_BEFORE 0xff00 /* Order section before all others
306 #define SHN_AFTER 0xff01 /* Order section after all others
308 #define SHN_HIPROC 0xff1f /* End of processor-specific */
309 #define SHN_LOOS 0xff20 /* Start of OS-specific */
310 #define SHN_HIOS 0xff3f /* End of OS-specific */
311 #define SHN_ABS 0xfff1 /* Associated symbol is absolute */
312 #define SHN_COMMON 0xfff2 /* Associated symbol is common */
313 #define SHN_XINDEX 0xffff /* Index is in extra table. */
314 #define SHN_HIRESERVE 0xffff /* End of reserved indices */
316 /* Legal values for sh_type (section type). */
318 #define SHT_NULL 0 /* Section header table entry unused */
319 #define SHT_PROGBITS 1 /* Program data */
320 #define SHT_SYMTAB 2 /* Symbol table */
321 #define SHT_STRTAB 3 /* String table */
322 #define SHT_RELA 4 /* Relocation entries with addends */
323 #define SHT_HASH 5 /* Symbol hash table */
324 #define SHT_DYNAMIC 6 /* Dynamic linking information */
325 #define SHT_NOTE 7 /* Notes */
326 #define SHT_NOBITS 8 /* Program space with no data (bss) */
327 #define SHT_REL 9 /* Relocation entries, no addends */
328 #define SHT_SHLIB 10 /* Reserved */
329 #define SHT_DYNSYM 11 /* Dynamic linker symbol table */
330 #define SHT_INIT_ARRAY 14 /* Array of constructors */
331 #define SHT_FINI_ARRAY 15 /* Array of destructors */
332 #define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
333 #define SHT_GROUP 17 /* Section group */
334 #define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
335 #define SHT_NUM 19 /* Number of defined types. */
336 #define SHT_LOOS 0x60000000 /* Start OS-specific. */
337 #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */
338 #define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */
339 #define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */
340 #define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */
341 #define SHT_SUNW_move 0x6ffffffa
342 #define SHT_SUNW_COMDAT 0x6ffffffb
343 #define SHT_SUNW_syminfo 0x6ffffffc
344 #define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
345 #define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
346 #define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
347 #define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
348 #define SHT_HIOS 0x6fffffff /* End OS-specific type */
349 #define SHT_LOPROC 0x70000000 /* Start of processor-specific */
350 #define SHT_HIPROC 0x7fffffff /* End of processor-specific */
351 #define SHT_LOUSER 0x80000000 /* Start of application-specific */
352 #define SHT_HIUSER 0x8fffffff /* End of application-specific */
354 /* Legal values for sh_flags (section flags). */
356 #define SHF_WRITE (1 << 0) /* Writable */
357 #define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
358 #define SHF_EXECINSTR (1 << 2) /* Executable */
359 #define SHF_MERGE (1 << 4) /* Might be merged */
360 #define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */
361 #define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */
362 #define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */
363 #define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling
365 #define SHF_GROUP (1 << 9) /* Section is member of a group. */
366 #define SHF_TLS (1 << 10) /* Section hold thread-local data. */
367 #define SHF_MASKOS 0x0ff00000 /* OS-specific. */
368 #define SHF_MASKPROC 0xf0000000 /* Processor-specific */
369 #define SHF_ORDERED (1 << 30) /* Special ordering requirement
371 #define SHF_EXCLUDE (1 << 31) /* Section is excluded unless
372 referenced or allocated (Solaris).*/
374 /* Section group handling. */
375 #define GRP_COMDAT 0x1 /* Mark group as COMDAT. */
377 /* Symbol table entry. */
381 Elf32_Word st_name; /* Symbol name (string tbl index) */
382 Elf32_Addr st_value; /* Symbol value */
383 Elf32_Word st_size; /* Symbol size */
384 unsigned char st_info; /* Symbol type and binding */
385 unsigned char st_other; /* Symbol visibility */
386 Elf32_Section st_shndx; /* Section index */
391 Elf64_Word st_name; /* Symbol name (string tbl index) */
392 unsigned char st_info; /* Symbol type and binding */
393 unsigned char st_other; /* Symbol visibility */
394 Elf64_Section st_shndx; /* Section index */
395 Elf64_Addr st_value; /* Symbol value */
396 Elf64_Xword st_size; /* Symbol size */
399 /* The syminfo section if available contains additional information about
400 every dynamic symbol. */
404 Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
405 Elf32_Half si_flags; /* Per symbol flags */
410 Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
411 Elf64_Half si_flags; /* Per symbol flags */
414 /* Possible values for si_boundto. */
415 #define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
416 #define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
417 #define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
419 /* Possible bitmasks for si_flags. */
420 #define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
421 #define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
422 #define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
423 #define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
425 /* Syminfo version values. */
426 #define SYMINFO_NONE 0
427 #define SYMINFO_CURRENT 1
428 #define SYMINFO_NUM 2
431 /* How to extract and insert information held in the st_info field. */
433 #define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
434 #define ELF32_ST_TYPE(val) ((val) & 0xf)
435 #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
437 /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
438 #define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
439 #define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
440 #define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
442 /* Legal values for ST_BIND subfield of st_info (symbol binding). */
444 #define STB_LOCAL 0 /* Local symbol */
445 #define STB_GLOBAL 1 /* Global symbol */
446 #define STB_WEAK 2 /* Weak symbol */
447 #define STB_NUM 3 /* Number of defined types. */
448 #define STB_LOOS 10 /* Start of OS-specific */
449 #define STB_HIOS 12 /* End of OS-specific */
450 #define STB_LOPROC 13 /* Start of processor-specific */
451 #define STB_HIPROC 15 /* End of processor-specific */
453 /* Legal values for ST_TYPE subfield of st_info (symbol type). */
455 #define STT_NOTYPE 0 /* Symbol type is unspecified */
456 #define STT_OBJECT 1 /* Symbol is a data object */
457 #define STT_FUNC 2 /* Symbol is a code object */
458 #define STT_SECTION 3 /* Symbol associated with a section */
459 #define STT_FILE 4 /* Symbol's name is file name */
460 #define STT_COMMON 5 /* Symbol is a common data object */
461 #define STT_TLS 6 /* Symbol is thread-local data object*/
462 #define STT_NUM 7 /* Number of defined types. */
463 #define STT_LOOS 10 /* Start of OS-specific */
464 #define STT_HIOS 12 /* End of OS-specific */
465 #define STT_LOPROC 13 /* Start of processor-specific */
466 #define STT_HIPROC 15 /* End of processor-specific */
469 /* Symbol table indices are found in the hash buckets and chain table
470 of a symbol hash table section. This special index value indicates
471 the end of a chain, meaning no further symbols are found in that bucket. */
473 #define STN_UNDEF 0 /* End of a chain. */
476 /* How to extract and insert information held in the st_other field. */
478 #define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
480 /* For ELF64 the definitions are the same. */
481 #define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
483 /* Symbol visibility specification encoded in the st_other field. */
484 #define STV_DEFAULT 0 /* Default symbol visibility rules */
485 #define STV_INTERNAL 1 /* Processor specific hidden class */
486 #define STV_HIDDEN 2 /* Sym unavailable in other modules */
487 #define STV_PROTECTED 3 /* Not preemptible, not exported */
490 /* Relocation table entry without addend (in section of type SHT_REL). */
494 Elf32_Addr r_offset; /* Address */
495 Elf32_Word r_info; /* Relocation type and symbol index */
498 /* I have seen two different definitions of the Elf64_Rel and
499 Elf64_Rela structures, so we'll leave them out until Novell (or
500 whoever) gets their act together. */
501 /* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
505 Elf64_Addr r_offset; /* Address */
506 Elf64_Xword r_info; /* Relocation type and symbol index */
509 /* Relocation table entry with addend (in section of type SHT_RELA). */
513 Elf32_Addr r_offset; /* Address */
514 Elf32_Word r_info; /* Relocation type and symbol index */
515 Elf32_Sword r_addend; /* Addend */
520 Elf64_Addr r_offset; /* Address */
521 Elf64_Xword r_info; /* Relocation type and symbol index */
522 Elf64_Sxword r_addend; /* Addend */
525 /* How to extract and insert information held in the r_info field. */
527 #define ELF32_R_SYM(val) ((val) >> 8)
528 #define ELF32_R_TYPE(val) ((val) & 0xff)
529 #define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
531 #define ELF64_R_SYM(i) ((i) >> 32)
532 #define ELF64_R_TYPE(i) ((i) & 0xffffffff)
533 #define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) + (type))
535 /* Program segment header. */
539 Elf32_Word p_type; /* Segment type */
540 Elf32_Off p_offset; /* Segment file offset */
541 Elf32_Addr p_vaddr; /* Segment virtual address */
542 Elf32_Addr p_paddr; /* Segment physical address */
543 Elf32_Word p_filesz; /* Segment size in file */
544 Elf32_Word p_memsz; /* Segment size in memory */
545 Elf32_Word p_flags; /* Segment flags */
546 Elf32_Word p_align; /* Segment alignment */
551 Elf64_Word p_type; /* Segment type */
552 Elf64_Word p_flags; /* Segment flags */
553 Elf64_Off p_offset; /* Segment file offset */
554 Elf64_Addr p_vaddr; /* Segment virtual address */
555 Elf64_Addr p_paddr; /* Segment physical address */
556 Elf64_Xword p_filesz; /* Segment size in file */
557 Elf64_Xword p_memsz; /* Segment size in memory */
558 Elf64_Xword p_align; /* Segment alignment */
561 /* Legal values for p_type (segment type). */
563 #define PT_NULL 0 /* Program header table entry unused */
564 #define PT_LOAD 1 /* Loadable program segment */
565 #define PT_DYNAMIC 2 /* Dynamic linking information */
566 #define PT_INTERP 3 /* Program interpreter */
567 #define PT_NOTE 4 /* Auxiliary information */
568 #define PT_SHLIB 5 /* Reserved */
569 #define PT_PHDR 6 /* Entry for header table itself */
570 #define PT_TLS 7 /* Thread-local storage segment */
571 #define PT_NUM 8 /* Number of defined types */
572 #define PT_LOOS 0x60000000 /* Start of OS-specific */
573 #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
574 #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */
575 #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */
576 #define PT_LOSUNW 0x6ffffffa
577 #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
578 #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
579 #define PT_HISUNW 0x6fffffff
580 #define PT_HIOS 0x6fffffff /* End of OS-specific */
581 #define PT_LOPROC 0x70000000 /* Start of processor-specific */
582 #define PT_HIPROC 0x7fffffff /* End of processor-specific */
584 /* Legal values for p_flags (segment flags). */
586 #define PF_X (1 << 0) /* Segment is executable */
587 #define PF_W (1 << 1) /* Segment is writable */
588 #define PF_R (1 << 2) /* Segment is readable */
589 #define PF_MASKOS 0x0ff00000 /* OS-specific */
590 #define PF_MASKPROC 0xf0000000 /* Processor-specific */
592 /* Legal values for note segment descriptor types for core files. */
594 #define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
595 #define NT_FPREGSET 2 /* Contains copy of fpregset struct */
596 #define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
597 #define NT_PRXREG 4 /* Contains copy of prxregset struct */
598 #define NT_TASKSTRUCT 4 /* Contains copy of task structure */
599 #define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
600 #define NT_AUXV 6 /* Contains copy of auxv array */
601 #define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
602 #define NT_ASRS 8 /* Contains copy of asrset struct */
603 #define NT_PSTATUS 10 /* Contains copy of pstatus struct */
604 #define NT_PSINFO 13 /* Contains copy of psinfo struct */
605 #define NT_PRCRED 14 /* Contains copy of prcred struct */
606 #define NT_UTSNAME 15 /* Contains copy of utsname struct */
607 #define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
608 #define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
609 #define NT_PRFPXREG 20 /* Contains copy of fprxregset struct*/
611 /* Legal values for the note segment descriptor types for object files. */
613 #define NT_VERSION 1 /* Contains a version string. */
616 /* Dynamic section entry. */
620 Elf32_Sword d_tag; /* Dynamic entry type */
623 Elf32_Word d_val; /* Integer value */
624 Elf32_Addr d_ptr; /* Address value */
630 Elf64_Sxword d_tag; /* Dynamic entry type */
633 Elf64_Xword d_val; /* Integer value */
634 Elf64_Addr d_ptr; /* Address value */
638 /* Legal values for d_tag (dynamic entry type). */
640 #define DT_NULL 0 /* Marks end of dynamic section */
641 #define DT_NEEDED 1 /* Name of needed library */
642 #define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
643 #define DT_PLTGOT 3 /* Processor defined value */
644 #define DT_HASH 4 /* Address of symbol hash table */
645 #define DT_STRTAB 5 /* Address of string table */
646 #define DT_SYMTAB 6 /* Address of symbol table */
647 #define DT_RELA 7 /* Address of Rela relocs */
648 #define DT_RELASZ 8 /* Total size of Rela relocs */
649 #define DT_RELAENT 9 /* Size of one Rela reloc */
650 #define DT_STRSZ 10 /* Size of string table */
651 #define DT_SYMENT 11 /* Size of one symbol table entry */
652 #define DT_INIT 12 /* Address of init function */
653 #define DT_FINI 13 /* Address of termination function */
654 #define DT_SONAME 14 /* Name of shared object */
655 #define DT_RPATH 15 /* Library search path (deprecated) */
656 #define DT_SYMBOLIC 16 /* Start symbol search here */
657 #define DT_REL 17 /* Address of Rel relocs */
658 #define DT_RELSZ 18 /* Total size of Rel relocs */
659 #define DT_RELENT 19 /* Size of one Rel reloc */
660 #define DT_PLTREL 20 /* Type of reloc in PLT */
661 #define DT_DEBUG 21 /* For debugging; unspecified */
662 #define DT_TEXTREL 22 /* Reloc might modify .text */
663 #define DT_JMPREL 23 /* Address of PLT relocs */
664 #define DT_BIND_NOW 24 /* Process relocations of object */
665 #define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
666 #define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
667 #define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
668 #define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
669 #define DT_RUNPATH 29 /* Library search path */
670 #define DT_FLAGS 30 /* Flags for the object being loaded */
671 #define DT_ENCODING 32 /* Start of encoded range */
672 #define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
673 #define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
674 #define DT_NUM 34 /* Number used */
675 #define DT_LOOS 0x6000000d /* Start of OS-specific */
676 #define DT_HIOS 0x6ffff000 /* End of OS-specific */
677 #define DT_LOPROC 0x70000000 /* Start of processor-specific */
678 #define DT_HIPROC 0x7fffffff /* End of processor-specific */
679 #define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
681 /* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
682 Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
684 #define DT_VALRNGLO 0x6ffffd00
685 #define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */
686 #define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */
687 #define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */
688 #define DT_CHECKSUM 0x6ffffdf8
689 #define DT_PLTPADSZ 0x6ffffdf9
690 #define DT_MOVEENT 0x6ffffdfa
691 #define DT_MOVESZ 0x6ffffdfb
692 #define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */
693 #define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
694 the following DT_* entry. */
695 #define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
696 #define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
697 #define DT_VALRNGHI 0x6ffffdff
698 #define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */
701 /* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
702 Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
704 If any adjustment is made to the ELF object after it has been
705 built these entries will need to be adjusted. */
706 #define DT_ADDRRNGLO 0x6ffffe00
707 #define DT_GNU_HASH 0x6ffffef5 /* GNU-style hash table. */
708 #define DT_TLSDESC_PLT 0x6ffffef6
709 #define DT_TLSDESC_GOT 0x6ffffef7
710 #define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */
711 #define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */
712 #define DT_CONFIG 0x6ffffefa /* Configuration information. */
713 #define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */
714 #define DT_AUDIT 0x6ffffefc /* Object auditing. */
715 #define DT_PLTPAD 0x6ffffefd /* PLT padding. */
716 #define DT_MOVETAB 0x6ffffefe /* Move table. */
717 #define DT_SYMINFO 0x6ffffeff /* Syminfo table. */
718 #define DT_ADDRRNGHI 0x6ffffeff
719 #define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */
720 #define DT_ADDRNUM 11
722 /* The versioning entry types. The next are defined as part of the
724 #define DT_VERSYM 0x6ffffff0
726 #define DT_RELACOUNT 0x6ffffff9
727 #define DT_RELCOUNT 0x6ffffffa
729 /* These were chosen by Sun. */
730 #define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
731 #define DT_VERDEF 0x6ffffffc /* Address of version definition
733 #define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
734 #define DT_VERNEED 0x6ffffffe /* Address of table with needed
736 #define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
737 #define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
738 #define DT_VERSIONTAGNUM 16
740 /* Sun added these machine-independent extensions in the "processor-specific"
741 range. Be compatible. */
742 #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
743 #define DT_FILTER 0x7fffffff /* Shared object to get values from */
744 #define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
745 #define DT_EXTRANUM 3
747 /* Values of `d_un.d_val' in the DT_FLAGS entry. */
748 #define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */
749 #define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */
750 #define DF_TEXTREL 0x00000004 /* Object contains text relocations */
751 #define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */
752 #define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model */
754 /* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
755 entry in the dynamic section. */
756 #define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
757 #define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
758 #define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
759 #define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
760 #define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
761 #define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
762 #define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
763 #define DF_1_ORIGIN 0x00000080 /* $ORIGIN must be handled. */
764 #define DF_1_DIRECT 0x00000100 /* Direct binding enabled. */
765 #define DF_1_TRANS 0x00000200
766 #define DF_1_INTERPOSE 0x00000400 /* Object is used to interpose. */
767 #define DF_1_NODEFLIB 0x00000800 /* Ignore default lib search path. */
768 #define DF_1_NODUMP 0x00001000 /* Object can't be dldump'ed. */
769 #define DF_1_CONFALT 0x00002000 /* Configuration alternative created.*/
770 #define DF_1_ENDFILTEE 0x00004000 /* Filtee terminates filters search. */
771 #define DF_1_DISPRELDNE 0x00008000 /* Disp reloc applied at build time. */
772 #define DF_1_DISPRELPND 0x00010000 /* Disp reloc applied at run-time. */
774 /* Flags for the feature selection in DT_FEATURE_1. */
775 #define DTF_1_PARINIT 0x00000001
776 #define DTF_1_CONFEXP 0x00000002
778 /* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */
779 #define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */
780 #define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not
781 generally available. */
783 /* Version definition sections. */
787 Elf32_Half vd_version; /* Version revision */
788 Elf32_Half vd_flags; /* Version information */
789 Elf32_Half vd_ndx; /* Version Index */
790 Elf32_Half vd_cnt; /* Number of associated aux entries */
791 Elf32_Word vd_hash; /* Version name hash value */
792 Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
793 Elf32_Word vd_next; /* Offset in bytes to next verdef
799 Elf64_Half vd_version; /* Version revision */
800 Elf64_Half vd_flags; /* Version information */
801 Elf64_Half vd_ndx; /* Version Index */
802 Elf64_Half vd_cnt; /* Number of associated aux entries */
803 Elf64_Word vd_hash; /* Version name hash value */
804 Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
805 Elf64_Word vd_next; /* Offset in bytes to next verdef
810 /* Legal values for vd_version (version revision). */
811 #define VER_DEF_NONE 0 /* No version */
812 #define VER_DEF_CURRENT 1 /* Current version */
813 #define VER_DEF_NUM 2 /* Given version number */
815 /* Legal values for vd_flags (version information flags). */
816 #define VER_FLG_BASE 0x1 /* Version definition of file itself */
817 #define VER_FLG_WEAK 0x2 /* Weak version identifier */
819 /* Versym symbol index values. */
820 #define VER_NDX_LOCAL 0 /* Symbol is local. */
821 #define VER_NDX_GLOBAL 1 /* Symbol is global. */
822 #define VER_NDX_LORESERVE 0xff00 /* Beginning of reserved entries. */
823 #define VER_NDX_ELIMINATE 0xff01 /* Symbol is to be eliminated. */
825 /* Auxialiary version information. */
829 Elf32_Word vda_name; /* Version or dependency names */
830 Elf32_Word vda_next; /* Offset in bytes to next verdaux
836 Elf64_Word vda_name; /* Version or dependency names */
837 Elf64_Word vda_next; /* Offset in bytes to next verdaux
842 /* Version dependency section. */
846 Elf32_Half vn_version; /* Version of structure */
847 Elf32_Half vn_cnt; /* Number of associated aux entries */
848 Elf32_Word vn_file; /* Offset of filename for this
850 Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
851 Elf32_Word vn_next; /* Offset in bytes to next verneed
857 Elf64_Half vn_version; /* Version of structure */
858 Elf64_Half vn_cnt; /* Number of associated aux entries */
859 Elf64_Word vn_file; /* Offset of filename for this
861 Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
862 Elf64_Word vn_next; /* Offset in bytes to next verneed
867 /* Legal values for vn_version (version revision). */
868 #define VER_NEED_NONE 0 /* No version */
869 #define VER_NEED_CURRENT 1 /* Current version */
870 #define VER_NEED_NUM 2 /* Given version number */
872 /* Auxiliary needed version information. */
876 Elf32_Word vna_hash; /* Hash value of dependency name */
877 Elf32_Half vna_flags; /* Dependency specific information */
878 Elf32_Half vna_other; /* Unused */
879 Elf32_Word vna_name; /* Dependency name string offset */
880 Elf32_Word vna_next; /* Offset in bytes to next vernaux
886 Elf64_Word vna_hash; /* Hash value of dependency name */
887 Elf64_Half vna_flags; /* Dependency specific information */
888 Elf64_Half vna_other; /* Unused */
889 Elf64_Word vna_name; /* Dependency name string offset */
890 Elf64_Word vna_next; /* Offset in bytes to next vernaux
895 /* Legal values for vna_flags. */
896 #define VER_FLG_WEAK 0x2 /* Weak version identifier */
899 /* Auxiliary vector. */
901 /* This vector is normally only used by the program interpreter. The
902 usual definition in an ABI supplement uses the name auxv_t. The
903 vector is not usually defined in a standard <elf.h> file, but it
904 can't hurt. We rename it to avoid conflicts. The sizes of these
905 types are an arrangement between the exec server and the program
906 interpreter, so we don't fully specify them here. */
910 uint32_t a_type; /* Entry type */
913 uint32_t a_val; /* Integer value */
914 /* We use to have pointer elements added here. We cannot do that,
915 though, since it does not work when using 32-bit definitions
916 on 64-bit platforms and vice versa. */
922 uint64_t a_type; /* Entry type */
925 uint64_t a_val; /* Integer value */
926 /* We use to have pointer elements added here. We cannot do that,
927 though, since it does not work when using 32-bit definitions
928 on 64-bit platforms and vice versa. */
932 /* Legal values for a_type (entry type). */
934 #define AT_NULL 0 /* End of vector */
935 #define AT_IGNORE 1 /* Entry should be ignored */
936 #define AT_EXECFD 2 /* File descriptor of program */
937 #define AT_PHDR 3 /* Program headers for program */
938 #define AT_PHENT 4 /* Size of program header entry */
939 #define AT_PHNUM 5 /* Number of program headers */
940 #define AT_PAGESZ 6 /* System page size */
941 #define AT_BASE 7 /* Base address of interpreter */
942 #define AT_FLAGS 8 /* Flags */
943 #define AT_ENTRY 9 /* Entry point of program */
944 #define AT_NOTELF 10 /* Program is not ELF */
945 #define AT_UID 11 /* Real uid */
946 #define AT_EUID 12 /* Effective uid */
947 #define AT_GID 13 /* Real gid */
948 #define AT_EGID 14 /* Effective gid */
949 #define AT_CLKTCK 17 /* Frequency of times() */
951 /* Some more special a_type values describing the hardware. */
952 #define AT_PLATFORM 15 /* String identifying platform. */
953 #define AT_HWCAP 16 /* Machine dependent hints about
954 processor capabilities. */
956 /* This entry gives some information about the FPU initialization
957 performed by the kernel. */
958 #define AT_FPUCW 18 /* Used FPU control word. */
960 /* Cache block sizes. */
961 #define AT_DCACHEBSIZE 19 /* Data cache block size. */
962 #define AT_ICACHEBSIZE 20 /* Instruction cache block size. */
963 #define AT_UCACHEBSIZE 21 /* Unified cache block size. */
965 /* A special ignored value for PPC, used by the kernel to control the
966 interpretation of the AUXV. Must be > 16. */
967 #define AT_IGNOREPPC 22 /* Entry should be ignored. */
969 #define AT_SECURE 23 /* Boolean, was exec setuid-like? */
971 /* Pointer to the global system page used for system calls and other
973 #define AT_SYSINFO 32
974 #define AT_SYSINFO_EHDR 33
976 /* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains
977 log2 of line size; mask those to get cache size. */
978 #define AT_L1I_CACHESHAPE 34
979 #define AT_L1D_CACHESHAPE 35
980 #define AT_L2_CACHESHAPE 36
981 #define AT_L3_CACHESHAPE 37
983 /* Note section contents. Each entry in the note section begins with
984 a header of a fixed form. */
988 Elf32_Word n_namesz; /* Length of the note's name. */
989 Elf32_Word n_descsz; /* Length of the note's descriptor. */
990 Elf32_Word n_type; /* Type of the note. */
995 Elf64_Word n_namesz; /* Length of the note's name. */
996 Elf64_Word n_descsz; /* Length of the note's descriptor. */
997 Elf64_Word n_type; /* Type of the note. */
1000 /* Known names of notes. */
1002 /* Solaris entries in the note section have this name. */
1003 #define ELF_NOTE_SOLARIS "SUNW Solaris"
1005 /* Note entries for GNU systems have this name. */
1006 #define ELF_NOTE_GNU "GNU"
1009 /* Defined types of notes for Solaris. */
1011 /* Value of descriptor (one word) is desired pagesize for the binary. */
1012 #define ELF_NOTE_PAGESIZE_HINT 1
1015 /* Defined note types for GNU systems. */
1017 /* ABI information. The descriptor consists of words:
1018 word 0: OS descriptor
1019 word 1: major version of the ABI
1020 word 2: minor version of the ABI
1021 word 3: subminor version of the ABI
1023 #define ELF_NOTE_ABI 1
1025 /* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI
1026 note section entry. */
1027 #define ELF_NOTE_OS_LINUX 0
1028 #define ELF_NOTE_OS_GNU 1
1029 #define ELF_NOTE_OS_SOLARIS2 2
1030 #define ELF_NOTE_OS_FREEBSD 3
1036 Elf32_Xword m_value; /* Symbol value. */
1037 Elf32_Word m_info; /* Size and index. */
1038 Elf32_Word m_poffset; /* Symbol offset. */
1039 Elf32_Half m_repeat; /* Repeat count. */
1040 Elf32_Half m_stride; /* Stride info. */
1045 Elf64_Xword m_value; /* Symbol value. */
1046 Elf64_Xword m_info; /* Size and index. */
1047 Elf64_Xword m_poffset; /* Symbol offset. */
1048 Elf64_Half m_repeat; /* Repeat count. */
1049 Elf64_Half m_stride; /* Stride info. */
1052 /* Macro to construct move records. */
1053 #define ELF32_M_SYM(info) ((info) >> 8)
1054 #define ELF32_M_SIZE(info) ((unsigned char) (info))
1055 #define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
1057 #define ELF64_M_SYM(info) ELF32_M_SYM (info)
1058 #define ELF64_M_SIZE(info) ELF32_M_SIZE (info)
1059 #define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
1062 /* Intel 80386 specific definitions. */
1066 #define R_386_NONE 0 /* No reloc */
1067 #define R_386_32 1 /* Direct 32 bit */
1068 #define R_386_PC32 2 /* PC relative 32 bit */
1069 #define R_386_GOT32 3 /* 32 bit GOT entry */
1070 #define R_386_PLT32 4 /* 32 bit PLT address */
1071 #define R_386_COPY 5 /* Copy symbol at runtime */
1072 #define R_386_GLOB_DAT 6 /* Create GOT entry */
1073 #define R_386_JMP_SLOT 7 /* Create PLT entry */
1074 #define R_386_RELATIVE 8 /* Adjust by program base */
1075 #define R_386_GOTOFF 9 /* 32 bit offset to GOT */
1076 #define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
1077 #define R_386_32PLT 11
1078 #define R_386_TLS_TPOFF 14 /* Offset in static TLS block */
1079 #define R_386_TLS_IE 15 /* Address of GOT entry for static TLS
1081 #define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block
1083 #define R_386_TLS_LE 17 /* Offset relative to static TLS
1085 #define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of
1086 general dynamic thread local data */
1087 #define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of
1088 local dynamic thread local data
1091 #define R_386_PC16 21
1093 #define R_386_PC8 23
1094 #define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic
1095 thread local data */
1096 #define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */
1097 #define R_386_TLS_GD_CALL 26 /* Relocation for call to
1099 #define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */
1100 #define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic
1101 thread local data in LE code */
1102 #define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */
1103 #define R_386_TLS_LDM_CALL 30 /* Relocation for call to
1104 __tls_get_addr() in LDM code */
1105 #define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */
1106 #define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */
1107 #define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS
1109 #define R_386_TLS_LE_32 34 /* Negated offset relative to static
1111 #define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */
1112 #define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */
1113 #define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block */
1114 /* Keep this the last entry. */
1115 #define R_386_NUM 38
1118 /* Legal values for l_flags. */
1121 #define LL_EXACT_MATCH (1 << 0) /* Require exact match */
1122 #define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
1123 #define LL_REQUIRE_MINOR (1 << 2)
1124 #define LL_EXPORTS (1 << 3)
1125 #define LL_DELAY_LOAD (1 << 4)
1126 #define LL_DELTA (1 << 5)
1128 /* Entries found in sections of type SHT_MIPS_CONFLICT. */
1130 typedef Elf32_Addr Elf32_Conflict;
1133 /* AMD x86-64 relocations. */
1134 #define R_X86_64_NONE 0 /* No reloc */
1135 #define R_X86_64_64 1 /* Direct 64 bit */
1136 #define R_X86_64_PC32 2 /* PC relative 32 bit signed */
1137 #define R_X86_64_GOT32 3 /* 32 bit GOT entry */
1138 #define R_X86_64_PLT32 4 /* 32 bit PLT address */
1139 #define R_X86_64_COPY 5 /* Copy symbol at runtime */
1140 #define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
1141 #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
1142 #define R_X86_64_RELATIVE 8 /* Adjust by program base */
1143 #define R_X86_64_GOTPCREL 9 /* 32 bit signed PC relative
1145 #define R_X86_64_32 10 /* Direct 32 bit zero extended */
1146 #define R_X86_64_32S 11 /* Direct 32 bit sign extended */
1147 #define R_X86_64_16 12 /* Direct 16 bit zero extended */
1148 #define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
1149 #define R_X86_64_8 14 /* Direct 8 bit sign extended */
1150 #define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
1151 #define R_X86_64_DTPMOD64 16 /* ID of module containing symbol */
1152 #define R_X86_64_DTPOFF64 17 /* Offset in module's TLS block */
1153 #define R_X86_64_TPOFF64 18 /* Offset in initial TLS block */
1154 #define R_X86_64_TLSGD 19 /* 32 bit signed PC relative offset
1155 to two GOT entries for GD symbol */
1156 #define R_X86_64_TLSLD 20 /* 32 bit signed PC relative offset
1157 to two GOT entries for LD symbol */
1158 #define R_X86_64_DTPOFF32 21 /* Offset in TLS block */
1159 #define R_X86_64_GOTTPOFF 22 /* 32 bit signed PC relative offset
1160 to GOT entry for IE symbol */
1161 #define R_X86_64_TPOFF32 23 /* Offset in initial TLS block */
1163 #define R_X86_64_NUM 24
1170 struct link_map *l_next, *l_prev;