1336809Sdim#ifndef DYNAMIC_TAG 2336809Sdim#error "DYNAMIC_TAG must be defined" 3336809Sdim#endif 4336809Sdim 5336809Sdim// Add separate macros for the architecture specific tags and the markers 6336809Sdim// such as DT_HIOS, etc. to allow using this file to in other contexts. 7336809Sdim// For example we can use it to generate a stringification switch statement. 8336809Sdim 9353358Sdim#ifndef AARCH64_DYNAMIC_TAG 10353358Sdim#define AARCH64_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) 11353358Sdim#define AARCH64_DYNAMIC_TAG_DEFINED 12353358Sdim#endif 13353358Sdim 14336809Sdim#ifndef HEXAGON_DYNAMIC_TAG 15336809Sdim#define HEXAGON_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) 16336809Sdim#define HEXAGON_DYNAMIC_TAG_DEFINED 17336809Sdim#endif 18336809Sdim 19336809Sdim#ifndef MIPS_DYNAMIC_TAG 20336809Sdim#define MIPS_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) 21336809Sdim#define MIPS_DYNAMIC_TAG_DEFINED 22336809Sdim#endif 23336809Sdim 24353358Sdim#ifndef PPC_DYNAMIC_TAG 25353358Sdim#define PPC_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) 26353358Sdim#define PPC_DYNAMIC_TAG_DEFINED 27353358Sdim#endif 28353358Sdim 29336809Sdim#ifndef PPC64_DYNAMIC_TAG 30336809Sdim#define PPC64_DYNAMIC_TAG(name, value) DYNAMIC_TAG(name, value) 31336809Sdim#define PPC64_DYNAMIC_TAG_DEFINED 32336809Sdim#endif 33336809Sdim 34336809Sdim#ifndef DYNAMIC_TAG_MARKER 35336809Sdim#define DYNAMIC_TAG_MARKER(name, value) DYNAMIC_TAG(name, value) 36336809Sdim#define DYNAMIC_TAG_MARKER_DEFINED 37336809Sdim#endif 38336809Sdim 39336809SdimDYNAMIC_TAG(NULL, 0) // Marks end of dynamic array. 40336809SdimDYNAMIC_TAG(NEEDED, 1) // String table offset of needed library. 41336809SdimDYNAMIC_TAG(PLTRELSZ, 2) // Size of relocation entries in PLT. 42336809SdimDYNAMIC_TAG(PLTGOT, 3) // Address associated with linkage table. 43336809SdimDYNAMIC_TAG(HASH, 4) // Address of symbolic hash table. 44336809SdimDYNAMIC_TAG(STRTAB, 5) // Address of dynamic string table. 45336809SdimDYNAMIC_TAG(SYMTAB, 6) // Address of dynamic symbol table. 46336809SdimDYNAMIC_TAG(RELA, 7) // Address of relocation table (Rela entries). 47336809SdimDYNAMIC_TAG(RELASZ, 8) // Size of Rela relocation table. 48336809SdimDYNAMIC_TAG(RELAENT, 9) // Size of a Rela relocation entry. 49336809SdimDYNAMIC_TAG(STRSZ, 10) // Total size of the string table. 50336809SdimDYNAMIC_TAG(SYMENT, 11) // Size of a symbol table entry. 51336809SdimDYNAMIC_TAG(INIT, 12) // Address of initialization function. 52336809SdimDYNAMIC_TAG(FINI, 13) // Address of termination function. 53336809SdimDYNAMIC_TAG(SONAME, 14) // String table offset of a shared objects name. 54336809SdimDYNAMIC_TAG(RPATH, 15) // String table offset of library search path. 55336809SdimDYNAMIC_TAG(SYMBOLIC, 16) // Changes symbol resolution algorithm. 56336809SdimDYNAMIC_TAG(REL, 17) // Address of relocation table (Rel entries). 57336809SdimDYNAMIC_TAG(RELSZ, 18) // Size of Rel relocation table. 58336809SdimDYNAMIC_TAG(RELENT, 19) // Size of a Rel relocation entry. 59336809SdimDYNAMIC_TAG(PLTREL, 20) // Type of relocation entry used for linking. 60336809SdimDYNAMIC_TAG(DEBUG, 21) // Reserved for debugger. 61336809SdimDYNAMIC_TAG(TEXTREL, 22) // Relocations exist for non-writable segments. 62336809SdimDYNAMIC_TAG(JMPREL, 23) // Address of relocations associated with PLT. 63336809SdimDYNAMIC_TAG(BIND_NOW, 24) // Process all relocations before execution. 64336809SdimDYNAMIC_TAG(INIT_ARRAY, 25) // Pointer to array of initialization functions. 65336809SdimDYNAMIC_TAG(FINI_ARRAY, 26) // Pointer to array of termination functions. 66336809SdimDYNAMIC_TAG(INIT_ARRAYSZ, 27) // Size of DT_INIT_ARRAY. 67336809SdimDYNAMIC_TAG(FINI_ARRAYSZ, 28) // Size of DT_FINI_ARRAY. 68336809SdimDYNAMIC_TAG(RUNPATH, 29) // String table offset of lib search path. 69336809SdimDYNAMIC_TAG(FLAGS, 30) // Flags. 70336809SdimDYNAMIC_TAG_MARKER(ENCODING, 32) // Values from here to DT_LOOS follow the rules 71336809Sdim // for the interpretation of the d_un union. 72336809Sdim 73336809SdimDYNAMIC_TAG(PREINIT_ARRAY, 32) // Pointer to array of preinit functions. 74336809SdimDYNAMIC_TAG(PREINIT_ARRAYSZ, 33) // Size of the DT_PREINIT_ARRAY array. 75336809Sdim 76336809SdimDYNAMIC_TAG(SYMTAB_SHNDX, 34) // Address of the SHT_SYMTAB_SHNDX section. 77336809Sdim 78336809Sdim// Experimental support for SHT_RELR sections. For details, see proposal 79336809Sdim// at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg 80336809SdimDYNAMIC_TAG(RELRSZ, 35) // Size of Relr relocation table. 81336809SdimDYNAMIC_TAG(RELR, 36) // Address of relocation table (Relr entries). 82336809SdimDYNAMIC_TAG(RELRENT, 37) // Size of a Relr relocation entry. 83336809Sdim 84336809SdimDYNAMIC_TAG_MARKER(LOOS, 0x60000000) // Start of environment specific tags. 85336809SdimDYNAMIC_TAG_MARKER(HIOS, 0x6FFFFFFF) // End of environment specific tags. 86336809SdimDYNAMIC_TAG_MARKER(LOPROC, 0x70000000) // Start of processor specific tags. 87336809SdimDYNAMIC_TAG_MARKER(HIPROC, 0x7FFFFFFF) // End of processor specific tags. 88336809Sdim 89336809Sdim// Android packed relocation section tags. 90336809Sdim// https://android.googlesource.com/platform/bionic/+/6f12bfece5dcc01325e0abba56a46b1bcf991c69/tools/relocation_packer/src/elf_file.cc#31 91336809SdimDYNAMIC_TAG(ANDROID_REL, 0x6000000F) 92336809SdimDYNAMIC_TAG(ANDROID_RELSZ, 0x60000010) 93336809SdimDYNAMIC_TAG(ANDROID_RELA, 0x60000011) 94336809SdimDYNAMIC_TAG(ANDROID_RELASZ, 0x60000012) 95336809Sdim 96336809Sdim// Android's experimental support for SHT_RELR sections. 97336809Sdim// https://android.googlesource.com/platform/bionic/+/b7feec74547f84559a1467aca02708ff61346d2a/libc/include/elf.h#253 98336809SdimDYNAMIC_TAG(ANDROID_RELR, 0x6FFFE000) // Address of relocation table (Relr entries). 99336809SdimDYNAMIC_TAG(ANDROID_RELRSZ, 0x6FFFE001) // Size of Relr relocation table. 100336809SdimDYNAMIC_TAG(ANDROID_RELRENT, 0x6FFFE003) // Size of a Relr relocation entry. 101336809Sdim 102336809SdimDYNAMIC_TAG(GNU_HASH, 0x6FFFFEF5) // Reference to the GNU hash table. 103336809SdimDYNAMIC_TAG(TLSDESC_PLT, 0x6FFFFEF6) // Location of PLT entry for TLS 104336809Sdim // descriptor resolver calls. 105336809SdimDYNAMIC_TAG(TLSDESC_GOT, 0x6FFFFEF7) // Location of GOT entry used by TLS 106336809Sdim // descriptor resolver PLT entry. 107336809SdimDYNAMIC_TAG(RELACOUNT, 0x6FFFFFF9) // ELF32_Rela count. 108336809SdimDYNAMIC_TAG(RELCOUNT, 0x6FFFFFFA) // ELF32_Rel count. 109336809Sdim 110336809SdimDYNAMIC_TAG(FLAGS_1, 0X6FFFFFFB) // Flags_1. 111336809Sdim 112336809SdimDYNAMIC_TAG(VERSYM, 0x6FFFFFF0) // The address of .gnu.version section. 113336809SdimDYNAMIC_TAG(VERDEF, 0X6FFFFFFC) // The address of the version definition 114336809Sdim // table. 115336809SdimDYNAMIC_TAG(VERDEFNUM, 0X6FFFFFFD) // The number of entries in DT_VERDEF. 116336809SdimDYNAMIC_TAG(VERNEED, 0X6FFFFFFE) // The address of the version dependency 117336809Sdim // table. 118336809SdimDYNAMIC_TAG(VERNEEDNUM, 0X6FFFFFFF) // The number of entries in DT_VERNEED. 119336809Sdim 120353358Sdim// AArch64 specific dynamic table entries 121353358SdimAARCH64_DYNAMIC_TAG(AARCH64_BTI_PLT, 0x70000001) 122353358SdimAARCH64_DYNAMIC_TAG(AARCH64_PAC_PLT, 0x70000003) 123353358Sdim 124336809Sdim// Hexagon specific dynamic table entries 125336809SdimHEXAGON_DYNAMIC_TAG(HEXAGON_SYMSZ, 0x70000000) 126336809SdimHEXAGON_DYNAMIC_TAG(HEXAGON_VER, 0x70000001) 127336809SdimHEXAGON_DYNAMIC_TAG(HEXAGON_PLT, 0x70000002) 128336809Sdim 129336809Sdim// Mips specific dynamic table entry tags. 130336809Sdim 131336809SdimMIPS_DYNAMIC_TAG(MIPS_RLD_VERSION, 0x70000001) // 32 bit version number for 132336809Sdim // runtime linker interface. 133336809SdimMIPS_DYNAMIC_TAG(MIPS_TIME_STAMP, 0x70000002) // Time stamp. 134336809SdimMIPS_DYNAMIC_TAG(MIPS_ICHECKSUM, 0x70000003) // Checksum of external strings 135336809Sdim // and common sizes. 136336809SdimMIPS_DYNAMIC_TAG(MIPS_IVERSION, 0x70000004) // Index of version string 137336809Sdim // in string table. 138336809SdimMIPS_DYNAMIC_TAG(MIPS_FLAGS, 0x70000005) // 32 bits of flags. 139336809SdimMIPS_DYNAMIC_TAG(MIPS_BASE_ADDRESS, 0x70000006) // Base address of the segment. 140336809SdimMIPS_DYNAMIC_TAG(MIPS_MSYM, 0x70000007) // Address of .msym section. 141336809SdimMIPS_DYNAMIC_TAG(MIPS_CONFLICT, 0x70000008) // Address of .conflict section. 142336809SdimMIPS_DYNAMIC_TAG(MIPS_LIBLIST, 0x70000009) // Address of .liblist section. 143336809SdimMIPS_DYNAMIC_TAG(MIPS_LOCAL_GOTNO, 0x7000000a) // Number of local global offset 144336809Sdim // table entries. 145336809SdimMIPS_DYNAMIC_TAG(MIPS_CONFLICTNO, 0x7000000b) // Number of entries 146336809Sdim // in the .conflict section. 147336809SdimMIPS_DYNAMIC_TAG(MIPS_LIBLISTNO, 0x70000010) // Number of entries 148336809Sdim // in the .liblist section. 149336809SdimMIPS_DYNAMIC_TAG(MIPS_SYMTABNO, 0x70000011) // Number of entries 150336809Sdim // in the .dynsym section. 151336809SdimMIPS_DYNAMIC_TAG(MIPS_UNREFEXTNO, 0x70000012) // Index of first external dynamic 152336809Sdim // symbol not referenced locally. 153336809SdimMIPS_DYNAMIC_TAG(MIPS_GOTSYM, 0x70000013) // Index of first dynamic symbol 154336809Sdim // in global offset table. 155336809SdimMIPS_DYNAMIC_TAG(MIPS_HIPAGENO, 0x70000014) // Number of page table entries 156336809Sdim // in global offset table. 157336809SdimMIPS_DYNAMIC_TAG(MIPS_RLD_MAP, 0x70000016) // Address of run time loader map 158336809Sdim // used for debugging. 159336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_CLASS, 0x70000017) // Delta C++ class definition. 160336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_CLASS_NO, 0x70000018) // Number of entries 161336809Sdim // in DT_MIPS_DELTA_CLASS. 162336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_INSTANCE, 0x70000019) // Delta C++ class instances. 163336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_INSTANCE_NO, 0x7000001A) // Number of entries 164336809Sdim // in DT_MIPS_DELTA_INSTANCE. 165336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_RELOC, 0x7000001B) // Delta relocations. 166336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_RELOC_NO, 0x7000001C) // Number of entries 167336809Sdim // in DT_MIPS_DELTA_RELOC. 168336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_SYM, 0x7000001D) // Delta symbols that Delta 169336809Sdim // relocations refer to. 170336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_SYM_NO, 0x7000001E) // Number of entries 171336809Sdim // in DT_MIPS_DELTA_SYM. 172336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_CLASSSYM, 0x70000020) // Delta symbols that hold 173336809Sdim // class declarations. 174336809SdimMIPS_DYNAMIC_TAG(MIPS_DELTA_CLASSSYM_NO, 0x70000021) // Number of entries 175336809Sdim // in DT_MIPS_DELTA_CLASSSYM. 176336809Sdim 177336809SdimMIPS_DYNAMIC_TAG(MIPS_CXX_FLAGS, 0x70000022) // Flags indicating information 178336809Sdim // about C++ flavor. 179336809SdimMIPS_DYNAMIC_TAG(MIPS_PIXIE_INIT, 0x70000023) // Pixie information. 180336809SdimMIPS_DYNAMIC_TAG(MIPS_SYMBOL_LIB, 0x70000024) // Address of .MIPS.symlib 181336809SdimMIPS_DYNAMIC_TAG(MIPS_LOCALPAGE_GOTIDX, 0x70000025) // The GOT index of the first PTE 182336809Sdim // for a segment 183336809SdimMIPS_DYNAMIC_TAG(MIPS_LOCAL_GOTIDX, 0x70000026) // The GOT index of the first PTE 184336809Sdim // for a local symbol 185336809SdimMIPS_DYNAMIC_TAG(MIPS_HIDDEN_GOTIDX, 0x70000027) // The GOT index of the first PTE 186336809Sdim // for a hidden symbol 187336809SdimMIPS_DYNAMIC_TAG(MIPS_PROTECTED_GOTIDX, 0x70000028) // The GOT index of the first PTE 188336809Sdim // for a protected symbol 189336809SdimMIPS_DYNAMIC_TAG(MIPS_OPTIONS, 0x70000029) // Address of `.MIPS.options'. 190336809SdimMIPS_DYNAMIC_TAG(MIPS_INTERFACE, 0x7000002A) // Address of `.interface'. 191336809SdimMIPS_DYNAMIC_TAG(MIPS_DYNSTR_ALIGN, 0x7000002B) // Unknown. 192336809SdimMIPS_DYNAMIC_TAG(MIPS_INTERFACE_SIZE, 0x7000002C) // Size of the .interface section. 193336809SdimMIPS_DYNAMIC_TAG(MIPS_RLD_TEXT_RESOLVE_ADDR, 0x7000002D) // Size of rld_text_resolve 194336809Sdim // function stored in the GOT. 195336809SdimMIPS_DYNAMIC_TAG(MIPS_PERF_SUFFIX, 0x7000002E) // Default suffix of DSO to be added 196336809Sdim // by rld on dlopen() calls. 197336809SdimMIPS_DYNAMIC_TAG(MIPS_COMPACT_SIZE, 0x7000002F) // Size of compact relocation 198336809Sdim // section (O32). 199336809SdimMIPS_DYNAMIC_TAG(MIPS_GP_VALUE, 0x70000030) // GP value for auxiliary GOTs. 200336809SdimMIPS_DYNAMIC_TAG(MIPS_AUX_DYNAMIC, 0x70000031) // Address of auxiliary .dynamic. 201336809SdimMIPS_DYNAMIC_TAG(MIPS_PLTGOT, 0x70000032) // Address of the base of the PLTGOT. 202336809SdimMIPS_DYNAMIC_TAG(MIPS_RWPLT, 0x70000034) // Points to the base 203336809Sdim // of a writable PLT. 204336809SdimMIPS_DYNAMIC_TAG(MIPS_RLD_MAP_REL, 0x70000035) // Relative offset of run time loader 205336809Sdim // map, used for debugging. 206336809Sdim 207353358Sdim// PPC specific dynamic table entries. 208353358SdimPPC_DYNAMIC_TAG(PPC_GOT, 0x70000000) // Uses Secure PLT ABI. 209353358SdimPPC_DYNAMIC_TAG(PPC_OPT, 0x70000001) // Has TLS optimization. 210353358Sdim 211336809Sdim// PPC64 specific dynamic table entries. 212336809SdimPPC64_DYNAMIC_TAG(PPC64_GLINK, 0x70000000) // Address of 32 bytes before the 213336809Sdim // first glink lazy resolver stub. 214336809Sdim 215336809Sdim// Sun machine-independent extensions. 216336809SdimDYNAMIC_TAG(AUXILIARY, 0x7FFFFFFD) // Shared object to load before self 217353358SdimDYNAMIC_TAG(USED, 0x7FFFFFFE) // Same as DT_NEEDED 218336809SdimDYNAMIC_TAG(FILTER, 0x7FFFFFFF) // Shared object to get values from 219336809Sdim 220336809Sdim 221336809Sdim#ifdef DYNAMIC_TAG_MARKER_DEFINED 222336809Sdim#undef DYNAMIC_TAG_MARKER 223353358Sdim#undef DYNAMIC_TAG_MARKER_DEFINED 224336809Sdim#endif 225353358Sdim#ifdef AARCH64_DYNAMIC_TAG_DEFINED 226353358Sdim#undef AARCH64_DYNAMIC_TAG 227353358Sdim#undef AARCH64_DYNAMIC_TAG_DEFINED 228353358Sdim#endif 229336809Sdim#ifdef MIPS_DYNAMIC_TAG_DEFINED 230336809Sdim#undef MIPS_DYNAMIC_TAG 231336809Sdim#undef MIPS_DYNAMIC_TAG_DEFINED 232336809Sdim#endif 233336809Sdim#ifdef HEXAGON_DYNAMIC_TAG_DEFINED 234336809Sdim#undef HEXAGON_DYNAMIC_TAG 235336809Sdim#undef HEXAGON_DYNAMIC_TAG_DEFINED 236336809Sdim#endif 237353358Sdim#ifdef PPC_DYNAMIC_TAG_DEFINED 238353358Sdim#undef PPC_DYNAMIC_TAG 239353358Sdim#undef PPC_DYNAMIC_TAG_DEFINED 240353358Sdim#endif 241336809Sdim#ifdef PPC64_DYNAMIC_TAG_DEFINED 242336809Sdim#undef PPC64_DYNAMIC_TAG 243336809Sdim#undef PPC64_DYNAMIC_TAG_DEFINED 244336809Sdim#endif 245