btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / storage / ElfX.h
bloba588ad0aaf499dc002ae6cbaf5aa1b46bcf7b01f
1 /*
2 * Copyright 2002-2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
6 // No header guard: The file is included twice by <Elf.h> and must not be
7 // included elsewhere. The _ELFX_BITS macro must be define before inclusion.
10 #undef ElfX
12 #if _ELFX_BITS == 32
13 # define ElfX(x) Elf32_##x
14 #elif _ELFX_BITS == 64
15 # define ElfX(x) Elf64_##x
16 #endif
19 // object file header
20 typedef struct {
21 unsigned char e_ident[EI_NIDENT];
22 ElfX(Half) e_type;
23 ElfX(Half) e_machine;
24 ElfX(Word) e_version;
25 ElfX(Addr) e_entry;
26 ElfX(Off) e_phoff;
27 ElfX(Off) e_shoff;
28 ElfX(Word) e_flags;
29 ElfX(Half) e_ehsize;
30 ElfX(Half) e_phentsize;
31 ElfX(Half) e_phnum;
32 ElfX(Half) e_shentsize;
33 ElfX(Half) e_shnum;
34 ElfX(Half) e_shstrndx;
35 } ElfX(Ehdr);
37 // program header
38 typedef struct {
39 ElfX(Word) p_type;
40 #if _ELFX_BITS == 64
41 ElfX(Word) p_flags;
42 #endif
43 ElfX(Off) p_offset;
44 ElfX(Addr) p_vaddr;
45 ElfX(Addr) p_paddr;
46 ElfX(Xword) p_filesz;
47 ElfX(Xword) p_memsz;
48 #if _ELFX_BITS == 32
49 ElfX(Word) p_flags;
50 #endif
51 ElfX(Xword) p_align;
52 } ElfX(Phdr);
54 // section header
55 typedef struct {
56 ElfX(Word) sh_name;
57 ElfX(Word) sh_type;
58 ElfX(Xword) sh_flags;
59 ElfX(Addr) sh_addr;
60 ElfX(Off) sh_offset;
61 ElfX(Xword) sh_size;
62 ElfX(Word) sh_link;
63 ElfX(Word) sh_info;
64 ElfX(Xword) sh_addralign;
65 ElfX(Xword) sh_entsize;
66 } ElfX(Shdr);
68 #undef ElfX