1 | #ifndef DYNAMIC_TAG |
2 | #error "DYNAMIC_TAG must be defined" |
3 | #endif |
4 | |
5 | // Add separate macros for the architecture specific tags and the markers |
6 | // such as DT_HIOS, etc. to allow using this file to in other contexts. |
7 | // For example we can use it to generate a stringification switch statement. |
8 | |
9 | #ifndef AARCH64_DYNAMIC_TAG |
10 | #define AARCH64_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) |
11 | #define AARCH64_DYNAMIC_TAG_DEFINED |
12 | #endif |
13 | |
14 | #ifndef HEXAGON_DYNAMIC_TAG |
15 | #define HEXAGON_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) |
16 | #define HEXAGON_DYNAMIC_TAG_DEFINED |
17 | #endif |
18 | |
19 | #ifndef MIPS_DYNAMIC_TAG |
20 | #define MIPS_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) |
21 | #define MIPS_DYNAMIC_TAG_DEFINED |
22 | #endif |
23 | |
24 | #ifndef PPC_DYNAMIC_TAG |
25 | #define PPC_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) |
26 | #define PPC_DYNAMIC_TAG_DEFINED |
27 | #endif |
28 | |
29 | #ifndef PPC64_DYNAMIC_TAG |
30 | #define PPC64_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) |
31 | #define PPC64_DYNAMIC_TAG_DEFINED |
32 | #endif |
33 | |
34 | #ifndef RISCV_DYNAMIC_TAG |
35 | #define RISCV_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) |
36 | #define RISCV_DYNAMIC_TAG_DEFINED |
37 | #endif |
38 | |
39 | #ifndef DYNAMIC_TAG_MARKER |
40 | #define DYNAMIC_TAG_MARKER(name, value) DYNAMIC_TAG(name, value) |
41 | #define DYNAMIC_TAG_MARKER_DEFINED |
42 | #endif |
43 | |
44 | DYNAMIC_TAG(NULL, 0) // Marks end of dynamic array. |
45 | DYNAMIC_TAG(NEEDED, 1) // String table offset of needed library. |
46 | DYNAMIC_TAG(PLTRELSZ, 2) // Size of relocation entries in PLT. |
47 | DYNAMIC_TAG(PLTGOT, 3) // Address associated with linkage table. |
48 | DYNAMIC_TAG(HASH, 4) // Address of symbolic hash table. |
49 | DYNAMIC_TAG(STRTAB, 5) // Address of dynamic string table. |
50 | DYNAMIC_TAG(SYMTAB, 6) // Address of dynamic symbol table. |
51 | DYNAMIC_TAG(RELA, 7) // Address of relocation table (Rela entries). |
52 | DYNAMIC_TAG(RELASZ, 8) // Size of Rela relocation table. |
53 | DYNAMIC_TAG(RELAENT, 9) // Size of a Rela relocation entry. |
54 | DYNAMIC_TAG(STRSZ, 10) // Total size of the string table. |
55 | DYNAMIC_TAG(SYMENT, 11) // Size of a symbol table entry. |
56 | DYNAMIC_TAG(INIT, 12) // Address of initialization function. |
57 | DYNAMIC_TAG(FINI, 13) // Address of termination function. |
58 | DYNAMIC_TAG(SONAME, 14) // String table offset of a shared objects name. |
59 | DYNAMIC_TAG(RPATH, 15) // String table offset of library search path. |
60 | DYNAMIC_TAG(SYMBOLIC, 16) // Changes symbol resolution algorithm. |
61 | DYNAMIC_TAG(REL, 17) // Address of relocation table (Rel entries). |
62 | DYNAMIC_TAG(RELSZ, 18) // Size of Rel relocation table. |
63 | DYNAMIC_TAG(RELENT, 19) // Size of a Rel relocation entry. |
64 | DYNAMIC_TAG(PLTREL, 20) // Type of relocation entry used for linking. |
65 | DYNAMIC_TAG(DEBUG, 21) // Reserved for debugger. |
66 | DYNAMIC_TAG(TEXTREL, 22) // Relocations exist for non-writable segments. |
67 | DYNAMIC_TAG(JMPREL, 23) // Address of relocations associated with PLT. |
68 | DYNAMIC_TAG(BIND_NOW, 24) // Process all relocations before execution. |
69 | DYNAMIC_TAG(INIT_ARRAY, 25) // Pointer to array of initialization functions. |
70 | DYNAMIC_TAG(FINI_ARRAY, 26) // Pointer to array of termination functions. |
71 | DYNAMIC_TAG(INIT_ARRAYSZ, 27) // Size of DT_INIT_ARRAY. |
72 | DYNAMIC_TAG(FINI_ARRAYSZ, 28) // Size of DT_FINI_ARRAY. |
73 | DYNAMIC_TAG(RUNPATH, 29) // String table offset of lib search path. |
74 | DYNAMIC_TAG(FLAGS, 30) // Flags. |
75 | DYNAMIC_TAG_MARKER(ENCODING, 32) // Values from here to DT_LOOS follow the rules |
76 | // for the interpretation of the d_un union. |
77 | |
78 | DYNAMIC_TAG(PREINIT_ARRAY, 32) // Pointer to array of preinit functions. |
79 | DYNAMIC_TAG(PREINIT_ARRAYSZ, 33) // Size of the DT_PREINIT_ARRAY array. |
80 | |
81 | DYNAMIC_TAG(SYMTAB_SHNDX, 34) // Address of the SHT_SYMTAB_SHNDX section. |
82 | |
83 | // Experimental support for SHT_RELR sections. For details, see proposal |
84 | // at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg |
85 | DYNAMIC_TAG(RELRSZ, 35) // Size of Relr relocation table. |
86 | DYNAMIC_TAG(RELR, 36) // Address of relocation table (Relr entries). |
87 | DYNAMIC_TAG(RELRENT, 37) // Size of a Relr relocation entry. |
88 | |
89 | DYNAMIC_TAG_MARKER(LOOS, 0x60000000) // Start of environment specific tags. |
90 | DYNAMIC_TAG_MARKER(HIOS, 0x6FFFFFFF) // End of environment specific tags. |
91 | DYNAMIC_TAG_MARKER(LOPROC, 0x70000000) // Start of processor specific tags. |
92 | DYNAMIC_TAG_MARKER(HIPROC, 0x7FFFFFFF) // End of processor specific tags. |
93 | |
94 | // Android packed relocation section tags. |
95 | // https://android.googlesource.com/platform/bionic/+/6f12bfece5dcc01325e0abba56a46b1bcf991c69/tools/relocation_packer/src/elf_file.cc#31 |
96 | DYNAMIC_TAG(ANDROID_REL, 0x6000000F) |
97 | DYNAMIC_TAG(ANDROID_RELSZ, 0x60000010) |
98 | DYNAMIC_TAG(ANDROID_RELA, 0x60000011) |
99 | DYNAMIC_TAG(ANDROID_RELASZ, 0x60000012) |
100 | |
101 | // Android's experimental support for SHT_RELR sections. |
102 | // https://android.googlesource.com/platform/bionic/+/b7feec74547f84559a1467aca02708ff61346d2a/libc/include/elf.h#253 |
103 | DYNAMIC_TAG(ANDROID_RELR, 0x6FFFE000) // Address of relocation table (Relr entries). |
104 | DYNAMIC_TAG(ANDROID_RELRSZ, 0x6FFFE001) // Size of Relr relocation table. |
105 | DYNAMIC_TAG(ANDROID_RELRENT, 0x6FFFE003) // Size of a Relr relocation entry. |
106 | |
107 | DYNAMIC_TAG(GNU_HASH, 0x6FFFFEF5) // Reference to the GNU hash table. |
108 | DYNAMIC_TAG(TLSDESC_PLT, 0x6FFFFEF6) // Location of PLT entry for TLS |
109 | // descriptor resolver calls. |
110 | DYNAMIC_TAG(TLSDESC_GOT, 0x6FFFFEF7) // Location of GOT entry used by TLS |
111 | // descriptor resolver PLT entry. |
112 | DYNAMIC_TAG(RELACOUNT, 0x6FFFFFF9) // ELF32_Rela count. |
113 | DYNAMIC_TAG(RELCOUNT, 0x6FFFFFFA) // ELF32_Rel count. |
114 | |
115 | DYNAMIC_TAG(FLAGS_1, 0X6FFFFFFB) // Flags_1. |
116 | |
117 | DYNAMIC_TAG(VERSYM, 0x6FFFFFF0) // The address of .gnu.version section. |
118 | DYNAMIC_TAG(VERDEF, 0X6FFFFFFC) // The address of the version definition |
119 | // table. |
120 | DYNAMIC_TAG(VERDEFNUM, 0X6FFFFFFD) // The number of entries in DT_VERDEF. |
121 | DYNAMIC_TAG(VERNEED, 0X6FFFFFFE) // The address of the version dependency |
122 | // table. |
123 | DYNAMIC_TAG(VERNEEDNUM, 0X6FFFFFFF) // The number of entries in DT_VERNEED. |
124 | |
125 | // AArch64 specific dynamic table entries |
126 | AARCH64_DYNAMIC_TAG(AARCH64_BTI_PLT, 0x70000001) |
127 | AARCH64_DYNAMIC_TAG(AARCH64_PAC_PLT, 0x70000003) |
128 | AARCH64_DYNAMIC_TAG(AARCH64_VARIANT_PCS, 0x70000005) |
129 | AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_MODE, 0x70000009) |
130 | AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_HEAP, 0x7000000b) |
131 | AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_STACK, 0x7000000c) |
132 | AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_GLOBALS, 0x7000000d) |
133 | AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_GLOBALSSZ, 0x7000000f) |
134 | |
135 | // AArch64 specific dynamic table entries for RELR auth relocations as described here: |
136 | // https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#dynamic-section |
137 | AARCH64_DYNAMIC_TAG(AARCH64_AUTH_RELRSZ, 0x70000011) |
138 | AARCH64_DYNAMIC_TAG(AARCH64_AUTH_RELR, 0x70000012) |
139 | AARCH64_DYNAMIC_TAG(AARCH64_AUTH_RELRENT, 0x70000013) |
140 | |
141 | // Hexagon specific dynamic table entries |
142 | HEXAGON_DYNAMIC_TAG(HEXAGON_SYMSZ, 0x70000000) |
143 | HEXAGON_DYNAMIC_TAG(HEXAGON_VER, 0x70000001) |
144 | HEXAGON_DYNAMIC_TAG(HEXAGON_PLT, 0x70000002) |
145 | |
146 | // Mips specific dynamic table entry tags. |
147 | |
148 | MIPS_DYNAMIC_TAG(MIPS_RLD_VERSION, 0x70000001) // 32 bit version number for |
149 | // runtime linker interface. |
150 | MIPS_DYNAMIC_TAG(MIPS_TIME_STAMP, 0x70000002) // Time stamp. |
151 | MIPS_DYNAMIC_TAG(MIPS_ICHECKSUM, 0x70000003) // Checksum of external strings |
152 | // and common sizes. |
153 | MIPS_DYNAMIC_TAG(MIPS_IVERSION, 0x70000004) // Index of version string |
154 | // in string table. |
155 | MIPS_DYNAMIC_TAG(MIPS_FLAGS, 0x70000005) // 32 bits of flags. |
156 | MIPS_DYNAMIC_TAG(MIPS_BASE_ADDRESS, 0x70000006) // Base address of the segment. |
157 | MIPS_DYNAMIC_TAG(MIPS_MSYM, 0x70000007) // Address of .msym section. |
158 | MIPS_DYNAMIC_TAG(MIPS_CONFLICT, 0x70000008) // Address of .conflict section. |
159 | MIPS_DYNAMIC_TAG(MIPS_LIBLIST, 0x70000009) // Address of .liblist section. |
160 | MIPS_DYNAMIC_TAG(MIPS_LOCAL_GOTNO, 0x7000000a) // Number of local global offset |
161 | // table entries. |
162 | MIPS_DYNAMIC_TAG(MIPS_CONFLICTNO, 0x7000000b) // Number of entries |
163 | // in the .conflict section. |
164 | MIPS_DYNAMIC_TAG(MIPS_LIBLISTNO, 0x70000010) // Number of entries |
165 | // in the .liblist section. |
166 | MIPS_DYNAMIC_TAG(MIPS_SYMTABNO, 0x70000011) // Number of entries |
167 | // in the .dynsym section. |
168 | MIPS_DYNAMIC_TAG(MIPS_UNREFEXTNO, 0x70000012) // Index of first external dynamic |
169 | // symbol not referenced locally. |
170 | MIPS_DYNAMIC_TAG(MIPS_GOTSYM, 0x70000013) // Index of first dynamic symbol |
171 | // in global offset table. |
172 | MIPS_DYNAMIC_TAG(MIPS_HIPAGENO, 0x70000014) // Number of page table entries |
173 | // in global offset table. |
174 | MIPS_DYNAMIC_TAG(MIPS_RLD_MAP, 0x70000016) // Address of run time loader map |
175 | // used for debugging. |
176 | MIPS_DYNAMIC_TAG(MIPS_DELTA_CLASS, 0x70000017) // Delta C++ class definition. |
177 | MIPS_DYNAMIC_TAG(MIPS_DELTA_CLASS_NO, 0x70000018) // Number of entries |
178 | // in DT_MIPS_DELTA_CLASS. |
179 | MIPS_DYNAMIC_TAG(MIPS_DELTA_INSTANCE, 0x70000019) // Delta C++ class instances. |
180 | MIPS_DYNAMIC_TAG(MIPS_DELTA_INSTANCE_NO, 0x7000001A) // Number of entries |
181 | // in DT_MIPS_DELTA_INSTANCE. |
182 | MIPS_DYNAMIC_TAG(MIPS_DELTA_RELOC, 0x7000001B) // Delta relocations. |
183 | MIPS_DYNAMIC_TAG(MIPS_DELTA_RELOC_NO, 0x7000001C) // Number of entries |
184 | // in DT_MIPS_DELTA_RELOC. |
185 | MIPS_DYNAMIC_TAG(MIPS_DELTA_SYM, 0x7000001D) // Delta symbols that Delta |
186 | // relocations refer to. |
187 | MIPS_DYNAMIC_TAG(MIPS_DELTA_SYM_NO, 0x7000001E) // Number of entries |
188 | // in DT_MIPS_DELTA_SYM. |
189 | MIPS_DYNAMIC_TAG(MIPS_DELTA_CLASSSYM, 0x70000020) // Delta symbols that hold |
190 | // class declarations. |
191 | MIPS_DYNAMIC_TAG(MIPS_DELTA_CLASSSYM_NO, 0x70000021) // Number of entries |
192 | // in DT_MIPS_DELTA_CLASSSYM. |
193 | |
194 | MIPS_DYNAMIC_TAG(MIPS_CXX_FLAGS, 0x70000022) // Flags indicating information |
195 | // about C++ flavor. |
196 | MIPS_DYNAMIC_TAG(MIPS_PIXIE_INIT, 0x70000023) // Pixie information. |
197 | MIPS_DYNAMIC_TAG(MIPS_SYMBOL_LIB, 0x70000024) // Address of .MIPS.symlib |
198 | MIPS_DYNAMIC_TAG(MIPS_LOCALPAGE_GOTIDX, 0x70000025) // The GOT index of the first PTE |
199 | // for a segment |
200 | MIPS_DYNAMIC_TAG(MIPS_LOCAL_GOTIDX, 0x70000026) // The GOT index of the first PTE |
201 | // for a local symbol |
202 | MIPS_DYNAMIC_TAG(MIPS_HIDDEN_GOTIDX, 0x70000027) // The GOT index of the first PTE |
203 | // for a hidden symbol |
204 | MIPS_DYNAMIC_TAG(MIPS_PROTECTED_GOTIDX, 0x70000028) // The GOT index of the first PTE |
205 | // for a protected symbol |
206 | MIPS_DYNAMIC_TAG(MIPS_OPTIONS, 0x70000029) // Address of `.MIPS.options'. |
207 | MIPS_DYNAMIC_TAG(MIPS_INTERFACE, 0x7000002A) // Address of `.interface'. |
208 | MIPS_DYNAMIC_TAG(MIPS_DYNSTR_ALIGN, 0x7000002B) // Unknown. |
209 | MIPS_DYNAMIC_TAG(MIPS_INTERFACE_SIZE, 0x7000002C) // Size of the .interface section. |
210 | MIPS_DYNAMIC_TAG(MIPS_RLD_TEXT_RESOLVE_ADDR, 0x7000002D) // Size of rld_text_resolve |
211 | // function stored in the GOT. |
212 | MIPS_DYNAMIC_TAG(MIPS_PERF_SUFFIX, 0x7000002E) // Default suffix of DSO to be added |
213 | // by rld on dlopen() calls. |
214 | MIPS_DYNAMIC_TAG(MIPS_COMPACT_SIZE, 0x7000002F) // Size of compact relocation |
215 | // section (O32). |
216 | MIPS_DYNAMIC_TAG(MIPS_GP_VALUE, 0x70000030) // GP value for auxiliary GOTs. |
217 | MIPS_DYNAMIC_TAG(MIPS_AUX_DYNAMIC, 0x70000031) // Address of auxiliary .dynamic. |
218 | MIPS_DYNAMIC_TAG(MIPS_PLTGOT, 0x70000032) // Address of the base of the PLTGOT. |
219 | MIPS_DYNAMIC_TAG(MIPS_RWPLT, 0x70000034) // Points to the base |
220 | // of a writable PLT. |
221 | MIPS_DYNAMIC_TAG(MIPS_RLD_MAP_REL, 0x70000035) // Relative offset of run time loader |
222 | // map, used for debugging. |
223 | MIPS_DYNAMIC_TAG(MIPS_XHASH, 0x70000036) // GNU-style hash table with xlat. |
224 | |
225 | // PPC specific dynamic table entries. |
226 | PPC_DYNAMIC_TAG(PPC_GOT, 0x70000000) // Uses Secure PLT ABI. |
227 | PPC_DYNAMIC_TAG(PPC_OPT, 0x70000001) // Has TLS optimization. |
228 | |
229 | // PPC64 specific dynamic table entries. |
230 | PPC64_DYNAMIC_TAG(PPC64_GLINK, 0x70000000) // Address of 32 bytes before the |
231 | // first glink lazy resolver stub. |
232 | PPC64_DYNAMIC_TAG(PPC64_OPT, 0x70000003) // Flags to control optimizations |
233 | // for TLS and multiple TOCs. |
234 | |
235 | // RISC-V specific dynamic array tags. |
236 | RISCV_DYNAMIC_TAG(RISCV_VARIANT_CC, 0x70000001) |
237 | |
238 | // Sun machine-independent extensions. |
239 | DYNAMIC_TAG(AUXILIARY, 0x7FFFFFFD) // Shared object to load before self |
240 | DYNAMIC_TAG(USED, 0x7FFFFFFE) // Same as DT_NEEDED |
241 | DYNAMIC_TAG(FILTER, 0x7FFFFFFF) // Shared object to get values from |
242 | |
243 | |
244 | #ifdef DYNAMIC_TAG_MARKER_DEFINED |
245 | #undef DYNAMIC_TAG_MARKER |
246 | #undef DYNAMIC_TAG_MARKER_DEFINED |
247 | #endif |
248 | #ifdef AARCH64_DYNAMIC_TAG_DEFINED |
249 | #undef AARCH64_DYNAMIC_TAG |
250 | #undef AARCH64_DYNAMIC_TAG_DEFINED |
251 | #endif |
252 | #ifdef MIPS_DYNAMIC_TAG_DEFINED |
253 | #undef MIPS_DYNAMIC_TAG |
254 | #undef MIPS_DYNAMIC_TAG_DEFINED |
255 | #endif |
256 | #ifdef HEXAGON_DYNAMIC_TAG_DEFINED |
257 | #undef HEXAGON_DYNAMIC_TAG |
258 | #undef HEXAGON_DYNAMIC_TAG_DEFINED |
259 | #endif |
260 | #ifdef PPC_DYNAMIC_TAG_DEFINED |
261 | #undef PPC_DYNAMIC_TAG |
262 | #undef PPC_DYNAMIC_TAG_DEFINED |
263 | #endif |
264 | #ifdef PPC64_DYNAMIC_TAG_DEFINED |
265 | #undef PPC64_DYNAMIC_TAG |
266 | #undef PPC64_DYNAMIC_TAG_DEFINED |
267 | #endif |
268 | #ifdef RISCV_DYNAMIC_TAG_DEFINED |
269 | #undef RISCV_DYNAMIC_TAG |
270 | #undef RISCV_DYNAMIC_TAG_DEFINED |
271 | #endif |
272 | |