| @@ -1,1318 +1,1317 @@ | | | @@ -1,1318 +1,1317 @@ |
1 | /* $NetBSD: exec_elf.h,v 1.147 2015/07/24 21:09:25 matt Exp $ */ | | 1 | /* $NetBSD: exec_elf.h,v 1.148 2015/07/24 21:27:03 matt Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1994 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1994 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Christos Zoulas. | | 8 | * by Christos Zoulas. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
15 | * 2. Redistributions in binary form must reproduce the above copyright | | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in the | | 16 | * notice, this list of conditions and the following disclaimer in the |
17 | * documentation and/or other materials provided with the distribution. | | 17 | * documentation and/or other materials provided with the distribution. |
18 | * | | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #ifndef _SYS_EXEC_ELF_H_ | | 32 | #ifndef _SYS_EXEC_ELF_H_ |
33 | #define _SYS_EXEC_ELF_H_ | | 33 | #define _SYS_EXEC_ELF_H_ |
34 | | | 34 | |
35 | /* | | 35 | /* |
36 | * The current ELF ABI specification is available at: | | 36 | * The current ELF ABI specification is available at: |
37 | * http://www.sco.com/developers/gabi/ | | 37 | * http://www.sco.com/developers/gabi/ |
38 | * | | 38 | * |
39 | * Current header definitions are in: | | 39 | * Current header definitions are in: |
40 | * http://www.sco.com/developers/gabi/latest/ch4.eheader.html | | 40 | * http://www.sco.com/developers/gabi/latest/ch4.eheader.html |
41 | */ | | 41 | */ |
42 | | | 42 | |
43 | #if defined(_KERNEL) || defined(_STANDALONE) | | 43 | #if defined(_KERNEL) || defined(_STANDALONE) |
44 | #include <sys/types.h> | | 44 | #include <sys/types.h> |
45 | #else | | 45 | #else |
46 | #include <inttypes.h> | | 46 | #include <inttypes.h> |
47 | #endif /* _KERNEL || _STANDALONE */ | | 47 | #endif /* _KERNEL || _STANDALONE */ |
48 | | | 48 | |
49 | #ifdef _BSD_SIZE_T_ | | 49 | #ifdef _BSD_SIZE_T_ |
50 | typedef _BSD_SIZE_T_ size_t; | | 50 | typedef _BSD_SIZE_T_ size_t; |
51 | #undef _BSD_SIZE_T_ | | 51 | #undef _BSD_SIZE_T_ |
52 | #endif | | 52 | #endif |
53 | | | 53 | |
54 | #if HAVE_NBTOOL_CONFIG_H | | 54 | #if HAVE_NBTOOL_CONFIG_H |
55 | #include <nbinclude/machine/elf_machdep.h> | | 55 | #include <nbinclude/machine/elf_machdep.h> |
56 | #else | | 56 | #else |
57 | #include <machine/elf_machdep.h> | | 57 | #include <machine/elf_machdep.h> |
58 | #endif | | 58 | #endif |
59 | | | 59 | |
60 | typedef uint8_t Elf_Byte; | | 60 | typedef uint8_t Elf_Byte; |
61 | | | 61 | |
62 | typedef uint32_t Elf32_Addr; | | 62 | typedef uint32_t Elf32_Addr; |
63 | #define ELF32_FSZ_ADDR 4 | | 63 | #define ELF32_FSZ_ADDR 4 |
64 | typedef uint32_t Elf32_Off; | | 64 | typedef uint32_t Elf32_Off; |
65 | typedef int32_t Elf32_SOff; | | 65 | typedef int32_t Elf32_SOff; |
66 | #define ELF32_FSZ_OFF 4 | | 66 | #define ELF32_FSZ_OFF 4 |
67 | typedef int32_t Elf32_Sword; | | 67 | typedef int32_t Elf32_Sword; |
68 | #define ELF32_FSZ_SWORD 4 | | 68 | #define ELF32_FSZ_SWORD 4 |
69 | typedef uint32_t Elf32_Word; | | 69 | typedef uint32_t Elf32_Word; |
70 | #define ELF32_FSZ_WORD 4 | | 70 | #define ELF32_FSZ_WORD 4 |
71 | typedef uint16_t Elf32_Half; | | 71 | typedef uint16_t Elf32_Half; |
72 | #define ELF32_FSZ_HALF 2 | | 72 | #define ELF32_FSZ_HALF 2 |
73 | typedef uint64_t Elf32_Lword; | | 73 | typedef uint64_t Elf32_Lword; |
74 | #define ELF32_FSZ_LWORD 8 | | 74 | #define ELF32_FSZ_LWORD 8 |
75 | | | 75 | |
76 | typedef uint64_t Elf64_Addr; | | 76 | typedef uint64_t Elf64_Addr; |
77 | #define ELF64_FSZ_ADDR 8 | | 77 | #define ELF64_FSZ_ADDR 8 |
78 | typedef uint64_t Elf64_Off; | | 78 | typedef uint64_t Elf64_Off; |
79 | typedef int64_t Elf64_SOff; | | 79 | typedef int64_t Elf64_SOff; |
80 | #define ELF64_FSZ_OFF 8 | | 80 | #define ELF64_FSZ_OFF 8 |
81 | | | 81 | |
82 | typedef int32_t Elf64_Sword; | | 82 | typedef int32_t Elf64_Sword; |
83 | #define ELF64_FSZ_SWORD 4 | | 83 | #define ELF64_FSZ_SWORD 4 |
84 | typedef uint32_t Elf64_Word; | | 84 | typedef uint32_t Elf64_Word; |
85 | #define ELF64_FSZ_WORD 4 | | 85 | #define ELF64_FSZ_WORD 4 |
86 | | | 86 | |
87 | typedef int64_t Elf64_Sxword; | | 87 | typedef int64_t Elf64_Sxword; |
88 | #define ELF64_FSZ_SXWORD 8 | | 88 | #define ELF64_FSZ_SXWORD 8 |
89 | typedef uint64_t Elf64_Xword; | | 89 | typedef uint64_t Elf64_Xword; |
90 | #define ELF64_FSZ_XWORD 8 | | 90 | #define ELF64_FSZ_XWORD 8 |
91 | typedef uint64_t Elf64_Lword; | | 91 | typedef uint64_t Elf64_Lword; |
92 | #define ELF64_FSZ_LWORD 8 | | 92 | #define ELF64_FSZ_LWORD 8 |
93 | typedef uint16_t Elf64_Half; | | 93 | typedef uint16_t Elf64_Half; |
94 | #define ELF64_FSZ_HALF 2 | | 94 | #define ELF64_FSZ_HALF 2 |
95 | | | 95 | |
96 | /* | | 96 | /* |
97 | * ELF Header | | 97 | * ELF Header |
98 | */ | | 98 | */ |
99 | #define ELF_NIDENT 16 | | 99 | #define ELF_NIDENT 16 |
100 | | | 100 | |
101 | typedef struct { | | 101 | typedef struct { |
102 | unsigned char e_ident[ELF_NIDENT]; /* Id bytes */ | | 102 | unsigned char e_ident[ELF_NIDENT]; /* Id bytes */ |
103 | Elf32_Half e_type; /* file type */ | | 103 | Elf32_Half e_type; /* file type */ |
104 | Elf32_Half e_machine; /* machine type */ | | 104 | Elf32_Half e_machine; /* machine type */ |
105 | Elf32_Word e_version; /* version number */ | | 105 | Elf32_Word e_version; /* version number */ |
106 | Elf32_Addr e_entry; /* entry point */ | | 106 | Elf32_Addr e_entry; /* entry point */ |
107 | Elf32_Off e_phoff; /* Program hdr offset */ | | 107 | Elf32_Off e_phoff; /* Program hdr offset */ |
108 | Elf32_Off e_shoff; /* Section hdr offset */ | | 108 | Elf32_Off e_shoff; /* Section hdr offset */ |
109 | Elf32_Word e_flags; /* Processor flags */ | | 109 | Elf32_Word e_flags; /* Processor flags */ |
110 | Elf32_Half e_ehsize; /* sizeof ehdr */ | | 110 | Elf32_Half e_ehsize; /* sizeof ehdr */ |
111 | Elf32_Half e_phentsize; /* Program header entry size */ | | 111 | Elf32_Half e_phentsize; /* Program header entry size */ |
112 | Elf32_Half e_phnum; /* Number of program headers */ | | 112 | Elf32_Half e_phnum; /* Number of program headers */ |
113 | Elf32_Half e_shentsize; /* Section header entry size */ | | 113 | Elf32_Half e_shentsize; /* Section header entry size */ |
114 | Elf32_Half e_shnum; /* Number of section headers */ | | 114 | Elf32_Half e_shnum; /* Number of section headers */ |
115 | Elf32_Half e_shstrndx; /* String table index */ | | 115 | Elf32_Half e_shstrndx; /* String table index */ |
116 | } Elf32_Ehdr; | | 116 | } Elf32_Ehdr; |
117 | | | 117 | |
118 | typedef struct { | | 118 | typedef struct { |
119 | unsigned char e_ident[ELF_NIDENT]; /* Id bytes */ | | 119 | unsigned char e_ident[ELF_NIDENT]; /* Id bytes */ |
120 | Elf64_Half e_type; /* file type */ | | 120 | Elf64_Half e_type; /* file type */ |
121 | Elf64_Half e_machine; /* machine type */ | | 121 | Elf64_Half e_machine; /* machine type */ |
122 | Elf64_Word e_version; /* version number */ | | 122 | Elf64_Word e_version; /* version number */ |
123 | Elf64_Addr e_entry; /* entry point */ | | 123 | Elf64_Addr e_entry; /* entry point */ |
124 | Elf64_Off e_phoff; /* Program hdr offset */ | | 124 | Elf64_Off e_phoff; /* Program hdr offset */ |
125 | Elf64_Off e_shoff; /* Section hdr offset */ | | 125 | Elf64_Off e_shoff; /* Section hdr offset */ |
126 | Elf64_Word e_flags; /* Processor flags */ | | 126 | Elf64_Word e_flags; /* Processor flags */ |
127 | Elf64_Half e_ehsize; /* sizeof ehdr */ | | 127 | Elf64_Half e_ehsize; /* sizeof ehdr */ |
128 | Elf64_Half e_phentsize; /* Program header entry size */ | | 128 | Elf64_Half e_phentsize; /* Program header entry size */ |
129 | Elf64_Half e_phnum; /* Number of program headers */ | | 129 | Elf64_Half e_phnum; /* Number of program headers */ |
130 | Elf64_Half e_shentsize; /* Section header entry size */ | | 130 | Elf64_Half e_shentsize; /* Section header entry size */ |
131 | Elf64_Half e_shnum; /* Number of section headers */ | | 131 | Elf64_Half e_shnum; /* Number of section headers */ |
132 | Elf64_Half e_shstrndx; /* String table index */ | | 132 | Elf64_Half e_shstrndx; /* String table index */ |
133 | } Elf64_Ehdr; | | 133 | } Elf64_Ehdr; |
134 | | | 134 | |
135 | /* e_ident offsets */ | | 135 | /* e_ident offsets */ |
136 | #define EI_MAG0 0 /* '\177' */ | | 136 | #define EI_MAG0 0 /* '\177' */ |
137 | #define EI_MAG1 1 /* 'E' */ | | 137 | #define EI_MAG1 1 /* 'E' */ |
138 | #define EI_MAG2 2 /* 'L' */ | | 138 | #define EI_MAG2 2 /* 'L' */ |
139 | #define EI_MAG3 3 /* 'F' */ | | 139 | #define EI_MAG3 3 /* 'F' */ |
140 | #define EI_CLASS 4 /* File class */ | | 140 | #define EI_CLASS 4 /* File class */ |
141 | #define EI_DATA 5 /* Data encoding */ | | 141 | #define EI_DATA 5 /* Data encoding */ |
142 | #define EI_VERSION 6 /* File version */ | | 142 | #define EI_VERSION 6 /* File version */ |
143 | #define EI_OSABI 7 /* Operating system/ABI identification */ | | 143 | #define EI_OSABI 7 /* Operating system/ABI identification */ |
144 | #define EI_ABIVERSION 8 /* ABI version */ | | 144 | #define EI_ABIVERSION 8 /* ABI version */ |
145 | #define EI_PAD 9 /* Start of padding bytes up to EI_NIDENT*/ | | 145 | #define EI_PAD 9 /* Start of padding bytes up to EI_NIDENT*/ |
146 | #define EI_NIDENT 16 /* First non-ident header byte */ | | 146 | #define EI_NIDENT 16 /* First non-ident header byte */ |
147 | | | 147 | |
148 | /* e_ident[EI_MAG0,EI_MAG3] */ | | 148 | /* e_ident[EI_MAG0,EI_MAG3] */ |
149 | #define ELFMAG0 0x7f | | 149 | #define ELFMAG0 0x7f |
150 | #define ELFMAG1 'E' | | 150 | #define ELFMAG1 'E' |
151 | #define ELFMAG2 'L' | | 151 | #define ELFMAG2 'L' |
152 | #define ELFMAG3 'F' | | 152 | #define ELFMAG3 'F' |
153 | #define ELFMAG "\177ELF" | | 153 | #define ELFMAG "\177ELF" |
154 | #define SELFMAG 4 | | 154 | #define SELFMAG 4 |
155 | | | 155 | |
156 | /* e_ident[EI_CLASS] */ | | 156 | /* e_ident[EI_CLASS] */ |
157 | #define ELFCLASSNONE 0 /* Invalid class */ | | 157 | #define ELFCLASSNONE 0 /* Invalid class */ |
158 | #define ELFCLASS32 1 /* 32-bit objects */ | | 158 | #define ELFCLASS32 1 /* 32-bit objects */ |
159 | #define ELFCLASS64 2 /* 64-bit objects */ | | 159 | #define ELFCLASS64 2 /* 64-bit objects */ |
160 | #define ELFCLASSNUM 3 | | 160 | #define ELFCLASSNUM 3 |
161 | | | 161 | |
162 | /* e_ident[EI_DATA] */ | | 162 | /* e_ident[EI_DATA] */ |
163 | #define ELFDATANONE 0 /* Invalid data encoding */ | | 163 | #define ELFDATANONE 0 /* Invalid data encoding */ |
164 | #define ELFDATA2LSB 1 /* 2's complement values, LSB first */ | | 164 | #define ELFDATA2LSB 1 /* 2's complement values, LSB first */ |
165 | #define ELFDATA2MSB 2 /* 2's complement values, MSB first */ | | 165 | #define ELFDATA2MSB 2 /* 2's complement values, MSB first */ |
166 | | | 166 | |
167 | /* e_ident[EI_VERSION] */ | | 167 | /* e_ident[EI_VERSION] */ |
168 | #define EV_NONE 0 /* Invalid version */ | | 168 | #define EV_NONE 0 /* Invalid version */ |
169 | #define EV_CURRENT 1 /* Current version */ | | 169 | #define EV_CURRENT 1 /* Current version */ |
170 | #define EV_NUM 2 | | 170 | #define EV_NUM 2 |
171 | | | 171 | |
172 | /* e_ident[EI_OSABI] */ | | 172 | /* e_ident[EI_OSABI] */ |
173 | #define ELFOSABI_SYSV 0 /* UNIX System V ABI */ | | 173 | #define ELFOSABI_SYSV 0 /* UNIX System V ABI */ |
174 | #define ELFOSABI_HPUX 1 /* HP-UX operating system */ | | 174 | #define ELFOSABI_HPUX 1 /* HP-UX operating system */ |
175 | #define ELFOSABI_NETBSD 2 /* NetBSD */ | | 175 | #define ELFOSABI_NETBSD 2 /* NetBSD */ |
176 | #define ELFOSABI_LINUX 3 /* GNU/Linux */ | | 176 | #define ELFOSABI_LINUX 3 /* GNU/Linux */ |
177 | #define ELFOSABI_HURD 4 /* GNU/Hurd */ | | 177 | #define ELFOSABI_HURD 4 /* GNU/Hurd */ |
178 | #define ELFOSABI_86OPEN 5 /* 86Open */ | | 178 | #define ELFOSABI_86OPEN 5 /* 86Open */ |
179 | #define ELFOSABI_SOLARIS 6 /* Solaris */ | | 179 | #define ELFOSABI_SOLARIS 6 /* Solaris */ |
180 | #define ELFOSABI_MONTEREY 7 /* Monterey */ | | 180 | #define ELFOSABI_MONTEREY 7 /* Monterey */ |
181 | #define ELFOSABI_IRIX 8 /* IRIX */ | | 181 | #define ELFOSABI_IRIX 8 /* IRIX */ |
182 | #define ELFOSABI_FREEBSD 9 /* FreeBSD */ | | 182 | #define ELFOSABI_FREEBSD 9 /* FreeBSD */ |
183 | #define ELFOSABI_TRU64 10 /* TRU64 UNIX */ | | 183 | #define ELFOSABI_TRU64 10 /* TRU64 UNIX */ |
184 | #define ELFOSABI_MODESTO 11 /* Novell Modesto */ | | 184 | #define ELFOSABI_MODESTO 11 /* Novell Modesto */ |
185 | #define ELFOSABI_OPENBSD 12 /* OpenBSD */ | | 185 | #define ELFOSABI_OPENBSD 12 /* OpenBSD */ |
186 | #define ELFOSABI_OPENVMS 13 /* OpenVMS */ | | 186 | #define ELFOSABI_OPENVMS 13 /* OpenVMS */ |
187 | #define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */ | | 187 | #define ELFOSABI_NSK 14 /* HP Non-Stop Kernel */ |
188 | #define ELFOSABI_AROS 15 /* Amiga Research OS */ | | 188 | #define ELFOSABI_AROS 15 /* Amiga Research OS */ |
189 | /* Unofficial OSABIs follow */ | | 189 | /* Unofficial OSABIs follow */ |
190 | #define ELFOSABI_ARM 97 /* ARM */ | | 190 | #define ELFOSABI_ARM 97 /* ARM */ |
191 | #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ | | 191 | #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ |
192 | | | 192 | |
193 | #define ELFOSABI_NONE ELFOSABI_SYSV | | 193 | #define ELFOSABI_NONE ELFOSABI_SYSV |
194 | #define ELFOSABI_AIX ELFOSABI_MONTEREY | | 194 | #define ELFOSABI_AIX ELFOSABI_MONTEREY |
195 | | | 195 | |
196 | /* e_type */ | | 196 | /* e_type */ |
197 | #define ET_NONE 0 /* No file type */ | | 197 | #define ET_NONE 0 /* No file type */ |
198 | #define ET_REL 1 /* Relocatable file */ | | 198 | #define ET_REL 1 /* Relocatable file */ |
199 | #define ET_EXEC 2 /* Executable file */ | | 199 | #define ET_EXEC 2 /* Executable file */ |
200 | #define ET_DYN 3 /* Shared object file */ | | 200 | #define ET_DYN 3 /* Shared object file */ |
201 | #define ET_CORE 4 /* Core file */ | | 201 | #define ET_CORE 4 /* Core file */ |
202 | #define ET_NUM 5 | | 202 | #define ET_NUM 5 |
203 | | | 203 | |
204 | #define ET_LOOS 0xfe00 /* Operating system specific range */ | | 204 | #define ET_LOOS 0xfe00 /* Operating system specific range */ |
205 | #define ET_HIOS 0xfeff | | 205 | #define ET_HIOS 0xfeff |
206 | #define ET_LOPROC 0xff00 /* Processor-specific range */ | | 206 | #define ET_LOPROC 0xff00 /* Processor-specific range */ |
207 | #define ET_HIPROC 0xffff | | 207 | #define ET_HIPROC 0xffff |
208 | | | 208 | |
209 | /* e_machine */ | | 209 | /* e_machine */ |
210 | #define EM_NONE 0 /* No machine */ | | 210 | #define EM_NONE 0 /* No machine */ |
211 | #define EM_M32 1 /* AT&T WE 32100 */ | | 211 | #define EM_M32 1 /* AT&T WE 32100 */ |
212 | #define EM_SPARC 2 /* SPARC */ | | 212 | #define EM_SPARC 2 /* SPARC */ |
213 | #define EM_386 3 /* Intel 80386 */ | | 213 | #define EM_386 3 /* Intel 80386 */ |
214 | #define EM_68K 4 /* Motorola 68000 */ | | 214 | #define EM_68K 4 /* Motorola 68000 */ |
215 | #define EM_88K 5 /* Motorola 88000 */ | | 215 | #define EM_88K 5 /* Motorola 88000 */ |
216 | #define EM_486 6 /* Intel 80486 */ | | 216 | #define EM_486 6 /* Intel 80486 */ |
217 | #define EM_860 7 /* Intel 80860 */ | | 217 | #define EM_860 7 /* Intel 80860 */ |
218 | #define EM_MIPS 8 /* MIPS I Architecture */ | | 218 | #define EM_MIPS 8 /* MIPS I Architecture */ |
219 | #define EM_S370 9 /* Amdahl UTS on System/370 */ | | 219 | #define EM_S370 9 /* Amdahl UTS on System/370 */ |
220 | #define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */ | | 220 | #define EM_MIPS_RS3_LE 10 /* MIPS RS3000 Little-endian */ |
221 | /* 11-14 - Reserved */ | | 221 | /* 11-14 - Reserved */ |
222 | #define EM_RS6000 11 /* IBM RS/6000 XXX reserved */ | | 222 | #define EM_RS6000 11 /* IBM RS/6000 XXX reserved */ |
223 | #define EM_PARISC 15 /* Hewlett-Packard PA-RISC */ | | 223 | #define EM_PARISC 15 /* Hewlett-Packard PA-RISC */ |
224 | #define EM_NCUBE 16 /* NCube XXX reserved */ | | 224 | #define EM_NCUBE 16 /* NCube XXX reserved */ |
225 | #define EM_VPP500 17 /* Fujitsu VPP500 */ | | 225 | #define EM_VPP500 17 /* Fujitsu VPP500 */ |
226 | #define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ | | 226 | #define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ |
227 | #define EM_960 19 /* Intel 80960 */ | | 227 | #define EM_960 19 /* Intel 80960 */ |
228 | #define EM_PPC 20 /* PowerPC */ | | 228 | #define EM_PPC 20 /* PowerPC */ |
229 | #define EM_PPC64 21 /* 64-bit PowerPC */ | | 229 | #define EM_PPC64 21 /* 64-bit PowerPC */ |
230 | /* 22-35 - Reserved */ | | 230 | /* 22-35 - Reserved */ |
231 | #define EM_S390 22 /* System/390 XXX reserved */ | | 231 | #define EM_S390 22 /* System/390 XXX reserved */ |
232 | #define EM_V800 36 /* NEC V800 */ | | 232 | #define EM_V800 36 /* NEC V800 */ |
233 | #define EM_FR20 37 /* Fujitsu FR20 */ | | 233 | #define EM_FR20 37 /* Fujitsu FR20 */ |
234 | #define EM_RH32 38 /* TRW RH-32 */ | | 234 | #define EM_RH32 38 /* TRW RH-32 */ |
235 | #define EM_RCE 39 /* Motorola RCE */ | | 235 | #define EM_RCE 39 /* Motorola RCE */ |
236 | #define EM_ARM 40 /* Advanced RISC Machines ARM */ | | 236 | #define EM_ARM 40 /* Advanced RISC Machines ARM */ |
237 | #define EM_ALPHA 41 /* DIGITAL Alpha */ | | 237 | #define EM_ALPHA 41 /* DIGITAL Alpha */ |
238 | #define EM_SH 42 /* Hitachi Super-H */ | | 238 | #define EM_SH 42 /* Hitachi Super-H */ |
239 | #define EM_SPARCV9 43 /* SPARC Version 9 */ | | 239 | #define EM_SPARCV9 43 /* SPARC Version 9 */ |
240 | #define EM_TRICORE 44 /* Siemens Tricore */ | | 240 | #define EM_TRICORE 44 /* Siemens Tricore */ |
241 | #define EM_ARC 45 /* Argonaut RISC Core */ | | 241 | #define EM_ARC 45 /* Argonaut RISC Core */ |
242 | #define EM_H8_300 46 /* Hitachi H8/300 */ | | 242 | #define EM_H8_300 46 /* Hitachi H8/300 */ |
243 | #define EM_H8_300H 47 /* Hitachi H8/300H */ | | 243 | #define EM_H8_300H 47 /* Hitachi H8/300H */ |
244 | #define EM_H8S 48 /* Hitachi H8S */ | | 244 | #define EM_H8S 48 /* Hitachi H8S */ |
245 | #define EM_H8_500 49 /* Hitachi H8/500 */ | | 245 | #define EM_H8_500 49 /* Hitachi H8/500 */ |
246 | #define EM_IA_64 50 /* Intel Merced Processor */ | | 246 | #define EM_IA_64 50 /* Intel Merced Processor */ |
247 | #define EM_MIPS_X 51 /* Stanford MIPS-X */ | | 247 | #define EM_MIPS_X 51 /* Stanford MIPS-X */ |
248 | #define EM_COLDFIRE 52 /* Motorola Coldfire */ | | 248 | #define EM_COLDFIRE 52 /* Motorola Coldfire */ |
249 | #define EM_68HC12 53 /* Motorola MC68HC12 */ | | 249 | #define EM_68HC12 53 /* Motorola MC68HC12 */ |
250 | #define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */ | | 250 | #define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator */ |
251 | #define EM_PCP 55 /* Siemens PCP */ | | 251 | #define EM_PCP 55 /* Siemens PCP */ |
252 | #define EM_NCPU 56 /* Sony nCPU embedded RISC processor */ | | 252 | #define EM_NCPU 56 /* Sony nCPU embedded RISC processor */ |
253 | #define EM_NDR1 57 /* Denso NDR1 microprocessor */ | | 253 | #define EM_NDR1 57 /* Denso NDR1 microprocessor */ |
254 | #define EM_STARCORE 58 /* Motorola Star*Core processor */ | | 254 | #define EM_STARCORE 58 /* Motorola Star*Core processor */ |
255 | #define EM_ME16 59 /* Toyota ME16 processor */ | | 255 | #define EM_ME16 59 /* Toyota ME16 processor */ |
256 | #define EM_ST100 60 /* STMicroelectronics ST100 processor */ | | 256 | #define EM_ST100 60 /* STMicroelectronics ST100 processor */ |
257 | #define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded family processor */ | | 257 | #define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded family processor */ |
258 | #define EM_X86_64 62 /* AMD x86-64 architecture */ | | 258 | #define EM_X86_64 62 /* AMD x86-64 architecture */ |
259 | #define EM_PDSP 63 /* Sony DSP Processor */ | | 259 | #define EM_PDSP 63 /* Sony DSP Processor */ |
260 | #define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */ | | 260 | #define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */ |
261 | #define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */ | | 261 | #define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */ |
262 | #define EM_FX66 66 /* Siemens FX66 microcontroller */ | | 262 | #define EM_FX66 66 /* Siemens FX66 microcontroller */ |
263 | #define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */ | | 263 | #define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */ |
264 | #define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */ | | 264 | #define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */ |
265 | #define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */ | | 265 | #define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */ |
266 | #define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */ | | 266 | #define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */ |
267 | #define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */ | | 267 | #define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */ |
268 | #define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */ | | 268 | #define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */ |
269 | #define EM_SVX 73 /* Silicon Graphics SVx */ | | 269 | #define EM_SVX 73 /* Silicon Graphics SVx */ |
270 | #define EM_ST19 74 /* STMicroelectronics ST19 8-bit CPU */ | | 270 | #define EM_ST19 74 /* STMicroelectronics ST19 8-bit CPU */ |
271 | #define EM_VAX 75 /* Digital VAX */ | | 271 | #define EM_VAX 75 /* Digital VAX */ |
272 | #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ | | 272 | #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ |
273 | #define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded CPU */ | | 273 | #define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded CPU */ |
274 | #define EM_FIREPATH 78 /* Element 14 64-bit DSP processor */ | | 274 | #define EM_FIREPATH 78 /* Element 14 64-bit DSP processor */ |
275 | #define EM_ZSP 79 /* LSI Logic's 16-bit DSP processor */ | | 275 | #define EM_ZSP 79 /* LSI Logic's 16-bit DSP processor */ |
276 | #define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ | | 276 | #define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */ |
277 | #define EM_HUANY 81 /* Harvard's machine-independent format */ | | 277 | #define EM_HUANY 81 /* Harvard's machine-independent format */ |
278 | #define EM_PRISM 82 /* SiTera Prism */ | | 278 | #define EM_PRISM 82 /* SiTera Prism */ |
279 | #define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ | | 279 | #define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ |
280 | #define EM_FR30 84 /* Fujitsu FR30 */ | | 280 | #define EM_FR30 84 /* Fujitsu FR30 */ |
281 | #define EM_D10V 85 /* Mitsubishi D10V */ | | 281 | #define EM_D10V 85 /* Mitsubishi D10V */ |
282 | #define EM_D30V 86 /* Mitsubishi D30V */ | | 282 | #define EM_D30V 86 /* Mitsubishi D30V */ |
283 | #define EM_V850 87 /* NEC v850 */ | | 283 | #define EM_V850 87 /* NEC v850 */ |
284 | #define EM_M32R 88 /* Mitsubishi M32R */ | | 284 | #define EM_M32R 88 /* Mitsubishi M32R */ |
285 | #define EM_MN10300 89 /* Matsushita MN10300 */ | | 285 | #define EM_MN10300 89 /* Matsushita MN10300 */ |
286 | #define EM_MN10200 90 /* Matsushita MN10200 */ | | 286 | #define EM_MN10200 90 /* Matsushita MN10200 */ |
287 | #define EM_PJ 91 /* picoJava */ | | 287 | #define EM_PJ 91 /* picoJava */ |
288 | #define EM_OR1K 92 /* OpenRISC 32-bit embedded processor */ | | 288 | #define EM_OR1K 92 /* OpenRISC 32-bit embedded processor */ |
289 | #define EM_OPENRISC EM_OR1K | | 289 | #define EM_OPENRISC EM_OR1K |
290 | #define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ | | 290 | #define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ |
291 | #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ | | 291 | #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ |
292 | #define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */ | | 292 | #define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */ |
293 | #define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */ | | 293 | #define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */ |
294 | #define EM_NS32K 97 /* National Semiconductor 32000 series */ | | 294 | #define EM_NS32K 97 /* National Semiconductor 32000 series */ |
295 | #define EM_TPC 98 /* Tenor Network TPC processor */ | | 295 | #define EM_TPC 98 /* Tenor Network TPC processor */ |
296 | #define EM_SNP1K 99 /* Trebia SNP 1000 processor */ | | 296 | #define EM_SNP1K 99 /* Trebia SNP 1000 processor */ |
297 | #define EM_ST200 100 /* STMicroelectronics ST200 microcontroller */ | | 297 | #define EM_ST200 100 /* STMicroelectronics ST200 microcontroller */ |
298 | #define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */ | | 298 | #define EM_IP2K 101 /* Ubicom IP2xxx microcontroller family */ |
299 | #define EM_MAX 102 /* MAX processor */ | | 299 | #define EM_MAX 102 /* MAX processor */ |
300 | #define EM_CR 103 /* National Semiconductor CompactRISC micorprocessor */ | | 300 | #define EM_CR 103 /* National Semiconductor CompactRISC micorprocessor */ |
301 | #define EM_F2MC16 104 /* Fujitsu F2MC16 */ | | 301 | #define EM_F2MC16 104 /* Fujitsu F2MC16 */ |
302 | #define EM_MSP430 105 /* Texas Instruments MSP430 */ | | 302 | #define EM_MSP430 105 /* Texas Instruments MSP430 */ |
303 | #define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */ | | 303 | #define EM_BLACKFIN 106 /* Analog Devices Blackfin DSP */ |
304 | #define EM_SE_C33 107 /* Seiko Epson S1C33 family */ | | 304 | #define EM_SE_C33 107 /* Seiko Epson S1C33 family */ |
305 | #define EM_SEP 108 /* Sharp embedded microprocessor */ | | 305 | #define EM_SEP 108 /* Sharp embedded microprocessor */ |
306 | #define EM_ARCA 109 /* Arca RISC microprocessor */ | | 306 | #define EM_ARCA 109 /* Arca RISC microprocessor */ |
307 | #define EM_UNICORE 110 /* UNICORE from PKU-Unity Ltd. and MPRC Peking University */ | | 307 | #define EM_UNICORE 110 /* UNICORE from PKU-Unity Ltd. and MPRC Peking University */ |
308 | #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ | | 308 | #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ |
309 | #define EM_AARCH64 183 /* AArch64 64-bit ARM microprocessor */ | | 309 | #define EM_AARCH64 183 /* AArch64 64-bit ARM microprocessor */ |
310 | #define EM_AVR32 185 /* Atmel Corporation 32-bit microprocessor family*/ | | 310 | #define EM_AVR32 185 /* Atmel Corporation 32-bit microprocessor family*/ |
311 | #define EM_TILE64 187 /* Tilera TILE64 multicore architecture family */ | | 311 | #define EM_TILE64 187 /* Tilera TILE64 multicore architecture family */ |
312 | #define EM_TILEPRO 188 /* Tilera TILEPro multicore architecture family */ | | 312 | #define EM_TILEPRO 188 /* Tilera TILEPro multicore architecture family */ |
313 | #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ | | 313 | #define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */ |
314 | #define EM_TILEGX 192 /* Tilera TILE-GX multicore architecture family */ | | 314 | #define EM_TILEGX 192 /* Tilera TILE-GX multicore architecture family */ |
315 | #define EM_Z80 220 /* Zilog Z80 */ | | 315 | #define EM_Z80 220 /* Zilog Z80 */ |
316 | #define EM_RISCV 243 /* RISC-V */ | | 316 | #define EM_RISCV 243 /* RISC-V */ |
317 | | | 317 | |
318 | /* Unofficial machine types follow */ | | 318 | /* Unofficial machine types follow */ |
319 | #define EM_AVR32 6317 /* used by NetBSD/avr32 */ | | | |
320 | #define EM_ALPHA_EXP 36902 /* used by NetBSD/alpha; obsolete */ | | 319 | #define EM_ALPHA_EXP 36902 /* used by NetBSD/alpha; obsolete */ |
321 | #define EM_NUM 36903 | | 320 | #define EM_NUM 36903 |
322 | | | 321 | |
323 | /* | | 322 | /* |
324 | * Program Header | | 323 | * Program Header |
325 | */ | | 324 | */ |
326 | typedef struct { | | 325 | typedef struct { |
327 | Elf32_Word p_type; /* entry type */ | | 326 | Elf32_Word p_type; /* entry type */ |
328 | Elf32_Off p_offset; /* offset */ | | 327 | Elf32_Off p_offset; /* offset */ |
329 | Elf32_Addr p_vaddr; /* virtual address */ | | 328 | Elf32_Addr p_vaddr; /* virtual address */ |
330 | Elf32_Addr p_paddr; /* physical address */ | | 329 | Elf32_Addr p_paddr; /* physical address */ |
331 | Elf32_Word p_filesz; /* file size */ | | 330 | Elf32_Word p_filesz; /* file size */ |
332 | Elf32_Word p_memsz; /* memory size */ | | 331 | Elf32_Word p_memsz; /* memory size */ |
333 | Elf32_Word p_flags; /* flags */ | | 332 | Elf32_Word p_flags; /* flags */ |
334 | Elf32_Word p_align; /* memory & file alignment */ | | 333 | Elf32_Word p_align; /* memory & file alignment */ |
335 | } Elf32_Phdr; | | 334 | } Elf32_Phdr; |
336 | | | 335 | |
337 | typedef struct { | | 336 | typedef struct { |
338 | Elf64_Word p_type; /* entry type */ | | 337 | Elf64_Word p_type; /* entry type */ |
339 | Elf64_Word p_flags; /* flags */ | | 338 | Elf64_Word p_flags; /* flags */ |
340 | Elf64_Off p_offset; /* offset */ | | 339 | Elf64_Off p_offset; /* offset */ |
341 | Elf64_Addr p_vaddr; /* virtual address */ | | 340 | Elf64_Addr p_vaddr; /* virtual address */ |
342 | Elf64_Addr p_paddr; /* physical address */ | | 341 | Elf64_Addr p_paddr; /* physical address */ |
343 | Elf64_Xword p_filesz; /* file size */ | | 342 | Elf64_Xword p_filesz; /* file size */ |
344 | Elf64_Xword p_memsz; /* memory size */ | | 343 | Elf64_Xword p_memsz; /* memory size */ |
345 | Elf64_Xword p_align; /* memory & file alignment */ | | 344 | Elf64_Xword p_align; /* memory & file alignment */ |
346 | } Elf64_Phdr; | | 345 | } Elf64_Phdr; |
347 | | | 346 | |
348 | /* p_type */ | | 347 | /* p_type */ |
349 | #define PT_NULL 0 /* Program header table entry unused */ | | 348 | #define PT_NULL 0 /* Program header table entry unused */ |
350 | #define PT_LOAD 1 /* Loadable program segment */ | | 349 | #define PT_LOAD 1 /* Loadable program segment */ |
351 | #define PT_DYNAMIC 2 /* Dynamic linking information */ | | 350 | #define PT_DYNAMIC 2 /* Dynamic linking information */ |
352 | #define PT_INTERP 3 /* Program interpreter */ | | 351 | #define PT_INTERP 3 /* Program interpreter */ |
353 | #define PT_NOTE 4 /* Auxiliary information */ | | 352 | #define PT_NOTE 4 /* Auxiliary information */ |
354 | #define PT_SHLIB 5 /* Reserved, unspecified semantics */ | | 353 | #define PT_SHLIB 5 /* Reserved, unspecified semantics */ |
355 | #define PT_PHDR 6 /* Entry for header table itself */ | | 354 | #define PT_PHDR 6 /* Entry for header table itself */ |
356 | #define PT_TLS 7 /* TLS initialisation image */ | | 355 | #define PT_TLS 7 /* TLS initialisation image */ |
357 | #define PT_NUM 8 | | 356 | #define PT_NUM 8 |
358 | | | 357 | |
359 | #define PT_LOOS 0x60000000 /* OS-specific range */ | | 358 | #define PT_LOOS 0x60000000 /* OS-specific range */ |
360 | | | 359 | |
361 | /* GNU-specific */ | | 360 | /* GNU-specific */ |
362 | #define PT_GNU_EH_FRAME 0x6474e550 /* EH frame segment */ | | 361 | #define PT_GNU_EH_FRAME 0x6474e550 /* EH frame segment */ |
363 | #define PT_GNU_STACK 0x6474e551 /* Indicate executable stack */ | | 362 | #define PT_GNU_STACK 0x6474e551 /* Indicate executable stack */ |
364 | #define PT_GNU_RELRO 0x6474e552 /* Make read-only after relocation */ | | 363 | #define PT_GNU_RELRO 0x6474e552 /* Make read-only after relocation */ |
365 | | | 364 | |
366 | #define PT_HIOS 0x6fffffff | | 365 | #define PT_HIOS 0x6fffffff |
367 | #define PT_LOPROC 0x70000000 /* Processor-specific range */ | | 366 | #define PT_LOPROC 0x70000000 /* Processor-specific range */ |
368 | #define PT_HIPROC 0x7fffffff | | 367 | #define PT_HIPROC 0x7fffffff |
369 | | | 368 | |
370 | #define PT_MIPS_REGINFO 0x70000000 | | 369 | #define PT_MIPS_REGINFO 0x70000000 |
371 | | | 370 | |
372 | /* p_flags */ | | 371 | /* p_flags */ |
373 | #define PF_R 0x4 /* Segment is readable */ | | 372 | #define PF_R 0x4 /* Segment is readable */ |
374 | #define PF_W 0x2 /* Segment is writable */ | | 373 | #define PF_W 0x2 /* Segment is writable */ |
375 | #define PF_X 0x1 /* Segment is executable */ | | 374 | #define PF_X 0x1 /* Segment is executable */ |
376 | | | 375 | |
377 | #define PF_MASKOS 0x0ff00000 /* Operating system specific values */ | | 376 | #define PF_MASKOS 0x0ff00000 /* Operating system specific values */ |
378 | #define PF_MASKPROC 0xf0000000 /* Processor-specific values */ | | 377 | #define PF_MASKPROC 0xf0000000 /* Processor-specific values */ |
379 | | | 378 | |
380 | /* Extended program header index. */ | | 379 | /* Extended program header index. */ |
381 | #define PN_XNUM 0xffff | | 380 | #define PN_XNUM 0xffff |
382 | | | 381 | |
383 | /* | | 382 | /* |
384 | * Section Headers | | 383 | * Section Headers |
385 | */ | | 384 | */ |
386 | typedef struct { | | 385 | typedef struct { |
387 | Elf32_Word sh_name; /* section name (.shstrtab index) */ | | 386 | Elf32_Word sh_name; /* section name (.shstrtab index) */ |
388 | Elf32_Word sh_type; /* section type */ | | 387 | Elf32_Word sh_type; /* section type */ |
389 | Elf32_Word sh_flags; /* section flags */ | | 388 | Elf32_Word sh_flags; /* section flags */ |
390 | Elf32_Addr sh_addr; /* virtual address */ | | 389 | Elf32_Addr sh_addr; /* virtual address */ |
391 | Elf32_Off sh_offset; /* file offset */ | | 390 | Elf32_Off sh_offset; /* file offset */ |
392 | Elf32_Word sh_size; /* section size */ | | 391 | Elf32_Word sh_size; /* section size */ |
393 | Elf32_Word sh_link; /* link to another */ | | 392 | Elf32_Word sh_link; /* link to another */ |
394 | Elf32_Word sh_info; /* misc info */ | | 393 | Elf32_Word sh_info; /* misc info */ |
395 | Elf32_Word sh_addralign; /* memory alignment */ | | 394 | Elf32_Word sh_addralign; /* memory alignment */ |
396 | Elf32_Word sh_entsize; /* table entry size */ | | 395 | Elf32_Word sh_entsize; /* table entry size */ |
397 | } Elf32_Shdr; | | 396 | } Elf32_Shdr; |
398 | | | 397 | |
399 | typedef struct { | | 398 | typedef struct { |
400 | Elf64_Word sh_name; /* section name (.shstrtab index) */ | | 399 | Elf64_Word sh_name; /* section name (.shstrtab index) */ |
401 | Elf64_Word sh_type; /* section type */ | | 400 | Elf64_Word sh_type; /* section type */ |
402 | Elf64_Xword sh_flags; /* section flags */ | | 401 | Elf64_Xword sh_flags; /* section flags */ |
403 | Elf64_Addr sh_addr; /* virtual address */ | | 402 | Elf64_Addr sh_addr; /* virtual address */ |
404 | Elf64_Off sh_offset; /* file offset */ | | 403 | Elf64_Off sh_offset; /* file offset */ |
405 | Elf64_Xword sh_size; /* section size */ | | 404 | Elf64_Xword sh_size; /* section size */ |
406 | Elf64_Word sh_link; /* link to another */ | | 405 | Elf64_Word sh_link; /* link to another */ |
407 | Elf64_Word sh_info; /* misc info */ | | 406 | Elf64_Word sh_info; /* misc info */ |
408 | Elf64_Xword sh_addralign; /* memory alignment */ | | 407 | Elf64_Xword sh_addralign; /* memory alignment */ |
409 | Elf64_Xword sh_entsize; /* table entry size */ | | 408 | Elf64_Xword sh_entsize; /* table entry size */ |
410 | } Elf64_Shdr; | | 409 | } Elf64_Shdr; |
411 | | | 410 | |
412 | /* sh_type */ | | 411 | /* sh_type */ |
413 | #define SHT_NULL 0 /* Section header table entry unused */ | | 412 | #define SHT_NULL 0 /* Section header table entry unused */ |
414 | #define SHT_PROGBITS 1 /* Program information */ | | 413 | #define SHT_PROGBITS 1 /* Program information */ |
415 | #define SHT_SYMTAB 2 /* Symbol table */ | | 414 | #define SHT_SYMTAB 2 /* Symbol table */ |
416 | #define SHT_STRTAB 3 /* String table */ | | 415 | #define SHT_STRTAB 3 /* String table */ |
417 | #define SHT_RELA 4 /* Relocation information w/ addend */ | | 416 | #define SHT_RELA 4 /* Relocation information w/ addend */ |
418 | #define SHT_HASH 5 /* Symbol hash table */ | | 417 | #define SHT_HASH 5 /* Symbol hash table */ |
419 | #define SHT_DYNAMIC 6 /* Dynamic linking information */ | | 418 | #define SHT_DYNAMIC 6 /* Dynamic linking information */ |
420 | #define SHT_NOTE 7 /* Auxiliary information */ | | 419 | #define SHT_NOTE 7 /* Auxiliary information */ |
421 | #define SHT_NOBITS 8 /* No space allocated in file image */ | | 420 | #define SHT_NOBITS 8 /* No space allocated in file image */ |
422 | #define SHT_REL 9 /* Relocation information w/o addend */ | | 421 | #define SHT_REL 9 /* Relocation information w/o addend */ |
423 | #define SHT_SHLIB 10 /* Reserved, unspecified semantics */ | | 422 | #define SHT_SHLIB 10 /* Reserved, unspecified semantics */ |
424 | #define SHT_DYNSYM 11 /* Symbol table for dynamic linker */ | | 423 | #define SHT_DYNSYM 11 /* Symbol table for dynamic linker */ |
425 | #define SHT_INIT_ARRAY 14 /* Initialization function pointers */ | | 424 | #define SHT_INIT_ARRAY 14 /* Initialization function pointers */ |
426 | #define SHT_FINI_ARRAY 15 /* Termination function pointers */ | | 425 | #define SHT_FINI_ARRAY 15 /* Termination function pointers */ |
427 | #define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */ | | 426 | #define SHT_PREINIT_ARRAY 16 /* Pre-initialization function ptrs */ |
428 | #define SHT_GROUP 17 /* Section group */ | | 427 | #define SHT_GROUP 17 /* Section group */ |
429 | #define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */ | | 428 | #define SHT_SYMTAB_SHNDX 18 /* Section indexes (see SHN_XINDEX) */ |
430 | #define SHT_NUM 19 | | 429 | #define SHT_NUM 19 |
431 | | | 430 | |
432 | #define SHT_LOOS 0x60000000 /* Operating system specific range */ | | 431 | #define SHT_LOOS 0x60000000 /* Operating system specific range */ |
433 | #define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* GNU incremental build data */ | | 432 | #define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* GNU incremental build data */ |
434 | #define SHT_LOSUNW 0x6ffffff4 | | 433 | #define SHT_LOSUNW 0x6ffffff4 |
435 | #define SHT_SUNW_dof 0x6ffffff4 | | 434 | #define SHT_SUNW_dof 0x6ffffff4 |
436 | #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* GNU object attributes */ | | 435 | #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* GNU object attributes */ |
437 | #define SHT_SUNW_cap 0x6ffffff5 | | 436 | #define SHT_SUNW_cap 0x6ffffff5 |
438 | #define SHT_SUNW_SIGNATURE 0x6ffffff6 | | 437 | #define SHT_SUNW_SIGNATURE 0x6ffffff6 |
439 | #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */ | | 438 | #define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */ |
440 | #define SHT_GNU_LIBLIST 0x6ffffff7 /* GNU list of prelink dependencies */ | | 439 | #define SHT_GNU_LIBLIST 0x6ffffff7 /* GNU list of prelink dependencies */ |
441 | #define SHT_SUNW_move 0x6ffffffa | | 440 | #define SHT_SUNW_move 0x6ffffffa |
442 | #define SHT_SUNW_COMDAT 0x6ffffffb | | 441 | #define SHT_SUNW_COMDAT 0x6ffffffb |
443 | #define SHT_SUNW_syminfo 0x6ffffffc | | 442 | #define SHT_SUNW_syminfo 0x6ffffffc |
444 | #define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */ | | 443 | #define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */ |
445 | #define SHT_GNU_verdef SHT_SUNW_verdef | | 444 | #define SHT_GNU_verdef SHT_SUNW_verdef |
446 | #define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */ | | 445 | #define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */ |
447 | #define SHT_GNU_verneed SHT_SUNW_verneed | | 446 | #define SHT_GNU_verneed SHT_SUNW_verneed |
448 | #define SHT_SUNW_versym 0x6fffffff /* Symbol versions */ | | 447 | #define SHT_SUNW_versym 0x6fffffff /* Symbol versions */ |
449 | #define SHT_GNU_versym SHT_SUNW_versym | | 448 | #define SHT_GNU_versym SHT_SUNW_versym |
450 | #define SHT_HISUNW 0x6fffffff | | 449 | #define SHT_HISUNW 0x6fffffff |
451 | #define SHT_HIOS 0x6fffffff | | 450 | #define SHT_HIOS 0x6fffffff |
452 | #define SHT_LOPROC 0x70000000 /* Processor-specific range */ | | 451 | #define SHT_LOPROC 0x70000000 /* Processor-specific range */ |
453 | #define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ | | 452 | #define SHT_AMD64_UNWIND 0x70000001 /* unwind information */ |
454 | #define SHT_ARM_EXIDX 0x70000001 /* exception index table */ | | 453 | #define SHT_ARM_EXIDX 0x70000001 /* exception index table */ |
455 | #define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking | | 454 | #define SHT_ARM_PREEMPTMAP 0x70000002 /* BPABI DLL dynamic linking |
456 | * pre-emption map */ | | 455 | * pre-emption map */ |
457 | #define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility | | 456 | #define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility |
458 | * attributes */ | | 457 | * attributes */ |
459 | #define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details */ | | 458 | #define SHT_ARM_DEBUGOVERLAY 0x70000004 /* See DBGOVL for details */ |
460 | #define SHT_ARM_OVERLAYSECTION 0x70000005 | | 459 | #define SHT_ARM_OVERLAYSECTION 0x70000005 |
461 | #define SHT_MIPS_REGINFO 0x70000006 | | 460 | #define SHT_MIPS_REGINFO 0x70000006 |
462 | #define SHT_MIPS_OPTIONS 0x7000000d | | 461 | #define SHT_MIPS_OPTIONS 0x7000000d |
463 | #define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */ | | 462 | #define SHT_MIPS_DWARF 0x7000001e /* MIPS gcc uses MIPS_DWARF */ |
464 | #define SHT_HIPROC 0x7fffffff | | 463 | #define SHT_HIPROC 0x7fffffff |
465 | #define SHT_LOUSER 0x80000000 /* Application-specific range */ | | 464 | #define SHT_LOUSER 0x80000000 /* Application-specific range */ |
466 | #define SHT_HIUSER 0xffffffff | | 465 | #define SHT_HIUSER 0xffffffff |
467 | | | 466 | |
468 | /* sh_flags */ | | 467 | /* sh_flags */ |
469 | #define SHF_WRITE 0x00000001 /* Contains writable data */ | | 468 | #define SHF_WRITE 0x00000001 /* Contains writable data */ |
470 | #define SHF_ALLOC 0x00000002 /* Occupies memory */ | | 469 | #define SHF_ALLOC 0x00000002 /* Occupies memory */ |
471 | #define SHF_EXECINSTR 0x00000004 /* Contains executable insns */ | | 470 | #define SHF_EXECINSTR 0x00000004 /* Contains executable insns */ |
472 | #define SHF_MERGE 0x00000010 /* Might be merged */ | | 471 | #define SHF_MERGE 0x00000010 /* Might be merged */ |
473 | #define SHF_STRINGS 0x00000020 /* Contains nul terminated strings */ | | 472 | #define SHF_STRINGS 0x00000020 /* Contains nul terminated strings */ |
474 | #define SHF_INFO_LINK 0x00000040 /* "sh_info" contains SHT index */ | | 473 | #define SHF_INFO_LINK 0x00000040 /* "sh_info" contains SHT index */ |
475 | #define SHF_LINK_ORDER 0x00000080 /* Preserve order after combining */ | | 474 | #define SHF_LINK_ORDER 0x00000080 /* Preserve order after combining */ |
476 | #define SHF_OS_NONCONFORMING 0x00000100 /* OS specific handling required */ | | 475 | #define SHF_OS_NONCONFORMING 0x00000100 /* OS specific handling required */ |
477 | #define SHF_GROUP 0x00000200 /* Is member of a group */ | | 476 | #define SHF_GROUP 0x00000200 /* Is member of a group */ |
478 | #define SHF_TLS 0x00000400 /* Holds thread-local data */ | | 477 | #define SHF_TLS 0x00000400 /* Holds thread-local data */ |
479 | #define SHF_MASKOS 0x0ff00000 /* Operating system specific values */ | | 478 | #define SHF_MASKOS 0x0ff00000 /* Operating system specific values */ |
480 | #define SHF_MASKPROC 0xf0000000 /* Processor-specific values */ | | 479 | #define SHF_MASKPROC 0xf0000000 /* Processor-specific values */ |
481 | #define SHF_ORDERED 0x40000000 /* Ordering requirement (Solaris) */ | | 480 | #define SHF_ORDERED 0x40000000 /* Ordering requirement (Solaris) */ |
482 | #define SHF_EXCLUDE 0x80000000 /* Excluded unless unles ref/alloc | | 481 | #define SHF_EXCLUDE 0x80000000 /* Excluded unless unles ref/alloc |
483 | (Solaris).*/ | | 482 | (Solaris).*/ |
484 | /* | | 483 | /* |
485 | * Symbol Table | | 484 | * Symbol Table |
486 | */ | | 485 | */ |
487 | typedef struct { | | 486 | typedef struct { |
488 | Elf32_Word st_name; /* Symbol name (.strtab index) */ | | 487 | Elf32_Word st_name; /* Symbol name (.strtab index) */ |
489 | Elf32_Word st_value; /* value of symbol */ | | 488 | Elf32_Word st_value; /* value of symbol */ |
490 | Elf32_Word st_size; /* size of symbol */ | | 489 | Elf32_Word st_size; /* size of symbol */ |
491 | Elf_Byte st_info; /* type / binding attrs */ | | 490 | Elf_Byte st_info; /* type / binding attrs */ |
492 | Elf_Byte st_other; /* unused */ | | 491 | Elf_Byte st_other; /* unused */ |
493 | Elf32_Half st_shndx; /* section index of symbol */ | | 492 | Elf32_Half st_shndx; /* section index of symbol */ |
494 | } Elf32_Sym; | | 493 | } Elf32_Sym; |
495 | | | 494 | |
496 | typedef struct { | | 495 | typedef struct { |
497 | Elf64_Word st_name; /* Symbol name (.strtab index) */ | | 496 | Elf64_Word st_name; /* Symbol name (.strtab index) */ |
498 | Elf_Byte st_info; /* type / binding attrs */ | | 497 | Elf_Byte st_info; /* type / binding attrs */ |
499 | Elf_Byte st_other; /* unused */ | | 498 | Elf_Byte st_other; /* unused */ |
500 | Elf64_Half st_shndx; /* section index of symbol */ | | 499 | Elf64_Half st_shndx; /* section index of symbol */ |
501 | Elf64_Addr st_value; /* value of symbol */ | | 500 | Elf64_Addr st_value; /* value of symbol */ |
502 | Elf64_Xword st_size; /* size of symbol */ | | 501 | Elf64_Xword st_size; /* size of symbol */ |
503 | } Elf64_Sym; | | 502 | } Elf64_Sym; |
504 | | | 503 | |
505 | /* Symbol Table index of the undefined symbol */ | | 504 | /* Symbol Table index of the undefined symbol */ |
506 | #define ELF_SYM_UNDEFINED 0 | | 505 | #define ELF_SYM_UNDEFINED 0 |
507 | | | 506 | |
508 | #define STN_UNDEF 0 /* undefined index */ | | 507 | #define STN_UNDEF 0 /* undefined index */ |
509 | | | 508 | |
510 | /* st_info: Symbol Bindings */ | | 509 | /* st_info: Symbol Bindings */ |
511 | #define STB_LOCAL 0 /* local symbol */ | | 510 | #define STB_LOCAL 0 /* local symbol */ |
512 | #define STB_GLOBAL 1 /* global symbol */ | | 511 | #define STB_GLOBAL 1 /* global symbol */ |
513 | #define STB_WEAK 2 /* weakly defined global symbol */ | | 512 | #define STB_WEAK 2 /* weakly defined global symbol */ |
514 | #define STB_NUM 3 | | 513 | #define STB_NUM 3 |
515 | | | 514 | |
516 | #define STB_LOOS 10 /* Operating system specific range */ | | 515 | #define STB_LOOS 10 /* Operating system specific range */ |
517 | #define STB_HIOS 12 | | 516 | #define STB_HIOS 12 |
518 | #define STB_LOPROC 13 /* Processor-specific range */ | | 517 | #define STB_LOPROC 13 /* Processor-specific range */ |
519 | #define STB_HIPROC 15 | | 518 | #define STB_HIPROC 15 |
520 | | | 519 | |
521 | /* st_info: Symbol Types */ | | 520 | /* st_info: Symbol Types */ |
522 | #define STT_NOTYPE 0 /* Type not specified */ | | 521 | #define STT_NOTYPE 0 /* Type not specified */ |
523 | #define STT_OBJECT 1 /* Associated with a data object */ | | 522 | #define STT_OBJECT 1 /* Associated with a data object */ |
524 | #define STT_FUNC 2 /* Associated with a function */ | | 523 | #define STT_FUNC 2 /* Associated with a function */ |
525 | #define STT_SECTION 3 /* Associated with a section */ | | 524 | #define STT_SECTION 3 /* Associated with a section */ |
526 | #define STT_FILE 4 /* Associated with a file name */ | | 525 | #define STT_FILE 4 /* Associated with a file name */ |
527 | #define STT_COMMON 5 /* Uninitialised common block */ | | 526 | #define STT_COMMON 5 /* Uninitialised common block */ |
528 | #define STT_TLS 6 /* Thread local data object */ | | 527 | #define STT_TLS 6 /* Thread local data object */ |
529 | #define STT_NUM 7 | | 528 | #define STT_NUM 7 |
530 | | | 529 | |
531 | #define STT_LOOS 10 /* Operating system specific range */ | | 530 | #define STT_LOOS 10 /* Operating system specific range */ |
532 | #define STT_GNU_IFUNC 10 /* GNU extension: indirect function */ | | 531 | #define STT_GNU_IFUNC 10 /* GNU extension: indirect function */ |
533 | #define STT_HIOS 12 | | 532 | #define STT_HIOS 12 |
534 | #define STT_LOPROC 13 /* Processor-specific range */ | | 533 | #define STT_LOPROC 13 /* Processor-specific range */ |
535 | #define STT_HIPROC 15 | | 534 | #define STT_HIPROC 15 |
536 | | | 535 | |
537 | /* st_other: Visibility Types */ | | 536 | /* st_other: Visibility Types */ |
538 | #define STV_DEFAULT 0 /* use binding type */ | | 537 | #define STV_DEFAULT 0 /* use binding type */ |
539 | #define STV_INTERNAL 1 /* not referenced from outside */ | | 538 | #define STV_INTERNAL 1 /* not referenced from outside */ |
540 | #define STV_HIDDEN 2 /* not visible, may be used via ptr */ | | 539 | #define STV_HIDDEN 2 /* not visible, may be used via ptr */ |
541 | #define STV_PROTECTED 3 /* visible, not preemptible */ | | 540 | #define STV_PROTECTED 3 /* visible, not preemptible */ |
542 | #define STV_EXPORTED 4 | | 541 | #define STV_EXPORTED 4 |
543 | #define STV_SINGLETON 5 | | 542 | #define STV_SINGLETON 5 |
544 | #define STV_ELIMINATE 6 | | 543 | #define STV_ELIMINATE 6 |
545 | | | 544 | |
546 | /* st_info/st_other utility macros */ | | 545 | /* st_info/st_other utility macros */ |
547 | #define ELF_ST_BIND(info) ((uint32_t)(info) >> 4) | | 546 | #define ELF_ST_BIND(info) ((uint32_t)(info) >> 4) |
548 | #define ELF_ST_TYPE(info) ((uint32_t)(info) & 0xf) | | 547 | #define ELF_ST_TYPE(info) ((uint32_t)(info) & 0xf) |
549 | #define ELF_ST_INFO(bind,type) ((Elf_Byte)(((bind) << 4) | \ | | 548 | #define ELF_ST_INFO(bind,type) ((Elf_Byte)(((bind) << 4) | \ |
550 | ((type) & 0xf))) | | 549 | ((type) & 0xf))) |
551 | #define ELF_ST_VISIBILITY(other) ((uint32_t)(other) & 3) | | 550 | #define ELF_ST_VISIBILITY(other) ((uint32_t)(other) & 3) |
552 | | | 551 | |
553 | /* | | 552 | /* |
554 | * Special section indexes | | 553 | * Special section indexes |
555 | */ | | 554 | */ |
556 | #define SHN_UNDEF 0 /* Undefined section */ | | 555 | #define SHN_UNDEF 0 /* Undefined section */ |
557 | | | 556 | |
558 | #define SHN_LORESERVE 0xff00 /* Reserved range */ | | 557 | #define SHN_LORESERVE 0xff00 /* Reserved range */ |
559 | #define SHN_ABS 0xfff1 /* Absolute symbols */ | | 558 | #define SHN_ABS 0xfff1 /* Absolute symbols */ |
560 | #define SHN_COMMON 0xfff2 /* Common symbols */ | | 559 | #define SHN_COMMON 0xfff2 /* Common symbols */ |
561 | #define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere */ | | 560 | #define SHN_XINDEX 0xffff /* Escape -- index stored elsewhere */ |
562 | #define SHN_HIRESERVE 0xffff | | 561 | #define SHN_HIRESERVE 0xffff |
563 | | | 562 | |
564 | #define SHN_LOPROC 0xff00 /* Processor-specific range */ | | 563 | #define SHN_LOPROC 0xff00 /* Processor-specific range */ |
565 | #define SHN_HIPROC 0xff1f | | 564 | #define SHN_HIPROC 0xff1f |
566 | #define SHN_LOOS 0xff20 /* Operating system specific range */ | | 565 | #define SHN_LOOS 0xff20 /* Operating system specific range */ |
567 | #define SHN_HIOS 0xff3f | | 566 | #define SHN_HIOS 0xff3f |
568 | | | 567 | |
569 | #define SHN_MIPS_ACOMMON 0xff00 | | 568 | #define SHN_MIPS_ACOMMON 0xff00 |
570 | #define SHN_MIPS_TEXT 0xff01 | | 569 | #define SHN_MIPS_TEXT 0xff01 |
571 | #define SHN_MIPS_DATA 0xff02 | | 570 | #define SHN_MIPS_DATA 0xff02 |
572 | #define SHN_MIPS_SCOMMON 0xff03 | | 571 | #define SHN_MIPS_SCOMMON 0xff03 |
573 | | | 572 | |
574 | /* | | 573 | /* |
575 | * Relocation Entries | | 574 | * Relocation Entries |
576 | */ | | 575 | */ |
577 | typedef struct { | | 576 | typedef struct { |
578 | Elf32_Word r_offset; /* where to do it */ | | 577 | Elf32_Word r_offset; /* where to do it */ |
579 | Elf32_Word r_info; /* index & type of relocation */ | | 578 | Elf32_Word r_info; /* index & type of relocation */ |
580 | } Elf32_Rel; | | 579 | } Elf32_Rel; |
581 | | | 580 | |
582 | typedef struct { | | 581 | typedef struct { |
583 | Elf32_Word r_offset; /* where to do it */ | | 582 | Elf32_Word r_offset; /* where to do it */ |
584 | Elf32_Word r_info; /* index & type of relocation */ | | 583 | Elf32_Word r_info; /* index & type of relocation */ |
585 | Elf32_Sword r_addend; /* adjustment value */ | | 584 | Elf32_Sword r_addend; /* adjustment value */ |
586 | } Elf32_Rela; | | 585 | } Elf32_Rela; |
587 | | | 586 | |
588 | /* r_info utility macros */ | | 587 | /* r_info utility macros */ |
589 | #define ELF32_R_SYM(info) ((info) >> 8) | | 588 | #define ELF32_R_SYM(info) ((info) >> 8) |
590 | #define ELF32_R_TYPE(info) ((info) & 0xff) | | 589 | #define ELF32_R_TYPE(info) ((info) & 0xff) |
591 | #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) | | 590 | #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) |
592 | | | 591 | |
593 | typedef struct { | | 592 | typedef struct { |
594 | Elf64_Addr r_offset; /* where to do it */ | | 593 | Elf64_Addr r_offset; /* where to do it */ |
595 | Elf64_Xword r_info; /* index & type of relocation */ | | 594 | Elf64_Xword r_info; /* index & type of relocation */ |
596 | } Elf64_Rel; | | 595 | } Elf64_Rel; |
597 | | | 596 | |
598 | typedef struct { | | 597 | typedef struct { |
599 | Elf64_Addr r_offset; /* where to do it */ | | 598 | Elf64_Addr r_offset; /* where to do it */ |
600 | Elf64_Xword r_info; /* index & type of relocation */ | | 599 | Elf64_Xword r_info; /* index & type of relocation */ |
601 | Elf64_Sxword r_addend; /* adjustment value */ | | 600 | Elf64_Sxword r_addend; /* adjustment value */ |
602 | } Elf64_Rela; | | 601 | } Elf64_Rela; |
603 | | | 602 | |
604 | /* r_info utility macros */ | | 603 | /* r_info utility macros */ |
605 | #define ELF64_R_SYM(info) ((info) >> 32) | | 604 | #define ELF64_R_SYM(info) ((info) >> 32) |
606 | #define ELF64_R_TYPE(info) ((info) & 0xffffffff) | | 605 | #define ELF64_R_TYPE(info) ((info) & 0xffffffff) |
607 | #define ELF64_R_INFO(sym,type) (((sym) << 32) + (type)) | | 606 | #define ELF64_R_INFO(sym,type) (((sym) << 32) + (type)) |
608 | | | 607 | |
609 | /* | | 608 | /* |
610 | * Move entries | | 609 | * Move entries |
611 | */ | | 610 | */ |
612 | typedef struct { | | 611 | typedef struct { |
613 | Elf32_Lword m_value; /* symbol value */ | | 612 | Elf32_Lword m_value; /* symbol value */ |
614 | Elf32_Word m_info; /* size + index */ | | 613 | Elf32_Word m_info; /* size + index */ |
615 | Elf32_Word m_poffset; /* symbol offset */ | | 614 | Elf32_Word m_poffset; /* symbol offset */ |
616 | Elf32_Half m_repeat; /* repeat count */ | | 615 | Elf32_Half m_repeat; /* repeat count */ |
617 | Elf32_Half m_stride; /* stride info */ | | 616 | Elf32_Half m_stride; /* stride info */ |
618 | } Elf32_Move; | | 617 | } Elf32_Move; |
619 | | | 618 | |
620 | #define ELF32_M_SYM(info) ((info) >> 8) | | 619 | #define ELF32_M_SYM(info) ((info) >> 8) |
621 | #define ELF32_M_SIZE(info) ((info) & 0xff) | | 620 | #define ELF32_M_SIZE(info) ((info) & 0xff) |
622 | #define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) | | 621 | #define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) |
623 | | | 622 | |
624 | typedef struct { | | 623 | typedef struct { |
625 | Elf64_Lword m_value; /* symbol value */ | | 624 | Elf64_Lword m_value; /* symbol value */ |
626 | Elf64_Xword m_info; /* size + index */ | | 625 | Elf64_Xword m_info; /* size + index */ |
627 | Elf64_Xword m_poffset; /* symbol offset */ | | 626 | Elf64_Xword m_poffset; /* symbol offset */ |
628 | Elf64_Word m_repeat; /* repeat count */ | | 627 | Elf64_Word m_repeat; /* repeat count */ |
629 | Elf64_Word m_stride; /* stride info */ | | 628 | Elf64_Word m_stride; /* stride info */ |
630 | } Elf64_Move; | | 629 | } Elf64_Move; |
631 | | | 630 | |
632 | #define ELF64_M_SYM(info) ((info) >> 8) | | 631 | #define ELF64_M_SYM(info) ((info) >> 8) |
633 | #define ELF64_M_SIZE(info) ((info) & 0xff) | | 632 | #define ELF64_M_SIZE(info) ((info) & 0xff) |
634 | #define ELF64_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) | | 633 | #define ELF64_M_INFO(sym, size) (((sym) << 8) + (unsigned char)(size)) |
635 | | | 634 | |
636 | /* | | 635 | /* |
637 | * Hardware/software capabilities entry | | 636 | * Hardware/software capabilities entry |
638 | */ | | 637 | */ |
639 | typedef struct { | | 638 | typedef struct { |
640 | Elf32_Word c_tag; /* entry tag value */ | | 639 | Elf32_Word c_tag; /* entry tag value */ |
641 | union { | | 640 | union { |
642 | Elf32_Addr c_ptr; | | 641 | Elf32_Addr c_ptr; |
643 | Elf32_Word c_val; | | 642 | Elf32_Word c_val; |
644 | } c_un; | | 643 | } c_un; |
645 | } Elf32_Cap; | | 644 | } Elf32_Cap; |
646 | | | 645 | |
647 | typedef struct { | | 646 | typedef struct { |
648 | Elf64_Xword c_tag; /* entry tag value */ | | 647 | Elf64_Xword c_tag; /* entry tag value */ |
649 | union { | | 648 | union { |
650 | Elf64_Addr c_ptr; | | 649 | Elf64_Addr c_ptr; |
651 | Elf64_Xword c_val; | | 650 | Elf64_Xword c_val; |
652 | } c_un; | | 651 | } c_un; |
653 | } Elf64_Cap; | | 652 | } Elf64_Cap; |
654 | | | 653 | |
655 | /* | | 654 | /* |
656 | * Dynamic Section structure array | | 655 | * Dynamic Section structure array |
657 | */ | | 656 | */ |
658 | typedef struct { | | 657 | typedef struct { |
659 | Elf32_Word d_tag; /* entry tag value */ | | 658 | Elf32_Word d_tag; /* entry tag value */ |
660 | union { | | 659 | union { |
661 | Elf32_Addr d_ptr; | | 660 | Elf32_Addr d_ptr; |
662 | Elf32_Word d_val; | | 661 | Elf32_Word d_val; |
663 | } d_un; | | 662 | } d_un; |
664 | } Elf32_Dyn; | | 663 | } Elf32_Dyn; |
665 | | | 664 | |
666 | typedef struct { | | 665 | typedef struct { |
667 | Elf64_Xword d_tag; /* entry tag value */ | | 666 | Elf64_Xword d_tag; /* entry tag value */ |
668 | union { | | 667 | union { |
669 | Elf64_Addr d_ptr; | | 668 | Elf64_Addr d_ptr; |
670 | Elf64_Xword d_val; | | 669 | Elf64_Xword d_val; |
671 | } d_un; | | 670 | } d_un; |
672 | } Elf64_Dyn; | | 671 | } Elf64_Dyn; |
673 | | | 672 | |
674 | /* d_tag */ | | 673 | /* d_tag */ |
675 | #define DT_NULL 0 /* Marks end of dynamic array */ | | 674 | #define DT_NULL 0 /* Marks end of dynamic array */ |
676 | #define DT_NEEDED 1 /* Name of needed library (DT_STRTAB offset) */ | | 675 | #define DT_NEEDED 1 /* Name of needed library (DT_STRTAB offset) */ |
677 | #define DT_PLTRELSZ 2 /* Size, in bytes, of relocations in PLT */ | | 676 | #define DT_PLTRELSZ 2 /* Size, in bytes, of relocations in PLT */ |
678 | #define DT_PLTGOT 3 /* Address of PLT and/or GOT */ | | 677 | #define DT_PLTGOT 3 /* Address of PLT and/or GOT */ |
679 | #define DT_HASH 4 /* Address of symbol hash table */ | | 678 | #define DT_HASH 4 /* Address of symbol hash table */ |
680 | #define DT_STRTAB 5 /* Address of string table */ | | 679 | #define DT_STRTAB 5 /* Address of string table */ |
681 | #define DT_SYMTAB 6 /* Address of symbol table */ | | 680 | #define DT_SYMTAB 6 /* Address of symbol table */ |
682 | #define DT_RELA 7 /* Address of Rela relocation table */ | | 681 | #define DT_RELA 7 /* Address of Rela relocation table */ |
683 | #define DT_RELASZ 8 /* Size, in bytes, of DT_RELA table */ | | 682 | #define DT_RELASZ 8 /* Size, in bytes, of DT_RELA table */ |
684 | #define DT_RELAENT 9 /* Size, in bytes, of one DT_RELA entry */ | | 683 | #define DT_RELAENT 9 /* Size, in bytes, of one DT_RELA entry */ |
685 | #define DT_STRSZ 10 /* Size, in bytes, of DT_STRTAB table */ | | 684 | #define DT_STRSZ 10 /* Size, in bytes, of DT_STRTAB table */ |
686 | #define DT_SYMENT 11 /* Size, in bytes, of one DT_SYMTAB entry */ | | 685 | #define DT_SYMENT 11 /* Size, in bytes, of one DT_SYMTAB entry */ |
687 | #define DT_INIT 12 /* Address of initialization function */ | | 686 | #define DT_INIT 12 /* Address of initialization function */ |
688 | #define DT_FINI 13 /* Address of termination function */ | | 687 | #define DT_FINI 13 /* Address of termination function */ |
689 | #define DT_SONAME 14 /* Shared object name (DT_STRTAB offset) */ | | 688 | #define DT_SONAME 14 /* Shared object name (DT_STRTAB offset) */ |
690 | #define DT_RPATH 15 /* Library search path (DT_STRTAB offset) */ | | 689 | #define DT_RPATH 15 /* Library search path (DT_STRTAB offset) */ |
691 | #define DT_SYMBOLIC 16 /* Start symbol search within local object */ | | 690 | #define DT_SYMBOLIC 16 /* Start symbol search within local object */ |
692 | #define DT_REL 17 /* Address of Rel relocation table */ | | 691 | #define DT_REL 17 /* Address of Rel relocation table */ |
693 | #define DT_RELSZ 18 /* Size, in bytes, of DT_REL table */ | | 692 | #define DT_RELSZ 18 /* Size, in bytes, of DT_REL table */ |
694 | #define DT_RELENT 19 /* Size, in bytes, of one DT_REL entry */ | | 693 | #define DT_RELENT 19 /* Size, in bytes, of one DT_REL entry */ |
695 | #define DT_PLTREL 20 /* Type of PLT relocation entries */ | | 694 | #define DT_PLTREL 20 /* Type of PLT relocation entries */ |
696 | #define DT_DEBUG 21 /* Used for debugging; unspecified */ | | 695 | #define DT_DEBUG 21 /* Used for debugging; unspecified */ |
697 | #define DT_TEXTREL 22 /* Relocations might modify non-writable seg */ | | 696 | #define DT_TEXTREL 22 /* Relocations might modify non-writable seg */ |
698 | #define DT_JMPREL 23 /* Address of relocations associated with PLT */ | | 697 | #define DT_JMPREL 23 /* Address of relocations associated with PLT */ |
699 | #define DT_BIND_NOW 24 /* Process all relocations at load-time */ | | 698 | #define DT_BIND_NOW 24 /* Process all relocations at load-time */ |
700 | #define DT_INIT_ARRAY 25 /* Address of initialization function array */ | | 699 | #define DT_INIT_ARRAY 25 /* Address of initialization function array */ |
701 | #define DT_FINI_ARRAY 26 /* Size, in bytes, of DT_INIT_ARRAY array */ | | 700 | #define DT_FINI_ARRAY 26 /* Size, in bytes, of DT_INIT_ARRAY array */ |
702 | #define DT_INIT_ARRAYSZ 27 /* Address of termination function array */ | | 701 | #define DT_INIT_ARRAYSZ 27 /* Address of termination function array */ |
703 | #define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/ | | 702 | #define DT_FINI_ARRAYSZ 28 /* Size, in bytes, of DT_FINI_ARRAY array*/ |
704 | #define DT_RUNPATH 29 /* overrides DT_RPATH */ | | 703 | #define DT_RUNPATH 29 /* overrides DT_RPATH */ |
705 | #define DT_FLAGS 30 /* Encodes ORIGIN, SYMBOLIC, TEXTREL, BIND_NOW, STATIC_TLS */ | | 704 | #define DT_FLAGS 30 /* Encodes ORIGIN, SYMBOLIC, TEXTREL, BIND_NOW, STATIC_TLS */ |
706 | #define DT_ENCODING 31 /* ??? */ | | 705 | #define DT_ENCODING 31 /* ??? */ |
707 | #define DT_PREINIT_ARRAY 32 /* Address of pre-init function array */ | | 706 | #define DT_PREINIT_ARRAY 32 /* Address of pre-init function array */ |
708 | #define DT_PREINIT_ARRAYSZ 33 /* Size, in bytes, of DT_PREINIT_ARRAY array */ | | 707 | #define DT_PREINIT_ARRAYSZ 33 /* Size, in bytes, of DT_PREINIT_ARRAY array */ |
709 | #define DT_NUM 34 | | 708 | #define DT_NUM 34 |
710 | | | 709 | |
711 | #define DT_LOOS 0x60000000 /* Operating system specific range */ | | 710 | #define DT_LOOS 0x60000000 /* Operating system specific range */ |
712 | #define DT_VERSYM 0x6ffffff0 /* Symbol versions */ | | 711 | #define DT_VERSYM 0x6ffffff0 /* Symbol versions */ |
713 | #define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */ | | 712 | #define DT_FLAGS_1 0x6ffffffb /* ELF dynamic flags */ |
714 | #define DT_VERDEF 0x6ffffffc /* Versions defined by file */ | | 713 | #define DT_VERDEF 0x6ffffffc /* Versions defined by file */ |
715 | #define DT_VERDEFNUM 0x6ffffffd /* Number of versions defined by file */ | | 714 | #define DT_VERDEFNUM 0x6ffffffd /* Number of versions defined by file */ |
716 | #define DT_VERNEED 0x6ffffffe /* Versions needed by file */ | | 715 | #define DT_VERNEED 0x6ffffffe /* Versions needed by file */ |
717 | #define DT_VERNEEDNUM 0x6fffffff /* Number of versions needed by file */ | | 716 | #define DT_VERNEEDNUM 0x6fffffff /* Number of versions needed by file */ |
718 | #define DT_HIOS 0x6fffffff | | 717 | #define DT_HIOS 0x6fffffff |
719 | #define DT_LOPROC 0x70000000 /* Processor-specific range */ | | 718 | #define DT_LOPROC 0x70000000 /* Processor-specific range */ |
720 | #define DT_HIPROC 0x7fffffff | | 719 | #define DT_HIPROC 0x7fffffff |
721 | | | 720 | |
722 | /* Flag values for DT_FLAGS */ | | 721 | /* Flag values for DT_FLAGS */ |
723 | #define DF_ORIGIN 0x00000001 /* uses $ORIGIN */ | | 722 | #define DF_ORIGIN 0x00000001 /* uses $ORIGIN */ |
724 | #define DF_SYMBOLIC 0x00000002 /* */ | | 723 | #define DF_SYMBOLIC 0x00000002 /* */ |
725 | #define DF_TEXTREL 0x00000004 /* */ | | 724 | #define DF_TEXTREL 0x00000004 /* */ |
726 | #define DF_BIND_NOW 0x00000008 /* */ | | 725 | #define DF_BIND_NOW 0x00000008 /* */ |
727 | #define DF_STATIC_TLS 0x00000010 /* */ | | 726 | #define DF_STATIC_TLS 0x00000010 /* */ |
728 | | | 727 | |
729 | /* Flag values for DT_FLAGS_1 (incomplete) */ | | 728 | /* Flag values for DT_FLAGS_1 (incomplete) */ |
730 | #define DF_1_BIND_NOW 0x00000001 /* Same as DF_BIND_NOW */ | | 729 | #define DF_1_BIND_NOW 0x00000001 /* Same as DF_BIND_NOW */ |
731 | #define DF_1_NODELETE 0x00000008 /* Set the RTLD_NODELETE for object */ | | 730 | #define DF_1_NODELETE 0x00000008 /* Set the RTLD_NODELETE for object */ |
732 | #define DF_1_INITFIRST 0x00000020 /* Object's init/fini take priority */ | | 731 | #define DF_1_INITFIRST 0x00000020 /* Object's init/fini take priority */ |
733 | #define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */ | | 732 | #define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */ |
734 | | | 733 | |
735 | /* | | 734 | /* |
736 | * Auxiliary Vectors | | 735 | * Auxiliary Vectors |
737 | */ | | 736 | */ |
738 | typedef struct { | | 737 | typedef struct { |
739 | Elf32_Word a_type; /* 32-bit id */ | | 738 | Elf32_Word a_type; /* 32-bit id */ |
740 | Elf32_Word a_v; /* 32-bit id */ | | 739 | Elf32_Word a_v; /* 32-bit id */ |
741 | } Aux32Info; | | 740 | } Aux32Info; |
742 | | | 741 | |
743 | typedef struct { | | 742 | typedef struct { |
744 | Elf64_Word a_type; /* 32-bit id */ | | 743 | Elf64_Word a_type; /* 32-bit id */ |
745 | Elf64_Xword a_v; /* 64-bit id */ | | 744 | Elf64_Xword a_v; /* 64-bit id */ |
746 | } Aux64Info; | | 745 | } Aux64Info; |
747 | | | 746 | |
748 | /* a_type */ | | 747 | /* a_type */ |
749 | #define AT_NULL 0 /* Marks end of array */ | | 748 | #define AT_NULL 0 /* Marks end of array */ |
750 | #define AT_IGNORE 1 /* No meaning, a_un is undefined */ | | 749 | #define AT_IGNORE 1 /* No meaning, a_un is undefined */ |
751 | #define AT_EXECFD 2 /* Open file descriptor of object file */ | | 750 | #define AT_EXECFD 2 /* Open file descriptor of object file */ |
752 | #define AT_PHDR 3 /* &phdr[0] */ | | 751 | #define AT_PHDR 3 /* &phdr[0] */ |
753 | #define AT_PHENT 4 /* sizeof(phdr[0]) */ | | 752 | #define AT_PHENT 4 /* sizeof(phdr[0]) */ |
754 | #define AT_PHNUM 5 /* # phdr entries */ | | 753 | #define AT_PHNUM 5 /* # phdr entries */ |
755 | #define AT_PAGESZ 6 /* PAGESIZE */ | | 754 | #define AT_PAGESZ 6 /* PAGESIZE */ |
756 | #define AT_BASE 7 /* Interpreter base addr */ | | 755 | #define AT_BASE 7 /* Interpreter base addr */ |
757 | #define AT_FLAGS 8 /* Processor flags */ | | 756 | #define AT_FLAGS 8 /* Processor flags */ |
758 | #define AT_ENTRY 9 /* Entry address of executable */ | | 757 | #define AT_ENTRY 9 /* Entry address of executable */ |
759 | #define AT_DCACHEBSIZE 10 /* Data cache block size */ | | 758 | #define AT_DCACHEBSIZE 10 /* Data cache block size */ |
760 | #define AT_ICACHEBSIZE 11 /* Instruction cache block size */ | | 759 | #define AT_ICACHEBSIZE 11 /* Instruction cache block size */ |
761 | #define AT_UCACHEBSIZE 12 /* Unified cache block size */ | | 760 | #define AT_UCACHEBSIZE 12 /* Unified cache block size */ |
762 | #define AT_STACKBASE 13 /* Base address of the main thread */ | | 761 | #define AT_STACKBASE 13 /* Base address of the main thread */ |
763 | | | 762 | |
764 | /* Vendor specific */ | | 763 | /* Vendor specific */ |
765 | #define AT_MIPS_NOTELF 10 /* XXX a_val != 0 -> MIPS XCOFF executable */ | | 764 | #define AT_MIPS_NOTELF 10 /* XXX a_val != 0 -> MIPS XCOFF executable */ |
766 | | | 765 | |
767 | #define AT_EUID 2000 /* euid (solaris compatible numbers) */ | | 766 | #define AT_EUID 2000 /* euid (solaris compatible numbers) */ |
768 | #define AT_RUID 2001 /* ruid (solaris compatible numbers) */ | | 767 | #define AT_RUID 2001 /* ruid (solaris compatible numbers) */ |
769 | #define AT_EGID 2002 /* egid (solaris compatible numbers) */ | | 768 | #define AT_EGID 2002 /* egid (solaris compatible numbers) */ |
770 | #define AT_RGID 2003 /* rgid (solaris compatible numbers) */ | | 769 | #define AT_RGID 2003 /* rgid (solaris compatible numbers) */ |
771 | | | 770 | |
772 | /* Solaris kernel specific */ | | 771 | /* Solaris kernel specific */ |
773 | #define AT_SUN_LDELF 2004 /* dynamic linker's ELF header */ | | 772 | #define AT_SUN_LDELF 2004 /* dynamic linker's ELF header */ |
774 | #define AT_SUN_LDSHDR 2005 /* dynamic linker's section header */ | | 773 | #define AT_SUN_LDSHDR 2005 /* dynamic linker's section header */ |
775 | #define AT_SUN_LDNAME 2006 /* dynamic linker's name */ | | 774 | #define AT_SUN_LDNAME 2006 /* dynamic linker's name */ |
776 | #define AT_SUN_LPGSIZE 2007 /* large pagesize */ | | 775 | #define AT_SUN_LPGSIZE 2007 /* large pagesize */ |
777 | | | 776 | |
778 | /* Other information */ | | 777 | /* Other information */ |
779 | #define AT_SUN_PLATFORM 2008 /* sysinfo(SI_PLATFORM) */ | | 778 | #define AT_SUN_PLATFORM 2008 /* sysinfo(SI_PLATFORM) */ |
780 | #define AT_SUN_HWCAP 2009 /* process hardware capabilities */ | | 779 | #define AT_SUN_HWCAP 2009 /* process hardware capabilities */ |
781 | #define AT_SUN_IFLUSH 2010 /* do we need to flush the instruction cache? */ | | 780 | #define AT_SUN_IFLUSH 2010 /* do we need to flush the instruction cache? */ |
782 | #define AT_SUN_CPU 2011 /* CPU name */ | | 781 | #define AT_SUN_CPU 2011 /* CPU name */ |
783 | /* ibcs2 emulation band aid */ | | 782 | /* ibcs2 emulation band aid */ |
784 | #define AT_SUN_EMUL_ENTRY 2012 /* coff entry point */ | | 783 | #define AT_SUN_EMUL_ENTRY 2012 /* coff entry point */ |
785 | #define AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */ | | 784 | #define AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */ |
786 | /* Executable's fully resolved name */ | | 785 | /* Executable's fully resolved name */ |
787 | #define AT_SUN_EXECNAME 2014 | | 786 | #define AT_SUN_EXECNAME 2014 |
788 | | | 787 | |
789 | /* | | 788 | /* |
790 | * The header for GNU-style hash sections. | | 789 | * The header for GNU-style hash sections. |
791 | */ | | 790 | */ |
792 | typedef struct { | | 791 | typedef struct { |
793 | uint32_t gh_nbuckets; /* Number of hash buckets. */ | | 792 | uint32_t gh_nbuckets; /* Number of hash buckets. */ |
794 | uint32_t gh_symndx; /* First visible symbol in .dynsym. */ | | 793 | uint32_t gh_symndx; /* First visible symbol in .dynsym. */ |
795 | uint32_t gh_maskwords; /* #maskwords used in bloom filter. */ | | 794 | uint32_t gh_maskwords; /* #maskwords used in bloom filter. */ |
796 | uint32_t gh_shift2; /* Bloom filter shift count. */ | | 795 | uint32_t gh_shift2; /* Bloom filter shift count. */ |
797 | } Elf_GNU_Hash_Header; | | 796 | } Elf_GNU_Hash_Header; |
798 | | | 797 | |
799 | /* | | 798 | /* |
800 | * Note Headers | | 799 | * Note Headers |
801 | */ | | 800 | */ |
802 | typedef struct { | | 801 | typedef struct { |
803 | Elf32_Word n_namesz; | | 802 | Elf32_Word n_namesz; |
804 | Elf32_Word n_descsz; | | 803 | Elf32_Word n_descsz; |
805 | Elf32_Word n_type; | | 804 | Elf32_Word n_type; |
806 | } Elf32_Nhdr; | | 805 | } Elf32_Nhdr; |
807 | | | 806 | |
808 | typedef struct { | | 807 | typedef struct { |
809 | Elf64_Word n_namesz; | | 808 | Elf64_Word n_namesz; |
810 | Elf64_Word n_descsz; | | 809 | Elf64_Word n_descsz; |
811 | Elf64_Word n_type; | | 810 | Elf64_Word n_type; |
812 | } Elf64_Nhdr; | | 811 | } Elf64_Nhdr; |
813 | | | 812 | |
814 | #define ELF_NOTE_GNU_NAMESZ 4 | | 813 | #define ELF_NOTE_GNU_NAMESZ 4 |
815 | #define ELF_NOTE_GNU_NAME "GNU\0" | | 814 | #define ELF_NOTE_GNU_NAME "GNU\0" |
816 | | | 815 | |
817 | /* | | 816 | /* |
818 | * GNU-specific note type: ABI tag | | 817 | * GNU-specific note type: ABI tag |
819 | * name: GNU\0 | | 818 | * name: GNU\0 |
820 | * namesz: 4 | | 819 | * namesz: 4 |
821 | * desc: | | 820 | * desc: |
822 | * word[0]: OS tag | | 821 | * word[0]: OS tag |
823 | * word[1]: major version | | 822 | * word[1]: major version |
824 | * word[2]: minor version | | 823 | * word[2]: minor version |
825 | * word[3]: teeny version | | 824 | * word[3]: teeny version |
826 | * descsz: 16 | | 825 | * descsz: 16 |
827 | */ | | 826 | */ |
828 | /* GNU-specific note name and description sizes */ | | 827 | /* GNU-specific note name and description sizes */ |
829 | #define ELF_NOTE_TYPE_ABI_TAG 1 | | 828 | #define ELF_NOTE_TYPE_ABI_TAG 1 |
830 | #define ELF_NOTE_ABI_NAME ELF_NOTE_GNU_NAME | | 829 | #define ELF_NOTE_ABI_NAME ELF_NOTE_GNU_NAME |
831 | #define ELF_NOTE_ABI_NAMESZ ELF_NOTE_GNU_NAMESZ | | 830 | #define ELF_NOTE_ABI_NAMESZ ELF_NOTE_GNU_NAMESZ |
832 | #define ELF_NOTE_ABI_DESCSZ 16 | | 831 | #define ELF_NOTE_ABI_DESCSZ 16 |
833 | /* GNU-specific OS/version value stuff */ | | 832 | /* GNU-specific OS/version value stuff */ |
834 | #define ELF_NOTE_ABI_OS_LINUX 0 | | 833 | #define ELF_NOTE_ABI_OS_LINUX 0 |
835 | #define ELF_NOTE_ABI_OS_HURD 1 | | 834 | #define ELF_NOTE_ABI_OS_HURD 1 |
836 | #define ELF_NOTE_ABI_OS_SOLARIS 2 | | 835 | #define ELF_NOTE_ABI_OS_SOLARIS 2 |
837 | #define ELF_NOTE_ABI_OS_KFREEBSD 3 | | 836 | #define ELF_NOTE_ABI_OS_KFREEBSD 3 |
838 | #define ELF_NOTE_ABI_OS_KNETBSD 4 | | 837 | #define ELF_NOTE_ABI_OS_KNETBSD 4 |
839 | | | 838 | |
840 | /* | | 839 | /* |
841 | * GNU-specific note type: Hardware capabilities | | 840 | * GNU-specific note type: Hardware capabilities |
842 | * name: GNU\0 | | 841 | * name: GNU\0 |
843 | * namesz: 4 | | 842 | * namesz: 4 |
844 | * desc: | | 843 | * desc: |
845 | * word[0]: Number of entries | | 844 | * word[0]: Number of entries |
846 | * word[1]: Bitmask of enabled entries | | 845 | * word[1]: Bitmask of enabled entries |
847 | * Followed by a byte id, and a NUL terminated string per entry | | 846 | * Followed by a byte id, and a NUL terminated string per entry |
848 | * descsz: variable | | 847 | * descsz: variable |
849 | */ | | 848 | */ |
850 | #define ELF_NOTE_TYPE_GNU_HWCAP 2 | | 849 | #define ELF_NOTE_TYPE_GNU_HWCAP 2 |
851 | | | 850 | |
852 | /* | | 851 | /* |
853 | * GNU-specific note type: Build ID generated by ld | | 852 | * GNU-specific note type: Build ID generated by ld |
854 | * name: GNU\0 | | 853 | * name: GNU\0 |
855 | * desc: | | 854 | * desc: |
856 | * word[0..4] SHA1 [default] | | 855 | * word[0..4] SHA1 [default] |
857 | * or | | 856 | * or |
858 | * word[0..3] md5 or uuid | | 857 | * word[0..3] md5 or uuid |
859 | * descsz: 16 or 20 | | 858 | * descsz: 16 or 20 |
860 | */ | | 859 | */ |
861 | #define ELF_NOTE_TYPE_GNU_BUILD_ID 3 | | 860 | #define ELF_NOTE_TYPE_GNU_BUILD_ID 3 |
862 | | | 861 | |
863 | /* SuSE-specific note type: ABI | | 862 | /* SuSE-specific note type: ABI |
864 | * name: SuSE\0 | | 863 | * name: SuSE\0 |
865 | * namesz: 5 | | 864 | * namesz: 5 |
866 | * desc: | | 865 | * desc: |
867 | * half[0] = MMmm | | 866 | * half[0] = MMmm |
868 | * | | 867 | * |
869 | * M = product major version | | 868 | * M = product major version |
870 | * m = product minor version | | 869 | * m = product minor version |
871 | * descsz: 2 | | 870 | * descsz: 2 |
872 | */ | | 871 | */ |
873 | #define ELF_NOTE_TYPE_SUSE_TAG 1 | | 872 | #define ELF_NOTE_TYPE_SUSE_TAG 1 |
874 | /* SuSE-specific note name and description sizes */ | | 873 | /* SuSE-specific note name and description sizes */ |
875 | #define ELF_NOTE_SUSE_NAMESZ 5 | | 874 | #define ELF_NOTE_SUSE_NAMESZ 5 |
876 | #define ELF_NOTE_SUSE_DESCSZ 2 | | 875 | #define ELF_NOTE_SUSE_DESCSZ 2 |
877 | /* SuSE-specific note name */ | | 876 | /* SuSE-specific note name */ |
878 | #define ELF_NOTE_SUSE_NAME "SuSE\0" | | 877 | #define ELF_NOTE_SUSE_NAME "SuSE\0" |
879 | | | 878 | |
880 | /* SuSE-specific note type: version | | 879 | /* SuSE-specific note type: version |
881 | * name: SuSE\0\0\0\0 | | 880 | * name: SuSE\0\0\0\0 |
882 | * namesz: 8 | | 881 | * namesz: 8 |
883 | * desc: | | 882 | * desc: |
884 | * word[0] = VVTTMMmm | | 883 | * word[0] = VVTTMMmm |
885 | * | | 884 | * |
886 | * V = version of following data | | 885 | * V = version of following data |
887 | * T = product type: [box, sles, nld, whatever] | | 886 | * T = product type: [box, sles, nld, whatever] |
888 | * M = product major version | | 887 | * M = product major version |
889 | * m = product minor version | | 888 | * m = product minor version |
890 | * descsz: 8 | | 889 | * descsz: 8 |
891 | */ | | 890 | */ |
892 | #define ELF_NOTE_TYPE_SUSE_VERSION_TAG 0x45537553 /* SuSE in LE */ | | 891 | #define ELF_NOTE_TYPE_SUSE_VERSION_TAG 0x45537553 /* SuSE in LE */ |
893 | /* SuSE-specific note name and description sizes */ | | 892 | /* SuSE-specific note name and description sizes */ |
894 | #define ELF_NOTE_SUSE_VERSION_NAMESZ 8 | | 893 | #define ELF_NOTE_SUSE_VERSION_NAMESZ 8 |
895 | #define ELF_NOTE_SUSE_VERSION_DESCSZ 8 | | 894 | #define ELF_NOTE_SUSE_VERSION_DESCSZ 8 |
896 | /* SuSE-specific note name */ | | 895 | /* SuSE-specific note name */ |
897 | #define ELF_NOTE_SUSE_VERSION_NAME "SuSE\0\0\0\0" | | 896 | #define ELF_NOTE_SUSE_VERSION_NAME "SuSE\0\0\0\0" |
898 | | | 897 | |
899 | /* NetBSD-specific note type: Emulation name. | | 898 | /* NetBSD-specific note type: Emulation name. |
900 | * name: NetBSD\0\0 | | 899 | * name: NetBSD\0\0 |
901 | * namesz: 8 | | 900 | * namesz: 8 |
902 | * desc: | | 901 | * desc: |
903 | * word[0]: MMmmrrpp00 | | 902 | * word[0]: MMmmrrpp00 |
904 | * | | 903 | * |
905 | * M = major version | | 904 | * M = major version |
906 | * m = minor version | | 905 | * m = minor version |
907 | * r = release ["",A-Z,Z[A-Z] but numeric] | | 906 | * r = release ["",A-Z,Z[A-Z] but numeric] |
908 | * p = patchlevel | | 907 | * p = patchlevel |
909 | * descsz: 4 | | 908 | * descsz: 4 |
910 | */ | | 909 | */ |
911 | #define ELF_NOTE_TYPE_NETBSD_TAG 1 | | 910 | #define ELF_NOTE_TYPE_NETBSD_TAG 1 |
912 | /* NetBSD-specific note name and description sizes */ | | 911 | /* NetBSD-specific note name and description sizes */ |
913 | #define ELF_NOTE_NETBSD_NAMESZ 7 | | 912 | #define ELF_NOTE_NETBSD_NAMESZ 7 |
914 | #define ELF_NOTE_NETBSD_DESCSZ 4 | | 913 | #define ELF_NOTE_NETBSD_DESCSZ 4 |
915 | /* NetBSD-specific note name */ | | 914 | /* NetBSD-specific note name */ |
916 | #define ELF_NOTE_NETBSD_NAME "NetBSD\0\0" | | 915 | #define ELF_NOTE_NETBSD_NAME "NetBSD\0\0" |
917 | | | 916 | |
918 | /* NetBSD-specific note type: Checksum. | | 917 | /* NetBSD-specific note type: Checksum. |
919 | * There should be 1 NOTE per PT_LOAD section. | | 918 | * There should be 1 NOTE per PT_LOAD section. |
920 | * name: ??? | | 919 | * name: ??? |
921 | * namesz: ??? | | 920 | * namesz: ??? |
922 | * desc: | | 921 | * desc: |
923 | * a tuple of <phnum>(16),<chk-type>(16),<chk-value>. | | 922 | * a tuple of <phnum>(16),<chk-type>(16),<chk-value>. |
924 | * descsz: ??? | | 923 | * descsz: ??? |
925 | */ | | 924 | */ |
926 | #define ELF_NOTE_TYPE_CHECKSUM_TAG 2 | | 925 | #define ELF_NOTE_TYPE_CHECKSUM_TAG 2 |
927 | #define ELF_NOTE_CHECKSUM_CRC32 1 | | 926 | #define ELF_NOTE_CHECKSUM_CRC32 1 |
928 | #define ELF_NOTE_CHECKSUM_MD5 2 | | 927 | #define ELF_NOTE_CHECKSUM_MD5 2 |
929 | #define ELF_NOTE_CHECKSUM_SHA1 3 | | 928 | #define ELF_NOTE_CHECKSUM_SHA1 3 |
930 | #define ELF_NOTE_CHECKSUM_SHA256 4 | | 929 | #define ELF_NOTE_CHECKSUM_SHA256 4 |
931 | | | 930 | |
932 | /* | | 931 | /* |
933 | * NetBSD-specific note type: PaX. | | 932 | * NetBSD-specific note type: PaX. |
934 | * There should be 1 NOTE per executable. | | 933 | * There should be 1 NOTE per executable. |
935 | * name: PaX\0 | | 934 | * name: PaX\0 |
936 | * namesz: 4 | | 935 | * namesz: 4 |
937 | * desc: | | 936 | * desc: |
938 | * word[0]: capability bitmask | | 937 | * word[0]: capability bitmask |
939 | * descsz: 4 | | 938 | * descsz: 4 |
940 | */ | | 939 | */ |
941 | #define ELF_NOTE_TYPE_PAX_TAG 3 | | 940 | #define ELF_NOTE_TYPE_PAX_TAG 3 |
942 | #define ELF_NOTE_PAX_MPROTECT 0x01 /* Force enable Mprotect */ | | 941 | #define ELF_NOTE_PAX_MPROTECT 0x01 /* Force enable Mprotect */ |
943 | #define ELF_NOTE_PAX_NOMPROTECT 0x02 /* Force disable Mprotect */ | | 942 | #define ELF_NOTE_PAX_NOMPROTECT 0x02 /* Force disable Mprotect */ |
944 | #define ELF_NOTE_PAX_GUARD 0x04 /* Force enable Segvguard */ | | 943 | #define ELF_NOTE_PAX_GUARD 0x04 /* Force enable Segvguard */ |
945 | #define ELF_NOTE_PAX_NOGUARD 0x08 /* Force disable Servguard */ | | 944 | #define ELF_NOTE_PAX_NOGUARD 0x08 /* Force disable Servguard */ |
946 | #define ELF_NOTE_PAX_ASLR 0x10 /* Force enable ASLR */ | | 945 | #define ELF_NOTE_PAX_ASLR 0x10 /* Force enable ASLR */ |
947 | #define ELF_NOTE_PAX_NOASLR 0x20 /* Force disable ASLR */ | | 946 | #define ELF_NOTE_PAX_NOASLR 0x20 /* Force disable ASLR */ |
948 | #define ELF_NOTE_PAX_NAMESZ 4 | | 947 | #define ELF_NOTE_PAX_NAMESZ 4 |
949 | #define ELF_NOTE_PAX_NAME "PaX\0" | | 948 | #define ELF_NOTE_PAX_NAME "PaX\0" |
950 | #define ELF_NOTE_PAX_DESCSZ 4 | | 949 | #define ELF_NOTE_PAX_DESCSZ 4 |
951 | | | 950 | |
952 | /* | | 951 | /* |
953 | * NetBSD-specific core file information. | | 952 | * NetBSD-specific core file information. |
954 | * | | 953 | * |
955 | * NetBSD ELF core files use notes to provide information about | | 954 | * NetBSD ELF core files use notes to provide information about |
956 | * the process's state. The note name is "NetBSD-CORE" for | | 955 | * the process's state. The note name is "NetBSD-CORE" for |
957 | * information that is global to the process, and "NetBSD-CORE@nn", | | 956 | * information that is global to the process, and "NetBSD-CORE@nn", |
958 | * where "nn" is the lwpid of the LWP that the information belongs | | 957 | * where "nn" is the lwpid of the LWP that the information belongs |
959 | * to (such as register state). | | 958 | * to (such as register state). |
960 | * | | 959 | * |
961 | * We use the following note identifiers: | | 960 | * We use the following note identifiers: |
962 | * | | 961 | * |
963 | * ELF_NOTE_NETBSD_CORE_PROCINFO | | 962 | * ELF_NOTE_NETBSD_CORE_PROCINFO |
964 | * Note is a "netbsd_elfcore_procinfo" structure. | | 963 | * Note is a "netbsd_elfcore_procinfo" structure. |
965 | * | | 964 | * |
966 | * We also use ptrace(2) request numbers (the ones that exist in | | 965 | * We also use ptrace(2) request numbers (the ones that exist in |
967 | * machine-dependent space) to identify register info notes. The | | 966 | * machine-dependent space) to identify register info notes. The |
968 | * info in such notes is in the same format that ptrace(2) would | | 967 | * info in such notes is in the same format that ptrace(2) would |
969 | * export that information. | | 968 | * export that information. |
970 | * | | 969 | * |
971 | * Please try to keep the members of this structure nicely aligned, | | 970 | * Please try to keep the members of this structure nicely aligned, |
972 | * and if you add elements, add them to the end and bump the version. | | 971 | * and if you add elements, add them to the end and bump the version. |
973 | */ | | 972 | */ |
974 | | | 973 | |
975 | #define ELF_NOTE_NETBSD_CORE_NAME "NetBSD-CORE" | | 974 | #define ELF_NOTE_NETBSD_CORE_NAME "NetBSD-CORE" |
976 | | | 975 | |
977 | #define ELF_NOTE_NETBSD_CORE_PROCINFO 1 | | 976 | #define ELF_NOTE_NETBSD_CORE_PROCINFO 1 |
978 | | | 977 | |
979 | #define NETBSD_ELFCORE_PROCINFO_VERSION 1 | | 978 | #define NETBSD_ELFCORE_PROCINFO_VERSION 1 |
980 | | | 979 | |
981 | struct netbsd_elfcore_procinfo { | | 980 | struct netbsd_elfcore_procinfo { |
982 | /* Version 1 fields start here. */ | | 981 | /* Version 1 fields start here. */ |
983 | uint32_t cpi_version; /* our version */ | | 982 | uint32_t cpi_version; /* our version */ |
984 | uint32_t cpi_cpisize; /* sizeof(this struct) */ | | 983 | uint32_t cpi_cpisize; /* sizeof(this struct) */ |
985 | uint32_t cpi_signo; /* killing signal */ | | 984 | uint32_t cpi_signo; /* killing signal */ |
986 | uint32_t cpi_sigcode; /* signal code */ | | 985 | uint32_t cpi_sigcode; /* signal code */ |
987 | uint32_t cpi_sigpend[4]; /* pending signals */ | | 986 | uint32_t cpi_sigpend[4]; /* pending signals */ |
988 | uint32_t cpi_sigmask[4]; /* blocked signals */ | | 987 | uint32_t cpi_sigmask[4]; /* blocked signals */ |
989 | uint32_t cpi_sigignore[4]; /* ignored signals */ | | 988 | uint32_t cpi_sigignore[4]; /* ignored signals */ |
990 | uint32_t cpi_sigcatch[4]; /* caught signals */ | | 989 | uint32_t cpi_sigcatch[4]; /* caught signals */ |
991 | int32_t cpi_pid; /* process ID */ | | 990 | int32_t cpi_pid; /* process ID */ |
992 | int32_t cpi_ppid; /* parent process ID */ | | 991 | int32_t cpi_ppid; /* parent process ID */ |
993 | int32_t cpi_pgrp; /* process group ID */ | | 992 | int32_t cpi_pgrp; /* process group ID */ |
994 | int32_t cpi_sid; /* session ID */ | | 993 | int32_t cpi_sid; /* session ID */ |
995 | uint32_t cpi_ruid; /* real user ID */ | | 994 | uint32_t cpi_ruid; /* real user ID */ |
996 | uint32_t cpi_euid; /* effective user ID */ | | 995 | uint32_t cpi_euid; /* effective user ID */ |
997 | uint32_t cpi_svuid; /* saved user ID */ | | 996 | uint32_t cpi_svuid; /* saved user ID */ |
998 | uint32_t cpi_rgid; /* real group ID */ | | 997 | uint32_t cpi_rgid; /* real group ID */ |
999 | uint32_t cpi_egid; /* effective group ID */ | | 998 | uint32_t cpi_egid; /* effective group ID */ |
1000 | uint32_t cpi_svgid; /* saved group ID */ | | 999 | uint32_t cpi_svgid; /* saved group ID */ |
1001 | uint32_t cpi_nlwps; /* number of LWPs */ | | 1000 | uint32_t cpi_nlwps; /* number of LWPs */ |
1002 | int8_t cpi_name[32]; /* copy of p->p_comm */ | | 1001 | int8_t cpi_name[32]; /* copy of p->p_comm */ |
1003 | /* Add version 2 fields below here. */ | | 1002 | /* Add version 2 fields below here. */ |
1004 | int32_t cpi_siglwp; /* LWP target of killing signal */ | | 1003 | int32_t cpi_siglwp; /* LWP target of killing signal */ |
1005 | }; | | 1004 | }; |
1006 | | | 1005 | |
1007 | /* | | 1006 | /* |
1008 | * NetBSD-specific note type: MACHINE_ARCH. | | 1007 | * NetBSD-specific note type: MACHINE_ARCH. |
1009 | * There should be 1 NOTE per executable. | | 1008 | * There should be 1 NOTE per executable. |
1010 | * name: NetBSD\0 | | 1009 | * name: NetBSD\0 |
1011 | * namesz: 7 | | 1010 | * namesz: 7 |
1012 | * desc: string | | 1011 | * desc: string |
1013 | * descsz: variable | | 1012 | * descsz: variable |
1014 | */ | | 1013 | */ |
1015 | #define ELF_NOTE_TYPE_MARCH_TAG 5 | | 1014 | #define ELF_NOTE_TYPE_MARCH_TAG 5 |
1016 | /* NetBSD-specific note name and description sizes */ | | 1015 | /* NetBSD-specific note name and description sizes */ |
1017 | #define ELF_NOTE_MARCH_NAMESZ ELF_NOTE_NETBSD_NAMESZ | | 1016 | #define ELF_NOTE_MARCH_NAMESZ ELF_NOTE_NETBSD_NAMESZ |
1018 | /* NetBSD-specific note name */ | | 1017 | /* NetBSD-specific note name */ |
1019 | #define ELF_NOTE_MARCH_NAME ELF_NOTE_NETBSD_NAME | | 1018 | #define ELF_NOTE_MARCH_NAME ELF_NOTE_NETBSD_NAME |
1020 | | | 1019 | |
1021 | /* | | 1020 | /* |
1022 | * NetBSD-specific note type: MCMODEL | | 1021 | * NetBSD-specific note type: MCMODEL |
1023 | * There should be 1 NOTE per executable. | | 1022 | * There should be 1 NOTE per executable. |
1024 | * name: NetBSD\0 | | 1023 | * name: NetBSD\0 |
1025 | * namesz: 7 | | 1024 | * namesz: 7 |
1026 | * code model: string | | 1025 | * code model: string |
1027 | */ | | 1026 | */ |
1028 | | | 1027 | |
1029 | #define ELF_NOTE_TYPE_MCMODEL_TAG 6 | | 1028 | #define ELF_NOTE_TYPE_MCMODEL_TAG 6 |
1030 | /* NetBSD-specific note name and description sizes */ | | 1029 | /* NetBSD-specific note name and description sizes */ |
1031 | #define ELF_NOTE_MCMODEL_NAMESZ ELF_NOTE_NETBSD_NAMESZ | | 1030 | #define ELF_NOTE_MCMODEL_NAMESZ ELF_NOTE_NETBSD_NAMESZ |
1032 | /* NetBSD-specific note name */ | | 1031 | /* NetBSD-specific note name */ |
1033 | #define ELF_NOTE_MCMODEL_NAME ELF_NOTE_NETBSD_NAME | | 1032 | #define ELF_NOTE_MCMODEL_NAME ELF_NOTE_NETBSD_NAME |
1034 | | | 1033 | |
1035 | | | 1034 | |
1036 | #if !defined(ELFSIZE) && defined(ARCH_ELFSIZE) | | 1035 | #if !defined(ELFSIZE) && defined(ARCH_ELFSIZE) |
1037 | #define ELFSIZE ARCH_ELFSIZE | | 1036 | #define ELFSIZE ARCH_ELFSIZE |
1038 | #endif | | 1037 | #endif |
1039 | | | 1038 | |
1040 | #if defined(ELFSIZE) | | 1039 | #if defined(ELFSIZE) |
1041 | #define CONCAT(x,y) __CONCAT(x,y) | | 1040 | #define CONCAT(x,y) __CONCAT(x,y) |
1042 | #define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x))) | | 1041 | #define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x))) |
1043 | #define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y)))) | | 1042 | #define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y)))) |
1044 | #define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE)) | | 1043 | #define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE)) |
1045 | #define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x))) | | 1044 | #define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x))) |
1046 | #endif | | 1045 | #endif |
1047 | | | 1046 | |
1048 | #if defined(ELFSIZE) && (ELFSIZE == 32) | | 1047 | #if defined(ELFSIZE) && (ELFSIZE == 32) |
1049 | #define Elf_Ehdr Elf32_Ehdr | | 1048 | #define Elf_Ehdr Elf32_Ehdr |
1050 | #define Elf_Phdr Elf32_Phdr | | 1049 | #define Elf_Phdr Elf32_Phdr |
1051 | #define Elf_Shdr Elf32_Shdr | | 1050 | #define Elf_Shdr Elf32_Shdr |
1052 | #define Elf_Sym Elf32_Sym | | 1051 | #define Elf_Sym Elf32_Sym |
1053 | #define Elf_Rel Elf32_Rel | | 1052 | #define Elf_Rel Elf32_Rel |
1054 | #define Elf_Rela Elf32_Rela | | 1053 | #define Elf_Rela Elf32_Rela |
1055 | #define Elf_Dyn Elf32_Dyn | | 1054 | #define Elf_Dyn Elf32_Dyn |
1056 | #define Elf_Word Elf32_Word | | 1055 | #define Elf_Word Elf32_Word |
1057 | #define Elf_Sword Elf32_Sword | | 1056 | #define Elf_Sword Elf32_Sword |
1058 | #define Elf_Half Elf32_Half | | 1057 | #define Elf_Half Elf32_Half |
1059 | #define Elf_Addr Elf32_Addr | | 1058 | #define Elf_Addr Elf32_Addr |
1060 | #define Elf_Off Elf32_Off | | 1059 | #define Elf_Off Elf32_Off |
1061 | #define Elf_SOff Elf32_SOff | | 1060 | #define Elf_SOff Elf32_SOff |
1062 | #define Elf_Nhdr Elf32_Nhdr | | 1061 | #define Elf_Nhdr Elf32_Nhdr |
1063 | #define Elf_Verdef Elf32_Verdef | | 1062 | #define Elf_Verdef Elf32_Verdef |
1064 | #define Elf_Verdaux Elf32_Verdaux | | 1063 | #define Elf_Verdaux Elf32_Verdaux |
1065 | #define Elf_Verneed Elf32_Verneed | | 1064 | #define Elf_Verneed Elf32_Verneed |
1066 | #define Elf_Vernaux Elf32_Vernaux | | 1065 | #define Elf_Vernaux Elf32_Vernaux |
1067 | #define Elf_Versym Elf32_Versym | | 1066 | #define Elf_Versym Elf32_Versym |
1068 | | | 1067 | |
1069 | #define ELF_R_SYM ELF32_R_SYM | | 1068 | #define ELF_R_SYM ELF32_R_SYM |
1070 | #define ELF_R_TYPE ELF32_R_TYPE | | 1069 | #define ELF_R_TYPE ELF32_R_TYPE |
1071 | #define ELFCLASS ELFCLASS32 | | 1070 | #define ELFCLASS ELFCLASS32 |
1072 | | | 1071 | |
1073 | #define AuxInfo Aux32Info | | 1072 | #define AuxInfo Aux32Info |
1074 | #elif defined(ELFSIZE) && (ELFSIZE == 64) | | 1073 | #elif defined(ELFSIZE) && (ELFSIZE == 64) |
1075 | #define Elf_Ehdr Elf64_Ehdr | | 1074 | #define Elf_Ehdr Elf64_Ehdr |
1076 | #define Elf_Phdr Elf64_Phdr | | 1075 | #define Elf_Phdr Elf64_Phdr |
1077 | #define Elf_Shdr Elf64_Shdr | | 1076 | #define Elf_Shdr Elf64_Shdr |
1078 | #define Elf_Sym Elf64_Sym | | 1077 | #define Elf_Sym Elf64_Sym |
1079 | #define Elf_Rel Elf64_Rel | | 1078 | #define Elf_Rel Elf64_Rel |
1080 | #define Elf_Rela Elf64_Rela | | 1079 | #define Elf_Rela Elf64_Rela |
1081 | #define Elf_Dyn Elf64_Dyn | | 1080 | #define Elf_Dyn Elf64_Dyn |
1082 | #define Elf_Word Elf64_Word | | 1081 | #define Elf_Word Elf64_Word |
1083 | #define Elf_Sword Elf64_Sword | | 1082 | #define Elf_Sword Elf64_Sword |
1084 | #define Elf_Half Elf64_Half | | 1083 | #define Elf_Half Elf64_Half |
1085 | #define Elf_Addr Elf64_Addr | | 1084 | #define Elf_Addr Elf64_Addr |
1086 | #define Elf_Off Elf64_Off | | 1085 | #define Elf_Off Elf64_Off |
1087 | #define Elf_SOff Elf64_SOff | | 1086 | #define Elf_SOff Elf64_SOff |
1088 | #define Elf_Nhdr Elf64_Nhdr | | 1087 | #define Elf_Nhdr Elf64_Nhdr |
1089 | #define Elf_Verdef Elf64_Verdef | | 1088 | #define Elf_Verdef Elf64_Verdef |
1090 | #define Elf_Verdaux Elf64_Verdaux | | 1089 | #define Elf_Verdaux Elf64_Verdaux |
1091 | #define Elf_Verneed Elf64_Verneed | | 1090 | #define Elf_Verneed Elf64_Verneed |
1092 | #define Elf_Vernaux Elf64_Vernaux | | 1091 | #define Elf_Vernaux Elf64_Vernaux |
1093 | #define Elf_Versym Elf64_Versym | | 1092 | #define Elf_Versym Elf64_Versym |
1094 | | | 1093 | |
1095 | #define ELF_R_SYM ELF64_R_SYM | | 1094 | #define ELF_R_SYM ELF64_R_SYM |
1096 | #define ELF_R_TYPE ELF64_R_TYPE | | 1095 | #define ELF_R_TYPE ELF64_R_TYPE |
1097 | #define ELFCLASS ELFCLASS64 | | 1096 | #define ELFCLASS ELFCLASS64 |
1098 | | | 1097 | |
1099 | #define AuxInfo Aux64Info | | 1098 | #define AuxInfo Aux64Info |
1100 | #endif | | 1099 | #endif |
1101 | | | 1100 | |
1102 | #ifndef Elf_Symindx | | 1101 | #ifndef Elf_Symindx |
1103 | #define Elf_Symindx uint32_t | | 1102 | #define Elf_Symindx uint32_t |
1104 | #endif | | 1103 | #endif |
1105 | | | 1104 | |
1106 | #define ELF32_ST_BIND(info) ELF_ST_BIND(info) | | 1105 | #define ELF32_ST_BIND(info) ELF_ST_BIND(info) |
1107 | #define ELF32_ST_TYPE(info) ELF_ST_TYPE(info) | | 1106 | #define ELF32_ST_TYPE(info) ELF_ST_TYPE(info) |
1108 | #define ELF32_ST_INFO(bind,type) ELF_ST_INFO(bind,type) | | 1107 | #define ELF32_ST_INFO(bind,type) ELF_ST_INFO(bind,type) |
1109 | #define ELF32_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other) | | 1108 | #define ELF32_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other) |
1110 | | | 1109 | |
1111 | #define ELF64_ST_BIND(info) ELF_ST_BIND(info) | | 1110 | #define ELF64_ST_BIND(info) ELF_ST_BIND(info) |
1112 | #define ELF64_ST_TYPE(info) ELF_ST_TYPE(info) | | 1111 | #define ELF64_ST_TYPE(info) ELF_ST_TYPE(info) |
1113 | #define ELF64_ST_INFO(bind,type) ELF_ST_INFO(bind,type) | | 1112 | #define ELF64_ST_INFO(bind,type) ELF_ST_INFO(bind,type) |
1114 | #define ELF64_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other) | | 1113 | #define ELF64_ST_VISIBILITY(other) ELF_ST_VISIBILITY(other) |
1115 | | | 1114 | |
1116 | typedef struct { | | 1115 | typedef struct { |
1117 | Elf32_Half si_boundto; /* direct bindings - symbol bound to */ | | 1116 | Elf32_Half si_boundto; /* direct bindings - symbol bound to */ |
1118 | Elf32_Half si_flags; /* per symbol flags */ | | 1117 | Elf32_Half si_flags; /* per symbol flags */ |
1119 | } Elf32_Syminfo; | | 1118 | } Elf32_Syminfo; |
1120 | | | 1119 | |
1121 | typedef struct { | | 1120 | typedef struct { |
1122 | Elf64_Word si_boundto; /* direct bindings - symbol bound to */ | | 1121 | Elf64_Word si_boundto; /* direct bindings - symbol bound to */ |
1123 | Elf64_Word si_flags; /* per symbol flags */ | | 1122 | Elf64_Word si_flags; /* per symbol flags */ |
1124 | } Elf64_Syminfo; | | 1123 | } Elf64_Syminfo; |
1125 | | | 1124 | |
1126 | #define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association | | 1125 | #define SYMINFO_FLG_DIRECT 0x0001 /* symbol ref has direct association |
1127 | to object containing definition */ | | 1126 | to object containing definition */ |
1128 | #define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */ | | 1127 | #define SYMINFO_FLG_PASSTHRU 0x0002 /* ignored - see SYMINFO_FLG_FILTER */ |
1129 | #define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */ | | 1128 | #define SYMINFO_FLG_COPY 0x0004 /* symbol is a copy-reloc */ |
1130 | #define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be | | 1129 | #define SYMINFO_FLG_LAZYLOAD 0x0008 /* object containing defn should be |
1131 | lazily-loaded */ | | 1130 | lazily-loaded */ |
1132 | #define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to | | 1131 | #define SYMINFO_FLG_DIRECTBIND 0x0010 /* ref should be bound directly to |
1133 | object containing definition */ | | 1132 | object containing definition */ |
1134 | #define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference | | 1133 | #define SYMINFO_FLG_NOEXTDIRECT 0x0020 /* don't let an external reference |
1135 | directly bind to this symbol */ | | 1134 | directly bind to this symbol */ |
1136 | #define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */ | | 1135 | #define SYMINFO_FLG_FILTER 0x0002 /* symbol ref is associated to a */ |
1137 | #define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */ | | 1136 | #define SYMINFO_FLG_AUXILIARY 0x0040 /* standard or auxiliary filter */ |
1138 | | | 1137 | |
1139 | #define SYMINFO_BT_SELF 0xffff /* symbol bound to self */ | | 1138 | #define SYMINFO_BT_SELF 0xffff /* symbol bound to self */ |
1140 | #define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */ | | 1139 | #define SYMINFO_BT_PARENT 0xfffe /* symbol bound to parent */ |
1141 | #define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */ | | 1140 | #define SYMINFO_BT_NONE 0xfffd /* no special symbol binding */ |
1142 | #define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */ | | 1141 | #define SYMINFO_BT_EXTERN 0xfffc /* symbol defined as external */ |
1143 | #define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */ | | 1142 | #define SYMINFO_BT_LOWRESERVE 0xff00 /* beginning of reserved entries */ |
1144 | | | 1143 | |
1145 | #define SYMINFO_NONE 0 /* Syminfo version */ | | 1144 | #define SYMINFO_NONE 0 /* Syminfo version */ |
1146 | #define SYMINFO_CURRENT 1 | | 1145 | #define SYMINFO_CURRENT 1 |
1147 | #define SYMINFO_NUM 2 | | 1146 | #define SYMINFO_NUM 2 |
1148 | | | 1147 | |
1149 | /* | | 1148 | /* |
1150 | * These constants are used for Elf32_Verdef struct's version number. | | 1149 | * These constants are used for Elf32_Verdef struct's version number. |
1151 | */ | | 1150 | */ |
1152 | #define VER_DEF_NONE 0 | | 1151 | #define VER_DEF_NONE 0 |
1153 | #define VER_DEF_CURRENT 1 | | 1152 | #define VER_DEF_CURRENT 1 |
1154 | | | 1153 | |
1155 | /* | | 1154 | /* |
1156 | * These constants are used for Elf32_Verdef struct's vd_ndx. | | 1155 | * These constants are used for Elf32_Verdef struct's vd_ndx. |
1157 | */ | | 1156 | */ |
1158 | #define VER_DEF_IDX(x) VER_NDX(x) | | 1157 | #define VER_DEF_IDX(x) VER_NDX(x) |
1159 | | | 1158 | |
1160 | /* | | 1159 | /* |
1161 | * These constants are used for Elf32_Verdef struct's vd_flags. | | 1160 | * These constants are used for Elf32_Verdef struct's vd_flags. |
1162 | */ | | 1161 | */ |
1163 | #define VER_FLG_BASE 0x1 | | 1162 | #define VER_FLG_BASE 0x1 |
1164 | #define VER_FLG_WEAK 0x2 | | 1163 | #define VER_FLG_WEAK 0x2 |
1165 | | | 1164 | |
1166 | /* | | 1165 | /* |
1167 | * These are used in an Elf32_Versym field. | | 1166 | * These are used in an Elf32_Versym field. |
1168 | */ | | 1167 | */ |
1169 | #define VER_NDX_LOCAL 0 | | 1168 | #define VER_NDX_LOCAL 0 |
1170 | #define VER_NDX_GLOBAL 1 | | 1169 | #define VER_NDX_GLOBAL 1 |
1171 | #define VER_NDX_GIVEN 2 | | 1170 | #define VER_NDX_GIVEN 2 |
1172 | | | 1171 | |
1173 | /* | | 1172 | /* |
1174 | * These constants are used for Elf32_Verneed struct's version number. | | 1173 | * These constants are used for Elf32_Verneed struct's version number. |
1175 | */ | | 1174 | */ |
1176 | #define VER_NEED_NONE 0 | | 1175 | #define VER_NEED_NONE 0 |
1177 | #define VER_NEED_CURRENT 1 | | 1176 | #define VER_NEED_CURRENT 1 |
1178 | | | 1177 | |
1179 | /* | | 1178 | /* |
1180 | * These constants are used for Elf32_Vernaux struct's vna_other. | | 1179 | * These constants are used for Elf32_Vernaux struct's vna_other. |
1181 | */ | | 1180 | */ |
1182 | #define VER_NEED_HIDDEN VER_NDX_HIDDEN | | 1181 | #define VER_NEED_HIDDEN VER_NDX_HIDDEN |
1183 | #define VER_NEED_IDX(x) VER_NDX(x) | | 1182 | #define VER_NEED_IDX(x) VER_NDX(x) |
1184 | | | 1183 | |
1185 | /* index */ | | 1184 | /* index */ |
1186 | #define VER_NDX_HIDDEN 0x8000 | | 1185 | #define VER_NDX_HIDDEN 0x8000 |
1187 | #define VER_NDX(x) ((x) & ~VER_NDX_HIDDEN) | | 1186 | #define VER_NDX(x) ((x) & ~VER_NDX_HIDDEN) |
1188 | | | 1187 | |
1189 | /* | | 1188 | /* |
1190 | * GNU Extension hidding symbol | | 1189 | * GNU Extension hidding symbol |
1191 | */ | | 1190 | */ |
1192 | #define VERSYM_HIDDEN 0x8000 | | 1191 | #define VERSYM_HIDDEN 0x8000 |
1193 | #define VERSYM_VERSION 0x7fff | | 1192 | #define VERSYM_VERSION 0x7fff |
1194 | | | 1193 | |
1195 | #define ELF_VER_CHR '@' | | 1194 | #define ELF_VER_CHR '@' |
1196 | | | 1195 | |
1197 | /* | | 1196 | /* |
1198 | * These are current size independent. | | 1197 | * These are current size independent. |
1199 | */ | | 1198 | */ |
1200 | | | 1199 | |
1201 | typedef struct { | | 1200 | typedef struct { |
1202 | Elf32_Half vd_version; /* version number of structure */ | | 1201 | Elf32_Half vd_version; /* version number of structure */ |
1203 | Elf32_Half vd_flags; /* flags (VER_FLG_*) */ | | 1202 | Elf32_Half vd_flags; /* flags (VER_FLG_*) */ |
1204 | Elf32_Half vd_ndx; /* version index */ | | 1203 | Elf32_Half vd_ndx; /* version index */ |
1205 | Elf32_Half vd_cnt; /* number of verdaux entries */ | | 1204 | Elf32_Half vd_cnt; /* number of verdaux entries */ |
1206 | Elf32_Word vd_hash; /* hash of name */ | | 1205 | Elf32_Word vd_hash; /* hash of name */ |
1207 | Elf32_Word vd_aux; /* offset to verdaux entries */ | | 1206 | Elf32_Word vd_aux; /* offset to verdaux entries */ |
1208 | Elf32_Word vd_next; /* offset to next verdef */ | | 1207 | Elf32_Word vd_next; /* offset to next verdef */ |
1209 | } Elf32_Verdef; | | 1208 | } Elf32_Verdef; |
1210 | typedef Elf32_Verdef Elf64_Verdef; | | 1209 | typedef Elf32_Verdef Elf64_Verdef; |
1211 | | | 1210 | |
1212 | typedef struct { | | 1211 | typedef struct { |
1213 | Elf32_Word vda_name; /* string table offset of name */ | | 1212 | Elf32_Word vda_name; /* string table offset of name */ |
1214 | Elf32_Word vda_next; /* offset to verdaux */ | | 1213 | Elf32_Word vda_next; /* offset to verdaux */ |
1215 | } Elf32_Verdaux; | | 1214 | } Elf32_Verdaux; |
1216 | typedef Elf32_Verdaux Elf64_Verdaux; | | 1215 | typedef Elf32_Verdaux Elf64_Verdaux; |
1217 | | | 1216 | |
1218 | typedef struct { | | 1217 | typedef struct { |
1219 | Elf32_Half vn_version; /* version number of structure */ | | 1218 | Elf32_Half vn_version; /* version number of structure */ |
1220 | Elf32_Half vn_cnt; /* number of vernaux entries */ | | 1219 | Elf32_Half vn_cnt; /* number of vernaux entries */ |
1221 | Elf32_Word vn_file; /* string table offset of library name*/ | | 1220 | Elf32_Word vn_file; /* string table offset of library name*/ |
1222 | Elf32_Word vn_aux; /* offset to vernaux entries */ | | 1221 | Elf32_Word vn_aux; /* offset to vernaux entries */ |
1223 | Elf32_Word vn_next; /* offset to next verneed */ | | 1222 | Elf32_Word vn_next; /* offset to next verneed */ |
1224 | } Elf32_Verneed; | | 1223 | } Elf32_Verneed; |
1225 | typedef Elf32_Verneed Elf64_Verneed; | | 1224 | typedef Elf32_Verneed Elf64_Verneed; |
1226 | | | 1225 | |
1227 | typedef struct { | | 1226 | typedef struct { |
1228 | Elf32_Word vna_hash; /* Hash of dependency name */ | | 1227 | Elf32_Word vna_hash; /* Hash of dependency name */ |
1229 | Elf32_Half vna_flags; /* flags (VER_FLG_*) */ | | 1228 | Elf32_Half vna_flags; /* flags (VER_FLG_*) */ |
1230 | Elf32_Half vna_other; /* unused */ | | 1229 | Elf32_Half vna_other; /* unused */ |
1231 | Elf32_Word vna_name; /* string table offset to version name*/ | | 1230 | Elf32_Word vna_name; /* string table offset to version name*/ |
1232 | Elf32_Word vna_next; /* offset to next vernaux */ | | 1231 | Elf32_Word vna_next; /* offset to next vernaux */ |
1233 | } Elf32_Vernaux; | | 1232 | } Elf32_Vernaux; |
1234 | typedef Elf32_Vernaux Elf64_Vernaux; | | 1233 | typedef Elf32_Vernaux Elf64_Vernaux; |
1235 | | | 1234 | |
1236 | typedef struct { | | 1235 | typedef struct { |
1237 | Elf32_Half vs_vers; | | 1236 | Elf32_Half vs_vers; |
1238 | } Elf32_Versym; | | 1237 | } Elf32_Versym; |
1239 | typedef Elf32_Versym Elf64_Versym; | | 1238 | typedef Elf32_Versym Elf64_Versym; |
1240 | | | 1239 | |
1241 | #ifdef _KERNEL | | 1240 | #ifdef _KERNEL |
1242 | | | 1241 | |
1243 | /* | | 1242 | /* |
1244 | * Arbitrary limits to avoid DoS for excessive memory allocation. | | 1243 | * Arbitrary limits to avoid DoS for excessive memory allocation. |
1245 | */ | | 1244 | */ |
1246 | #define ELF_MAXPHNUM 128 | | 1245 | #define ELF_MAXPHNUM 128 |
1247 | #define ELF_MAXSHNUM 32768 | | 1246 | #define ELF_MAXSHNUM 32768 |
1248 | #define ELF_MAXNOTESIZE 1024 | | 1247 | #define ELF_MAXNOTESIZE 1024 |
1249 | | | 1248 | |
1250 | #define ELF_AUX_ENTRIES 15 /* Max size of aux array passed to loader */ | | 1249 | #define ELF_AUX_ENTRIES 15 /* Max size of aux array passed to loader */ |
1251 | #define ELF32_NO_ADDR (~(Elf32_Addr)0) /* Indicates addr. not yet filled in */ | | 1250 | #define ELF32_NO_ADDR (~(Elf32_Addr)0) /* Indicates addr. not yet filled in */ |
1252 | #define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */ | | 1251 | #define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */ |
1253 | #define ELF64_NO_ADDR (~(Elf64_Addr)0) /* Indicates addr. not yet filled in */ | | 1252 | #define ELF64_NO_ADDR (~(Elf64_Addr)0) /* Indicates addr. not yet filled in */ |
1254 | #define ELF64_LINK_ADDR ((Elf64_Addr)-2) /* advises to use link address */ | | 1253 | #define ELF64_LINK_ADDR ((Elf64_Addr)-2) /* advises to use link address */ |
1255 | | | 1254 | |
1256 | #if defined(ELFSIZE) && (ELFSIZE == 64) | | 1255 | #if defined(ELFSIZE) && (ELFSIZE == 64) |
1257 | #define ELF_NO_ADDR ELF64_NO_ADDR | | 1256 | #define ELF_NO_ADDR ELF64_NO_ADDR |
1258 | #define ELF_LINK_ADDR ELF64_LINK_ADDR | | 1257 | #define ELF_LINK_ADDR ELF64_LINK_ADDR |
1259 | #elif defined(ELFSIZE) && (ELFSIZE == 32) | | 1258 | #elif defined(ELFSIZE) && (ELFSIZE == 32) |
1260 | #define ELF_NO_ADDR ELF32_NO_ADDR | | 1259 | #define ELF_NO_ADDR ELF32_NO_ADDR |
1261 | #define ELF_LINK_ADDR ELF32_LINK_ADDR | | 1260 | #define ELF_LINK_ADDR ELF32_LINK_ADDR |
1262 | #endif | | 1261 | #endif |
1263 | | | 1262 | |
1264 | #ifndef ELF32_EHDR_FLAGS_OK | | 1263 | #ifndef ELF32_EHDR_FLAGS_OK |
1265 | #define ELF32_EHDR_FLAGS_OK(eh) 1 | | 1264 | #define ELF32_EHDR_FLAGS_OK(eh) 1 |
1266 | #endif | | 1265 | #endif |
1267 | | | 1266 | |
1268 | #ifndef ELF64_EHDR_FLAGS_OK | | 1267 | #ifndef ELF64_EHDR_FLAGS_OK |
1269 | #define ELF64_EHDR_FLAGS_OK(eh) 1 | | 1268 | #define ELF64_EHDR_FLAGS_OK(eh) 1 |
1270 | #endif | | 1269 | #endif |
1271 | | | 1270 | |
1272 | #if defined(ELFSIZE) && (ELFSIZE == 64) | | 1271 | #if defined(ELFSIZE) && (ELFSIZE == 64) |
1273 | #define ELF_EHDR_FLAGS_OK(eh) ELF64_EHDR_FLAGS_OK(eh) | | 1272 | #define ELF_EHDR_FLAGS_OK(eh) ELF64_EHDR_FLAGS_OK(eh) |
1274 | #else | | 1273 | #else |
1275 | #define ELF_EHDR_FLAGS_OK(eh) ELF32_EHDR_FLAGS_OK(eh) | | 1274 | #define ELF_EHDR_FLAGS_OK(eh) ELF32_EHDR_FLAGS_OK(eh) |
1276 | #endif | | 1275 | #endif |
1277 | | | 1276 | |
1278 | #if defined(ELFSIZE) | | 1277 | #if defined(ELFSIZE) |
1279 | struct elf_args { | | 1278 | struct elf_args { |
1280 | Elf_Addr arg_entry; /* program entry point */ | | 1279 | Elf_Addr arg_entry; /* program entry point */ |
1281 | Elf_Addr arg_interp; /* Interpreter load address */ | | 1280 | Elf_Addr arg_interp; /* Interpreter load address */ |
1282 | Elf_Addr arg_phaddr; /* program header address */ | | 1281 | Elf_Addr arg_phaddr; /* program header address */ |
1283 | Elf_Addr arg_phentsize; /* Size of program header */ | | 1282 | Elf_Addr arg_phentsize; /* Size of program header */ |
1284 | Elf_Addr arg_phnum; /* Number of program headers */ | | 1283 | Elf_Addr arg_phnum; /* Number of program headers */ |
1285 | }; | | 1284 | }; |
1286 | #endif | | 1285 | #endif |
1287 | | | 1286 | |
1288 | #ifdef _KERNEL_OPT | | 1287 | #ifdef _KERNEL_OPT |
1289 | #include "opt_execfmt.h" | | 1288 | #include "opt_execfmt.h" |
1290 | #endif | | 1289 | #endif |
1291 | | | 1290 | |
1292 | struct ps_strings; | | 1291 | struct ps_strings; |
1293 | struct coredump_iostate; | | 1292 | struct coredump_iostate; |
1294 | struct note_state; | | 1293 | struct note_state; |
1295 | struct exec_package; | | 1294 | struct exec_package; |
1296 | | | 1295 | |
1297 | #ifdef EXEC_ELF32 | | 1296 | #ifdef EXEC_ELF32 |
1298 | int exec_elf32_makecmds(struct lwp *, struct exec_package *); | | 1297 | int exec_elf32_makecmds(struct lwp *, struct exec_package *); |
1299 | int elf32_copyargs(struct lwp *, struct exec_package *, | | 1298 | int elf32_copyargs(struct lwp *, struct exec_package *, |
1300 | struct ps_strings *, char **, void *); | | 1299 | struct ps_strings *, char **, void *); |
1301 | | | 1300 | |
1302 | int coredump_elf32(struct lwp *, struct coredump_iostate *); | | 1301 | int coredump_elf32(struct lwp *, struct coredump_iostate *); |
1303 | void coredump_savenote_elf32(struct note_state *, unsigned int, | | 1302 | void coredump_savenote_elf32(struct note_state *, unsigned int, |
1304 | const char *, void *, size_t); | | 1303 | const char *, void *, size_t); |
1305 | | | 1304 | |
1306 | int elf32_check_header(Elf32_Ehdr *); | | 1305 | int elf32_check_header(Elf32_Ehdr *); |
1307 | #endif | | 1306 | #endif |
1308 | | | 1307 | |
1309 | #ifdef EXEC_ELF64 | | 1308 | #ifdef EXEC_ELF64 |
1310 | int exec_elf64_makecmds(struct lwp *, struct exec_package *); | | 1309 | int exec_elf64_makecmds(struct lwp *, struct exec_package *); |
1311 | int elf64_copyargs(struct lwp *, struct exec_package *, | | 1310 | int elf64_copyargs(struct lwp *, struct exec_package *, |
1312 | struct ps_strings *, char **, void *); | | 1311 | struct ps_strings *, char **, void *); |
1313 | | | 1312 | |
1314 | int coredump_elf64(struct lwp *, struct coredump_iostate *); | | 1313 | int coredump_elf64(struct lwp *, struct coredump_iostate *); |
1315 | void coredump_savenote_elf64(struct note_state *, unsigned int, | | 1314 | void coredump_savenote_elf64(struct note_state *, unsigned int, |
1316 | const char *, void *, size_t); | | 1315 | const char *, void *, size_t); |
1317 | | | 1316 | |
1318 | int elf64_check_header(Elf64_Ehdr *); | | 1317 | int elf64_check_header(Elf64_Ehdr *); |