blob: 536b8c375686075303b3d058bfc04218e4bd0c5e [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
Elliott Hughes203e13d2016-07-22 14:56:18 -070028
Elliott Hughes6663f552020-01-24 14:36:10 -080029#pragma once
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030
Josh Gao16016df2016-11-07 18:27:16 -080031#include <sys/cdefs.h>
32
Elliott Hughes0446c8c2017-04-19 10:20:25 -070033#include <bits/auxvec.h>
Elliott Hughes5109bb42017-04-19 13:25:27 -070034#include <bits/elf_arm.h>
35#include <bits/elf_arm64.h>
Elliott Hughes5109bb42017-04-19 13:25:27 -070036#include <bits/elf_x86.h>
37#include <bits/elf_x86_64.h>
Elliott Hughes0266ae52014-02-10 17:46:57 -080038#include <linux/elf.h>
39#include <linux/elf-em.h>
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080040
Elliott Hughesa8a23f52017-10-31 17:22:41 -070041/* http://www.sco.com/developers/gabi/latest/ch4.intro.html */
Elliott Hughes89d8a3c2017-12-05 13:00:22 -080042typedef __u64 Elf32_Xword;
Dmitriy Ivanovce16a532015-05-07 22:58:00 -070043typedef __s64 Elf32_Sxword;
44
Nick Kralevich2c5153b2013-01-11 14:43:05 -080045typedef struct {
Elliott Hughes0266ae52014-02-10 17:46:57 -080046 __u32 a_type;
Nick Kralevich2c5153b2013-01-11 14:43:05 -080047 union {
Elliott Hughes0266ae52014-02-10 17:46:57 -080048 __u32 a_val;
Nick Kralevich2c5153b2013-01-11 14:43:05 -080049 } a_un;
50} Elf32_auxv_t;
51
52typedef struct {
Elliott Hughes0266ae52014-02-10 17:46:57 -080053 __u64 a_type;
Nick Kralevich2c5153b2013-01-11 14:43:05 -080054 union {
Elliott Hughes0266ae52014-02-10 17:46:57 -080055 __u64 a_val;
Nick Kralevich2c5153b2013-01-11 14:43:05 -080056 } a_un;
57} Elf64_auxv_t;
58
Elliott Hughesa8a23f52017-10-31 17:22:41 -070059/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
60typedef struct {
61 Elf32_Word ch_type;
62 Elf32_Word ch_size;
63 Elf32_Word ch_addralign;
64} Elf32_Chdr;
65typedef struct {
66 Elf64_Word ch_type;
67 Elf64_Word ch_reserved;
68 Elf64_Xword ch_size;
69 Elf64_Xword ch_addralign;
70} Elf64_Chdr;
71
Elliott Hughes89d8a3c2017-12-05 13:00:22 -080072typedef struct {
73 Elf32_Word l_name;
74 Elf32_Word l_time_stamp;
75 Elf32_Word l_checksum;
76 Elf32_Word l_version;
77 Elf32_Word l_flags;
78} Elf32_Lib;
79typedef struct {
80 Elf64_Word l_name;
81 Elf64_Word l_time_stamp;
82 Elf64_Word l_checksum;
83 Elf64_Word l_version;
84 Elf64_Word l_flags;
85} Elf64_Lib;
86/* ElfW(Lib)::l_flags values. */
87#define LL_NONE 0x0
88#define LL_EXACT_MATCH 0x1
89#define LL_IGNORE_INT_VER 0x2
90#define LL_REQUIRE_MINOR 0x4
91#define LL_EXPORTS 0x8
92#define LL_DELAY_LOAD 0x10
93#define LL_DELTA 0x20
94
95typedef struct {
96 Elf32_Xword m_value;
97 Elf32_Word m_info;
98 Elf32_Word m_poffset;
99 Elf32_Half m_repeat;
100 Elf32_Half m_stride;
101} Elf32_Move;
102typedef struct {
103 Elf64_Xword m_value;
104 Elf64_Xword m_info;
105 Elf64_Xword m_poffset;
106 Elf64_Half m_repeat;
107 Elf64_Half m_stride;
108} Elf64_Move;
109
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700110typedef __u16 Elf32_Section;
111typedef __u16 Elf64_Section;
112
Elliott Hughes89d8a3c2017-12-05 13:00:22 -0800113typedef struct {
114 Elf32_Half si_boundto;
115 Elf32_Half si_flags;
116} Elf32_Syminfo;
117typedef struct {
118 Elf64_Half si_boundto;
119 Elf64_Half si_flags;
120} Elf64_Syminfo;
121/* ElfW(Syminfo)::si_boundto values. */
122#define SYMINFO_BT_SELF 0xffff
123#define SYMINFO_BT_PARENT 0xfffe
124/* ElfW(Syminfo)::si_flags values. */
125#define SYMINFO_FLG_DIRECT 0x1
126#define SYMINFO_FLG_PASSTHRU 0x2
127#define SYMINFO_FLG_COPY 0x4
128#define SYMINFO_FLG_LAZYLOAD 0x8
129
Dmitriy Ivanovc0e7dbb2015-04-09 13:58:53 -0700130typedef Elf32_Half Elf32_Versym;
131typedef Elf64_Half Elf64_Versym;
132
133typedef struct {
134 Elf32_Half vd_version;
135 Elf32_Half vd_flags;
136 Elf32_Half vd_ndx;
137 Elf32_Half vd_cnt;
138 Elf32_Word vd_hash;
139 Elf32_Word vd_aux;
140 Elf32_Word vd_next;
141} Elf32_Verdef;
142
143typedef struct {
144 Elf32_Word vda_name;
145 Elf32_Word vda_next;
146} Elf32_Verdaux;
147
148typedef struct {
149 Elf64_Half vd_version;
150 Elf64_Half vd_flags;
151 Elf64_Half vd_ndx;
152 Elf64_Half vd_cnt;
153 Elf64_Word vd_hash;
154 Elf64_Word vd_aux;
155 Elf64_Word vd_next;
156} Elf64_Verdef;
157
158typedef struct {
159 Elf64_Word vda_name;
160 Elf64_Word vda_next;
161} Elf64_Verdaux;
162
163typedef struct {
164 Elf32_Half vn_version;
165 Elf32_Half vn_cnt;
166 Elf32_Word vn_file;
167 Elf32_Word vn_aux;
168 Elf32_Word vn_next;
169} Elf32_Verneed;
170
171typedef struct {
172 Elf32_Word vna_hash;
173 Elf32_Half vna_flags;
174 Elf32_Half vna_other;
175 Elf32_Word vna_name;
176 Elf32_Word vna_next;
177} Elf32_Vernaux;
178
179typedef struct {
180 Elf64_Half vn_version;
181 Elf64_Half vn_cnt;
182 Elf64_Word vn_file;
183 Elf64_Word vn_aux;
184 Elf64_Word vn_next;
185} Elf64_Verneed;
186
187typedef struct {
188 Elf64_Word vna_hash;
189 Elf64_Half vna_flags;
190 Elf64_Half vna_other;
191 Elf64_Word vna_name;
192 Elf64_Word vna_next;
193} Elf64_Vernaux;
194
Rahul Chaudhryf16b6592018-01-25 15:34:15 -0800195/* Relocation table entry for relative (in section of type SHT_RELR). */
Rahul Chaudhryb7feec72017-12-19 15:25:23 -0800196typedef Elf32_Word Elf32_Relr;
197typedef Elf64_Xword Elf64_Relr;
Rahul Chaudhryb7feec72017-12-19 15:25:23 -0800198
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700199/* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html */
Elliott Hughes0266ae52014-02-10 17:46:57 -0800200#define DF_ORIGIN 0x00000001
201#define DF_SYMBOLIC 0x00000002
202#define DF_TEXTREL 0x00000004
203#define DF_BIND_NOW 0x00000008
204#define DF_STATIC_TLS 0x00000010
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800205
Dmitriy Ivanova6bee4d2014-10-13 12:23:55 -0700206#define DF_1_NOW 0x00000001 /* Perform complete relocation processing. */
207#define DF_1_GLOBAL 0x00000002 /* implies RTLD_GLOBAL */
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700208#define DF_1_GROUP 0x00000004
Dmitriy Ivanova6bee4d2014-10-13 12:23:55 -0700209#define DF_1_NODELETE 0x00000008 /* implies RTLD_NODELETE */
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700210#define DF_1_LOADFLTR 0x00000010
211#define DF_1_INITFIRST 0x00000020
Dmitriy Ivanova6bee4d2014-10-13 12:23:55 -0700212#define DF_1_NOOPEN 0x00000040 /* Object can not be used with dlopen(3) */
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700213#define DF_1_ORIGIN 0x00000080
214#define DF_1_DIRECT 0x00000100
215#define DF_1_TRANS 0x00000200
216#define DF_1_INTERPOSE 0x00000400
217#define DF_1_NODEFLIB 0x00000800
Dmitriy Ivanova6bee4d2014-10-13 12:23:55 -0700218#define DF_1_NODUMP 0x00001000 /* Object cannot be dumped with dldump(3) */
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700219#define DF_1_CONFALT 0x00002000
220#define DF_1_ENDFILTEE 0x00004000
221#define DF_1_DISPRELDNE 0x00008000
222#define DF_1_DISPRELPND 0x00010000
223#define DF_1_NODIRECT 0x00020000
Dmitriy Ivanova6bee4d2014-10-13 12:23:55 -0700224#define DF_1_IGNMULDEF 0x00040000 /* Internal use */
225#define DF_1_NOKSYMS 0x00080000 /* Internal use */
226#define DF_1_NOHDR 0x00100000 /* Internal use */
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700227#define DF_1_EDITED 0x00200000
Dmitriy Ivanova6bee4d2014-10-13 12:23:55 -0700228#define DF_1_NORELOC 0x00400000 /* Internal use */
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700229#define DF_1_SYMINTPOSE 0x00800000
230#define DF_1_GLOBAUDIT 0x01000000
231#define DF_1_SINGLETON 0x02000000
232#define DF_1_STUB 0x04000000
233#define DF_1_PIE 0x08000000
234
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700235/* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html */
Elliott Hughes0266ae52014-02-10 17:46:57 -0800236#define DT_BIND_NOW 24
237#define DT_INIT_ARRAY 25
238#define DT_FINI_ARRAY 26
239#define DT_INIT_ARRAYSZ 27
240#define DT_FINI_ARRAYSZ 28
241#define DT_RUNPATH 29
242#define DT_FLAGS 30
243/* glibc and BSD disagree for DT_ENCODING; glibc looks wrong. */
244#define DT_PREINIT_ARRAY 32
245#define DT_PREINIT_ARRAYSZ 33
Elliott Hughes6663f552020-01-24 14:36:10 -0800246#define DT_RELRSZ 35
247#define DT_RELR 36
248#define DT_RELRENT 37
Rahul Chaudhryb7feec72017-12-19 15:25:23 -0800249
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800250#define DT_GNU_HASH 0x6ffffef5
Elliott Hughes9724e932018-03-23 18:46:07 -0700251#define DT_TLSDESC_PLT 0x6ffffef6
252#define DT_TLSDESC_GOT 0x6ffffef7
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800253
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700254/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
255#define EI_ABIVERSION 8
256#undef EI_PAD
257#define EI_PAD 9
258
259/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
260#define ELFCOMPRESS_ZLIB 1
261#define ELFCOMPRESS_LOOS 0x60000000
262#define ELFCOMPRESS_HIOS 0x6fffffff
263#define ELFCOMPRESS_LOPROC 0x70000000
264#define ELFCOMPRESS_HIPROC 0x7fffffff
265
266/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
Elliott Hughes0266ae52014-02-10 17:46:57 -0800267#define ELFOSABI_SYSV 0 /* Synonym for ELFOSABI_NONE used by valgrind. */
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700268#define ELFOSABI_HPUX 1
269#define ELFOSABI_NETBSD 2
270#define ELFOSABI_GNU 3 /* Synonym for ELFOSABI_LINUX. */
271#define ELFOSABI_SOLARIS 6
272#define ELFOSABI_AIX 7
273#define ELFOSABI_IRIX 8
274#define ELFOSABI_FREEBSD 9
275#define ELFOSABI_TRU64 10
276#define ELFOSABI_MODESTO 11
277#define ELFOSABI_OPENBSD 12
278#define ELFOSABI_OPENVMS 13
279#define ELFOSABI_NSK 14
280#define ELFOSABI_AROS 15
281#define ELFOSABI_FENIXOS 16
282#define ELFOSABI_CLOUDABI 17
283#define ELFOSABI_OPENVOS 18
284#define ELFOSABI_ARM_AEABI 64
Elliott Hughes0266ae52014-02-10 17:46:57 -0800285
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700286/* http://www.sco.com/developers/gabi/latest/ch4.reloc.html */
287#define ELF32_R_INFO(sym, type) ((((Elf32_Word)sym) << 8) | ((type) & 0xff))
288#define ELF64_R_INFO(sym, type) ((((Elf64_Xword)sym) << 32) | ((type) & 0xffffffff))
Elliott Hughes0266ae52014-02-10 17:46:57 -0800289
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700290/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
Elliott Hughesd390df12017-04-30 22:56:10 -0700291#undef ELF_ST_TYPE
292#define ELF_ST_TYPE(x) ((x) & 0xf)
293#define ELF_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
294#define ELF32_ST_INFO(b,t) ELF_ST_INFO(b,t)
295#define ELF64_ST_INFO(b,t) ELF_ST_INFO(b,t)
296
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700297/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
298#define EM_S370 9
299#define EM_VPP500 17
300#define EM_960 19
301#define EM_V800 36
302#define EM_FR20 37
303#define EM_RH32 38
304#define EM_RCE 39
305#define EM_FAKE_ALPHA 41
306#define EM_TRICORE 44
307#define EM_ARC 45
308#define EM_H8_300H 47
309#define EM_H8S 48
310#define EM_H8_500 49
311#define EM_MIPS_X 51
312#define EM_COLDFIRE 52
313#define EM_68HC12 53
314#define EM_MMA 54
315#define EM_PCP 55
316#define EM_NCPU 56
317#define EM_NDR1 57
318#define EM_STARCORE 58
319#define EM_ME16 59
320#define EM_ST100 60
321#define EM_TINYJ 61
322#define EM_PDSP 63
323#define EM_PDP10 64
324#define EM_PDP11 65
325#define EM_FX66 66
326#define EM_ST9PLUS 67
327#define EM_ST7 68
328#define EM_68HC16 69
329#define EM_68HC11 70
330#define EM_68HC08 71
331#define EM_68HC05 72
332#define EM_SVX 73
333#define EM_ST19 74
334#define EM_VAX 75
335#define EM_JAVELIN 77
336#define EM_FIREPATH 78
337#define EM_ZSP 79
338#define EM_MMIX 80
339#define EM_HUANY 81
340#define EM_PRISM 82
341#define EM_AVR 83
342#define EM_FR30 84
343#define EM_D10V 85
344#define EM_D30V 86
345#define EM_V850 87
346#define EM_MN10200 90
347#define EM_PJ 91
348#define EM_ARC_COMPACT 93
349#define EM_XTENSA 94
350#define EM_VIDEOCORE 95
351#define EM_TMM_GPP 96
352#define EM_NS32K 97
353#define EM_TPC 98
354#define EM_SNP1K 99
355#define EM_ST200 100
356#define EM_IP2K 101
357#define EM_MAX 102
358#define EM_CR 103
359#define EM_F2MC16 104
360#define EM_MSP430 105
361#define EM_SE_C33 107
362#define EM_SEP 108
363#define EM_ARCA 109
364#define EM_UNICORE 110
365#define EM_EXCESS 111
366#define EM_DXP 112
367#define EM_CRX 114
368#define EM_XGATE 115
369#define EM_C166 116
370#define EM_M16C 117
371#define EM_DSPIC30F 118
372#define EM_CE 119
373#define EM_M32C 120
374#define EM_TSK3000 131
375#define EM_RS08 132
376#define EM_SHARC 133
377#define EM_ECOG2 134
378#define EM_SCORE7 135
379#define EM_DSP24 136
380#define EM_VIDEOCORE3 137
381#define EM_LATTICEMICO32 138
382#define EM_SE_C17 139
383#define EM_TI_C2000 141
384#define EM_TI_C5500 142
385#define EM_MMDSP_PLUS 160
386#define EM_CYPRESS_M8C 161
387#define EM_R32C 162
388#define EM_TRIMEDIA 163
389#define EM_QDSP6 164
390#define EM_8051 165
391#define EM_STXP7X 166
392#define EM_NDS32 167
393#define EM_ECOG1 168
394#define EM_ECOG1X 168
395#define EM_MAXQ30 169
396#define EM_XIMO16 170
397#define EM_MANIK 171
398#define EM_CRAYNV2 172
399#define EM_RX 173
400#define EM_METAG 174
401#define EM_MCST_ELBRUS 175
402#define EM_ECOG16 176
403#define EM_CR16 177
404#define EM_ETPU 178
405#define EM_SLE9X 179
406#define EM_L10M 180
407#define EM_K10M 181
408#define EM_AVR32 185
409#define EM_STM8 186
410#define EM_TILE64 187
411#define EM_CUDA 190
412#define EM_CLOUDSHIELD 192
413#define EM_COREA_1ST 193
414#define EM_COREA_2ND 194
415#define EM_ARC_COMPACT2 195
416#define EM_OPEN8 196
417#define EM_RL78 197
418#define EM_VIDEOCORE5 198
419#define EM_78KOR 199
420#define EM_56800EX 200
421#define EM_BA1 201
422#define EM_BA2 202
423#define EM_XCORE 203
424#define EM_MCHP_PIC 204
425#define EM_INTEL205 205
426#define EM_INTEL206 206
427#define EM_INTEL207 207
428#define EM_INTEL208 208
429#define EM_INTEL209 209
430#define EM_KM32 210
431#define EM_KMX32 211
432#define EM_KMX16 212
433#define EM_KMX8 213
434#define EM_KVARC 214
435#define EM_CDP 215
436#define EM_COGE 216
437#define EM_COOL 217
438#define EM_NORC 218
439#define EM_CSR_KALIMBA 219
440#define EM_Z80 220
441#define EM_VISIUM 221
442#define EM_FT32 222
443#define EM_MOXIE 223
444#define EM_AMDGPU 224
445#define EM_RISCV 243
Elliott Hughes0266ae52014-02-10 17:46:57 -0800446
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700447/* http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
448#define ET_LOOS 0xfe00
449#define ET_HIOS 0xfeff
Dmitriy Ivanov13ed3f02015-02-13 16:25:43 -0800450
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700451/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
452#define GRP_COMDAT 0x1
453#define GRP_MASKOS 0x0ff00000
454#define GRP_MASKPROC 0xf0000000
Greg Hackmann8874d882017-10-31 13:25:03 -0700455
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700456/* http://www.sco.com/developers/gabi/latest/ch5.pheader.html */
457#define PF_X 0x1
458#define PF_W 0x2
459#define PF_R 0x4
460#define PF_MASKOS 0x0ff00000
461#define PF_MASKPROC 0xf0000000
462
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700463#define STB_LOOS 10
464#define STB_HIOS 12
465#define STB_LOPROC 13
466#define STB_HIPROC 15
467
468/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
469#define SHF_MERGE 0x10
470#define SHF_STRINGS 0x20
471#define SHF_INFO_LINK 0x40
472#define SHF_LINK_ORDER 0x80
473#define SHF_OS_NONCONFORMING 0x100
474#define SHF_GROUP 0x200
475#define SHF_TLS 0x400
476#define SHF_COMPRESSED 0x800
477#define SHF_MASKOS 0x0ff00000
478#define SHF_MASKPROC 0xf0000000
479
480/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
481#define SHN_LOOS 0xff20
482#define SHN_HIOS 0xff3f
483#define SHN_XINDEX 0xffff
484
485/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html */
486#define SHT_INIT_ARRAY 14
487#define SHT_FINI_ARRAY 15
488#define SHT_PREINIT_ARRAY 16
489#define SHT_GROUP 17
490#define SHT_SYMTAB_SHNDX 18
Elliott Hughes6663f552020-01-24 14:36:10 -0800491#define SHT_RELR 19
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700492#undef SHT_NUM
Elliott Hughes6663f552020-01-24 14:36:10 -0800493#define SHT_NUM 20
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700494#define SHT_LOOS 0x60000000
495#define SHT_HIOS 0x6fffffff
496
497/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
498#define STN_UNDEF 0
499
500/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
Brigid Smithc5a13ef2014-07-23 11:22:25 -0700501#define STT_GNU_IFUNC 10
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700502#define STT_LOOS 10
503#define STT_HIOS 12
504#define STT_LOPROC 13
505#define STT_HIPROC 15
Brigid Smithc5a13ef2014-07-23 11:22:25 -0700506
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700507/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
508#define STV_DEFAULT 0
509#define STV_INTERNAL 1
510#define STV_HIDDEN 2
Dmitriy Ivanovdbe26fd2015-05-04 19:30:49 -0700511#define STV_PROTECTED 3
512
Dmitriy Ivanova6bee4d2014-10-13 12:23:55 -0700513/* The kernel uses NT_PRFPREG but glibc also offers NT_FPREGSET */
514#define NT_FPREGSET NT_PRFPREG
515
Christopher Ferrisc94c7ff2015-03-13 10:32:45 -0700516#define ELF_NOTE_GNU "GNU"
517
518#define NT_GNU_BUILD_ID 3
519
Dmitriy Ivanov2a815362015-04-09 13:42:33 -0700520#define VER_FLG_BASE 0x1
521#define VER_FLG_WEAK 0x2
522
Elliott Hughesa8a23f52017-10-31 17:22:41 -0700523#define VER_NDX_LOCAL 0
Dmitriy Ivanov2a815362015-04-09 13:42:33 -0700524#define VER_NDX_GLOBAL 1
525
Elliott Hughes6663f552020-01-24 14:36:10 -0800526/*
527 * Experimental support for SHT_RELR sections. For details, see proposal
528 * at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg.
Elliott Hughesb070cab2020-01-27 16:00:19 -0800529 *
Elliott Hughes6663f552020-01-24 14:36:10 -0800530 * This was eventually replaced by SHT_RELR and DT_RELR (which are identical
531 * other than their different constants), but those constants are only
Elliott Hughesb070cab2020-01-27 16:00:19 -0800532 * supported by the OS in API levels >= 30.
Elliott Hughes6663f552020-01-24 14:36:10 -0800533 */
534#define SHT_ANDROID_RELR 0x6fffff00
535#define DT_ANDROID_RELR 0x6fffe000
536#define DT_ANDROID_RELRSZ 0x6fffe001
537#define DT_ANDROID_RELRENT 0x6fffe003
538#define DT_ANDROID_RELRCOUNT 0x6fffe005
Elliott Hughesb070cab2020-01-27 16:00:19 -0800539
540/*
541 * Android compressed REL/RELA sections. These were generated by the relocation
542 * packer in old versions of Android, and can be generated directly by lld
543 * with https://reviews.llvm.org/D39152.
544 *
545 * This was replaced by SHT_ANDROID_RELR in API level 28 (but is supported
546 * in all API levels >= 23).
547 */
548#define SHT_ANDROID_REL 0x60000001
549#define SHT_ANDROID_RELA 0x60000002
550#define DT_ANDROID_REL 0x6000000f // DT_LOOS + 2
551#define DT_ANDROID_RELSZ 0x60000010 // DT_LOOS + 3
552#define DT_ANDROID_RELA 0x60000011 // DT_LOOS + 4
553#define DT_ANDROID_RELASZ 0x60000012 // DT_LOOS + 5