root / prex-0.9.0 / include / sys / elf.h @ 03e9c04a
History | View | Annotate | Download (17.1 KB)
1 |
/*-
|
---|---|
2 |
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
|
3 |
*
|
4 |
* Redistribution and use in source and binary forms, with or without
|
5 |
* modification, are permitted provided that the following conditions
|
6 |
* are met:
|
7 |
* 1. Redistributions of source code must retain the above copyright
|
8 |
* notice, this list of conditions and the following disclaimer.
|
9 |
* 2. Redistributions in binary form must reproduce the above copyright
|
10 |
* notice, this list of conditions and the following disclaimer in the
|
11 |
* documentation and/or other materials provided with the distribution.
|
12 |
* 3. The name of the author may not be used to endorse or promote products
|
13 |
* derived from this software without specific prior written permission
|
14 |
*
|
15 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
16 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
17 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
18 |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
19 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
20 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
21 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
22 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
24 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25 |
*/
|
26 |
|
27 |
/*
|
28 |
* This is the ELF ABI header file
|
29 |
* formerly known as "elf_abi.h".
|
30 |
*/
|
31 |
|
32 |
#ifndef _SYS_ELF_H_
|
33 |
#define _SYS_ELF_H_
|
34 |
|
35 |
#include <sys/cdefs.h> |
36 |
#include <machine/types.h> |
37 |
|
38 |
#include <machine/elf.h> |
39 |
|
40 |
typedef uint8_t Elf_Byte;
|
41 |
|
42 |
typedef uint32_t Elf32_Addr; /* Unsigned program address */ |
43 |
typedef uint32_t Elf32_Off; /* Unsigned file offset */ |
44 |
typedef int32_t Elf32_Sword; /* Signed large integer */ |
45 |
typedef uint32_t Elf32_Word; /* Unsigned large integer */ |
46 |
typedef uint16_t Elf32_Half; /* Unsigned medium integer */ |
47 |
|
48 |
/* e_ident[] identification indexes */
|
49 |
#define EI_MAG0 0 /* file ID */ |
50 |
#define EI_MAG1 1 /* file ID */ |
51 |
#define EI_MAG2 2 /* file ID */ |
52 |
#define EI_MAG3 3 /* file ID */ |
53 |
#define EI_CLASS 4 /* file class */ |
54 |
#define EI_DATA 5 /* data encoding */ |
55 |
#define EI_VERSION 6 /* ELF header version */ |
56 |
#define EI_OSABI 7 /* Operating system / ABI identification */ |
57 |
#define EI_ABIVERSION 8 /* ABI version */ |
58 |
#define OLD_EI_BRAND 8 /* Start of architecture identification. */ |
59 |
#define EI_PAD 9 /* Start of padding (per SVR4 ABI). */ |
60 |
#define EI_NIDENT 16 /* Size of e_ident[] */ |
61 |
|
62 |
/* e_ident[] magic number */
|
63 |
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ |
64 |
#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ |
65 |
#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ |
66 |
#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ |
67 |
#define ELFMAG "\177ELF" /* magic */ |
68 |
#define SELFMAG 4 /* size of magic */ |
69 |
|
70 |
/* e_ident[] file class */
|
71 |
#define ELFCLASSNONE 0 /* invalid */ |
72 |
#define ELFCLASS32 1 /* 32-bit objs */ |
73 |
#define ELFCLASS64 2 /* 64-bit objs */ |
74 |
#define ELFCLASSNUM 3 /* number of classes */ |
75 |
|
76 |
/* e_ident[] data encoding */
|
77 |
#define ELFDATANONE 0 /* invalid */ |
78 |
#define ELFDATA2LSB 1 /* Little-Endian */ |
79 |
#define ELFDATA2MSB 2 /* Big-Endian */ |
80 |
#define ELFDATANUM 3 /* number of data encode defines */ |
81 |
|
82 |
/* e_ident[] OS ABI */
|
83 |
#define ELFOSABI_SYSV 0 /* UNIX System V ABI */ |
84 |
#define ELFOSABI_NONE ELFOSABI_SYSV /* symbol used in old spec */ |
85 |
#define ELFOSABI_HPUX 1 /* HP-UX operating system */ |
86 |
#define ELFOSABI_NETBSD 2 /* NetBSD */ |
87 |
#define ELFOSABI_LINUX 3 /* GNU/Linux */ |
88 |
#define ELFOSABI_HURD 4 /* GNU/Hurd */ |
89 |
#define ELFOSABI_86OPEN 5 /* 86Open common IA32 ABI */ |
90 |
#define ELFOSABI_SOLARIS 6 /* Solaris */ |
91 |
#define ELFOSABI_MONTEREY 7 /* Monterey */ |
92 |
#define ELFOSABI_IRIX 8 /* IRIX */ |
93 |
#define ELFOSABI_FREEBSD 9 /* FreeBSD */ |
94 |
#define ELFOSABI_TRU64 10 /* TRU64 UNIX */ |
95 |
#define ELFOSABI_MODESTO 11 /* Novell Modesto */ |
96 |
#define ELFOSABI_OPENBSD 12 /* OpenBSD */ |
97 |
#define ELFOSABI_ARM 97 /* ARM */ |
98 |
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ |
99 |
|
100 |
/* e_ident */
|
101 |
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
|
102 |
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ |
103 |
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ |
104 |
(ehdr).e_ident[EI_MAG3] == ELFMAG3) |
105 |
|
106 |
/* ELF Header */
|
107 |
typedef struct elfhdr{ |
108 |
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ |
109 |
Elf32_Half e_type; /* object file type */
|
110 |
Elf32_Half e_machine; /* machine */
|
111 |
Elf32_Word e_version; /* object file version */
|
112 |
Elf32_Addr e_entry; /* virtual entry point */
|
113 |
Elf32_Off e_phoff; /* program header table offset */
|
114 |
Elf32_Off e_shoff; /* section header table offset */
|
115 |
Elf32_Word e_flags; /* processor-specific flags */
|
116 |
Elf32_Half e_ehsize; /* ELF header size */
|
117 |
Elf32_Half e_phentsize; /* program header entry size */
|
118 |
Elf32_Half e_phnum; /* number of program header entries */
|
119 |
Elf32_Half e_shentsize; /* section header entry size */
|
120 |
Elf32_Half e_shnum; /* number of section header entries */
|
121 |
Elf32_Half e_shstrndx; /* section header table's "section
|
122 |
header string table" entry offset */
|
123 |
} Elf32_Ehdr; |
124 |
|
125 |
/* e_type */
|
126 |
#define ET_NONE 0 /* No file type */ |
127 |
#define ET_REL 1 /* relocatable file */ |
128 |
#define ET_EXEC 2 /* executable file */ |
129 |
#define ET_DYN 3 /* shared object file */ |
130 |
#define ET_CORE 4 /* core file */ |
131 |
#define ET_NUM 5 /* number of types */ |
132 |
#define ET_LOPROC 0xff00 /* reserved range for processor */ |
133 |
#define ET_HIPROC 0xffff /* specific e_type */ |
134 |
|
135 |
/* e_machine */
|
136 |
#define EM_NONE 0 /* No Machine */ |
137 |
#define EM_M32 1 /* AT&T WE 32100 */ |
138 |
#define EM_SPARC 2 /* SPARC */ |
139 |
#define EM_386 3 /* Intel 80386 */ |
140 |
#define EM_68K 4 /* Motorola 68000 */ |
141 |
#define EM_88K 5 /* Motorola 88000 */ |
142 |
#define EM_486 6 /* Intel 80486 - unused? */ |
143 |
#define EM_860 7 /* Intel 80860 */ |
144 |
#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ |
145 |
/*
|
146 |
* Don't know if EM_MIPS_RS4_BE,
|
147 |
* EM_SPARC64, EM_PARISC,
|
148 |
* or EM_PPC are ABI compliant
|
149 |
*/
|
150 |
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ |
151 |
#define EM_SPARC64 11 /* SPARC v9 64-bit unoffical */ |
152 |
#define EM_PARISC 15 /* HPPA */ |
153 |
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ |
154 |
#define EM_PPC 20 /* PowerPC */ |
155 |
#define EM_ARM 40 |
156 |
#define EM_ALPHA 41 /* DEC ALPHA */ |
157 |
#define EM_SPARCV9 43 /* SPARC version 9 */ |
158 |
#define EM_ALPHA_EXP 0x9026 /* DEC ALPHA */ |
159 |
#define EM_VAX 75 /* DEC VAX */ |
160 |
#define EM_NUM 15 /* number of machine types */ |
161 |
|
162 |
/* Version */
|
163 |
#define EV_NONE 0 /* Invalid */ |
164 |
#define EV_CURRENT 1 /* Current */ |
165 |
#define EV_NUM 2 /* number of versions */ |
166 |
|
167 |
/* Section Header */
|
168 |
typedef struct { |
169 |
Elf32_Word sh_name; /* name - index into section header
|
170 |
string table section */
|
171 |
Elf32_Word sh_type; /* type */
|
172 |
Elf32_Word sh_flags; /* flags */
|
173 |
Elf32_Addr sh_addr; /* address */
|
174 |
Elf32_Off sh_offset; /* file offset */
|
175 |
Elf32_Word sh_size; /* section size */
|
176 |
Elf32_Word sh_link; /* section header table index link */
|
177 |
Elf32_Word sh_info; /* extra information */
|
178 |
Elf32_Word sh_addralign; /* address alignment */
|
179 |
Elf32_Word sh_entsize; /* section entry size */
|
180 |
} Elf32_Shdr; |
181 |
|
182 |
/* Special Section Indexes */
|
183 |
#define SHN_UNDEF 0 /* undefined */ |
184 |
#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ |
185 |
#define SHN_LOPROC 0xff00 /* reserved range for processor */ |
186 |
#define SHN_HIPROC 0xff1f /* specific section indexes */ |
187 |
#define SHN_ABS 0xfff1 /* absolute value */ |
188 |
#define SHN_COMMON 0xfff2 /* common symbol */ |
189 |
#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ |
190 |
|
191 |
/* sh_type */
|
192 |
#define SHT_NULL 0 /* inactive */ |
193 |
#define SHT_PROGBITS 1 /* program defined information */ |
194 |
#define SHT_SYMTAB 2 /* symbol table section */ |
195 |
#define SHT_STRTAB 3 /* string table section */ |
196 |
#define SHT_RELA 4 /* relocation section with addends*/ |
197 |
#define SHT_HASH 5 /* symbol hash table section */ |
198 |
#define SHT_DYNAMIC 6 /* dynamic section */ |
199 |
#define SHT_NOTE 7 /* note section */ |
200 |
#define SHT_NOBITS 8 /* no space section */ |
201 |
#define SHT_REL 9 /* relation section without addends */ |
202 |
#define SHT_SHLIB 10 /* reserved - purpose unknown */ |
203 |
#define SHT_DYNSYM 11 /* dynamic symbol table section */ |
204 |
#define SHT_NUM 12 /* number of section types */ |
205 |
#define SHT_LOPROC 0x70000000 /* reserved range for processor */ |
206 |
#define SHT_HIPROC 0x7fffffff /* specific section header types */ |
207 |
#define SHT_LOUSER 0x80000000 /* reserved range for application */ |
208 |
#define SHT_HIUSER 0xffffffff /* specific indexes */ |
209 |
|
210 |
/* Section names */
|
211 |
#define ELF_BSS ".bss" /* uninitialized data */ |
212 |
#define ELF_DATA ".data" /* initialized data */ |
213 |
#define ELF_DEBUG ".debug" /* debug */ |
214 |
#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ |
215 |
#define ELF_DYNSTR ".dynstr" /* dynamic string table */ |
216 |
#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ |
217 |
#define ELF_FINI ".fini" /* termination code */ |
218 |
#define ELF_GOT ".got" /* global offset table */ |
219 |
#define ELF_HASH ".hash" /* symbol hash table */ |
220 |
#define ELF_INIT ".init" /* initialization code */ |
221 |
#define ELF_REL_DATA ".rel.data" /* relocation data */ |
222 |
#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ |
223 |
#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ |
224 |
#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ |
225 |
#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ |
226 |
#define ELF_REL_TEXT ".rel.text" /* relocation code */ |
227 |
#define ELF_RODATA ".rodata" /* read-only data */ |
228 |
#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ |
229 |
#define ELF_STRTAB ".strtab" /* string table */ |
230 |
#define ELF_SYMTAB ".symtab" /* symbol table */ |
231 |
#define ELF_TEXT ".text" /* code */ |
232 |
|
233 |
|
234 |
/* Section Attribute Flags - sh_flags */
|
235 |
#define SHF_WRITE 0x1 /* Writable */ |
236 |
#define SHF_ALLOC 0x2 /* occupies memory */ |
237 |
#define SHF_EXECINSTR 0x4 /* executable */ |
238 |
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ |
239 |
/* specific section attributes */
|
240 |
|
241 |
/* Symbol Table Entry */
|
242 |
typedef struct elf32_sym { |
243 |
Elf32_Word st_name; /* name - index into string table */
|
244 |
Elf32_Addr st_value; /* symbol value */
|
245 |
Elf32_Word st_size; /* symbol size */
|
246 |
unsigned char st_info; /* type and binding */ |
247 |
unsigned char st_other; /* 0 - no defined meaning */ |
248 |
Elf32_Half st_shndx; /* section header index */
|
249 |
} Elf32_Sym; |
250 |
|
251 |
/* Symbol table index */
|
252 |
#define STN_UNDEF 0 /* undefined */ |
253 |
|
254 |
/* Extract symbol info - st_info */
|
255 |
#define ELF32_ST_BIND(x) ((x) >> 4) |
256 |
#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) |
257 |
#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) |
258 |
|
259 |
/* Symbol Binding - ELF32_ST_BIND - st_info */
|
260 |
#define STB_LOCAL 0 /* Local symbol */ |
261 |
#define STB_GLOBAL 1 /* Global symbol */ |
262 |
#define STB_WEAK 2 /* like global - lower precedence */ |
263 |
#define STB_NUM 3 /* number of symbol bindings */ |
264 |
#define STB_LOPROC 13 /* reserved range for processor */ |
265 |
#define STB_HIPROC 15 /* specific symbol bindings */ |
266 |
|
267 |
/* Symbol type - ELF32_ST_TYPE - st_info */
|
268 |
#define STT_NOTYPE 0 /* not specified */ |
269 |
#define STT_OBJECT 1 /* data object */ |
270 |
#define STT_FUNC 2 /* function */ |
271 |
#define STT_SECTION 3 /* section */ |
272 |
#define STT_FILE 4 /* file */ |
273 |
#define STT_NUM 5 /* number of symbol types */ |
274 |
#define STT_LOPROC 13 /* reserved range for processor */ |
275 |
#define STT_HIPROC 15 /* specific symbol types */ |
276 |
|
277 |
/* Relocation entry with implicit addend */
|
278 |
typedef struct |
279 |
{ |
280 |
Elf32_Addr r_offset; /* offset of relocation */
|
281 |
Elf32_Word r_info; /* symbol table index and type */
|
282 |
} Elf32_Rel; |
283 |
|
284 |
/* Relocation entry with explicit addend */
|
285 |
typedef struct |
286 |
{ |
287 |
Elf32_Addr r_offset; /* offset of relocation */
|
288 |
Elf32_Word r_info; /* symbol table index and type */
|
289 |
Elf32_Sword r_addend; |
290 |
} Elf32_Rela; |
291 |
|
292 |
/* Extract relocation info - r_info */
|
293 |
#define ELF32_R_SYM(i) ((i) >> 8) |
294 |
#define ELF32_R_TYPE(i) ((unsigned char) (i)) |
295 |
#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) |
296 |
|
297 |
/* Program Header */
|
298 |
typedef struct { |
299 |
Elf32_Word p_type; /* segment type */
|
300 |
Elf32_Off p_offset; /* segment offset */
|
301 |
Elf32_Addr p_vaddr; /* virtual address of segment */
|
302 |
Elf32_Addr p_paddr; /* physical address - ignored? */
|
303 |
Elf32_Word p_filesz; /* number of bytes in file for seg. */
|
304 |
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
|
305 |
Elf32_Word p_flags; /* flags */
|
306 |
Elf32_Word p_align; /* memory alignment */
|
307 |
} Elf32_Phdr; |
308 |
|
309 |
/* Segment types - p_type */
|
310 |
#define PT_NULL 0 /* unused */ |
311 |
#define PT_LOAD 1 /* loadable segment */ |
312 |
#define PT_DYNAMIC 2 /* dynamic linking section */ |
313 |
#define PT_INTERP 3 /* the RTLD */ |
314 |
#define PT_NOTE 4 /* auxiliary information */ |
315 |
#define PT_SHLIB 5 /* reserved - purpose undefined */ |
316 |
#define PT_PHDR 6 /* program header */ |
317 |
#define PT_NUM 7 /* Number of segment types */ |
318 |
#define PT_LOPROC 0x70000000 /* reserved range for processor */ |
319 |
#define PT_HIPROC 0x7fffffff /* specific segment types */ |
320 |
|
321 |
/* Segment flags - p_flags */
|
322 |
#define PF_X 0x1 /* Executable */ |
323 |
#define PF_W 0x2 /* Writable */ |
324 |
#define PF_R 0x4 /* Readable */ |
325 |
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ |
326 |
/* specific segment flags */
|
327 |
|
328 |
/* Dynamic structure */
|
329 |
typedef struct { |
330 |
Elf32_Sword d_tag; /* controls meaning of d_val */
|
331 |
union {
|
332 |
Elf32_Word d_val; /* Multiple meanings - see d_tag */
|
333 |
Elf32_Addr d_ptr; /* program virtual address */
|
334 |
} d_un; |
335 |
} Elf32_Dyn; |
336 |
|
337 |
/* Dynamic Array Tags - d_tag */
|
338 |
#define DT_NULL 0 /* marks end of _DYNAMIC array */ |
339 |
#define DT_NEEDED 1 /* string table offset of needed lib */ |
340 |
#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ |
341 |
#define DT_PLTGOT 3 /* address PLT/GOT */ |
342 |
#define DT_HASH 4 /* address of symbol hash table */ |
343 |
#define DT_STRTAB 5 /* address of string table */ |
344 |
#define DT_SYMTAB 6 /* address of symbol table */ |
345 |
#define DT_RELA 7 /* address of relocation table */ |
346 |
#define DT_RELASZ 8 /* size of relocation table */ |
347 |
#define DT_RELAENT 9 /* size of relocation entry */ |
348 |
#define DT_STRSZ 10 /* size of string table */ |
349 |
#define DT_SYMENT 11 /* size of symbol table entry */ |
350 |
#define DT_INIT 12 /* address of initialization func. */ |
351 |
#define DT_FINI 13 /* address of termination function */ |
352 |
#define DT_SONAME 14 /* string table offset of shared obj */ |
353 |
#define DT_RPATH 15 /* string table offset of library |
354 |
search path */
|
355 |
#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ |
356 |
#define DT_REL 17 /* address of rel. tbl. w addends */ |
357 |
#define DT_RELSZ 18 /* size of DT_REL relocation table */ |
358 |
#define DT_RELENT 19 /* size of DT_REL relocation entry */ |
359 |
#define DT_PLTREL 20 /* PLT referenced relocation entry */ |
360 |
#define DT_DEBUG 21 /* bugger */ |
361 |
#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ |
362 |
#define DT_JMPREL 23 /* add. of PLT's relocation entries */ |
363 |
#define DT_BIND_NOW 24 /* Bind now regardless of env setting */ |
364 |
#define DT_NUM 25 /* Number used. */ |
365 |
#define DT_LOPROC 0x70000000 /* reserved range for processor */ |
366 |
#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ |
367 |
|
368 |
/* Standard ELF hashing function */
|
369 |
unsigned int elf_hash(const unsigned char *name); |
370 |
|
371 |
/*
|
372 |
* Note Definitions
|
373 |
*/
|
374 |
typedef struct { |
375 |
Elf32_Word namesz; |
376 |
Elf32_Word descsz; |
377 |
Elf32_Word type; |
378 |
} Elf32_Note; |
379 |
|
380 |
/*
|
381 |
* XXX - these _KERNEL items aren't part of the ABI!
|
382 |
*/
|
383 |
#if defined(_KERNEL) || defined(_DYN_LOADER)
|
384 |
|
385 |
#define ELF32_NO_ADDR ((u_long) ~0) /* Indicates addr. not yet filled in */ |
386 |
#define ELF_AUX_ENTRIES 8 /* Size of aux array passed to loader */ |
387 |
|
388 |
typedef struct { |
389 |
Elf32_Sword au_id; /* 32-bit id */
|
390 |
Elf32_Word au_v; /* 32-bit value */
|
391 |
} Aux32Info; |
392 |
|
393 |
enum AuxID {
|
394 |
AUX_null = 0,
|
395 |
AUX_ignore = 1,
|
396 |
AUX_execfd = 2,
|
397 |
AUX_phdr = 3, /* &phdr[0] */ |
398 |
AUX_phent = 4, /* sizeof(phdr[0]) */ |
399 |
AUX_phnum = 5, /* # phdr entries */ |
400 |
AUX_pagesz = 6, /* PAGESIZE */ |
401 |
AUX_base = 7, /* ld.so base addr */ |
402 |
AUX_flags = 8, /* processor flags */ |
403 |
AUX_entry = 9, /* a.out entry */ |
404 |
AUX_sun_uid = 2000, /* euid */ |
405 |
AUX_sun_ruid = 2001, /* ruid */ |
406 |
AUX_sun_gid = 2002, /* egid */ |
407 |
AUX_sun_rgid = 2003 /* rgid */ |
408 |
}; |
409 |
|
410 |
struct elf_args {
|
411 |
u_long arg_entry; /* program entry point */
|
412 |
u_long arg_interp; /* Interpreter load address */
|
413 |
u_long arg_phaddr; /* program header address */
|
414 |
u_long arg_phentsize; /* Size of program header */
|
415 |
u_long arg_phnum; /* Number of program headers */
|
416 |
u_long arg_os; /* OS tag */
|
417 |
}; |
418 |
|
419 |
#endif
|
420 |
|
421 |
#if !defined(ELFSIZE) && defined(ARCH_ELFSIZE)
|
422 |
#define ELFSIZE ARCH_ELFSIZE
|
423 |
#endif
|
424 |
|
425 |
#if defined(ELFSIZE)
|
426 |
#define CONCAT(x,y) __CONCAT(x,y)
|
427 |
#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
|
428 |
#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
|
429 |
#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
|
430 |
#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
|
431 |
#endif
|
432 |
|
433 |
#define Elf_Ehdr Elf32_Ehdr
|
434 |
#define Elf_Phdr Elf32_Phdr
|
435 |
#define Elf_Shdr Elf32_Shdr
|
436 |
#define Elf_Sym Elf32_Sym
|
437 |
#define Elf_Rel Elf32_Rel
|
438 |
#define Elf_RelA Elf32_Rela
|
439 |
#define Elf_Dyn Elf32_Dyn
|
440 |
#define Elf_Word Elf32_Word
|
441 |
#define Elf_Sword Elf32_Sword
|
442 |
#define Elf_Addr Elf32_Addr
|
443 |
#define Elf_Off Elf32_Off
|
444 |
#define Elf_Nhdr Elf32_Nhdr
|
445 |
#define Elf_Note Elf32_Note
|
446 |
|
447 |
#define ELF_R_SYM ELF32_R_SYM
|
448 |
#define ELF_R_TYPE ELF32_R_TYPE
|
449 |
#define ELF_R_INFO ELF32_R_INFO
|
450 |
#define ELFCLASS ELFCLASS32
|
451 |
|
452 |
#define ELF_ST_BIND ELF32_ST_BIND
|
453 |
#define ELF_ST_TYPE ELF32_ST_TYPE
|
454 |
#define ELF_ST_INFO ELF32_ST_INFO
|
455 |
|
456 |
#define AuxInfo Aux32Info
|
457 |
|
458 |
#define ELF_TARG_VER 1 /* The ver for which this code is intended */ |
459 |
|
460 |
|
461 |
__BEGIN_DECLS |
462 |
int relocate_rel(Elf32_Rel *, Elf32_Addr, char *); |
463 |
int relocate_rela(Elf32_Rela *, Elf32_Addr, char *); |
464 |
__END_DECLS |
465 |
|
466 |
#endif /* _SYS_ELF_H_ */ |