CARDS 2.4.87
Package manager for the NuTyX GNU/Linux distribution
elf.h
1 // elf.h
2 //
3 // Copyright (c) 2013-2017 by NuTyX team (http://nutyx.org)
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 // USA.
19 //
20 
21 #ifndef ELF_H
22 #define ELF_H
23 #if __x86_64__ || __ppc64__
24  #define ENV64BIT
25 #else
26  #define ENV32BIT
27 #endif
28 
29 /* ELF Header */
30 #define EI_NIDENT 16 /* Size of e_ident[] */
31 
32 typedef struct elf_internal_ehdr_begin {
33  unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
34  unsigned short e_type;
35  unsigned short e_machine;
36  unsigned int e_version;
38 
39 typedef struct elf_internal_ehdr_32b {
40  unsigned int e_entry;
41  unsigned int e_phoff;
42  unsigned int e_shoff;
44 typedef struct elf_internal_ehdr_64b {
45  long e_entry;
46  long e_phoff;
47  long e_shoff;
49 
50 typedef struct elf_internal_ehdr_end {
51  unsigned int e_flags;
52  unsigned short e_ehsize;
53  unsigned short e_phentsize;
54  unsigned short e_phnum;
55  unsigned short e_shentsize;
56  unsigned short e_shnum;
57  unsigned short e_shstrndx;
58 } Elf_Ehdr_End;
59 
60 
61 
62 /* dynamic section structure */
63 typedef struct elf_internal_dyn_32 {
64  unsigned long d_tag;
65  union {
66  unsigned long d_val;
67  unsigned long d_ptr;
68  } d_un;
69 } Elf_Dyn_32;
70 
71 typedef struct elf_internal_dyn_64 {
72  unsigned long d_tag;
73  union {
74  unsigned long d_val;
75  unsigned long d_ptr;
76  } d_un;
77 } Elf_Dyn_64;
78 
79 /* Section header */
80 
81 typedef struct elf_internal_shdr_32 {
82  unsigned int sh_name;
83  unsigned int sh_type;
84  unsigned long sh_flags;
85  unsigned long sh_addr;
86  unsigned long sh_offset;
87  unsigned long sh_size;
88  unsigned int sh_link;
89  unsigned int sh_info;
90  unsigned long sh_addralign;
91  unsigned long sh_entsize;
92 } Elf_Shdr_32;
93 
94 typedef struct elf_internal_shdr_64 {
95  unsigned int sh_name;
96  unsigned int sh_type;
97  unsigned long sh_flags;
98  unsigned long sh_addr;
99  unsigned long sh_offset;
100  unsigned long sh_size;
101  unsigned int sh_link;
102  unsigned int sh_info;
103  unsigned long sh_addralign;
104  unsigned long sh_entsize;
105 } Elf_Shdr_64;
106 
107 /* Program header */
108 
109 typedef struct elf_internal_phdr_32 {
110  unsigned int p_type;
111  unsigned long p_offset;
112  unsigned long p_vaddr;
113  unsigned long p_paddr;
114  unsigned long p_filesz;
115  unsigned long p_memsz;
116  unsigned int p_flags;
117  unsigned int p_align;
118 } Elf_Phdr_32;
119 
120 typedef struct elf_internal_phdr_64 {
121  unsigned int p_type;
122  unsigned int p_flags;
123  unsigned long p_offset;
124  unsigned long p_vaddr;
125  unsigned long p_paddr;
126  unsigned long p_filesz;
127  unsigned long p_memsz;
128  unsigned long p_align;
129 } Elf_Phdr_64;
130 
131 #endif /* ELF_H */
132 
133 // vim:set ts=2 :
Definition: elf.h:94
Definition: elf.h:39
Definition: elf.h:44
Definition: elf.h:71
Definition: elf.h:109
Definition: elf.h:32
Definition: elf.h:63
Definition: elf.h:120
Definition: elf.h:81
Definition: elf.h:50