orphan
[debian/elilo] / elf.h
1 /*
2  *  Copyright (C) 2001-2003 Hewlett-Packard Co.
3  *      Contributed by Stephane Eranian <eranian@hpl.hp.com>
4  *
5  * This file is part of the ELILO, the EFI Linux boot loader.
6  *
7  *  GNU EFI is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  GNU EFI is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with GNU EFI; see the file COPYING.  If not, write to the Free
19  *  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20  *  02111-1307, USA.
21  *
22  * Please check out the elilo.txt for complete documentation on how
23  * to use this program.
24  *
25  * Portions of this file are derived from the  LILO/x86
26  * Copyright 1992-1997 Werner Almesberger. 
27  */
28
29 #ifndef __LINUX_ELF_H__
30 #define __LINUX_ELF_H__
31
32 /*
33  * This file was derived from <linux/elf.h>.
34  */
35
36 #include <efi.h>
37
38 /* 32-bit ELF base types. */
39 typedef UINT32  Elf32_Addr;
40 typedef UINT16  Elf32_Half;
41 typedef UINT32  Elf32_Off;
42 typedef INT32   Elf32_Sword;
43 typedef UINT32  Elf32_Word;
44
45 /* 64-bit ELF base types. */
46 typedef UINT64  Elf64_Addr;
47 typedef UINT16  Elf64_Half;
48 typedef INT16   Elf64_SHalf;
49 typedef UINT64  Elf64_Off;
50 typedef INT64   Elf64_Sword;
51 typedef UINT64  Elf64_Word;
52
53 /* These constants are for the segment types stored in the image headers */
54 #define PT_NULL    0
55 #define PT_LOAD    1
56 #define PT_DYNAMIC 2
57 #define PT_INTERP  3
58 #define PT_NOTE    4
59 #define PT_SHLIB   5
60 #define PT_PHDR    6
61 #define PT_LOPROC  0x70000000
62 #define PT_HIPROC  0x7fffffff
63 #define PT_MIPS_REGINFO         0x70000000
64
65 /* Flags in the e_flags field of the header */
66 #define EF_MIPS_NOREORDER 0x00000001
67 #define EF_MIPS_PIC       0x00000002
68 #define EF_MIPS_CPIC      0x00000004
69 #define EF_MIPS_ARCH      0xf0000000
70
71 /* These constants define the different elf file types */
72 #define ET_NONE   0
73 #define ET_REL    1
74 #define ET_EXEC   2
75 #define ET_DYN    3
76 #define ET_CORE   4
77 #define ET_LOPROC 0xff00
78 #define ET_HIPROC 0xffff
79
80 /* These constants define the various ELF target machines */
81 #define EM_NONE  0
82 #define EM_M32   1
83 #define EM_SPARC 2
84 #define EM_386   3
85 #define EM_68K   4
86 #define EM_88K   5
87 #define EM_486   6   /* Perhaps disused */
88 #define EM_860   7
89
90 #define EM_MIPS         8       /* MIPS R3000 (officially, big-endian only) */
91
92 #define EM_MIPS_RS4_BE 10       /* MIPS R4000 big-endian */
93
94 #define EM_PARISC      15       /* HPPA */
95
96 #define EM_SPARC32PLUS 18       /* Sun's "v8plus" */
97
98 #define EM_PPC         20       /* PowerPC */
99
100 #define EM_SH          42       /* SuperH */
101
102 #define EM_SPARCV9     43       /* SPARC v9 64-bit */
103
104 #define EM_IA_64        50      /* HP/Intel IA-64 */
105
106 #define EM_X86_64       62      /* Intel/AMD x86-64 */
107 /*
108  * This is an interim value that we will use until the committee comes
109  * up with a final number.
110  */
111 #define EM_ALPHA        0x9026
112
113
114 /* This is the info that is needed to parse the dynamic section of the file */
115 #define DT_NULL         0
116 #define DT_NEEDED       1
117 #define DT_PLTRELSZ     2
118 #define DT_PLTGOT       3
119 #define DT_HASH         4
120 #define DT_STRTAB       5
121 #define DT_SYMTAB       6
122 #define DT_RELA         7
123 #define DT_RELASZ       8
124 #define DT_RELAENT      9
125 #define DT_STRSZ        10
126 #define DT_SYMENT       11
127 #define DT_INIT         12
128 #define DT_FINI         13
129 #define DT_SONAME       14
130 #define DT_RPATH        15
131 #define DT_SYMBOLIC     16
132 #define DT_REL          17
133 #define DT_RELSZ        18
134 #define DT_RELENT       19
135 #define DT_PLTREL       20
136 #define DT_DEBUG        21
137 #define DT_TEXTREL      22
138 #define DT_JMPREL       23
139 #define DT_LOPROC       0x70000000
140 #define DT_HIPROC       0x7fffffff
141 #define DT_MIPS_RLD_VERSION     0x70000001
142 #define DT_MIPS_TIME_STAMP      0x70000002
143 #define DT_MIPS_ICHECKSUM       0x70000003
144 #define DT_MIPS_IVERSION        0x70000004
145 #define DT_MIPS_FLAGS           0x70000005
146 #  define RHF_NONE                0
147 #  define RHF_HARDWAY             1
148 #  define RHF_NOTPOT              2
149 #define DT_MIPS_BASE_ADDRESS    0x70000006
150 #define DT_MIPS_CONFLICT        0x70000008
151 #define DT_MIPS_LIBLIST         0x70000009
152 #define DT_MIPS_LOCAL_GOTNO     0x7000000a
153 #define DT_MIPS_CONFLICTNO      0x7000000b
154 #define DT_MIPS_LIBLISTNO       0x70000010
155 #define DT_MIPS_SYMTABNO        0x70000011
156 #define DT_MIPS_UNREFEXTNO      0x70000012
157 #define DT_MIPS_GOTSYM          0x70000013
158 #define DT_MIPS_HIPAGENO        0x70000014
159 #define DT_MIPS_RLD_MAP         0x70000016
160
161 /* This info is needed when parsing the symbol table */
162 #define STB_LOCAL  0
163 #define STB_GLOBAL 1
164 #define STB_WEAK   2
165
166 #define STT_NOTYPE  0
167 #define STT_OBJECT  1
168 #define STT_FUNC    2
169 #define STT_SECTION 3
170 #define STT_FILE    4
171
172 #define ELF32_ST_BIND(x) ((x) >> 4)
173 #define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
174
175 /* Symbolic values for the entries in the auxiliary table
176    put on the initial stack */
177 #define AT_NULL   0     /* end of vector */
178 #define AT_IGNORE 1     /* entry should be ignored */
179 #define AT_EXECFD 2     /* file descriptor of program */
180 #define AT_PHDR   3     /* program headers for program */
181 #define AT_PHENT  4     /* size of program header entry */
182 #define AT_PHNUM  5     /* number of program headers */
183 #define AT_PAGESZ 6     /* system page size */
184 #define AT_BASE   7     /* base address of interpreter */
185 #define AT_FLAGS  8     /* flags */
186 #define AT_ENTRY  9     /* entry point of program */
187 #define AT_NOTELF 10    /* program is not ELF */
188 #define AT_UID    11    /* real uid */
189 #define AT_EUID   12    /* effective uid */
190 #define AT_GID    13    /* real gid */
191 #define AT_EGID   14    /* effective gid */
192 #define AT_PLATFORM 15  /* string identifying CPU for optimizations */
193 #define AT_HWCAP  16    /* arch dependent hints at CPU capabilities */
194
195 typedef struct dynamic{
196   Elf32_Sword d_tag;
197   union{
198     Elf32_Sword d_val;
199     Elf32_Addr  d_ptr;
200   } d_un;
201 } Elf32_Dyn;
202
203 typedef struct {
204   Elf64_Word d_tag;             /* entry tag value */
205   union {
206     Elf64_Word d_val;
207     Elf64_Word d_ptr;
208   } d_un;
209 } Elf64_Dyn;
210
211 /* The following are used with relocations */
212 #define ELF32_R_SYM(x) ((x) >> 8)
213 #define ELF32_R_TYPE(x) ((x) & 0xff)
214
215 #define R_386_NONE      0
216 #define R_386_32        1
217 #define R_386_PC32      2
218 #define R_386_GOT32     3
219 #define R_386_PLT32     4
220 #define R_386_COPY      5
221 #define R_386_GLOB_DAT  6
222 #define R_386_JMP_SLOT  7
223 #define R_386_RELATIVE  8
224 #define R_386_GOTOFF    9
225 #define R_386_GOTPC     10
226 #define R_386_NUM       11
227
228 #define R_MIPS_NONE             0
229 #define R_MIPS_16               1
230 #define R_MIPS_32               2
231 #define R_MIPS_REL32            3
232 #define R_MIPS_26               4
233 #define R_MIPS_HI16             5
234 #define R_MIPS_LO16             6
235 #define R_MIPS_GPREL16          7
236 #define R_MIPS_LITERAL          8
237 #define R_MIPS_GOT16            9
238 #define R_MIPS_PC16             10
239 #define R_MIPS_CALL16           11
240 #define R_MIPS_GPREL32          12
241 /* The remaining relocs are defined on Irix, although they are not
242    in the MIPS ELF ABI.  */
243 #define R_MIPS_UNUSED1          13
244 #define R_MIPS_UNUSED2          14
245 #define R_MIPS_UNUSED3          15
246 #define R_MIPS_SHIFT5           16
247 #define R_MIPS_SHIFT6           17
248 #define R_MIPS_64               18
249 #define R_MIPS_GOT_DISP         19
250 #define R_MIPS_GOT_PAGE         20
251 #define R_MIPS_GOT_OFST         21
252 /*
253  * The following two relocation types are specified in the the MIPS ABI
254  * conformance guide version 1.2 but not yet in the psABI.
255  */
256 #define R_MIPS_GOTHI16          22
257 #define R_MIPS_GOTLO16          23
258 #define R_MIPS_SUB              24
259 #define R_MIPS_INSERT_A         25
260 #define R_MIPS_INSERT_B         26
261 #define R_MIPS_DELETE           27
262 #define R_MIPS_HIGHER           28
263 #define R_MIPS_HIGHEST          29
264 /*
265  * The following two relocation types are specified in the the MIPS ABI
266  * conformance guide version 1.2 but not yet in the psABI.
267  */
268 #define R_MIPS_CALLHI16         30
269 #define R_MIPS_CALLLO16         31
270 /*
271  * This range is reserved for vendor specific relocations.
272  */
273 #define R_MIPS_LOVENDOR         100
274 #define R_MIPS_HIVENDOR         127
275
276
277 /*
278  * Sparc ELF relocation types
279  */
280 #define R_SPARC_NONE            0
281 #define R_SPARC_8               1
282 #define R_SPARC_16              2
283 #define R_SPARC_32              3
284 #define R_SPARC_DISP8           4
285 #define R_SPARC_DISP16          5
286 #define R_SPARC_DISP32          6
287 #define R_SPARC_WDISP30         7
288 #define R_SPARC_WDISP22         8
289 #define R_SPARC_HI22            9
290 #define R_SPARC_22              10
291 #define R_SPARC_13              11
292 #define R_SPARC_LO10            12
293 #define R_SPARC_GOT10           13
294 #define R_SPARC_GOT13           14
295 #define R_SPARC_GOT22           15
296 #define R_SPARC_PC10            16
297 #define R_SPARC_PC22            17
298 #define R_SPARC_WPLT30          18
299 #define R_SPARC_COPY            19
300 #define R_SPARC_GLOB_DAT        20
301 #define R_SPARC_JMP_SLOT        21
302 #define R_SPARC_RELATIVE        22
303 #define R_SPARC_UA32            23
304 #define R_SPARC_PLT32           24
305 #define R_SPARC_HIPLT22         25
306 #define R_SPARC_LOPLT10         26
307 #define R_SPARC_PCPLT32         27
308 #define R_SPARC_PCPLT22         28
309 #define R_SPARC_PCPLT10         29
310 #define R_SPARC_10              30
311 #define R_SPARC_11              31
312 #define R_SPARC_WDISP16         40
313 #define R_SPARC_WDISP19         41
314 #define R_SPARC_7               43
315 #define R_SPARC_5               44
316 #define R_SPARC_6               45
317
318 /* Bits present in AT_HWCAP, primarily for Sparc32.  */
319
320 #define HWCAP_SPARC_FLUSH       1    /* CPU supports flush instruction. */
321 #define HWCAP_SPARC_STBAR       2
322 #define HWCAP_SPARC_SWAP        4
323 #define HWCAP_SPARC_MULDIV      8
324 #define HWCAP_SPARC_V9          16
325
326
327 /*
328  * 68k ELF relocation types
329  */
330 #define R_68K_NONE      0
331 #define R_68K_32        1
332 #define R_68K_16        2
333 #define R_68K_8         3
334 #define R_68K_PC32      4
335 #define R_68K_PC16      5
336 #define R_68K_PC8       6
337 #define R_68K_GOT32     7
338 #define R_68K_GOT16     8
339 #define R_68K_GOT8      9
340 #define R_68K_GOT32O    10
341 #define R_68K_GOT16O    11
342 #define R_68K_GOT8O     12
343 #define R_68K_PLT32     13
344 #define R_68K_PLT16     14
345 #define R_68K_PLT8      15
346 #define R_68K_PLT32O    16
347 #define R_68K_PLT16O    17
348 #define R_68K_PLT8O     18
349 #define R_68K_COPY      19
350 #define R_68K_GLOB_DAT  20
351 #define R_68K_JMP_SLOT  21
352 #define R_68K_RELATIVE  22
353
354 /*
355  * Alpha ELF relocation types
356  */
357 #define R_ALPHA_NONE            0       /* No reloc */
358 #define R_ALPHA_REFLONG         1       /* Direct 32 bit */
359 #define R_ALPHA_REFQUAD         2       /* Direct 64 bit */
360 #define R_ALPHA_GPREL32         3       /* GP relative 32 bit */
361 #define R_ALPHA_LITERAL         4       /* GP relative 16 bit w/optimization */
362 #define R_ALPHA_LITUSE          5       /* Optimization hint for LITERAL */
363 #define R_ALPHA_GPDISP          6       /* Add displacement to GP */
364 #define R_ALPHA_BRADDR          7       /* PC+4 relative 23 bit shifted */
365 #define R_ALPHA_HINT            8       /* PC+4 relative 16 bit shifted */
366 #define R_ALPHA_SREL16          9       /* PC relative 16 bit */
367 #define R_ALPHA_SREL32          10      /* PC relative 32 bit */
368 #define R_ALPHA_SREL64          11      /* PC relative 64 bit */
369 #define R_ALPHA_OP_PUSH         12      /* OP stack push */
370 #define R_ALPHA_OP_STORE        13      /* OP stack pop and store */
371 #define R_ALPHA_OP_PSUB         14      /* OP stack subtract */
372 #define R_ALPHA_OP_PRSHIFT      15      /* OP stack right shift */
373 #define R_ALPHA_GPVALUE         16
374 #define R_ALPHA_GPRELHIGH       17
375 #define R_ALPHA_GPRELLOW        18
376 #define R_ALPHA_IMMED_GP_16     19
377 #define R_ALPHA_IMMED_GP_HI32   20
378 #define R_ALPHA_IMMED_SCN_HI32  21
379 #define R_ALPHA_IMMED_BR_HI32   22
380 #define R_ALPHA_IMMED_LO32      23
381 #define R_ALPHA_COPY            24      /* Copy symbol at runtime */
382 #define R_ALPHA_GLOB_DAT        25      /* Create GOT entry */
383 #define R_ALPHA_JMP_SLOT        26      /* Create PLT entry */
384 #define R_ALPHA_RELATIVE        27      /* Adjust by program base */
385
386 /* Legal values for e_flags field of Elf64_Ehdr.  */
387
388 #define EF_ALPHA_32BIT          1       /* All addresses are below 2GB */
389
390
391 typedef struct elf32_rel {
392   Elf32_Addr    r_offset;
393   Elf32_Word    r_info;
394 } Elf32_Rel;
395
396 typedef struct elf64_rel {
397   Elf64_Addr r_offset;  /* Location at which to apply the action */
398   Elf64_Word r_info;    /* index and type of relocation */
399 } Elf64_Rel;
400
401 typedef struct elf32_rela{
402   Elf32_Addr    r_offset;
403   Elf32_Word    r_info;
404   Elf32_Sword   r_addend;
405 } Elf32_Rela;
406
407 typedef struct elf64_rela {
408   Elf64_Addr r_offset;  /* Location at which to apply the action */
409   Elf64_Word r_info;    /* index and type of relocation */
410   Elf64_Word r_addend;  /* Constant addend used to compute value */
411 } Elf64_Rela;
412
413 typedef struct elf32_sym{
414   Elf32_Word    st_name;
415   Elf32_Addr    st_value;
416   Elf32_Word    st_size;
417   unsigned char st_info;
418   unsigned char st_other;
419   Elf32_Half    st_shndx;
420 } Elf32_Sym;
421
422 typedef struct elf64_sym {
423   Elf32_Word st_name;           /* Symbol name, index in string tbl (yes, Elf32) */
424   unsigned char st_info;        /* Type and binding attributes */
425   unsigned char st_other;       /* No defined meaning, 0 */
426   Elf64_Half st_shndx;          /* Associated section index */
427   Elf64_Addr st_value;          /* Value of the symbol */
428   Elf64_Word st_size;           /* Associated symbol size */
429 } Elf64_Sym;
430
431
432 #define EI_NIDENT       16
433
434 typedef struct elf32_hdr{
435   unsigned char e_ident[EI_NIDENT];
436   Elf32_Half    e_type;
437   Elf32_Half    e_machine;
438   Elf32_Word    e_version;
439   Elf32_Addr    e_entry;  /* Entry point */
440   Elf32_Off     e_phoff;
441   Elf32_Off     e_shoff;
442   Elf32_Word    e_flags;
443   Elf32_Half    e_ehsize;
444   Elf32_Half    e_phentsize;
445   Elf32_Half    e_phnum;
446   Elf32_Half    e_shentsize;
447   Elf32_Half    e_shnum;
448   Elf32_Half    e_shstrndx;
449 } Elf32_Ehdr;
450
451 typedef struct elf64_hdr {
452   unsigned char e_ident[16];            /* ELF "magic number" */
453   Elf64_SHalf e_type;
454   Elf64_Half e_machine;
455   INT32 e_version;
456   Elf64_Addr e_entry;           /* Entry point virtual address */
457   Elf64_Off e_phoff;            /* Program header table file offset */
458   Elf64_Off e_shoff;            /* Section header table file offset */
459   INT32 e_flags;
460   Elf64_SHalf e_ehsize;
461   Elf64_SHalf e_phentsize;
462   Elf64_SHalf e_phnum;
463   Elf64_SHalf e_shentsize;
464   Elf64_SHalf e_shnum;
465   Elf64_SHalf e_shstrndx;
466 } Elf64_Ehdr;
467
468 /* These constants define the permissions on sections in the program
469    header, p_flags. */
470 #define PF_R            0x4
471 #define PF_W            0x2
472 #define PF_X            0x1
473
474 typedef struct elf32_phdr{
475   Elf32_Word    p_type;
476   Elf32_Off     p_offset;
477   Elf32_Addr    p_vaddr;
478   Elf32_Addr    p_paddr;
479   Elf32_Word    p_filesz;
480   Elf32_Word    p_memsz;
481   Elf32_Word    p_flags;
482   Elf32_Word    p_align;
483 } Elf32_Phdr;
484
485 typedef struct elf64_phdr {
486   INT32 p_type;
487   INT32 p_flags;
488   Elf64_Off p_offset;           /* Segment file offset */
489   Elf64_Addr p_vaddr;           /* Segment virtual address */
490   Elf64_Addr p_paddr;           /* Segment physical address */
491   Elf64_Word p_filesz;          /* Segment size in file */
492   Elf64_Word p_memsz;           /* Segment size in memory */
493   Elf64_Word p_align;           /* Segment alignment, file & memory */
494 } Elf64_Phdr;
495
496 /* sh_type */
497 #define SHT_NULL        0
498 #define SHT_PROGBITS    1
499 #define SHT_SYMTAB      2
500 #define SHT_STRTAB      3
501 #define SHT_RELA        4
502 #define SHT_HASH        5
503 #define SHT_DYNAMIC     6
504 #define SHT_NOTE        7
505 #define SHT_NOBITS      8
506 #define SHT_REL         9
507 #define SHT_SHLIB       10
508 #define SHT_DYNSYM      11
509 #define SHT_NUM         12
510 #define SHT_LOPROC      0x70000000
511 #define SHT_HIPROC      0x7fffffff
512 #define SHT_LOUSER      0x80000000
513 #define SHT_HIUSER      0xffffffff
514 #define SHT_MIPS_LIST           0x70000000
515 #define SHT_MIPS_CONFLICT       0x70000002
516 #define SHT_MIPS_GPTAB          0x70000003
517 #define SHT_MIPS_UCODE          0x70000004
518
519 /* sh_flags */
520 #define SHF_WRITE       0x1
521 #define SHF_ALLOC       0x2
522 #define SHF_EXECINSTR   0x4
523 #define SHF_MASKPROC    0xf0000000
524 #define SHF_MIPS_GPREL  0x10000000
525
526 /* special section indexes */
527 #define SHN_UNDEF       0
528 #define SHN_LORESERVE   0xff00
529 #define SHN_LOPROC      0xff00
530 #define SHN_HIPROC      0xff1f
531 #define SHN_ABS         0xfff1
532 #define SHN_COMMON      0xfff2
533 #define SHN_HIRESERVE   0xffff
534 #define SHN_MIPS_ACCOMON        0xff00
535  
536 typedef struct {
537   Elf32_Word    sh_name;
538   Elf32_Word    sh_type;
539   Elf32_Word    sh_flags;
540   Elf32_Addr    sh_addr;
541   Elf32_Off     sh_offset;
542   Elf32_Word    sh_size;
543   Elf32_Word    sh_link;
544   Elf32_Word    sh_info;
545   Elf32_Word    sh_addralign;
546   Elf32_Word    sh_entsize;
547 } Elf32_Shdr;
548
549 typedef struct elf64_shdr {
550   Elf32_Word sh_name;           /* Section name, index in string tbl (yes Elf32) */
551   Elf32_Word sh_type;           /* Type of section (yes Elf32) */
552   Elf64_Word sh_flags;          /* Miscellaneous section attributes */
553   Elf64_Addr sh_addr;           /* Section virtual addr at execution */
554   Elf64_Off sh_offset;          /* Section file offset */
555   Elf64_Word sh_size;           /* Size of section in bytes */
556   Elf32_Word sh_link;           /* Index of another section (yes Elf32) */
557   Elf32_Word sh_info;           /* Additional section information (yes Elf32) */
558   Elf64_Word sh_addralign;      /* Section alignment */
559   Elf64_Word sh_entsize;        /* Entry size if section holds table */
560 } Elf64_Shdr;
561
562 #define EI_MAG0         0               /* e_ident[] indexes */
563 #define EI_MAG1         1
564 #define EI_MAG2         2
565 #define EI_MAG3         3
566 #define EI_CLASS        4
567 #define EI_DATA         5
568 #define EI_VERSION      6
569 #define EI_PAD          7
570
571 #define ELFMAG0         0x7f            /* EI_MAG */
572 #define ELFMAG1         'E'
573 #define ELFMAG2         'L'
574 #define ELFMAG3         'F'
575 #define ELFMAG          "\177ELF"
576 #define SELFMAG         4
577
578 #define ELFCLASSNONE    0               /* EI_CLASS */
579 #define ELFCLASS32      1
580 #define ELFCLASS64      2
581 #define ELFCLASSNUM     3
582
583 #define ELFDATANONE     0               /* e_ident[EI_DATA] */
584 #define ELFDATA2LSB     1
585 #define ELFDATA2MSB     2
586
587 #define EV_NONE         0               /* e_version, EI_VERSION */
588 #define EV_CURRENT      1
589 #define EV_NUM          2
590
591 /* Notes used in ET_CORE */
592 #define NT_PRSTATUS     1
593 #define NT_PRFPREG      2
594 #define NT_PRPSINFO     3
595 #define NT_TASKSTRUCT   4
596
597 /* Note header in a PT_NOTE section */
598 typedef struct elf32_note {
599   Elf32_Word    n_namesz;       /* Name size */
600   Elf32_Word    n_descsz;       /* Content size */
601   Elf32_Word    n_type;         /* Content type */
602 } Elf32_Nhdr;
603
604 /* Note header in a PT_NOTE section */
605 /*
606  * For now we use the 32 bit version of the structure until we figure
607  * out whether we need anything better.  Note - on the Alpha, "unsigned int"
608  * is only 32 bits.
609  */
610 typedef struct elf64_note {
611   Elf32_Word n_namesz;  /* Name size */
612   Elf32_Word n_descsz;  /* Content size */
613   Elf32_Word n_type;    /* Content type */
614 } Elf64_Nhdr;
615
616 #if ELF_CLASS == ELFCLASS32
617
618 extern Elf32_Dyn _DYNAMIC [];
619 #define elfhdr          elf32_hdr
620 #define elf_phdr        elf32_phdr
621 #define elf_note        elf32_note
622
623 #else
624
625 extern Elf64_Dyn _DYNAMIC [];
626 #define elfhdr          elf64_hdr
627 #define elf_phdr        elf64_phdr
628 #define elf_note        elf64_note
629
630 #endif
631
632
633 #endif /* __LINUX_ELF_H__ */