HACK
[asbestos.git] / stage2 / elf.h
blobb11028ea6db1acc1f4b69626f2fdbc0625c6a814
1 /* elf.h - ELF header definitions
3 Copyright (C) 2010-2011 Hector Martin "marcan" <hector@marcansoft.com>
5 This code is licensed to you under the terms of the GNU GPL, version 2;
6 see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
7 */
9 #ifndef __ELF_H__
10 #define __ELF_H__
12 #include "types.h"
14 #define EI_NIDENT 16
16 typedef struct {
17 unsigned char e_ident[EI_NIDENT];
18 u16 e_type;
19 u16 e_machine;
20 u32 e_version;
21 u64 e_entry;
22 u64 e_phoff;
23 u64 e_shoff;
24 u32 e_flags;
25 u16 e_ehsize;
26 u16 e_phentsize;
27 u16 e_phnum;
28 u16 e_shentsize;
29 u16 e_shnum;
30 u16 e_shtrndx;
31 } Elf64_Ehdr;
33 typedef struct {
34 u32 p_type;
35 u32 p_flags;
36 u64 p_offset;
37 u64 p_vaddr;
38 u64 p_paddr;
39 u64 p_filesz;
40 u64 p_memsz;
41 u64 p_align;
42 } Elf64_Phdr;
44 typedef struct {
45 unsigned char e_ident[EI_NIDENT];
46 u16 e_type;
47 u16 e_machine;
48 u32 e_version;
49 u32 e_entry;
50 u32 e_phoff;
51 u32 e_shoff;
52 u32 e_flags;
53 u16 e_ehsize;
54 u16 e_phentsize;
55 u16 e_phnum;
56 u16 e_shentsize;
57 u16 e_shnum;
58 u16 e_shtrndx;
59 } Elf32_Ehdr __attribute__((aligned(4)));
61 typedef struct {
62 u32 p_type;
63 u32 p_offset;
64 u32 p_vaddr;
65 u32 p_paddr;
66 u32 p_filesz;
67 u32 p_memsz;
68 u32 p_flags;
69 u32 p_align;
70 } Elf32_Phdr __attribute__((aligned(4)));
72 #define PT_NULL 0
73 #define PT_LOAD 1
74 #define PT_DYNAMIC 2
75 #define PT_INTERP 3
76 #define PT_NOTE 4
77 #define PT_SHLIB 5
78 #define PT_PHDR 6
80 #endif