locks: print unsigned ino in /proc/locks
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / init / elf.h
1 /*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20
21 #ifndef __ELF_H__
22 #define __ELF_H__
23
24 #define __TARGET_64__
25
26 #define _SHN_UNDEF 0
27
28 #ifdef __TARGET_64__
29 #define _DT_NULL 0
30 #define _DT_NEEDED 1
31 #define _DT_PLTRELSZ 2
32 #define _DT_PLTGOT 3
33 #define _DT_STRTAB 5
34 #define _DT_SYMTAB 6
35 #define _DT_RELA 7
36 #define _DT_RELASZ 8
37 #define _DT_RELAENT 9
38 #define _DT_STRSZ 10
39 #define _DT_SYMENT 11
40 #define _DT_INIT 12
41 #define _DT_FINI 13
42 #define _DT_SONAME 14
43 #define _DT_REL 17
44 #define _DT_PLTREL 20
45 #define _DT_JMPREL 23
46
47 #define _R_AARCH64_NONE 0
48 #define _R_AARCH64_ABS64 257
49 #define _R_AARCH64_RELATIVE 1027
50 #define _R_AARCH64_IRELATIVE 1032
51 #define _R_AARCH64_GLOB_DAT 1025
52 #define _R_AARCH64_JUMP_SLOT 1026
53 #define _R_AARCH64_RELATIVE 1027
54
55 #else //__TARGET_32__
56 #define _DT_INIT 12
57 #define _DT_FINI 13
58 #define _DT_SONAME 1
59 #define _DT_STRTAB 5
60 #define _DT_SYMTAB 6
61 #define _DT_RELA 7
62 #define _DT_RELASZ 8
63 #define _DT_RELAENT 9
64 #define _DT_STRSZ 10
65 #define _DT_SYMENT 11
66 #define _DT_REL 17
67 #define _DT_RELSZ 18
68 #define _DT_RELENT 19
69
70 #define _DT_JMPREL 23
71 #define _DT_PLTRELSZ 2
72 #define _DT_PLTREL 20
73
74 #define _R_ARM_NONE 0
75 #define _R_ARM_ABS32 2
76 #define _R_ARM_GLOB_DAT 21
77 #define _R_ARM_JUMP_SLOT 22
78 #define _R_ARM_RELATIVE 23
79 #endif
80
81 #define _PT_LOAD 1
82
83 typedef unsigned short _Elf_Half;
84
85 typedef unsigned int _Elf_Word;
86 typedef int _Elf_Sword;
87
88 typedef unsigned long long _Elf_Xword;
89 typedef long long _Elf_Sxword;
90
91 typedef unsigned long long _Elf_Addr;
92
93 typedef unsigned long long _Elf_Off;
94
95 typedef unsigned short _Elf_Section;
96
97 #define _EI_NIDENT (16)
98
99 typedef struct
100 {
101 unsigned char e_ident[_EI_NIDENT];
102 _Elf_Half e_type;
103 _Elf_Half e_machine;
104 _Elf_Word e_version;
105 _Elf_Addr e_entry;
106 _Elf_Off e_phoff;
107 _Elf_Off e_shoff;
108 _Elf_Word e_flags;
109 _Elf_Half e_ehsize;
110 _Elf_Half e_phentsize;
111 _Elf_Half e_phnum;
112 _Elf_Half e_shentsize;
113 _Elf_Half e_shnum;
114 _Elf_Half e_shstrndx;
115 } _Elf_Ehdr;
116
117 #ifdef __TARGET_64__
118
119 typedef struct
120 {
121 _Elf_Word sh_name;
122 _Elf_Word sh_type;
123 _Elf_Xword sh_flags;
124 _Elf_Addr sh_addr;
125 _Elf_Off sh_offset;
126 _Elf_Xword sh_size;
127 _Elf_Word sh_link;
128 _Elf_Word sh_info;
129 _Elf_Xword sh_addralign;
130 _Elf_Xword sh_entsize;
131 } _Elf_Shdr;
132
133 #else //__TARGET_32__
134 typedef struct
135 {
136 _Elf_Word sh_name;
137 _Elf_Word sh_type;
138 _Elf_Word sh_flags;
139 _Elf_Addr sh_addr;
140 _Elf_Off sh_offset;
141 _Elf_Word sh_size;
142 _Elf_Word sh_link;
143 _Elf_Word sh_info;
144 _Elf_Word sh_addralign;
145 _Elf_Word sh_entsize;
146 } _Elf_Shdr;
147
148 #endif //__TARGET_64__ | __TARGET_32__
149
150 #ifdef __TARGET_64__
151 typedef struct
152 {
153 _Elf_Word st_name;
154 unsigned char st_info;
155 unsigned char st_other;
156 _Elf_Section st_shndx;
157 _Elf_Addr st_value;
158 _Elf_Xword st_size;
159 } _Elf_Sym;
160
161 #else //__TARGET_32__
162 typedef struct
163 {
164 _Elf_Word st_name;
165 _Elf_Addr st_value;
166 _Elf_Word st_size;
167 unsigned char st_info;
168 unsigned char st_other;
169 _Elf_Section st_shndx;
170 } _Elf_Sym;
171
172 #endif //__TARGET_64__ | __TARGET_32__
173
174 #define _ELF_ST_BIND(val) (((unsigned char) (val)) >> 4)
175 #define _ELF_ST_TYPE(val) ((val) & 0xf)
176 #define _ELF_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
177
178 #ifdef __TARGET_64__
179 typedef struct
180 {
181 _Elf_Addr r_offset; /* Address */
182 _Elf_Xword r_info; /* Relocation type and symbol index */
183 _Elf_Sxword r_addend; /* Addend */
184 } _Elf_Rela;
185
186 #define _ELF_R_SYM(i) ((i) >> 32)
187 #define _ELF_R_TYPE(i) ((i) & 0xffffffff)
188
189 #else //__TARGET_32__
190 typedef struct
191 {
192 _Elf_Addr r_offset; /* Address */
193 _Elf_Word r_info; /* Relocation type and symbol index */
194 } _Elf_Rel;
195
196 #define _ELF_R_SYM(val) ((val) >> 8)
197 #define _ELF_R_TYPE(val) ((val) & 0xff)
198
199 #endif //__TARGET_64__ | __TARGET_32__
200
201 #ifdef __TARGET_64__
202 typedef struct
203 {
204 _Elf_Word p_type; /* Segment type */
205 _Elf_Word p_flags; /* Segment flags */
206 _Elf_Off p_offset; /* Segment file offset */
207 _Elf_Addr p_vaddr; /* Segment virtual address */
208 _Elf_Addr p_paddr; /* Segment physical address */
209 _Elf_Xword p_filesz; /* Segment size in file */
210 _Elf_Xword p_memsz; /* Segment size in memory */
211 _Elf_Xword p_align; /* Segment alignment */
212 } _Elf_Phdr;
213
214 #else //__TARGET_32__
215 typedef struct
216 {
217 _Elf_Word p_type; /* Segment type */
218 _Elf_Off p_offset; /* Segment file offset */
219 _Elf_Addr p_vaddr; /* Segment virtual address */
220 _Elf_Addr p_paddr; /* Segment physical address */
221 _Elf_Word p_filesz; /* Segment size in file */
222 _Elf_Word p_memsz; /* Segment size in memory */
223 _Elf_Word p_flags; /* Segment flags */
224 _Elf_Word p_align; /* Segment alignment */
225 } _Elf_Phdr;
226
227 #endif //__TARGET_64__ | __TARGET_32__
228
229 #ifdef __TARGET_64__
230 typedef struct
231 {
232 _Elf_Sxword d_tag; /* Dynamic entry type */
233 union
234 {
235 _Elf_Xword d_val; /* Integer value */
236 _Elf_Addr d_ptr; /* Address value */
237 } d_un;
238 } _Elf_Dyn;
239
240 #else //__TARGET_32__
241 typedef struct
242 {
243 _Elf_Sword d_tag; /* Dynamic entry type */
244 union
245 {
246 _Elf_Word d_val; /* Integer value */
247 _Elf_Addr d_ptr; /* Address value */
248 } d_un;
249 } _Elf_Dyn;
250
251 #endif //__TARGET_64__ | __TARGET_32__
252
253 #endif //__ELF_H__