34
|
1 |
/*
|
|
2 |
* elf_repl.h - public header file for systems that lack it.
|
|
3 |
* Copyright (C) 1995 - 2006 Michael Riepe
|
|
4 |
*
|
|
5 |
* This library is free software; you can redistribute it and/or
|
|
6 |
* modify it under the terms of the GNU Library General Public
|
|
7 |
* License as published by the Free Software Foundation; either
|
|
8 |
* version 2 of the License, or (at your option) any later version.
|
|
9 |
*
|
|
10 |
* This 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 |
* Library General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU Library General Public
|
|
16 |
* License along with this library; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 |
*/
|
|
19 |
|
|
20 |
/* @(#) $Id: elf_repl.h,v 1.20 2006/07/07 22:16:15 michael Exp $ */
|
|
21 |
|
|
22 |
/*
|
|
23 |
* NEVER INCLUDE THIS FILE DIRECTLY - USE <libelf.h> INSTEAD!
|
|
24 |
*/
|
|
25 |
|
|
26 |
#ifndef _ELF_REPL_H
|
|
27 |
#define _ELF_REPL_H
|
|
28 |
|
|
29 |
#ifdef __cplusplus
|
|
30 |
extern "C" {
|
|
31 |
#endif /* __cplusplus */
|
|
32 |
|
|
33 |
/*
|
|
34 |
* Scalar data types
|
|
35 |
*/
|
|
36 |
typedef __libelf_u32_t Elf32_Addr;
|
|
37 |
typedef __libelf_u16_t Elf32_Half;
|
|
38 |
typedef __libelf_u32_t Elf32_Off;
|
|
39 |
typedef __libelf_i32_t Elf32_Sword;
|
|
40 |
typedef __libelf_u32_t Elf32_Word;
|
|
41 |
|
|
42 |
#define ELF32_FSZ_ADDR 4
|
|
43 |
#define ELF32_FSZ_HALF 2
|
|
44 |
#define ELF32_FSZ_OFF 4
|
|
45 |
#define ELF32_FSZ_SWORD 4
|
|
46 |
#define ELF32_FSZ_WORD 4
|
|
47 |
|
|
48 |
#if __LIBELF64
|
|
49 |
|
|
50 |
typedef __libelf_u64_t Elf64_Addr;
|
|
51 |
typedef __libelf_u16_t Elf64_Half;
|
|
52 |
typedef __libelf_u64_t Elf64_Off;
|
|
53 |
typedef __libelf_i32_t Elf64_Sword;
|
|
54 |
typedef __libelf_u32_t Elf64_Word;
|
|
55 |
typedef __libelf_i64_t Elf64_Sxword;
|
|
56 |
typedef __libelf_u64_t Elf64_Xword;
|
|
57 |
|
|
58 |
#define ELF64_FSZ_ADDR 8
|
|
59 |
#define ELF64_FSZ_HALF 2
|
|
60 |
#define ELF64_FSZ_OFF 8
|
|
61 |
#define ELF64_FSZ_SWORD 4
|
|
62 |
#define ELF64_FSZ_WORD 4
|
|
63 |
#define ELF64_FSZ_SXWORD 8
|
|
64 |
#define ELF64_FSZ_XWORD 8
|
|
65 |
|
|
66 |
/*
|
|
67 |
* Blame Sun for this...
|
|
68 |
*/
|
|
69 |
typedef __libelf_u64_t Elf64_Lword;
|
|
70 |
typedef __libelf_u64_t Elf32_Lword;
|
|
71 |
|
|
72 |
#endif /* __LIBELF64 */
|
|
73 |
|
|
74 |
/*
|
|
75 |
* ELF header
|
|
76 |
*/
|
|
77 |
#define EI_NIDENT 16
|
|
78 |
|
|
79 |
typedef struct {
|
|
80 |
unsigned char e_ident[EI_NIDENT];
|
|
81 |
Elf32_Half e_type;
|
|
82 |
Elf32_Half e_machine;
|
|
83 |
Elf32_Word e_version;
|
|
84 |
Elf32_Addr e_entry;
|
|
85 |
Elf32_Off e_phoff;
|
|
86 |
Elf32_Off e_shoff;
|
|
87 |
Elf32_Word e_flags;
|
|
88 |
Elf32_Half e_ehsize;
|
|
89 |
Elf32_Half e_phentsize;
|
|
90 |
Elf32_Half e_phnum;
|
|
91 |
Elf32_Half e_shentsize;
|
|
92 |
Elf32_Half e_shnum;
|
|
93 |
Elf32_Half e_shstrndx;
|
|
94 |
} Elf32_Ehdr;
|
|
95 |
|
|
96 |
#if __LIBELF64
|
|
97 |
typedef struct {
|
|
98 |
unsigned char e_ident[EI_NIDENT];
|
|
99 |
Elf64_Half e_type;
|
|
100 |
Elf64_Half e_machine;
|
|
101 |
Elf64_Word e_version;
|
|
102 |
Elf64_Addr e_entry;
|
|
103 |
Elf64_Off e_phoff;
|
|
104 |
Elf64_Off e_shoff;
|
|
105 |
Elf64_Word e_flags;
|
|
106 |
Elf64_Half e_ehsize;
|
|
107 |
Elf64_Half e_phentsize;
|
|
108 |
Elf64_Half e_phnum;
|
|
109 |
Elf64_Half e_shentsize;
|
|
110 |
Elf64_Half e_shnum;
|
|
111 |
Elf64_Half e_shstrndx;
|
|
112 |
} Elf64_Ehdr;
|
|
113 |
#endif /* __LIBELF64 */
|
|
114 |
|
|
115 |
/*
|
|
116 |
* e_ident
|
|
117 |
*/
|
|
118 |
#define EI_MAG0 0
|
|
119 |
#define EI_MAG1 1
|
|
120 |
#define EI_MAG2 2
|
|
121 |
#define EI_MAG3 3
|
|
122 |
#define EI_CLASS 4
|
|
123 |
#define EI_DATA 5
|
|
124 |
#define EI_VERSION 6
|
|
125 |
#define EI_OSABI 7
|
|
126 |
#define EI_ABIVERSION 8
|
|
127 |
#define EI_PAD 9
|
|
128 |
|
|
129 |
#define ELFMAG0 0x7f
|
|
130 |
#define ELFMAG1 'E'
|
|
131 |
#define ELFMAG2 'L'
|
|
132 |
#define ELFMAG3 'F'
|
|
133 |
#define ELFMAG "\177ELF"
|
|
134 |
#define SELFMAG 4
|
|
135 |
|
|
136 |
/*
|
|
137 |
* e_ident[EI_CLASS]
|
|
138 |
*/
|
|
139 |
#define ELFCLASSNONE 0
|
|
140 |
#define ELFCLASS32 1
|
|
141 |
#define ELFCLASS64 2
|
|
142 |
#define ELFCLASSNUM 3
|
|
143 |
|
|
144 |
/*
|
|
145 |
* e_ident[EI_DATA]
|
|
146 |
*/
|
|
147 |
#define ELFDATANONE 0
|
|
148 |
#define ELFDATA2LSB 1
|
|
149 |
#define ELFDATA2MSB 2
|
|
150 |
#define ELFDATANUM 3
|
|
151 |
|
|
152 |
/*
|
|
153 |
* e_ident[EI_OSABI]
|
|
154 |
*/
|
|
155 |
#define ELFOSABI_NONE 0 /* No extensions or unspecified */
|
|
156 |
#define ELFOSABI_SYSV ELFOSABI_NONE
|
|
157 |
#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */
|
|
158 |
#define ELFOSABI_NETBSD 2 /* NetBSD */
|
|
159 |
#define ELFOSABI_LINUX 3 /* Linux */
|
|
160 |
#define ELFOSABI_SOLARIS 6 /* Sun Solaris */
|
|
161 |
#define ELFOSABI_AIX 7 /* AIX */
|
|
162 |
#define ELFOSABI_IRIX 8 /* IRIX */
|
|
163 |
#define ELFOSABI_FREEBSD 9 /* FreeBSD */
|
|
164 |
#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */
|
|
165 |
#define ELFOSABI_MODESTO 11 /* Novell Modesto */
|
|
166 |
#define ELFOSABI_OPENBSD 12 /* Open BSD */
|
|
167 |
#define ELFOSABI_OPENVMS 13 /* Open VMS */
|
|
168 |
#define ELFOSABI_NSK 14 /* Hewlett-Packard Non-Stop Kernel */
|
|
169 |
#define ELFOSABI_AROS 15 /* Amiga Research OS */
|
|
170 |
/* these are probably obsolete: */
|
|
171 |
#define ELFOSABI_ARM 97 /* ARM */
|
|
172 |
#define ELFOSABI_STANDALONE 255 /* standalone (embedded) application */
|
|
173 |
|
|
174 |
|
|
175 |
/*
|
|
176 |
* e_type
|
|
177 |
*/
|
|
178 |
#define ET_NONE 0
|
|
179 |
#define ET_REL 1
|
|
180 |
#define ET_EXEC 2
|
|
181 |
#define ET_DYN 3
|
|
182 |
#define ET_CORE 4
|
|
183 |
#define ET_NUM 5
|
|
184 |
#define ET_LOOS 0xfe00
|
|
185 |
#define ET_HIOS 0xfeff
|
|
186 |
#define ET_LOPROC 0xff00
|
|
187 |
#define ET_HIPROC 0xffff
|
|
188 |
|
|
189 |
/*
|
|
190 |
* e_machine
|
|
191 |
*/
|
|
192 |
#define EM_NONE 0 /* No machine */
|
|
193 |
#define EM_M32 1 /* AT&T WE 32100 */
|
|
194 |
#define EM_SPARC 2 /* SPARC */
|
|
195 |
#define EM_386 3 /* Intel 80386 */
|
|
196 |
#define EM_68K 4 /* Motorola 68000 */
|
|
197 |
#define EM_88K 5 /* Motorola 88000 */
|
|
198 |
#define EM_486 6 /* Intel i486 (DO NOT USE THIS ONE) */
|
|
199 |
#define EM_860 7 /* Intel 80860 */
|
|
200 |
#define EM_MIPS 8 /* MIPS I Architecture */
|
|
201 |
#define EM_S370 9 /* IBM System/370 Processor */
|
|
202 |
#define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */
|
|
203 |
#define EM_SPARC64 11 /* SPARC 64-bit */
|
|
204 |
#define EM_PARISC 15 /* Hewlett-Packard PA-RISC */
|
|
205 |
#define EM_VPP500 17 /* Fujitsu VPP500 */
|
|
206 |
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
|
|
207 |
#define EM_960 19 /* Intel 80960 */
|
|
208 |
#define EM_PPC 20 /* PowerPC */
|
|
209 |
#define EM_PPC64 21 /* 64-bit PowerPC */
|
|
210 |
#define EM_S390 22 /* IBM System/390 Processor */
|
|
211 |
#define EM_V800 36 /* NEC V800 */
|
|
212 |
#define EM_FR20 37 /* Fujitsu FR20 */
|
|
213 |
#define EM_RH32 38 /* TRW RH-32 */
|
|
214 |
#define EM_RCE 39 /* Motorola RCE */
|
|
215 |
#define EM_ARM 40 /* Advanced RISC Machines ARM */
|
|
216 |
#define EM_ALPHA 41 /* Digital Alpha */
|
|
217 |
#define EM_SH 42 /* Hitachi SH */
|
|
218 |
#define EM_SPARCV9 43 /* SPARC Version 9 */
|
|
219 |
#define EM_TRICORE 44 /* Siemens TriCore embedded processor */
|
|
220 |
#define EM_ARC 45 /* Argonaut RISC Core, Argonaut Technologies Inc. */
|
|
221 |
#define EM_H8_300 46 /* Hitachi H8/300 */
|
|
222 |
#define EM_H8_300H 47 /* Hitachi H8/300H */
|
|
223 |
#define EM_H8S 48 /* Hitachi H8S */
|
|
224 |
#define EM_H8_500 49 /* Hitachi H8/500 */
|
|
225 |
#define EM_IA_64 50 /* Intel IA-64 processor architecture */
|
|
226 |
#define EM_MIPS_X 51 /* Stanford MIPS-X */
|
|
227 |
#define EM_COLDFIRE 52 /* Motorola ColdFire */
|
|
228 |
#define EM_68HC12 53 /* Motorola M68HC12 */
|
|
229 |
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */
|
|
230 |
#define EM_PCP 55 /* Siemens PCP */
|
|
231 |
#define EM_NCPU 56 /* Sony nCPU embedded RISC processor */
|
|
232 |
#define EM_NDR1 57 /* Denso NDR1 microprocessor */
|
|
233 |
#define EM_STARCORE 58 /* Motorola Star*Core processor */
|
|
234 |
#define EM_ME16 59 /* Toyota ME16 processor */
|
|
235 |
#define EM_ST100 60 /* STMicroelectronics ST100 processor */
|
|
236 |
#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded processor family */
|
|
237 |
#define EM_X86_64 62 /* AMD x86-64 architecture */
|
|
238 |
#define EM_AMD64 EM_X86_64
|
|
239 |
#define EM_PDSP 63 /* Sony DSP Processor */
|
|
240 |
#define EM_FX66 66 /* Siemens FX66 microcontroller */
|
|
241 |
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
|
|
242 |
#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */
|
|
243 |
#define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */
|
|
244 |
#define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */
|
|
245 |
#define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */
|
|
246 |
#define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */
|
|
247 |
#define EM_SVX 73 /* Silicon Graphics SVx */
|
|
248 |
#define EM_ST19 74 /* STMicroelectronics ST19 8-bit microcontroller */
|
|
249 |
#define EM_VAX 75 /* Digital VAX */
|
|
250 |
#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
|
|
251 |
#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
|
|
252 |
#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
|
|
253 |
#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
|
|
254 |
#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
|
|
255 |
#define EM_HUANY 81 /* Harvard University machine-independent object files */
|
|
256 |
#define EM_PRISM 82 /* SiTera Prism */
|
|
257 |
#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
|
|
258 |
#define EM_FR30 84 /* Fujitsu FR30 */
|
|
259 |
#define EM_D10V 85 /* Mitsubishi D10V */
|
|
260 |
#define EM_D30V 86 /* Mitsubishi D30V */
|
|
261 |
#define EM_V850 87 /* NEC v850 */
|
|
262 |
#define EM_M32R 88 /* Mitsubishi M32R */
|
|
263 |
#define EM_MN10300 89 /* Matsushita MN10300 */
|
|
264 |
#define EM_MN10200 90 /* Matsushita MN10200 */
|
|
265 |
#define EM_PJ 91 /* picoJava */
|
|
266 |
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
|
|
267 |
#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
|
|
268 |
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
|
|
269 |
#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */
|
|
270 |
#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */
|
|
271 |
#define EM_NS32K 97 /* National Semiconductor 32000 series */
|
|
272 |
#define EM_TPC 98 /* Tenor Network TPC processor */
|
|
273 |
#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
|
|
274 |
#define EM_ST200 100 /* STMicroelectronics (www.st.com) ST200 microcontroller */
|
|
275 |
#define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */
|
|
276 |
#define EM_MAX 102 /* MAX Processor */
|
|
277 |
#define EM_CR 103 /* National Semiconductor CompactRISC microprocessor */
|
|
278 |
#define EM_F2MC16 104 /* Fujitsu F2MC16 */
|
|
279 |
#define EM_MSP430 105 /* Texas Instruments embedded microcontroller msp430 */
|
|
280 |
#define EM_BLACKFIN 106 /* Analog Devices Blackfin (DSP) processor */
|
|
281 |
#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processors */
|
|
282 |
#define EM_SEP 108 /* Sharp embedded microprocessor */
|
|
283 |
#define EM_ARCA 109 /* Arca RISC Microprocessor */
|
|
284 |
#define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
|
|
285 |
#define EM_NUM 111
|
|
286 |
|
|
287 |
/*
|
|
288 |
* e_ident[EI_VERSION], e_version
|
|
289 |
*/
|
|
290 |
#define EV_NONE 0
|
|
291 |
#define EV_CURRENT 1
|
|
292 |
#define EV_NUM 2
|
|
293 |
|
|
294 |
/*
|
|
295 |
* Section header
|
|
296 |
*/
|
|
297 |
typedef struct {
|
|
298 |
Elf32_Word sh_name;
|
|
299 |
Elf32_Word sh_type;
|
|
300 |
Elf32_Word sh_flags;
|
|
301 |
Elf32_Addr sh_addr;
|
|
302 |
Elf32_Off sh_offset;
|
|
303 |
Elf32_Word sh_size;
|
|
304 |
Elf32_Word sh_link;
|
|
305 |
Elf32_Word sh_info;
|
|
306 |
Elf32_Word sh_addralign;
|
|
307 |
Elf32_Word sh_entsize;
|
|
308 |
} Elf32_Shdr;
|
|
309 |
|
|
310 |
#if __LIBELF64
|
|
311 |
typedef struct {
|
|
312 |
Elf64_Word sh_name;
|
|
313 |
Elf64_Word sh_type;
|
|
314 |
Elf64_Xword sh_flags;
|
|
315 |
Elf64_Addr sh_addr;
|
|
316 |
Elf64_Off sh_offset;
|
|
317 |
Elf64_Xword sh_size;
|
|
318 |
Elf64_Word sh_link;
|
|
319 |
Elf64_Word sh_info;
|
|
320 |
Elf64_Xword sh_addralign;
|
|
321 |
Elf64_Xword sh_entsize;
|
|
322 |
} Elf64_Shdr;
|
|
323 |
#endif /* __LIBELF64 */
|
|
324 |
|
|
325 |
/*
|
|
326 |
* Special section indices
|
|
327 |
*/
|
|
328 |
#define SHN_UNDEF 0
|
|
329 |
#define SHN_LORESERVE 0xff00
|
|
330 |
#define SHN_LOPROC 0xff00
|
|
331 |
#define SHN_HIPROC 0xff1f
|
|
332 |
#define SHN_LOOS 0xff20
|
|
333 |
#define SHN_HIOS 0xff3f
|
|
334 |
#define SHN_ABS 0xfff1
|
|
335 |
#define SHN_COMMON 0xfff2
|
|
336 |
#define SHN_XINDEX 0xffff
|
|
337 |
#define SHN_HIRESERVE 0xffff
|
|
338 |
|
|
339 |
/*
|
|
340 |
* sh_type
|
|
341 |
*/
|
|
342 |
#define SHT_NULL 0
|
|
343 |
#define SHT_PROGBITS 1
|
|
344 |
#define SHT_SYMTAB 2
|
|
345 |
#define SHT_STRTAB 3
|
|
346 |
#define SHT_RELA 4
|
|
347 |
#define SHT_HASH 5
|
|
348 |
#define SHT_DYNAMIC 6
|
|
349 |
#define SHT_NOTE 7
|
|
350 |
#define SHT_NOBITS 8
|
|
351 |
#define SHT_REL 9
|
|
352 |
#define SHT_SHLIB 10
|
|
353 |
#define SHT_DYNSYM 11
|
|
354 |
#define SHT_INIT_ARRAY 14
|
|
355 |
#define SHT_FINI_ARRAY 15
|
|
356 |
#define SHT_PREINIT_ARRAY 16
|
|
357 |
#define SHT_GROUP 17
|
|
358 |
#define SHT_SYMTAB_SHNDX 18
|
|
359 |
#define SHT_NUM 19
|
|
360 |
#define SHT_LOOS 0x60000000
|
|
361 |
#define SHT_HIOS 0x6fffffff
|
|
362 |
#define SHT_LOPROC 0x70000000
|
|
363 |
#define SHT_HIPROC 0x7fffffff
|
|
364 |
#define SHT_LOUSER 0x80000000
|
|
365 |
#define SHT_HIUSER 0xffffffff
|
|
366 |
|
|
367 |
/*
|
|
368 |
* Solaris extensions
|
|
369 |
*/
|
|
370 |
#define SHT_LOSUNW 0x6ffffff4
|
|
371 |
#define SHT_SUNW_dof 0x6ffffff4
|
|
372 |
#define SHT_SUNW_cap 0x6ffffff5
|
|
373 |
#define SHT_SUNW_SIGNATURE 0x6ffffff6
|
|
374 |
#define SHT_SUNW_ANNOTATE 0x6ffffff7
|
|
375 |
#define SHT_SUNW_DEBUGSTR 0x6ffffff8
|
|
376 |
#define SHT_SUNW_DEBUG 0x6ffffff9
|
|
377 |
#define SHT_SUNW_move 0x6ffffffa
|
|
378 |
#define SHT_SUNW_COMDAT 0x6ffffffb
|
|
379 |
#define SHT_SUNW_syminfo 0x6ffffffc
|
|
380 |
#define SHT_SUNW_verdef 0x6ffffffd
|
|
381 |
#define SHT_SUNW_verneed 0x6ffffffe
|
|
382 |
#define SHT_SUNW_versym 0x6fffffff
|
|
383 |
#define SHT_HISUNW 0x6fffffff
|
|
384 |
|
|
385 |
#define SHT_SPARC_GOTDATA 0x70000000
|
|
386 |
#define SHT_AMD64_UNWIND 0x70000001
|
|
387 |
|
|
388 |
/*
|
|
389 |
* GNU extensions
|
|
390 |
*/
|
|
391 |
#define SHT_GNU_verdef 0x6ffffffd
|
|
392 |
#define SHT_GNU_verneed 0x6ffffffe
|
|
393 |
#define SHT_GNU_versym 0x6fffffff
|
|
394 |
|
|
395 |
/*
|
|
396 |
* sh_flags
|
|
397 |
*/
|
|
398 |
#define SHF_WRITE 0x1
|
|
399 |
#define SHF_ALLOC 0x2
|
|
400 |
#define SHF_EXECINSTR 0x4
|
|
401 |
#define SHF_MERGE 0x10
|
|
402 |
#define SHF_STRINGS 0x20
|
|
403 |
#define SHF_INFO_LINK 0x40
|
|
404 |
#define SHF_LINK_ORDER 0x80
|
|
405 |
#define SHF_OS_NONCONFORMING 0x100
|
|
406 |
#define SHF_GROUP 0x200
|
|
407 |
#define SHF_TLS 0x400
|
|
408 |
#define SHF_MASKOS 0x0ff00000
|
|
409 |
#define SHF_MASKPROC 0xf0000000
|
|
410 |
|
|
411 |
/*
|
|
412 |
* Solaris extensions
|
|
413 |
*/
|
|
414 |
#define SHF_AMD64_LARGE 0x10000000
|
|
415 |
#define SHF_ORDERED 0x40000000
|
|
416 |
#define SHF_EXCLUDE 0x80000000
|
|
417 |
|
|
418 |
/*
|
|
419 |
* Section group flags
|
|
420 |
*/
|
|
421 |
#define GRP_COMDAT 0x1
|
|
422 |
#define GRP_MASKOS 0x0ff00000
|
|
423 |
#define GRP_MASKPROC 0xf0000000
|
|
424 |
|
|
425 |
/*
|
|
426 |
* Symbol table
|
|
427 |
*/
|
|
428 |
typedef struct {
|
|
429 |
Elf32_Word st_name;
|
|
430 |
Elf32_Addr st_value;
|
|
431 |
Elf32_Word st_size;
|
|
432 |
unsigned char st_info;
|
|
433 |
unsigned char st_other;
|
|
434 |
Elf32_Half st_shndx;
|
|
435 |
} Elf32_Sym;
|
|
436 |
|
|
437 |
#if __LIBELF64
|
|
438 |
typedef struct {
|
|
439 |
Elf64_Word st_name;
|
|
440 |
unsigned char st_info;
|
|
441 |
unsigned char st_other;
|
|
442 |
Elf64_Half st_shndx;
|
|
443 |
Elf64_Addr st_value;
|
|
444 |
Elf64_Xword st_size;
|
|
445 |
} Elf64_Sym;
|
|
446 |
#endif /* __LIBELF64 */
|
|
447 |
|
|
448 |
/*
|
|
449 |
* Special symbol indices
|
|
450 |
*/
|
|
451 |
#define STN_UNDEF 0
|
|
452 |
|
|
453 |
/*
|
|
454 |
* Macros for manipulating st_info
|
|
455 |
*/
|
|
456 |
#define ELF32_ST_BIND(i) ((i)>>4)
|
|
457 |
#define ELF32_ST_TYPE(i) ((i)&0xf)
|
|
458 |
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
|
|
459 |
|
|
460 |
#if __LIBELF64
|
|
461 |
#define ELF64_ST_BIND(i) ((i)>>4)
|
|
462 |
#define ELF64_ST_TYPE(i) ((i)&0xf)
|
|
463 |
#define ELF64_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
|
|
464 |
#endif /* __LIBELF64 */
|
|
465 |
|
|
466 |
/*
|
|
467 |
* Symbol binding
|
|
468 |
*/
|
|
469 |
#define STB_LOCAL 0
|
|
470 |
#define STB_GLOBAL 1
|
|
471 |
#define STB_WEAK 2
|
|
472 |
#define STB_NUM 3
|
|
473 |
#define STB_LOOS 10
|
|
474 |
#define STB_HIOS 12
|
|
475 |
#define STB_LOPROC 13
|
|
476 |
#define STB_HIPROC 15
|
|
477 |
|
|
478 |
/*
|
|
479 |
* Symbol types
|
|
480 |
*/
|
|
481 |
#define STT_NOTYPE 0
|
|
482 |
#define STT_OBJECT 1
|
|
483 |
#define STT_FUNC 2
|
|
484 |
#define STT_SECTION 3
|
|
485 |
#define STT_FILE 4
|
|
486 |
#define STT_COMMON 5
|
|
487 |
#define STT_TLS 6
|
|
488 |
#define STT_NUM 7
|
|
489 |
#define STT_LOOS 10
|
|
490 |
#define STT_HIOS 12
|
|
491 |
#define STT_LOPROC 13
|
|
492 |
#define STT_HIPROC 15
|
|
493 |
|
|
494 |
/*
|
|
495 |
* Macros for manipulating st_other
|
|
496 |
*/
|
|
497 |
#define ELF32_ST_VISIBILITY(o) ((o)&0x3)
|
|
498 |
#if __LIBELF64
|
|
499 |
#define ELF64_ST_VISIBILITY(o) ((o)&0x3)
|
|
500 |
#endif /* __LIBELF64 */
|
|
501 |
|
|
502 |
/*
|
|
503 |
* Symbol visibility
|
|
504 |
*/
|
|
505 |
#define STV_DEFAULT 0
|
|
506 |
#define STV_INTERNAL 1
|
|
507 |
#define STV_HIDDEN 2
|
|
508 |
#define STV_PROTECTED 3
|
|
509 |
|
|
510 |
/*
|
|
511 |
* Relocation
|
|
512 |
*/
|
|
513 |
typedef struct {
|
|
514 |
Elf32_Addr r_offset;
|
|
515 |
Elf32_Word r_info;
|
|
516 |
} Elf32_Rel;
|
|
517 |
|
|
518 |
typedef struct {
|
|
519 |
Elf32_Addr r_offset;
|
|
520 |
Elf32_Word r_info;
|
|
521 |
Elf32_Sword r_addend;
|
|
522 |
} Elf32_Rela;
|
|
523 |
|
|
524 |
#if __LIBELF64
|
|
525 |
typedef struct {
|
|
526 |
Elf64_Addr r_offset;
|
|
527 |
Elf64_Xword r_info;
|
|
528 |
} Elf64_Rel;
|
|
529 |
|
|
530 |
typedef struct {
|
|
531 |
Elf64_Addr r_offset;
|
|
532 |
Elf64_Xword r_info;
|
|
533 |
Elf64_Sxword r_addend;
|
|
534 |
} Elf64_Rela;
|
|
535 |
#endif /* __LIBELF64 */
|
|
536 |
|
|
537 |
/*
|
|
538 |
* Macros for manipulating r_info
|
|
539 |
*/
|
|
540 |
#define ELF32_R_SYM(i) ((i)>>8)
|
|
541 |
#define ELF32_R_TYPE(i) ((unsigned char)(i))
|
|
542 |
#define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t))
|
|
543 |
|
|
544 |
#if __LIBELF64
|
|
545 |
#define ELF64_R_SYM(i) ((Elf64_Xword)(i)>>32)
|
|
546 |
#define ELF64_R_TYPE(i) ((i)&0xffffffffL)
|
|
547 |
#define ELF64_R_INFO(s,t) (((Elf64_Xword)(s)<<32)+((t)&0xffffffffL))
|
|
548 |
#endif /* __LIBELF64 */
|
|
549 |
|
|
550 |
/*
|
|
551 |
* Note entry header
|
|
552 |
*/
|
|
553 |
typedef struct {
|
|
554 |
Elf32_Word n_namesz; /* name size */
|
|
555 |
Elf32_Word n_descsz; /* descriptor size */
|
|
556 |
Elf32_Word n_type; /* descriptor type */
|
|
557 |
} Elf32_Nhdr;
|
|
558 |
|
|
559 |
#if __LIBELF64
|
|
560 |
/* Solaris and GNU use this layout. Be compatible. */
|
|
561 |
/* XXX: Latest ELF specs say it's 64-bit!!! */
|
|
562 |
typedef struct {
|
|
563 |
Elf64_Word n_namesz; /* name size */
|
|
564 |
Elf64_Word n_descsz; /* descriptor size */
|
|
565 |
Elf64_Word n_type; /* descriptor type */
|
|
566 |
} Elf64_Nhdr;
|
|
567 |
#endif /* __LIBELF64 */
|
|
568 |
|
|
569 |
/*
|
|
570 |
* Well-known descriptor types for ET_CORE files
|
|
571 |
*/
|
|
572 |
#define NT_PRSTATUS 1
|
|
573 |
#define NT_PRFPREG 2
|
|
574 |
#define NT_PRPSINFO 3
|
|
575 |
|
|
576 |
/*
|
|
577 |
* Program header
|
|
578 |
*/
|
|
579 |
typedef struct {
|
|
580 |
Elf32_Word p_type;
|
|
581 |
Elf32_Off p_offset;
|
|
582 |
Elf32_Addr p_vaddr;
|
|
583 |
Elf32_Addr p_paddr;
|
|
584 |
Elf32_Word p_filesz;
|
|
585 |
Elf32_Word p_memsz;
|
|
586 |
Elf32_Word p_flags;
|
|
587 |
Elf32_Word p_align;
|
|
588 |
} Elf32_Phdr;
|
|
589 |
|
|
590 |
#if __LIBELF64
|
|
591 |
typedef struct {
|
|
592 |
Elf64_Word p_type;
|
|
593 |
Elf64_Word p_flags;
|
|
594 |
Elf64_Off p_offset;
|
|
595 |
Elf64_Addr p_vaddr;
|
|
596 |
Elf64_Addr p_paddr;
|
|
597 |
Elf64_Xword p_filesz;
|
|
598 |
Elf64_Xword p_memsz;
|
|
599 |
Elf64_Xword p_align;
|
|
600 |
} Elf64_Phdr;
|
|
601 |
#endif /* __LIBELF64 */
|
|
602 |
|
|
603 |
/*
|
|
604 |
* Special numbers
|
|
605 |
*/
|
|
606 |
#define PN_XNUM 0xffff
|
|
607 |
|
|
608 |
/*
|
|
609 |
* p_type
|
|
610 |
*/
|
|
611 |
#define PT_NULL 0
|
|
612 |
#define PT_LOAD 1
|
|
613 |
#define PT_DYNAMIC 2
|
|
614 |
#define PT_INTERP 3
|
|
615 |
#define PT_NOTE 4
|
|
616 |
#define PT_SHLIB 5
|
|
617 |
#define PT_PHDR 6
|
|
618 |
#define PT_TLS 7
|
|
619 |
#define PT_NUM 8
|
|
620 |
#define PT_LOOS 0x60000000
|
|
621 |
#define PT_HIOS 0x6fffffff
|
|
622 |
#define PT_LOPROC 0x70000000
|
|
623 |
#define PT_HIPROC 0x7fffffff
|
|
624 |
|
|
625 |
/*
|
|
626 |
* Solaris extensions
|
|
627 |
*/
|
|
628 |
|
|
629 |
#define PT_SUNW_UNWIND 0x6464e550
|
|
630 |
#define PT_LOSUNW 0x6ffffffa
|
|
631 |
#define PT_SUNWBSS 0x6ffffffa
|
|
632 |
#define PT_SUNWSTACK 0x6ffffffb
|
|
633 |
#define PT_SUNWDTRACE 0x6ffffffc
|
|
634 |
#define PT_SUNWCAP 0x6ffffffd
|
|
635 |
#define PT_HISUNW 0x6fffffff
|
|
636 |
|
|
637 |
/*
|
|
638 |
* p_flags
|
|
639 |
*/
|
|
640 |
#define PF_X 0x1
|
|
641 |
#define PF_W 0x2
|
|
642 |
#define PF_R 0x4
|
|
643 |
#define PF_MASKOS 0x0ff00000
|
|
644 |
#define PF_MASKPROC 0xf0000000
|
|
645 |
|
|
646 |
/*
|
|
647 |
* Dynamic structure
|
|
648 |
*/
|
|
649 |
typedef struct {
|
|
650 |
Elf32_Sword d_tag;
|
|
651 |
union {
|
|
652 |
Elf32_Word d_val;
|
|
653 |
Elf32_Addr d_ptr;
|
|
654 |
} d_un;
|
|
655 |
} Elf32_Dyn;
|
|
656 |
|
|
657 |
#if __LIBELF64
|
|
658 |
typedef struct {
|
|
659 |
Elf64_Sxword d_tag;
|
|
660 |
union {
|
|
661 |
Elf64_Xword d_val;
|
|
662 |
Elf64_Addr d_ptr;
|
|
663 |
} d_un;
|
|
664 |
} Elf64_Dyn;
|
|
665 |
#endif /* __LIBELF64 */
|
|
666 |
|
|
667 |
/*
|
|
668 |
* Dynamic array tags
|
|
669 |
*/
|
|
670 |
/* d_un exec shared */
|
|
671 |
#define DT_NULL 0 /* ign. mand. mand. */
|
|
672 |
#define DT_NEEDED 1 /* d_val opt. opt. */
|
|
673 |
#define DT_PLTRELSZ 2 /* d_val opt. opt. */
|
|
674 |
#define DT_PLTGOT 3 /* d_ptr opt. opt. */
|
|
675 |
#define DT_HASH 4 /* d_ptr mand. mand. */
|
|
676 |
#define DT_STRTAB 5 /* d_ptr mand. mand. */
|
|
677 |
#define DT_SYMTAB 6 /* d_ptr mand. mand. */
|
|
678 |
#define DT_RELA 7 /* d_ptr mand. opt. */
|
|
679 |
#define DT_RELASZ 8 /* d_val mand. opt. */
|
|
680 |
#define DT_RELAENT 9 /* d_val mand. opt. */
|
|
681 |
#define DT_STRSZ 10 /* d_val mand. mand. */
|
|
682 |
#define DT_SYMENT 11 /* d_val mand. mand. */
|
|
683 |
#define DT_INIT 12 /* d_ptr opt. opt. */
|
|
684 |
#define DT_FINI 13 /* d_ptr opt. opt. */
|
|
685 |
#define DT_SONAME 14 /* d_val ign. opt. */
|
|
686 |
#define DT_RPATH 15 /* d_val opt. ign. */
|
|
687 |
#define DT_SYMBOLIC 16 /* ign. ign. opt. */
|
|
688 |
#define DT_REL 17 /* d_ptr mand. opt. */
|
|
689 |
#define DT_RELSZ 18 /* d_val mand. opt. */
|
|
690 |
#define DT_RELENT 19 /* d_val mand. opt. */
|
|
691 |
#define DT_PLTREL 20 /* d_val opt. opt. */
|
|
692 |
#define DT_DEBUG 21 /* d_ptr opt. ign. */
|
|
693 |
#define DT_TEXTREL 22 /* ign. opt. opt. */
|
|
694 |
#define DT_JMPREL 23 /* d_ptr opt. opt. */
|
|
695 |
#define DT_BIND_NOW 24 /* ign. opt. opt. */
|
|
696 |
#define DT_INIT_ARRAY 25 /* d_ptr opt. opt. */
|
|
697 |
#define DT_FINI_ARRAY 26 /* d_ptr opt. opt. */
|
|
698 |
#define DT_INIT_ARRAYSZ 27 /* d_val opt. opt. */
|
|
699 |
#define DT_FINI_ARRAYSZ 28 /* d_val opt. opt. */
|
|
700 |
#define DT_RUNPATH 29 /* d_val opt. opt. */
|
|
701 |
#define DT_FLAGS 30 /* d_val opt. opt. */
|
|
702 |
#define DT_ENCODING 32 /* odd/even encoding rule starts here */
|
|
703 |
#define DT_PREINIT_ARRAY 32 /* d_ptr opt. ign. */
|
|
704 |
#define DT_PREINIT_ARRAYSZ 33 /* d_val opt. ign. */
|
|
705 |
#define DT_NUM 34
|
|
706 |
#define DT_LOOS 0x6000000D
|
|
707 |
#define DT_HIOS 0x6ffff000
|
|
708 |
#define DT_LOPROC 0x70000000
|
|
709 |
#define DT_HIPROC 0x7fffffff
|
|
710 |
|
|
711 |
/*
|
|
712 |
* DT_FLAGS values
|
|
713 |
*/
|
|
714 |
#define DF_ORIGIN 0x1
|
|
715 |
#define DF_SYMBOLIC 0x2
|
|
716 |
#define DF_TEXTREL 0x4
|
|
717 |
#define DF_BIND_NOW 0x8
|
|
718 |
#define DF_STATIC_TLS 0x10
|
|
719 |
|
|
720 |
/*
|
|
721 |
* Solaris extensions
|
|
722 |
*/
|
|
723 |
#define DT_VALRNGLO 0x6ffffd00
|
|
724 |
#define DT_CHECKSUM 0x6ffffdf8
|
|
725 |
#define DT_PLTPADSZ 0x6ffffdf9
|
|
726 |
#define DT_MOVEENT 0x6ffffdfa
|
|
727 |
#define DT_MOVESZ 0x6ffffdfb
|
|
728 |
#define DT_FEATURE_1 0x6ffffdfc
|
|
729 |
#define DT_POSFLAG_1 0x6ffffdfd
|
|
730 |
#define DT_SYMINSZ 0x6ffffdfe
|
|
731 |
#define DT_SYMINENT 0x6ffffdff
|
|
732 |
#define DT_VALRNGHI 0x6ffffdff
|
|
733 |
|
|
734 |
#define DT_ADDRRNGLO 0x6ffffe00
|
|
735 |
#define DT_CONFIG 0x6ffffefa
|
|
736 |
#define DT_DEPAUDIT 0x6ffffefb
|
|
737 |
#define DT_AUDIT 0x6ffffefc
|
|
738 |
#define DT_PLTPAD 0x6ffffefd
|
|
739 |
#define DT_MOVETAB 0x6ffffefe
|
|
740 |
#define DT_SYMINFO 0x6ffffeff
|
|
741 |
#define DT_ADDRRNGHI 0x6ffffeff
|
|
742 |
|
|
743 |
#define DT_RELACOUNT 0x6ffffff9
|
|
744 |
#define DT_RELCOUNT 0x6ffffffa
|
|
745 |
#define DT_FLAGS_1 0x6ffffffb
|
|
746 |
#define DT_VERDEF 0x6ffffffc
|
|
747 |
#define DT_VERDEFNUM 0x6ffffffd
|
|
748 |
#define DT_VERNEED 0x6ffffffe
|
|
749 |
#define DT_VERNEEDNUM 0x6fffffff
|
|
750 |
|
|
751 |
#define DT_AUXILIARY 0x7ffffffd
|
|
752 |
#define DT_USED 0x7ffffffe
|
|
753 |
#define DT_FILTER 0x7fffffff
|
|
754 |
|
|
755 |
/*
|
|
756 |
* GNU extensions
|
|
757 |
*/
|
|
758 |
#define DT_VERSYM 0x6ffffff0
|
|
759 |
|
|
760 |
/*
|
|
761 |
* DT_FEATURE_1 values
|
|
762 |
*/
|
|
763 |
#define DTF_1_PARINIT 0x1
|
|
764 |
#define DTF_1_CONFEXP 0x2
|
|
765 |
|
|
766 |
/*
|
|
767 |
* DT_POSFLAG_1 values
|
|
768 |
*/
|
|
769 |
#define DF_P1_LAZYLOAD 0x1
|
|
770 |
#define DF_P1_GROUPPERM 0x2
|
|
771 |
|
|
772 |
/*
|
|
773 |
* DT_FLAGS_1 values
|
|
774 |
*/
|
|
775 |
#define DF_1_NOW 0x00000001
|
|
776 |
#define DF_1_GLOBAL 0x00000002
|
|
777 |
#define DF_1_GROUP 0x00000004
|
|
778 |
#define DF_1_NODELETE 0x00000008
|
|
779 |
#define DF_1_LOADFLTR 0x00000010
|
|
780 |
#define DF_1_INITFIRST 0x00000020
|
|
781 |
#define DF_1_NOOPEN 0x00000040
|
|
782 |
#define DF_1_ORIGIN 0x00000080
|
|
783 |
#define DF_1_DIRECT 0x00000100
|
|
784 |
#define DF_1_TRANS 0x00000200
|
|
785 |
#define DF_1_INTERPOSE 0x00000400
|
|
786 |
#define DF_1_NODEFLIB 0x00000800
|
|
787 |
#define DF_1_NODUMP 0x00001000
|
|
788 |
#define DF_1_CONFALT 0x00002000
|
|
789 |
#define DF_1_ENDFILTEE 0x00004000
|
|
790 |
#define DF_1_DISPRELDNE 0x00008000
|
|
791 |
#define DF_1_DISPRELPND 0x00010000
|
|
792 |
|
|
793 |
/*
|
|
794 |
* Syminfo structure
|
|
795 |
*/
|
|
796 |
typedef struct {
|
|
797 |
Elf32_Half si_boundto;
|
|
798 |
Elf32_Half si_flags;
|
|
799 |
} Elf32_Syminfo;
|
|
800 |
|
|
801 |
#if __LIBELF64
|
|
802 |
typedef struct {
|
|
803 |
Elf64_Half si_boundto;
|
|
804 |
Elf64_Half si_flags;
|
|
805 |
} Elf64_Syminfo;
|
|
806 |
#endif /* __LIBELF64 */
|
|
807 |
|
|
808 |
/*
|
|
809 |
* Syminfo version (stored in unused first entry)
|
|
810 |
*/
|
|
811 |
#define SYMINFO_NONE 0
|
|
812 |
#define SYMINFO_CURRENT 1
|
|
813 |
#define SYMINFO_NUM 2
|
|
814 |
|
|
815 |
/*
|
|
816 |
* si_boundto special values
|
|
817 |
*/
|
|
818 |
#define SYMINFO_BT_LOWRESERVE 0xff00
|
|
819 |
#define SYMINFO_BT_PARENT 0xfffe /* bound to parent */
|
|
820 |
#define SYMINFO_BT_SELF 0xffff /* bound to self */
|
|
821 |
|
|
822 |
/*
|
|
823 |
* si_flags
|
|
824 |
*/
|
|
825 |
#define SYMINFO_FLG_DIRECT 0x01 /* bound to an object */
|
|
826 |
#define SYMINFO_FLG_PASSTHRU 0x02 /* pass-thru symbol */
|
|
827 |
#define SYMINFO_FLG_COPY 0x04 /* result of a copy relocation */
|
|
828 |
#define SYMINFO_FLG_LAZYLOAD 0x08 /* bound to lazy-loaded object */
|
|
829 |
|
|
830 |
/*
|
|
831 |
* Version definitions
|
|
832 |
*/
|
|
833 |
typedef struct {
|
|
834 |
Elf32_Half vd_version;
|
|
835 |
Elf32_Half vd_flags;
|
|
836 |
Elf32_Half vd_ndx;
|
|
837 |
Elf32_Half vd_cnt;
|
|
838 |
Elf32_Word vd_hash;
|
|
839 |
Elf32_Word vd_aux;
|
|
840 |
Elf32_Word vd_next;
|
|
841 |
} Elf32_Verdef;
|
|
842 |
|
|
843 |
typedef struct {
|
|
844 |
Elf32_Word vda_name;
|
|
845 |
Elf32_Word vda_next;
|
|
846 |
} Elf32_Verdaux;
|
|
847 |
|
|
848 |
typedef struct {
|
|
849 |
Elf32_Half vn_version;
|
|
850 |
Elf32_Half vn_cnt;
|
|
851 |
Elf32_Word vn_file;
|
|
852 |
Elf32_Word vn_aux;
|
|
853 |
Elf32_Word vn_next;
|
|
854 |
} Elf32_Verneed;
|
|
855 |
|
|
856 |
typedef struct {
|
|
857 |
Elf32_Word vna_hash;
|
|
858 |
Elf32_Half vna_flags;
|
|
859 |
Elf32_Half vna_other;
|
|
860 |
Elf32_Word vna_name;
|
|
861 |
Elf32_Word vna_next;
|
|
862 |
} Elf32_Vernaux;
|
|
863 |
|
|
864 |
typedef Elf32_Half Elf32_Versym;
|
|
865 |
|
|
866 |
#if __LIBELF64
|
|
867 |
|
|
868 |
typedef struct {
|
|
869 |
Elf64_Half vd_version;
|
|
870 |
Elf64_Half vd_flags;
|
|
871 |
Elf64_Half vd_ndx;
|
|
872 |
Elf64_Half vd_cnt;
|
|
873 |
Elf64_Word vd_hash;
|
|
874 |
Elf64_Word vd_aux;
|
|
875 |
Elf64_Word vd_next;
|
|
876 |
} Elf64_Verdef;
|
|
877 |
|
|
878 |
typedef struct {
|
|
879 |
Elf64_Word vda_name;
|
|
880 |
Elf64_Word vda_next;
|
|
881 |
} Elf64_Verdaux;
|
|
882 |
|
|
883 |
typedef struct {
|
|
884 |
Elf64_Half vn_version;
|
|
885 |
Elf64_Half vn_cnt;
|
|
886 |
Elf64_Word vn_file;
|
|
887 |
Elf64_Word vn_aux;
|
|
888 |
Elf64_Word vn_next;
|
|
889 |
} Elf64_Verneed;
|
|
890 |
|
|
891 |
typedef struct {
|
|
892 |
Elf64_Word vna_hash;
|
|
893 |
Elf64_Half vna_flags;
|
|
894 |
Elf64_Half vna_other;
|
|
895 |
Elf64_Word vna_name;
|
|
896 |
Elf64_Word vna_next;
|
|
897 |
} Elf64_Vernaux;
|
|
898 |
|
|
899 |
typedef Elf64_Half Elf64_Versym;
|
|
900 |
|
|
901 |
#endif /* __LIBELF64 */
|
|
902 |
|
|
903 |
/*
|
|
904 |
* vd_version
|
|
905 |
*/
|
|
906 |
#define VER_DEF_NONE 0
|
|
907 |
#define VER_DEF_CURRENT 1
|
|
908 |
#define VER_DEF_NUM 2
|
|
909 |
|
|
910 |
/*
|
|
911 |
* vn_version
|
|
912 |
*/
|
|
913 |
#define VER_NEED_NONE 0
|
|
914 |
#define VER_NEED_CURRENT 1
|
|
915 |
#define VER_NEED_NUM 2
|
|
916 |
|
|
917 |
/*
|
|
918 |
* vd_flags / vna_flags
|
|
919 |
*/
|
|
920 |
#define VER_FLG_BASE 0x1 /* vd_flags only */
|
|
921 |
#define VER_FLG_WEAK 0x2
|
|
922 |
|
|
923 |
/*
|
|
924 |
* Elf*_Versym special values
|
|
925 |
*/
|
|
926 |
#define VER_NDX_LOCAL 0
|
|
927 |
#define VER_NDX_GLOBAL 1
|
|
928 |
|
|
929 |
/*
|
|
930 |
* Solaris extensions
|
|
931 |
*/
|
|
932 |
|
|
933 |
/*
|
|
934 |
* Move section
|
|
935 |
*/
|
|
936 |
#if __LIBELF64
|
|
937 |
|
|
938 |
typedef struct {
|
|
939 |
Elf32_Lword m_value;
|
|
940 |
Elf32_Word m_info;
|
|
941 |
Elf32_Word m_poffset;
|
|
942 |
Elf32_Half m_repeat;
|
|
943 |
Elf32_Half m_stride;
|
|
944 |
} Elf32_Move;
|
|
945 |
|
|
946 |
typedef struct {
|
|
947 |
Elf64_Lword m_value;
|
|
948 |
Elf64_Xword m_info;
|
|
949 |
Elf64_Xword m_poffset;
|
|
950 |
Elf64_Half m_repeat;
|
|
951 |
Elf64_Half m_stride;
|
|
952 |
} Elf64_Move;
|
|
953 |
|
|
954 |
#define ELF32_M_SYM(info) ((info)>>8)
|
|
955 |
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
|
956 |
#define ELF32_M_INFO(sym, sz) (((sym)<<8)+(unsigned char)(sz))
|
|
957 |
|
|
958 |
#define ELF64_M_SYM(info) ((Elf64_Xword)(info)>>8)
|
|
959 |
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
|
960 |
#define ELF64_M_INFO(sym, sz) (((Elf64_Xword)(sym)<<8)+(unsigned char)(sz))
|
|
961 |
|
|
962 |
#endif /* __LIBELF64 */
|
|
963 |
|
|
964 |
/*
|
|
965 |
* Capabilities
|
|
966 |
*/
|
|
967 |
|
|
968 |
typedef struct {
|
|
969 |
Elf32_Word c_tag;
|
|
970 |
union {
|
|
971 |
Elf32_Word c_val;
|
|
972 |
Elf32_Addr c_ptr;
|
|
973 |
} c_un;
|
|
974 |
} Elf32_Cap;
|
|
975 |
|
|
976 |
typedef struct {
|
|
977 |
Elf64_Xword c_tag;
|
|
978 |
union {
|
|
979 |
Elf64_Xword c_val;
|
|
980 |
Elf64_Addr c_ptr;
|
|
981 |
} c_un;
|
|
982 |
} Elf64_Cap;
|
|
983 |
|
|
984 |
#define CA_SUNW_NULL 0 /* c_un ignored */
|
|
985 |
#define CA_SUNW_HW_1 1 /* c_un.c_val */
|
|
986 |
#define CA_SUNW_SF_1 2 /* c_un.c_val */
|
|
987 |
|
|
988 |
#ifdef __cplusplus
|
|
989 |
}
|
|
990 |
#endif /* __cplusplus */
|
|
991 |
|
|
992 |
#endif /* _ELF_REPL_H */
|