Commit 4c3b512c6b054e8c0bf14b1d61b20d4569de0a21

Authored by Dave Martin
Committed by Russell King
1 parent 4394c12442

ARM: 6882/1: ELF: Define new core note type for VFP registers

The VFP registers are not currently included in coredumps,
and there's no existing note type where they can sensibly be
included, so this patch defines a dedicated note type for them.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Acked-by: Will Deacon <Will.Deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Showing 1 changed file with 1 additions and 0 deletions Inline Diff

1 #ifndef _LINUX_ELF_H 1 #ifndef _LINUX_ELF_H
2 #define _LINUX_ELF_H 2 #define _LINUX_ELF_H
3 3
4 #include <linux/types.h> 4 #include <linux/types.h>
5 #include <linux/elf-em.h> 5 #include <linux/elf-em.h>
6 #ifdef __KERNEL__ 6 #ifdef __KERNEL__
7 #include <asm/elf.h> 7 #include <asm/elf.h>
8 #endif 8 #endif
9 9
10 struct file; 10 struct file;
11 11
12 #ifndef elf_read_implies_exec 12 #ifndef elf_read_implies_exec
13 /* Executables for which elf_read_implies_exec() returns TRUE will 13 /* Executables for which elf_read_implies_exec() returns TRUE will
14 have the READ_IMPLIES_EXEC personality flag set automatically. 14 have the READ_IMPLIES_EXEC personality flag set automatically.
15 Override in asm/elf.h as needed. */ 15 Override in asm/elf.h as needed. */
16 # define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 16 # define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
17 #endif 17 #endif
18 18
19 /* 32-bit ELF base types. */ 19 /* 32-bit ELF base types. */
20 typedef __u32 Elf32_Addr; 20 typedef __u32 Elf32_Addr;
21 typedef __u16 Elf32_Half; 21 typedef __u16 Elf32_Half;
22 typedef __u32 Elf32_Off; 22 typedef __u32 Elf32_Off;
23 typedef __s32 Elf32_Sword; 23 typedef __s32 Elf32_Sword;
24 typedef __u32 Elf32_Word; 24 typedef __u32 Elf32_Word;
25 25
26 /* 64-bit ELF base types. */ 26 /* 64-bit ELF base types. */
27 typedef __u64 Elf64_Addr; 27 typedef __u64 Elf64_Addr;
28 typedef __u16 Elf64_Half; 28 typedef __u16 Elf64_Half;
29 typedef __s16 Elf64_SHalf; 29 typedef __s16 Elf64_SHalf;
30 typedef __u64 Elf64_Off; 30 typedef __u64 Elf64_Off;
31 typedef __s32 Elf64_Sword; 31 typedef __s32 Elf64_Sword;
32 typedef __u32 Elf64_Word; 32 typedef __u32 Elf64_Word;
33 typedef __u64 Elf64_Xword; 33 typedef __u64 Elf64_Xword;
34 typedef __s64 Elf64_Sxword; 34 typedef __s64 Elf64_Sxword;
35 35
36 /* These constants are for the segment types stored in the image headers */ 36 /* These constants are for the segment types stored in the image headers */
37 #define PT_NULL 0 37 #define PT_NULL 0
38 #define PT_LOAD 1 38 #define PT_LOAD 1
39 #define PT_DYNAMIC 2 39 #define PT_DYNAMIC 2
40 #define PT_INTERP 3 40 #define PT_INTERP 3
41 #define PT_NOTE 4 41 #define PT_NOTE 4
42 #define PT_SHLIB 5 42 #define PT_SHLIB 5
43 #define PT_PHDR 6 43 #define PT_PHDR 6
44 #define PT_TLS 7 /* Thread local storage segment */ 44 #define PT_TLS 7 /* Thread local storage segment */
45 #define PT_LOOS 0x60000000 /* OS-specific */ 45 #define PT_LOOS 0x60000000 /* OS-specific */
46 #define PT_HIOS 0x6fffffff /* OS-specific */ 46 #define PT_HIOS 0x6fffffff /* OS-specific */
47 #define PT_LOPROC 0x70000000 47 #define PT_LOPROC 0x70000000
48 #define PT_HIPROC 0x7fffffff 48 #define PT_HIPROC 0x7fffffff
49 #define PT_GNU_EH_FRAME 0x6474e550 49 #define PT_GNU_EH_FRAME 0x6474e550
50 50
51 #define PT_GNU_STACK (PT_LOOS + 0x474e551) 51 #define PT_GNU_STACK (PT_LOOS + 0x474e551)
52 52
53 /* 53 /*
54 * Extended Numbering 54 * Extended Numbering
55 * 55 *
56 * If the real number of program header table entries is larger than 56 * If the real number of program header table entries is larger than
57 * or equal to PN_XNUM(0xffff), it is set to sh_info field of the 57 * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
58 * section header at index 0, and PN_XNUM is set to e_phnum 58 * section header at index 0, and PN_XNUM is set to e_phnum
59 * field. Otherwise, the section header at index 0 is zero 59 * field. Otherwise, the section header at index 0 is zero
60 * initialized, if it exists. 60 * initialized, if it exists.
61 * 61 *
62 * Specifications are available in: 62 * Specifications are available in:
63 * 63 *
64 * - Sun microsystems: Linker and Libraries. 64 * - Sun microsystems: Linker and Libraries.
65 * Part No: 817-1984-17, September 2008. 65 * Part No: 817-1984-17, September 2008.
66 * URL: http://docs.sun.com/app/docs/doc/817-1984 66 * URL: http://docs.sun.com/app/docs/doc/817-1984
67 * 67 *
68 * - System V ABI AMD64 Architecture Processor Supplement 68 * - System V ABI AMD64 Architecture Processor Supplement
69 * Draft Version 0.99., 69 * Draft Version 0.99.,
70 * May 11, 2009. 70 * May 11, 2009.
71 * URL: http://www.x86-64.org/ 71 * URL: http://www.x86-64.org/
72 */ 72 */
73 #define PN_XNUM 0xffff 73 #define PN_XNUM 0xffff
74 74
75 /* These constants define the different elf file types */ 75 /* These constants define the different elf file types */
76 #define ET_NONE 0 76 #define ET_NONE 0
77 #define ET_REL 1 77 #define ET_REL 1
78 #define ET_EXEC 2 78 #define ET_EXEC 2
79 #define ET_DYN 3 79 #define ET_DYN 3
80 #define ET_CORE 4 80 #define ET_CORE 4
81 #define ET_LOPROC 0xff00 81 #define ET_LOPROC 0xff00
82 #define ET_HIPROC 0xffff 82 #define ET_HIPROC 0xffff
83 83
84 /* This is the info that is needed to parse the dynamic section of the file */ 84 /* This is the info that is needed to parse the dynamic section of the file */
85 #define DT_NULL 0 85 #define DT_NULL 0
86 #define DT_NEEDED 1 86 #define DT_NEEDED 1
87 #define DT_PLTRELSZ 2 87 #define DT_PLTRELSZ 2
88 #define DT_PLTGOT 3 88 #define DT_PLTGOT 3
89 #define DT_HASH 4 89 #define DT_HASH 4
90 #define DT_STRTAB 5 90 #define DT_STRTAB 5
91 #define DT_SYMTAB 6 91 #define DT_SYMTAB 6
92 #define DT_RELA 7 92 #define DT_RELA 7
93 #define DT_RELASZ 8 93 #define DT_RELASZ 8
94 #define DT_RELAENT 9 94 #define DT_RELAENT 9
95 #define DT_STRSZ 10 95 #define DT_STRSZ 10
96 #define DT_SYMENT 11 96 #define DT_SYMENT 11
97 #define DT_INIT 12 97 #define DT_INIT 12
98 #define DT_FINI 13 98 #define DT_FINI 13
99 #define DT_SONAME 14 99 #define DT_SONAME 14
100 #define DT_RPATH 15 100 #define DT_RPATH 15
101 #define DT_SYMBOLIC 16 101 #define DT_SYMBOLIC 16
102 #define DT_REL 17 102 #define DT_REL 17
103 #define DT_RELSZ 18 103 #define DT_RELSZ 18
104 #define DT_RELENT 19 104 #define DT_RELENT 19
105 #define DT_PLTREL 20 105 #define DT_PLTREL 20
106 #define DT_DEBUG 21 106 #define DT_DEBUG 21
107 #define DT_TEXTREL 22 107 #define DT_TEXTREL 22
108 #define DT_JMPREL 23 108 #define DT_JMPREL 23
109 #define DT_ENCODING 32 109 #define DT_ENCODING 32
110 #define OLD_DT_LOOS 0x60000000 110 #define OLD_DT_LOOS 0x60000000
111 #define DT_LOOS 0x6000000d 111 #define DT_LOOS 0x6000000d
112 #define DT_HIOS 0x6ffff000 112 #define DT_HIOS 0x6ffff000
113 #define DT_VALRNGLO 0x6ffffd00 113 #define DT_VALRNGLO 0x6ffffd00
114 #define DT_VALRNGHI 0x6ffffdff 114 #define DT_VALRNGHI 0x6ffffdff
115 #define DT_ADDRRNGLO 0x6ffffe00 115 #define DT_ADDRRNGLO 0x6ffffe00
116 #define DT_ADDRRNGHI 0x6ffffeff 116 #define DT_ADDRRNGHI 0x6ffffeff
117 #define DT_VERSYM 0x6ffffff0 117 #define DT_VERSYM 0x6ffffff0
118 #define DT_RELACOUNT 0x6ffffff9 118 #define DT_RELACOUNT 0x6ffffff9
119 #define DT_RELCOUNT 0x6ffffffa 119 #define DT_RELCOUNT 0x6ffffffa
120 #define DT_FLAGS_1 0x6ffffffb 120 #define DT_FLAGS_1 0x6ffffffb
121 #define DT_VERDEF 0x6ffffffc 121 #define DT_VERDEF 0x6ffffffc
122 #define DT_VERDEFNUM 0x6ffffffd 122 #define DT_VERDEFNUM 0x6ffffffd
123 #define DT_VERNEED 0x6ffffffe 123 #define DT_VERNEED 0x6ffffffe
124 #define DT_VERNEEDNUM 0x6fffffff 124 #define DT_VERNEEDNUM 0x6fffffff
125 #define OLD_DT_HIOS 0x6fffffff 125 #define OLD_DT_HIOS 0x6fffffff
126 #define DT_LOPROC 0x70000000 126 #define DT_LOPROC 0x70000000
127 #define DT_HIPROC 0x7fffffff 127 #define DT_HIPROC 0x7fffffff
128 128
129 /* This info is needed when parsing the symbol table */ 129 /* This info is needed when parsing the symbol table */
130 #define STB_LOCAL 0 130 #define STB_LOCAL 0
131 #define STB_GLOBAL 1 131 #define STB_GLOBAL 1
132 #define STB_WEAK 2 132 #define STB_WEAK 2
133 133
134 #define STT_NOTYPE 0 134 #define STT_NOTYPE 0
135 #define STT_OBJECT 1 135 #define STT_OBJECT 1
136 #define STT_FUNC 2 136 #define STT_FUNC 2
137 #define STT_SECTION 3 137 #define STT_SECTION 3
138 #define STT_FILE 4 138 #define STT_FILE 4
139 #define STT_COMMON 5 139 #define STT_COMMON 5
140 #define STT_TLS 6 140 #define STT_TLS 6
141 141
142 #define ELF_ST_BIND(x) ((x) >> 4) 142 #define ELF_ST_BIND(x) ((x) >> 4)
143 #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) 143 #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
144 #define ELF32_ST_BIND(x) ELF_ST_BIND(x) 144 #define ELF32_ST_BIND(x) ELF_ST_BIND(x)
145 #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) 145 #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
146 #define ELF64_ST_BIND(x) ELF_ST_BIND(x) 146 #define ELF64_ST_BIND(x) ELF_ST_BIND(x)
147 #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) 147 #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
148 148
149 typedef struct dynamic{ 149 typedef struct dynamic{
150 Elf32_Sword d_tag; 150 Elf32_Sword d_tag;
151 union{ 151 union{
152 Elf32_Sword d_val; 152 Elf32_Sword d_val;
153 Elf32_Addr d_ptr; 153 Elf32_Addr d_ptr;
154 } d_un; 154 } d_un;
155 } Elf32_Dyn; 155 } Elf32_Dyn;
156 156
157 typedef struct { 157 typedef struct {
158 Elf64_Sxword d_tag; /* entry tag value */ 158 Elf64_Sxword d_tag; /* entry tag value */
159 union { 159 union {
160 Elf64_Xword d_val; 160 Elf64_Xword d_val;
161 Elf64_Addr d_ptr; 161 Elf64_Addr d_ptr;
162 } d_un; 162 } d_un;
163 } Elf64_Dyn; 163 } Elf64_Dyn;
164 164
165 /* The following are used with relocations */ 165 /* The following are used with relocations */
166 #define ELF32_R_SYM(x) ((x) >> 8) 166 #define ELF32_R_SYM(x) ((x) >> 8)
167 #define ELF32_R_TYPE(x) ((x) & 0xff) 167 #define ELF32_R_TYPE(x) ((x) & 0xff)
168 168
169 #define ELF64_R_SYM(i) ((i) >> 32) 169 #define ELF64_R_SYM(i) ((i) >> 32)
170 #define ELF64_R_TYPE(i) ((i) & 0xffffffff) 170 #define ELF64_R_TYPE(i) ((i) & 0xffffffff)
171 171
172 typedef struct elf32_rel { 172 typedef struct elf32_rel {
173 Elf32_Addr r_offset; 173 Elf32_Addr r_offset;
174 Elf32_Word r_info; 174 Elf32_Word r_info;
175 } Elf32_Rel; 175 } Elf32_Rel;
176 176
177 typedef struct elf64_rel { 177 typedef struct elf64_rel {
178 Elf64_Addr r_offset; /* Location at which to apply the action */ 178 Elf64_Addr r_offset; /* Location at which to apply the action */
179 Elf64_Xword r_info; /* index and type of relocation */ 179 Elf64_Xword r_info; /* index and type of relocation */
180 } Elf64_Rel; 180 } Elf64_Rel;
181 181
182 typedef struct elf32_rela{ 182 typedef struct elf32_rela{
183 Elf32_Addr r_offset; 183 Elf32_Addr r_offset;
184 Elf32_Word r_info; 184 Elf32_Word r_info;
185 Elf32_Sword r_addend; 185 Elf32_Sword r_addend;
186 } Elf32_Rela; 186 } Elf32_Rela;
187 187
188 typedef struct elf64_rela { 188 typedef struct elf64_rela {
189 Elf64_Addr r_offset; /* Location at which to apply the action */ 189 Elf64_Addr r_offset; /* Location at which to apply the action */
190 Elf64_Xword r_info; /* index and type of relocation */ 190 Elf64_Xword r_info; /* index and type of relocation */
191 Elf64_Sxword r_addend; /* Constant addend used to compute value */ 191 Elf64_Sxword r_addend; /* Constant addend used to compute value */
192 } Elf64_Rela; 192 } Elf64_Rela;
193 193
194 typedef struct elf32_sym{ 194 typedef struct elf32_sym{
195 Elf32_Word st_name; 195 Elf32_Word st_name;
196 Elf32_Addr st_value; 196 Elf32_Addr st_value;
197 Elf32_Word st_size; 197 Elf32_Word st_size;
198 unsigned char st_info; 198 unsigned char st_info;
199 unsigned char st_other; 199 unsigned char st_other;
200 Elf32_Half st_shndx; 200 Elf32_Half st_shndx;
201 } Elf32_Sym; 201 } Elf32_Sym;
202 202
203 typedef struct elf64_sym { 203 typedef struct elf64_sym {
204 Elf64_Word st_name; /* Symbol name, index in string tbl */ 204 Elf64_Word st_name; /* Symbol name, index in string tbl */
205 unsigned char st_info; /* Type and binding attributes */ 205 unsigned char st_info; /* Type and binding attributes */
206 unsigned char st_other; /* No defined meaning, 0 */ 206 unsigned char st_other; /* No defined meaning, 0 */
207 Elf64_Half st_shndx; /* Associated section index */ 207 Elf64_Half st_shndx; /* Associated section index */
208 Elf64_Addr st_value; /* Value of the symbol */ 208 Elf64_Addr st_value; /* Value of the symbol */
209 Elf64_Xword st_size; /* Associated symbol size */ 209 Elf64_Xword st_size; /* Associated symbol size */
210 } Elf64_Sym; 210 } Elf64_Sym;
211 211
212 212
213 #define EI_NIDENT 16 213 #define EI_NIDENT 16
214 214
215 typedef struct elf32_hdr{ 215 typedef struct elf32_hdr{
216 unsigned char e_ident[EI_NIDENT]; 216 unsigned char e_ident[EI_NIDENT];
217 Elf32_Half e_type; 217 Elf32_Half e_type;
218 Elf32_Half e_machine; 218 Elf32_Half e_machine;
219 Elf32_Word e_version; 219 Elf32_Word e_version;
220 Elf32_Addr e_entry; /* Entry point */ 220 Elf32_Addr e_entry; /* Entry point */
221 Elf32_Off e_phoff; 221 Elf32_Off e_phoff;
222 Elf32_Off e_shoff; 222 Elf32_Off e_shoff;
223 Elf32_Word e_flags; 223 Elf32_Word e_flags;
224 Elf32_Half e_ehsize; 224 Elf32_Half e_ehsize;
225 Elf32_Half e_phentsize; 225 Elf32_Half e_phentsize;
226 Elf32_Half e_phnum; 226 Elf32_Half e_phnum;
227 Elf32_Half e_shentsize; 227 Elf32_Half e_shentsize;
228 Elf32_Half e_shnum; 228 Elf32_Half e_shnum;
229 Elf32_Half e_shstrndx; 229 Elf32_Half e_shstrndx;
230 } Elf32_Ehdr; 230 } Elf32_Ehdr;
231 231
232 typedef struct elf64_hdr { 232 typedef struct elf64_hdr {
233 unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ 233 unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
234 Elf64_Half e_type; 234 Elf64_Half e_type;
235 Elf64_Half e_machine; 235 Elf64_Half e_machine;
236 Elf64_Word e_version; 236 Elf64_Word e_version;
237 Elf64_Addr e_entry; /* Entry point virtual address */ 237 Elf64_Addr e_entry; /* Entry point virtual address */
238 Elf64_Off e_phoff; /* Program header table file offset */ 238 Elf64_Off e_phoff; /* Program header table file offset */
239 Elf64_Off e_shoff; /* Section header table file offset */ 239 Elf64_Off e_shoff; /* Section header table file offset */
240 Elf64_Word e_flags; 240 Elf64_Word e_flags;
241 Elf64_Half e_ehsize; 241 Elf64_Half e_ehsize;
242 Elf64_Half e_phentsize; 242 Elf64_Half e_phentsize;
243 Elf64_Half e_phnum; 243 Elf64_Half e_phnum;
244 Elf64_Half e_shentsize; 244 Elf64_Half e_shentsize;
245 Elf64_Half e_shnum; 245 Elf64_Half e_shnum;
246 Elf64_Half e_shstrndx; 246 Elf64_Half e_shstrndx;
247 } Elf64_Ehdr; 247 } Elf64_Ehdr;
248 248
249 /* These constants define the permissions on sections in the program 249 /* These constants define the permissions on sections in the program
250 header, p_flags. */ 250 header, p_flags. */
251 #define PF_R 0x4 251 #define PF_R 0x4
252 #define PF_W 0x2 252 #define PF_W 0x2
253 #define PF_X 0x1 253 #define PF_X 0x1
254 254
255 typedef struct elf32_phdr{ 255 typedef struct elf32_phdr{
256 Elf32_Word p_type; 256 Elf32_Word p_type;
257 Elf32_Off p_offset; 257 Elf32_Off p_offset;
258 Elf32_Addr p_vaddr; 258 Elf32_Addr p_vaddr;
259 Elf32_Addr p_paddr; 259 Elf32_Addr p_paddr;
260 Elf32_Word p_filesz; 260 Elf32_Word p_filesz;
261 Elf32_Word p_memsz; 261 Elf32_Word p_memsz;
262 Elf32_Word p_flags; 262 Elf32_Word p_flags;
263 Elf32_Word p_align; 263 Elf32_Word p_align;
264 } Elf32_Phdr; 264 } Elf32_Phdr;
265 265
266 typedef struct elf64_phdr { 266 typedef struct elf64_phdr {
267 Elf64_Word p_type; 267 Elf64_Word p_type;
268 Elf64_Word p_flags; 268 Elf64_Word p_flags;
269 Elf64_Off p_offset; /* Segment file offset */ 269 Elf64_Off p_offset; /* Segment file offset */
270 Elf64_Addr p_vaddr; /* Segment virtual address */ 270 Elf64_Addr p_vaddr; /* Segment virtual address */
271 Elf64_Addr p_paddr; /* Segment physical address */ 271 Elf64_Addr p_paddr; /* Segment physical address */
272 Elf64_Xword p_filesz; /* Segment size in file */ 272 Elf64_Xword p_filesz; /* Segment size in file */
273 Elf64_Xword p_memsz; /* Segment size in memory */ 273 Elf64_Xword p_memsz; /* Segment size in memory */
274 Elf64_Xword p_align; /* Segment alignment, file & memory */ 274 Elf64_Xword p_align; /* Segment alignment, file & memory */
275 } Elf64_Phdr; 275 } Elf64_Phdr;
276 276
277 /* sh_type */ 277 /* sh_type */
278 #define SHT_NULL 0 278 #define SHT_NULL 0
279 #define SHT_PROGBITS 1 279 #define SHT_PROGBITS 1
280 #define SHT_SYMTAB 2 280 #define SHT_SYMTAB 2
281 #define SHT_STRTAB 3 281 #define SHT_STRTAB 3
282 #define SHT_RELA 4 282 #define SHT_RELA 4
283 #define SHT_HASH 5 283 #define SHT_HASH 5
284 #define SHT_DYNAMIC 6 284 #define SHT_DYNAMIC 6
285 #define SHT_NOTE 7 285 #define SHT_NOTE 7
286 #define SHT_NOBITS 8 286 #define SHT_NOBITS 8
287 #define SHT_REL 9 287 #define SHT_REL 9
288 #define SHT_SHLIB 10 288 #define SHT_SHLIB 10
289 #define SHT_DYNSYM 11 289 #define SHT_DYNSYM 11
290 #define SHT_NUM 12 290 #define SHT_NUM 12
291 #define SHT_LOPROC 0x70000000 291 #define SHT_LOPROC 0x70000000
292 #define SHT_HIPROC 0x7fffffff 292 #define SHT_HIPROC 0x7fffffff
293 #define SHT_LOUSER 0x80000000 293 #define SHT_LOUSER 0x80000000
294 #define SHT_HIUSER 0xffffffff 294 #define SHT_HIUSER 0xffffffff
295 295
296 /* sh_flags */ 296 /* sh_flags */
297 #define SHF_WRITE 0x1 297 #define SHF_WRITE 0x1
298 #define SHF_ALLOC 0x2 298 #define SHF_ALLOC 0x2
299 #define SHF_EXECINSTR 0x4 299 #define SHF_EXECINSTR 0x4
300 #define SHF_MASKPROC 0xf0000000 300 #define SHF_MASKPROC 0xf0000000
301 301
302 /* special section indexes */ 302 /* special section indexes */
303 #define SHN_UNDEF 0 303 #define SHN_UNDEF 0
304 #define SHN_LORESERVE 0xff00 304 #define SHN_LORESERVE 0xff00
305 #define SHN_LOPROC 0xff00 305 #define SHN_LOPROC 0xff00
306 #define SHN_HIPROC 0xff1f 306 #define SHN_HIPROC 0xff1f
307 #define SHN_ABS 0xfff1 307 #define SHN_ABS 0xfff1
308 #define SHN_COMMON 0xfff2 308 #define SHN_COMMON 0xfff2
309 #define SHN_HIRESERVE 0xffff 309 #define SHN_HIRESERVE 0xffff
310 310
311 typedef struct elf32_shdr { 311 typedef struct elf32_shdr {
312 Elf32_Word sh_name; 312 Elf32_Word sh_name;
313 Elf32_Word sh_type; 313 Elf32_Word sh_type;
314 Elf32_Word sh_flags; 314 Elf32_Word sh_flags;
315 Elf32_Addr sh_addr; 315 Elf32_Addr sh_addr;
316 Elf32_Off sh_offset; 316 Elf32_Off sh_offset;
317 Elf32_Word sh_size; 317 Elf32_Word sh_size;
318 Elf32_Word sh_link; 318 Elf32_Word sh_link;
319 Elf32_Word sh_info; 319 Elf32_Word sh_info;
320 Elf32_Word sh_addralign; 320 Elf32_Word sh_addralign;
321 Elf32_Word sh_entsize; 321 Elf32_Word sh_entsize;
322 } Elf32_Shdr; 322 } Elf32_Shdr;
323 323
324 typedef struct elf64_shdr { 324 typedef struct elf64_shdr {
325 Elf64_Word sh_name; /* Section name, index in string tbl */ 325 Elf64_Word sh_name; /* Section name, index in string tbl */
326 Elf64_Word sh_type; /* Type of section */ 326 Elf64_Word sh_type; /* Type of section */
327 Elf64_Xword sh_flags; /* Miscellaneous section attributes */ 327 Elf64_Xword sh_flags; /* Miscellaneous section attributes */
328 Elf64_Addr sh_addr; /* Section virtual addr at execution */ 328 Elf64_Addr sh_addr; /* Section virtual addr at execution */
329 Elf64_Off sh_offset; /* Section file offset */ 329 Elf64_Off sh_offset; /* Section file offset */
330 Elf64_Xword sh_size; /* Size of section in bytes */ 330 Elf64_Xword sh_size; /* Size of section in bytes */
331 Elf64_Word sh_link; /* Index of another section */ 331 Elf64_Word sh_link; /* Index of another section */
332 Elf64_Word sh_info; /* Additional section information */ 332 Elf64_Word sh_info; /* Additional section information */
333 Elf64_Xword sh_addralign; /* Section alignment */ 333 Elf64_Xword sh_addralign; /* Section alignment */
334 Elf64_Xword sh_entsize; /* Entry size if section holds table */ 334 Elf64_Xword sh_entsize; /* Entry size if section holds table */
335 } Elf64_Shdr; 335 } Elf64_Shdr;
336 336
337 #define EI_MAG0 0 /* e_ident[] indexes */ 337 #define EI_MAG0 0 /* e_ident[] indexes */
338 #define EI_MAG1 1 338 #define EI_MAG1 1
339 #define EI_MAG2 2 339 #define EI_MAG2 2
340 #define EI_MAG3 3 340 #define EI_MAG3 3
341 #define EI_CLASS 4 341 #define EI_CLASS 4
342 #define EI_DATA 5 342 #define EI_DATA 5
343 #define EI_VERSION 6 343 #define EI_VERSION 6
344 #define EI_OSABI 7 344 #define EI_OSABI 7
345 #define EI_PAD 8 345 #define EI_PAD 8
346 346
347 #define ELFMAG0 0x7f /* EI_MAG */ 347 #define ELFMAG0 0x7f /* EI_MAG */
348 #define ELFMAG1 'E' 348 #define ELFMAG1 'E'
349 #define ELFMAG2 'L' 349 #define ELFMAG2 'L'
350 #define ELFMAG3 'F' 350 #define ELFMAG3 'F'
351 #define ELFMAG "\177ELF" 351 #define ELFMAG "\177ELF"
352 #define SELFMAG 4 352 #define SELFMAG 4
353 353
354 #define ELFCLASSNONE 0 /* EI_CLASS */ 354 #define ELFCLASSNONE 0 /* EI_CLASS */
355 #define ELFCLASS32 1 355 #define ELFCLASS32 1
356 #define ELFCLASS64 2 356 #define ELFCLASS64 2
357 #define ELFCLASSNUM 3 357 #define ELFCLASSNUM 3
358 358
359 #define ELFDATANONE 0 /* e_ident[EI_DATA] */ 359 #define ELFDATANONE 0 /* e_ident[EI_DATA] */
360 #define ELFDATA2LSB 1 360 #define ELFDATA2LSB 1
361 #define ELFDATA2MSB 2 361 #define ELFDATA2MSB 2
362 362
363 #define EV_NONE 0 /* e_version, EI_VERSION */ 363 #define EV_NONE 0 /* e_version, EI_VERSION */
364 #define EV_CURRENT 1 364 #define EV_CURRENT 1
365 #define EV_NUM 2 365 #define EV_NUM 2
366 366
367 #define ELFOSABI_NONE 0 367 #define ELFOSABI_NONE 0
368 #define ELFOSABI_LINUX 3 368 #define ELFOSABI_LINUX 3
369 369
370 #ifndef ELF_OSABI 370 #ifndef ELF_OSABI
371 #define ELF_OSABI ELFOSABI_NONE 371 #define ELF_OSABI ELFOSABI_NONE
372 #endif 372 #endif
373 373
374 /* 374 /*
375 * Notes used in ET_CORE. Architectures export some of the arch register sets 375 * Notes used in ET_CORE. Architectures export some of the arch register sets
376 * using the corresponding note types via the PTRACE_GETREGSET and 376 * using the corresponding note types via the PTRACE_GETREGSET and
377 * PTRACE_SETREGSET requests. 377 * PTRACE_SETREGSET requests.
378 */ 378 */
379 #define NT_PRSTATUS 1 379 #define NT_PRSTATUS 1
380 #define NT_PRFPREG 2 380 #define NT_PRFPREG 2
381 #define NT_PRPSINFO 3 381 #define NT_PRPSINFO 3
382 #define NT_TASKSTRUCT 4 382 #define NT_TASKSTRUCT 4
383 #define NT_AUXV 6 383 #define NT_AUXV 6
384 #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 384 #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
385 #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 385 #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
386 #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 386 #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
387 #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 387 #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
388 #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 388 #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
389 #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 389 #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
390 #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ 390 #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
391 #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ 391 #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
392 #define NT_S390_TIMER 0x301 /* s390 timer register */ 392 #define NT_S390_TIMER 0x301 /* s390 timer register */
393 #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ 393 #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
394 #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ 394 #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
395 #define NT_S390_CTRS 0x304 /* s390 control registers */ 395 #define NT_S390_CTRS 0x304 /* s390 control registers */
396 #define NT_S390_PREFIX 0x305 /* s390 prefix register */ 396 #define NT_S390_PREFIX 0x305 /* s390 prefix register */
397 #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ 397 #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
398 #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
398 399
399 400
400 /* Note header in a PT_NOTE section */ 401 /* Note header in a PT_NOTE section */
401 typedef struct elf32_note { 402 typedef struct elf32_note {
402 Elf32_Word n_namesz; /* Name size */ 403 Elf32_Word n_namesz; /* Name size */
403 Elf32_Word n_descsz; /* Content size */ 404 Elf32_Word n_descsz; /* Content size */
404 Elf32_Word n_type; /* Content type */ 405 Elf32_Word n_type; /* Content type */
405 } Elf32_Nhdr; 406 } Elf32_Nhdr;
406 407
407 /* Note header in a PT_NOTE section */ 408 /* Note header in a PT_NOTE section */
408 typedef struct elf64_note { 409 typedef struct elf64_note {
409 Elf64_Word n_namesz; /* Name size */ 410 Elf64_Word n_namesz; /* Name size */
410 Elf64_Word n_descsz; /* Content size */ 411 Elf64_Word n_descsz; /* Content size */
411 Elf64_Word n_type; /* Content type */ 412 Elf64_Word n_type; /* Content type */
412 } Elf64_Nhdr; 413 } Elf64_Nhdr;
413 414
414 #ifdef __KERNEL__ 415 #ifdef __KERNEL__
415 #if ELF_CLASS == ELFCLASS32 416 #if ELF_CLASS == ELFCLASS32
416 417
417 extern Elf32_Dyn _DYNAMIC []; 418 extern Elf32_Dyn _DYNAMIC [];
418 #define elfhdr elf32_hdr 419 #define elfhdr elf32_hdr
419 #define elf_phdr elf32_phdr 420 #define elf_phdr elf32_phdr
420 #define elf_shdr elf32_shdr 421 #define elf_shdr elf32_shdr
421 #define elf_note elf32_note 422 #define elf_note elf32_note
422 #define elf_addr_t Elf32_Off 423 #define elf_addr_t Elf32_Off
423 #define Elf_Half Elf32_Half 424 #define Elf_Half Elf32_Half
424 425
425 #else 426 #else
426 427
427 extern Elf64_Dyn _DYNAMIC []; 428 extern Elf64_Dyn _DYNAMIC [];
428 #define elfhdr elf64_hdr 429 #define elfhdr elf64_hdr
429 #define elf_phdr elf64_phdr 430 #define elf_phdr elf64_phdr
430 #define elf_shdr elf64_shdr 431 #define elf_shdr elf64_shdr
431 #define elf_note elf64_note 432 #define elf_note elf64_note
432 #define elf_addr_t Elf64_Off 433 #define elf_addr_t Elf64_Off
433 #define Elf_Half Elf64_Half 434 #define Elf_Half Elf64_Half
434 435
435 #endif 436 #endif
436 437
437 /* Optional callbacks to write extra ELF notes. */ 438 /* Optional callbacks to write extra ELF notes. */
438 #ifndef ARCH_HAVE_EXTRA_ELF_NOTES 439 #ifndef ARCH_HAVE_EXTRA_ELF_NOTES
439 static inline int elf_coredump_extra_notes_size(void) { return 0; } 440 static inline int elf_coredump_extra_notes_size(void) { return 0; }
440 static inline int elf_coredump_extra_notes_write(struct file *file, 441 static inline int elf_coredump_extra_notes_write(struct file *file,
441 loff_t *foffset) { return 0; } 442 loff_t *foffset) { return 0; }
442 #else 443 #else
443 extern int elf_coredump_extra_notes_size(void); 444 extern int elf_coredump_extra_notes_size(void);
444 extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset); 445 extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset);
445 #endif 446 #endif
446 #endif /* __KERNEL__ */ 447 #endif /* __KERNEL__ */
447 #endif /* _LINUX_ELF_H */ 448 #endif /* _LINUX_ELF_H */
448 449