1 /*- 2 * Copyright (c) 2010 Joseph Koshy 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 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $Id: elfdefinitions.h 3392 2016-02-05 19:51:22Z emaste $ 27 */ 28 29 /* 30 * These definitions are based on: 31 * - The public specification of the ELF format as defined in the 32 * October 2009 draft of System V ABI. 33 * See: http://www.sco.com/developers/gabi/latest/ch4.intro.html 34 * - The May 1998 (version 1.5) draft of "The ELF-64 object format". 35 * - Processor-specific ELF ABI definitions for sparc, i386, amd64, mips, 36 * ia64, and powerpc processors. 37 * - The "Linkers and Libraries Guide", from Sun Microsystems. 38 */ 39 40 #ifndef _ELFDEFINITIONS_H_ 41 #define _ELFDEFINITIONS_H_ 42 43 #include <stdint.h> 44 45 /* 46 * Types of capabilities. 47 */ 48 49 #define _ELF_DEFINE_CAPABILITIES() \ 50 _ELF_DEFINE_CA(CA_SUNW_NULL, 0, "ignored") \ 51 _ELF_DEFINE_CA(CA_SUNW_HW_1, 1, "hardware capability") \ 52 _ELF_DEFINE_CA(CA_SUNW_SW_1, 2, "software capability") 53 54 #undef _ELF_DEFINE_CA 55 #define _ELF_DEFINE_CA(N, V, DESCR) N = V , 56 enum { 57 _ELF_DEFINE_CAPABILITIES() 58 CA__LAST__ 59 }; 60 61 /* 62 * Flags used with dynamic linking entries. 63 */ 64 65 #define _ELF_DEFINE_DYN_FLAGS() \ 66 _ELF_DEFINE_DF(DF_ORIGIN, 0x1, \ 67 "object being loaded may refer to $ORIGIN") \ 68 _ELF_DEFINE_DF(DF_SYMBOLIC, 0x2, \ 69 "search library for references before executable") \ 70 _ELF_DEFINE_DF(DF_TEXTREL, 0x4, \ 71 "relocation entries may modify text segment") \ 72 _ELF_DEFINE_DF(DF_BIND_NOW, 0x8, \ 73 "process relocation entries at load time") \ 74 _ELF_DEFINE_DF(DF_STATIC_TLS, 0x10, \ 75 "uses static thread-local storage") 76 #undef _ELF_DEFINE_DF 77 #define _ELF_DEFINE_DF(N, V, DESCR) N = V , 78 enum { 79 _ELF_DEFINE_DYN_FLAGS() 80 DF__LAST__ 81 }; 82 83 84 /* 85 * Dynamic linking entry types. 86 */ 87 88 #define _ELF_DEFINE_DYN_TYPES() \ 89 _ELF_DEFINE_DT(DT_NULL, 0, "end of array") \ 90 _ELF_DEFINE_DT(DT_NEEDED, 1, "names a needed library") \ 91 _ELF_DEFINE_DT(DT_PLTRELSZ, 2, \ 92 "size in bytes of associated relocation entries") \ 93 _ELF_DEFINE_DT(DT_PLTGOT, 3, \ 94 "address associated with the procedure linkage table") \ 95 _ELF_DEFINE_DT(DT_HASH, 4, \ 96 "address of the symbol hash table") \ 97 _ELF_DEFINE_DT(DT_STRTAB, 5, \ 98 "address of the string table") \ 99 _ELF_DEFINE_DT(DT_SYMTAB, 6, \ 100 "address of the symbol table") \ 101 _ELF_DEFINE_DT(DT_RELA, 7, \ 102 "address of the relocation table") \ 103 _ELF_DEFINE_DT(DT_RELASZ, 8, "size of the DT_RELA table") \ 104 _ELF_DEFINE_DT(DT_RELAENT, 9, "size of each DT_RELA entry") \ 105 _ELF_DEFINE_DT(DT_STRSZ, 10, "size of the string table") \ 106 _ELF_DEFINE_DT(DT_SYMENT, 11, \ 107 "size of a symbol table entry") \ 108 _ELF_DEFINE_DT(DT_INIT, 12, \ 109 "address of the initialization function") \ 110 _ELF_DEFINE_DT(DT_FINI, 13, \ 111 "address of the finalization function") \ 112 _ELF_DEFINE_DT(DT_SONAME, 14, "names the shared object") \ 113 _ELF_DEFINE_DT(DT_RPATH, 15, \ 114 "runtime library search path") \ 115 _ELF_DEFINE_DT(DT_SYMBOLIC, 16, \ 116 "alter symbol resolution algorithm") \ 117 _ELF_DEFINE_DT(DT_REL, 17, \ 118 "address of the DT_REL table") \ 119 _ELF_DEFINE_DT(DT_RELSZ, 18, "size of the DT_REL table") \ 120 _ELF_DEFINE_DT(DT_RELENT, 19, "size of each DT_REL entry") \ 121 _ELF_DEFINE_DT(DT_PLTREL, 20, \ 122 "type of relocation entry in the procedure linkage table") \ 123 _ELF_DEFINE_DT(DT_DEBUG, 21, "used for debugging") \ 124 _ELF_DEFINE_DT(DT_TEXTREL, 22, \ 125 "text segment may be written to during relocation") \ 126 _ELF_DEFINE_DT(DT_JMPREL, 23, \ 127 "address of relocation entries associated with the procedure linkage table") \ 128 _ELF_DEFINE_DT(DT_BIND_NOW, 24, \ 129 "bind symbols at loading time") \ 130 _ELF_DEFINE_DT(DT_INIT_ARRAY, 25, \ 131 "pointers to initialization functions") \ 132 _ELF_DEFINE_DT(DT_FINI_ARRAY, 26, \ 133 "pointers to termination functions") \ 134 _ELF_DEFINE_DT(DT_INIT_ARRAYSZ, 27, "size of the DT_INIT_ARRAY") \ 135 _ELF_DEFINE_DT(DT_FINI_ARRAYSZ, 28, "size of the DT_FINI_ARRAY") \ 136 _ELF_DEFINE_DT(DT_RUNPATH, 29, \ 137 "index of library search path string") \ 138 _ELF_DEFINE_DT(DT_FLAGS, 30, \ 139 "flags specific to the object being loaded") \ 140 _ELF_DEFINE_DT(DT_ENCODING, 32, "standard semantics") \ 141 _ELF_DEFINE_DT(DT_PREINIT_ARRAY, 32, \ 142 "pointers to pre-initialization functions") \ 143 _ELF_DEFINE_DT(DT_PREINIT_ARRAYSZ, 33, \ 144 "size of pre-initialization array") \ 145 _ELF_DEFINE_DT(DT_MAXPOSTAGS, 34, \ 146 "the number of positive tags") \ 147 _ELF_DEFINE_DT(DT_LOOS, 0x6000000DUL, \ 148 "start of OS-specific types") \ 149 _ELF_DEFINE_DT(DT_SUNW_AUXILIARY, 0x6000000DUL, \ 150 "offset of string naming auxiliary filtees") \ 151 _ELF_DEFINE_DT(DT_SUNW_RTLDINF, 0x6000000EUL, "rtld internal use") \ 152 _ELF_DEFINE_DT(DT_SUNW_FILTER, 0x6000000FUL, \ 153 "offset of string naming standard filtees") \ 154 _ELF_DEFINE_DT(DT_SUNW_CAP, 0x60000010UL, \ 155 "address of hardware capabilities section") \ 156 _ELF_DEFINE_DT(DT_HIOS, 0x6FFFF000UL, \ 157 "end of OS-specific types") \ 158 _ELF_DEFINE_DT(DT_VALRNGLO, 0x6FFFFD00UL, \ 159 "start of range using the d_val field") \ 160 _ELF_DEFINE_DT(DT_GNU_PRELINKED, 0x6FFFFDF5UL, \ 161 "prelinking timestamp") \ 162 _ELF_DEFINE_DT(DT_GNU_CONFLICTSZ, 0x6FFFFDF6UL, \ 163 "size of conflict section") \ 164 _ELF_DEFINE_DT(DT_GNU_LIBLISTSZ, 0x6FFFFDF7UL, \ 165 "size of library list") \ 166 _ELF_DEFINE_DT(DT_CHECKSUM, 0x6FFFFDF8UL, \ 167 "checksum for the object") \ 168 _ELF_DEFINE_DT(DT_PLTPADSZ, 0x6FFFFDF9UL, \ 169 "size of PLT padding") \ 170 _ELF_DEFINE_DT(DT_MOVEENT, 0x6FFFFDFAUL, \ 171 "size of DT_MOVETAB entries") \ 172 _ELF_DEFINE_DT(DT_MOVESZ, 0x6FFFFDFBUL, \ 173 "total size of the MOVETAB table") \ 174 _ELF_DEFINE_DT(DT_FEATURE, 0x6FFFFDFCUL, "feature values") \ 175 _ELF_DEFINE_DT(DT_POSFLAG_1, 0x6FFFFDFDUL, \ 176 "dynamic position flags") \ 177 _ELF_DEFINE_DT(DT_SYMINSZ, 0x6FFFFDFEUL, \ 178 "size of the DT_SYMINFO table") \ 179 _ELF_DEFINE_DT(DT_SYMINENT, 0x6FFFFDFFUL, \ 180 "size of a DT_SYMINFO entry") \ 181 _ELF_DEFINE_DT(DT_VALRNGHI, 0x6FFFFDFFUL, \ 182 "end of range using the d_val field") \ 183 _ELF_DEFINE_DT(DT_ADDRRNGLO, 0x6FFFFE00UL, \ 184 "start of range using the d_ptr field") \ 185 _ELF_DEFINE_DT(DT_GNU_HASH, 0x6FFFFEF5UL, \ 186 "GNU style hash tables") \ 187 _ELF_DEFINE_DT(DT_GNU_CONFLICT, 0x6FFFFEF8UL, \ 188 "address of conflict section") \ 189 _ELF_DEFINE_DT(DT_GNU_LIBLIST, 0x6FFFFEF9UL, \ 190 "address of conflict section") \ 191 _ELF_DEFINE_DT(DT_CONFIG, 0x6FFFFEFAUL, \ 192 "configuration file") \ 193 _ELF_DEFINE_DT(DT_DEPAUDIT, 0x6FFFFEFBUL, \ 194 "string defining audit libraries") \ 195 _ELF_DEFINE_DT(DT_AUDIT, 0x6FFFFEFCUL, \ 196 "string defining audit libraries") \ 197 _ELF_DEFINE_DT(DT_PLTPAD, 0x6FFFFEFDUL, "PLT padding") \ 198 _ELF_DEFINE_DT(DT_MOVETAB, 0x6FFFFEFEUL, \ 199 "address of a move table") \ 200 _ELF_DEFINE_DT(DT_SYMINFO, 0x6FFFFEFFUL, \ 201 "address of the symbol information table") \ 202 _ELF_DEFINE_DT(DT_ADDRRNGHI, 0x6FFFFEFFUL, \ 203 "end of range using the d_ptr field") \ 204 _ELF_DEFINE_DT(DT_VERSYM, 0x6FFFFFF0UL, \ 205 "address of the version section") \ 206 _ELF_DEFINE_DT(DT_RELACOUNT, 0x6FFFFFF9UL, \ 207 "count of RELA relocations") \ 208 _ELF_DEFINE_DT(DT_RELCOUNT, 0x6FFFFFFAUL, \ 209 "count of REL relocations") \ 210 _ELF_DEFINE_DT(DT_FLAGS_1, 0x6FFFFFFBUL, "flag values") \ 211 _ELF_DEFINE_DT(DT_VERDEF, 0x6FFFFFFCUL, \ 212 "address of the version definition segment") \ 213 _ELF_DEFINE_DT(DT_VERDEFNUM, 0x6FFFFFFDUL, \ 214 "the number of version definition entries") \ 215 _ELF_DEFINE_DT(DT_VERNEED, 0x6FFFFFFEUL, \ 216 "address of section with needed versions") \ 217 _ELF_DEFINE_DT(DT_VERNEEDNUM, 0x6FFFFFFFUL, \ 218 "the number of version needed entries") \ 219 _ELF_DEFINE_DT(DT_LOPROC, 0x70000000UL, \ 220 "start of processor-specific types") \ 221 _ELF_DEFINE_DT(DT_ARM_SYMTABSZ, 0x70000001UL, \ 222 "number of entries in the dynamic symbol table") \ 223 _ELF_DEFINE_DT(DT_SPARC_REGISTER, 0x70000001UL, \ 224 "index of an STT_SPARC_REGISTER symbol") \ 225 _ELF_DEFINE_DT(DT_ARM_PREEMPTMAP, 0x70000002UL, \ 226 "address of the preemption map") \ 227 _ELF_DEFINE_DT(DT_MIPS_RLD_VERSION, 0x70000001UL, \ 228 "version ID for runtime linker interface") \ 229 _ELF_DEFINE_DT(DT_MIPS_TIME_STAMP, 0x70000002UL, \ 230 "timestamp") \ 231 _ELF_DEFINE_DT(DT_MIPS_ICHECKSUM, 0x70000003UL, \ 232 "checksum of all external strings and common sizes") \ 233 _ELF_DEFINE_DT(DT_MIPS_IVERSION, 0x70000004UL, \ 234 "string table index of a version string") \ 235 _ELF_DEFINE_DT(DT_MIPS_FLAGS, 0x70000005UL, \ 236 "MIPS-specific flags") \ 237 _ELF_DEFINE_DT(DT_MIPS_BASE_ADDRESS, 0x70000006UL, \ 238 "base address for the executable/DSO") \ 239 _ELF_DEFINE_DT(DT_MIPS_CONFLICT, 0x70000008UL, \ 240 "address of .conflict section") \ 241 _ELF_DEFINE_DT(DT_MIPS_LIBLIST, 0x70000009UL, \ 242 "address of .liblist section") \ 243 _ELF_DEFINE_DT(DT_MIPS_LOCAL_GOTNO, 0x7000000AUL, \ 244 "number of local GOT entries") \ 245 _ELF_DEFINE_DT(DT_MIPS_CONFLICTNO, 0x7000000BUL, \ 246 "number of entries in the .conflict section") \ 247 _ELF_DEFINE_DT(DT_MIPS_LIBLISTNO, 0x70000010UL, \ 248 "number of entries in the .liblist section") \ 249 _ELF_DEFINE_DT(DT_MIPS_SYMTABNO, 0x70000011UL, \ 250 "number of entries in the .dynsym section") \ 251 _ELF_DEFINE_DT(DT_MIPS_UNREFEXTNO, 0x70000012UL, \ 252 "index of first external dynamic symbol not ref'ed locally") \ 253 _ELF_DEFINE_DT(DT_MIPS_GOTSYM, 0x70000013UL, \ 254 "index of first dynamic symbol corresponds to a GOT entry") \ 255 _ELF_DEFINE_DT(DT_MIPS_HIPAGENO, 0x70000014UL, \ 256 "number of page table entries in GOT") \ 257 _ELF_DEFINE_DT(DT_MIPS_RLD_MAP, 0x70000016UL, \ 258 "address of runtime linker map") \ 259 _ELF_DEFINE_DT(DT_MIPS_DELTA_CLASS, 0x70000017UL, \ 260 "Delta C++ class definition") \ 261 _ELF_DEFINE_DT(DT_MIPS_DELTA_CLASS_NO, 0x70000018UL, \ 262 "number of entries in DT_MIPS_DELTA_CLASS") \ 263 _ELF_DEFINE_DT(DT_MIPS_DELTA_INSTANCE, 0x70000019UL, \ 264 "Delta C++ class instances") \ 265 _ELF_DEFINE_DT(DT_MIPS_DELTA_INSTANCE_NO, 0x7000001AUL, \ 266 "number of entries in DT_MIPS_DELTA_INSTANCE") \ 267 _ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC, 0x7000001BUL, \ 268 "Delta relocations") \ 269 _ELF_DEFINE_DT(DT_MIPS_DELTA_RELOC_NO, 0x7000001CUL, \ 270 "number of entries in DT_MIPS_DELTA_RELOC") \ 271 _ELF_DEFINE_DT(DT_MIPS_DELTA_SYM, 0x7000001DUL, \ 272 "Delta symbols refered by Delta relocations") \ 273 _ELF_DEFINE_DT(DT_MIPS_DELTA_SYM_NO, 0x7000001EUL, \ 274 "number of entries in DT_MIPS_DELTA_SYM") \ 275 _ELF_DEFINE_DT(DT_MIPS_DELTA_CLASSSYM, 0x70000020UL, \ 276 "Delta symbols for class declarations") \ 277 _ELF_DEFINE_DT(DT_MIPS_DELTA_CLASSSYM_NO, 0x70000021UL, \ 278 "number of entries in DT_MIPS_DELTA_CLASSSYM") \ 279 _ELF_DEFINE_DT(DT_MIPS_CXX_FLAGS, 0x70000022UL, \ 280 "C++ flavor flags") \ 281 _ELF_DEFINE_DT(DT_MIPS_PIXIE_INIT, 0x70000023UL, \ 282 "address of an initialization routine created by pixie") \ 283 _ELF_DEFINE_DT(DT_MIPS_SYMBOL_LIB, 0x70000024UL, \ 284 "address of .MIPS.symlib section") \ 285 _ELF_DEFINE_DT(DT_MIPS_LOCALPAGE_GOTIDX, 0x70000025UL, \ 286 "GOT index of first page table entry for a segment") \ 287 _ELF_DEFINE_DT(DT_MIPS_LOCAL_GOTIDX, 0x70000026UL, \ 288 "GOT index of first page table entry for a local symbol") \ 289 _ELF_DEFINE_DT(DT_MIPS_HIDDEN_GOTIDX, 0x70000027UL, \ 290 "GOT index of first page table entry for a hidden symbol") \ 291 _ELF_DEFINE_DT(DT_MIPS_PROTECTED_GOTIDX, 0x70000028UL, \ 292 "GOT index of first page table entry for a protected symbol") \ 293 _ELF_DEFINE_DT(DT_MIPS_OPTIONS, 0x70000029UL, \ 294 "address of .MIPS.options section") \ 295 _ELF_DEFINE_DT(DT_MIPS_INTERFACE, 0x7000002AUL, \ 296 "address of .MIPS.interface section") \ 297 _ELF_DEFINE_DT(DT_MIPS_DYNSTR_ALIGN, 0x7000002BUL, "???") \ 298 _ELF_DEFINE_DT(DT_MIPS_INTERFACE_SIZE, 0x7000002CUL, \ 299 "size of .MIPS.interface section") \ 300 _ELF_DEFINE_DT(DT_MIPS_RLD_TEXT_RESOLVE_ADDR, 0x7000002DUL, \ 301 "address of _rld_text_resolve in GOT") \ 302 _ELF_DEFINE_DT(DT_MIPS_PERF_SUFFIX, 0x7000002EUL, \ 303 "default suffix of DSO to be appended by dlopen") \ 304 _ELF_DEFINE_DT(DT_MIPS_COMPACT_SIZE, 0x7000002FUL, \ 305 "size of a ucode compact relocation record (o32)") \ 306 _ELF_DEFINE_DT(DT_MIPS_GP_VALUE, 0x70000030UL, \ 307 "GP value of a specified GP relative range") \ 308 _ELF_DEFINE_DT(DT_MIPS_AUX_DYNAMIC, 0x70000031UL, \ 309 "address of an auxiliary dynamic table") \ 310 _ELF_DEFINE_DT(DT_MIPS_PLTGOT, 0x70000032UL, \ 311 "address of the PLTGOT") \ 312 _ELF_DEFINE_DT(DT_MIPS_RLD_OBJ_UPDATE, 0x70000033UL, \ 313 "object list update callback") \ 314 _ELF_DEFINE_DT(DT_MIPS_RWPLT, 0x70000034UL, \ 315 "address of a writable PLT") \ 316 _ELF_DEFINE_DT(DT_PPC_GOT, 0x70000000UL, \ 317 "value of _GLOBAL_OFFSET_TABLE_") \ 318 _ELF_DEFINE_DT(DT_PPC_TLSOPT, 0x70000001UL, \ 319 "TLS descriptor should be optimized") \ 320 _ELF_DEFINE_DT(DT_PPC64_GLINK, 0x70000000UL, \ 321 "address of .glink section") \ 322 _ELF_DEFINE_DT(DT_PPC64_OPD, 0x70000001UL, \ 323 "address of .opd section") \ 324 _ELF_DEFINE_DT(DT_PPC64_OPDSZ, 0x70000002UL, \ 325 "size of .opd section") \ 326 _ELF_DEFINE_DT(DT_PPC64_TLSOPT, 0x70000003UL, \ 327 "TLS descriptor should be optimized") \ 328 _ELF_DEFINE_DT(DT_AUXILIARY, 0x7FFFFFFDUL, \ 329 "offset of string naming auxiliary filtees") \ 330 _ELF_DEFINE_DT(DT_USED, 0x7FFFFFFEUL, "ignored") \ 331 _ELF_DEFINE_DT(DT_FILTER, 0x7FFFFFFFUL, \ 332 "index of string naming filtees") \ 333 _ELF_DEFINE_DT(DT_HIPROC, 0x7FFFFFFFUL, \ 334 "end of processor-specific types") 335 336 #undef _ELF_DEFINE_DT 337 #define _ELF_DEFINE_DT(N, V, DESCR) N = V , 338 enum { 339 _ELF_DEFINE_DYN_TYPES() 340 DT__LAST__ = DT_HIPROC 341 }; 342 343 #define DT_DEPRECATED_SPARC_REGISTER DT_SPARC_REGISTER 344 345 /* 346 * Flags used in the executable header (field: e_flags). 347 */ 348 #define _ELF_DEFINE_EHDR_FLAGS() \ 349 _ELF_DEFINE_EF(EF_ARM_RELEXEC, 0x00000001UL, \ 350 "dynamic segment describes only how to relocate segments") \ 351 _ELF_DEFINE_EF(EF_ARM_HASENTRY, 0x00000002UL, \ 352 "e_entry contains a program entry point") \ 353 _ELF_DEFINE_EF(EF_ARM_SYMSARESORTED, 0x00000004UL, \ 354 "subsection of symbol table is sorted by symbol value") \ 355 _ELF_DEFINE_EF(EF_ARM_DYNSYMSUSESEGIDX, 0x00000008UL, \ 356 "dynamic symbol st_shndx = containing segment index + 1") \ 357 _ELF_DEFINE_EF(EF_ARM_MAPSYMSFIRST, 0x00000010UL, \ 358 "mapping symbols precede other local symbols in symtab") \ 359 _ELF_DEFINE_EF(EF_ARM_BE8, 0x00800000UL, \ 360 "file contains BE-8 code") \ 361 _ELF_DEFINE_EF(EF_ARM_LE8, 0x00400000UL, \ 362 "file contains LE-8 code") \ 363 _ELF_DEFINE_EF(EF_ARM_EABIMASK, 0xFF000000UL, \ 364 "mask for ARM EABI version number (0 denotes GNU or unknown)") \ 365 _ELF_DEFINE_EF(EF_ARM_EABI_UNKNOWN, 0x00000000UL, \ 366 "Unknown or GNU ARM EABI version number") \ 367 _ELF_DEFINE_EF(EF_ARM_EABI_VER1, 0x01000000UL, \ 368 "ARM EABI version 1") \ 369 _ELF_DEFINE_EF(EF_ARM_EABI_VER2, 0x02000000UL, \ 370 "ARM EABI version 2") \ 371 _ELF_DEFINE_EF(EF_ARM_EABI_VER3, 0x03000000UL, \ 372 "ARM EABI version 3") \ 373 _ELF_DEFINE_EF(EF_ARM_EABI_VER4, 0x04000000UL, \ 374 "ARM EABI version 4") \ 375 _ELF_DEFINE_EF(EF_ARM_EABI_VER5, 0x05000000UL, \ 376 "ARM EABI version 5") \ 377 _ELF_DEFINE_EF(EF_ARM_INTERWORK, 0x00000004UL, \ 378 "GNU EABI extension") \ 379 _ELF_DEFINE_EF(EF_ARM_APCS_26, 0x00000008UL, \ 380 "GNU EABI extension") \ 381 _ELF_DEFINE_EF(EF_ARM_APCS_FLOAT, 0x00000010UL, \ 382 "GNU EABI extension") \ 383 _ELF_DEFINE_EF(EF_ARM_PIC, 0x00000020UL, \ 384 "GNU EABI extension") \ 385 _ELF_DEFINE_EF(EF_ARM_ALIGN8, 0x00000040UL, \ 386 "GNU EABI extension") \ 387 _ELF_DEFINE_EF(EF_ARM_NEW_ABI, 0x00000080UL, \ 388 "GNU EABI extension") \ 389 _ELF_DEFINE_EF(EF_ARM_OLD_ABI, 0x00000100UL, \ 390 "GNU EABI extension") \ 391 _ELF_DEFINE_EF(EF_ARM_SOFT_FLOAT, 0x00000200UL, \ 392 "GNU EABI extension") \ 393 _ELF_DEFINE_EF(EF_ARM_VFP_FLOAT, 0x00000400UL, \ 394 "GNU EABI extension") \ 395 _ELF_DEFINE_EF(EF_ARM_MAVERICK_FLOAT, 0x00000800UL, \ 396 "GNU EABI extension") \ 397 _ELF_DEFINE_EF(EF_MIPS_NOREORDER, 0x00000001UL, \ 398 "at least one .noreorder directive appeared in the source") \ 399 _ELF_DEFINE_EF(EF_MIPS_PIC, 0x00000002UL, \ 400 "file contains position independent code") \ 401 _ELF_DEFINE_EF(EF_MIPS_CPIC, 0x00000004UL, \ 402 "file's code uses standard conventions for calling PIC") \ 403 _ELF_DEFINE_EF(EF_MIPS_UCODE, 0x00000010UL, \ 404 "file contains UCODE (obsolete)") \ 405 _ELF_DEFINE_EF(EF_MIPS_ABI2, 0x00000020UL, \ 406 "file follows MIPS III 32-bit ABI") \ 407 _ELF_DEFINE_EF(EF_MIPS_OPTIONS_FIRST, 0x00000080UL, \ 408 "ld(1) should process .MIPS.options section first") \ 409 _ELF_DEFINE_EF(EF_MIPS_ARCH_ASE, 0x0F000000UL, \ 410 "file uses application-specific architectural extensions") \ 411 _ELF_DEFINE_EF(EF_MIPS_ARCH_ASE_MDMX, 0x08000000UL, \ 412 "file uses MDMX multimedia extensions") \ 413 _ELF_DEFINE_EF(EF_MIPS_ARCH_ASE_M16, 0x04000000UL, \ 414 "file uses MIPS-16 ISA extensions") \ 415 _ELF_DEFINE_EF(EF_MIPS_ARCH, 0xF0000000UL, \ 416 "4-bit MIPS architecture field") \ 417 _ELF_DEFINE_EF(EF_PPC_EMB, 0x80000000UL, \ 418 "Embedded PowerPC flag") \ 419 _ELF_DEFINE_EF(EF_PPC_RELOCATABLE, 0x00010000UL, \ 420 "-mrelocatable flag") \ 421 _ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x00008000UL, \ 422 "-mrelocatable-lib flag") \ 423 _ELF_DEFINE_EF(EF_SPARC_EXT_MASK, 0x00ffff00UL, \ 424 "Vendor Extension mask") \ 425 _ELF_DEFINE_EF(EF_SPARC_32PLUS, 0x00000100UL, \ 426 "Generic V8+ features") \ 427 _ELF_DEFINE_EF(EF_SPARC_SUN_US1, 0x00000200UL, \ 428 "Sun UltraSPARCTM 1 Extensions") \ 429 _ELF_DEFINE_EF(EF_SPARC_HAL_R1, 0x00000400UL, "HAL R1 Extensions") \ 430 _ELF_DEFINE_EF(EF_SPARC_SUN_US3, 0x00000800UL, \ 431 "Sun UltraSPARC 3 Extensions") \ 432 _ELF_DEFINE_EF(EF_SPARCV9_MM, 0x00000003UL, \ 433 "Mask for Memory Model") \ 434 _ELF_DEFINE_EF(EF_SPARCV9_TSO, 0x00000000UL, \ 435 "Total Store Ordering") \ 436 _ELF_DEFINE_EF(EF_SPARCV9_PSO, 0x00000001UL, \ 437 "Partial Store Ordering") \ 438 _ELF_DEFINE_EF(EF_SPARCV9_RMO, 0x00000002UL, \ 439 "Relaxed Memory Ordering") 440 441 #undef _ELF_DEFINE_EF 442 #define _ELF_DEFINE_EF(N, V, DESCR) N = V , 443 enum { 444 _ELF_DEFINE_EHDR_FLAGS() 445 EF__LAST__ 446 }; 447 448 /* 449 * Offsets in the `ei_ident[]` field of an ELF executable header. 450 */ 451 #define _ELF_DEFINE_EI_OFFSETS() \ 452 _ELF_DEFINE_EI(EI_MAG0, 0, "magic number") \ 453 _ELF_DEFINE_EI(EI_MAG1, 1, "magic number") \ 454 _ELF_DEFINE_EI(EI_MAG2, 2, "magic number") \ 455 _ELF_DEFINE_EI(EI_MAG3, 3, "magic number") \ 456 _ELF_DEFINE_EI(EI_CLASS, 4, "file class") \ 457 _ELF_DEFINE_EI(EI_DATA, 5, "data encoding") \ 458 _ELF_DEFINE_EI(EI_VERSION, 6, "file version") \ 459 _ELF_DEFINE_EI(EI_OSABI, 7, "OS ABI kind") \ 460 _ELF_DEFINE_EI(EI_ABIVERSION, 8, "OS ABI version") \ 461 _ELF_DEFINE_EI(EI_PAD, 9, "padding start") \ 462 _ELF_DEFINE_EI(EI_NIDENT, 16, "total size") 463 464 #undef _ELF_DEFINE_EI 465 #define _ELF_DEFINE_EI(N, V, DESCR) N = V , 466 enum { 467 _ELF_DEFINE_EI_OFFSETS() 468 EI__LAST__ 469 }; 470 471 /* 472 * The ELF class of an object. 473 */ 474 #define _ELF_DEFINE_ELFCLASS() \ 475 _ELF_DEFINE_EC(ELFCLASSNONE, 0, "Unknown ELF class") \ 476 _ELF_DEFINE_EC(ELFCLASS32, 1, "32 bit objects") \ 477 _ELF_DEFINE_EC(ELFCLASS64, 2, "64 bit objects") 478 479 #undef _ELF_DEFINE_EC 480 #define _ELF_DEFINE_EC(N, V, DESCR) N = V , 481 enum { 482 _ELF_DEFINE_ELFCLASS() 483 EC__LAST__ 484 }; 485 486 /* 487 * Endianness of data in an ELF object. 488 */ 489 490 #define _ELF_DEFINE_ELF_DATA_ENDIANNESS() \ 491 _ELF_DEFINE_ED(ELFDATANONE, 0, "Unknown data endianness") \ 492 _ELF_DEFINE_ED(ELFDATA2LSB, 1, "little endian") \ 493 _ELF_DEFINE_ED(ELFDATA2MSB, 2, "big endian") 494 495 #undef _ELF_DEFINE_ED 496 #define _ELF_DEFINE_ED(N, V, DESCR) N = V , 497 enum { 498 _ELF_DEFINE_ELF_DATA_ENDIANNESS() 499 ED__LAST__ 500 }; 501 502 /* 503 * Values of the magic numbers used in identification array. 504 */ 505 #define _ELF_DEFINE_ELF_MAGIC() \ 506 _ELF_DEFINE_EMAG(ELFMAG0, 0x7FU) \ 507 _ELF_DEFINE_EMAG(ELFMAG1, 'E') \ 508 _ELF_DEFINE_EMAG(ELFMAG2, 'L') \ 509 _ELF_DEFINE_EMAG(ELFMAG3, 'F') 510 511 #undef _ELF_DEFINE_EMAG 512 #define _ELF_DEFINE_EMAG(N, V) N = V , 513 enum { 514 _ELF_DEFINE_ELF_MAGIC() 515 ELFMAG__LAST__ 516 }; 517 518 /* 519 * ELF OS ABI field. 520 */ 521 #define _ELF_DEFINE_ELF_OSABI() \ 522 _ELF_DEFINE_EABI(ELFOSABI_NONE, 0, \ 523 "No extensions or unspecified") \ 524 _ELF_DEFINE_EABI(ELFOSABI_SYSV, 0, "SYSV") \ 525 _ELF_DEFINE_EABI(ELFOSABI_HPUX, 1, "Hewlett-Packard HP-UX") \ 526 _ELF_DEFINE_EABI(ELFOSABI_NETBSD, 2, "NetBSD") \ 527 _ELF_DEFINE_EABI(ELFOSABI_GNU, 3, "GNU") \ 528 _ELF_DEFINE_EABI(ELFOSABI_HURD, 4, "GNU/HURD") \ 529 _ELF_DEFINE_EABI(ELFOSABI_86OPEN, 5, "86Open Common ABI") \ 530 _ELF_DEFINE_EABI(ELFOSABI_SOLARIS, 6, "Sun Solaris") \ 531 _ELF_DEFINE_EABI(ELFOSABI_AIX, 7, "AIX") \ 532 _ELF_DEFINE_EABI(ELFOSABI_IRIX, 8, "IRIX") \ 533 _ELF_DEFINE_EABI(ELFOSABI_FREEBSD, 9, "FreeBSD") \ 534 _ELF_DEFINE_EABI(ELFOSABI_TRU64, 10, "Compaq TRU64 UNIX") \ 535 _ELF_DEFINE_EABI(ELFOSABI_MODESTO, 11, "Novell Modesto") \ 536 _ELF_DEFINE_EABI(ELFOSABI_OPENBSD, 12, "Open BSD") \ 537 _ELF_DEFINE_EABI(ELFOSABI_OPENVMS, 13, "Open VMS") \ 538 _ELF_DEFINE_EABI(ELFOSABI_NSK, 14, \ 539 "Hewlett-Packard Non-Stop Kernel") \ 540 _ELF_DEFINE_EABI(ELFOSABI_AROS, 15, "Amiga Research OS") \ 541 _ELF_DEFINE_EABI(ELFOSABI_FENIXOS, 16, \ 542 "The FenixOS highly scalable multi-core OS") \ 543 _ELF_DEFINE_EABI(ELFOSABI_ARM_AEABI, 64, \ 544 "ARM specific symbol versioning extensions") \ 545 _ELF_DEFINE_EABI(ELFOSABI_ARM, 97, "ARM ABI") \ 546 _ELF_DEFINE_EABI(ELFOSABI_STANDALONE, 255, \ 547 "Standalone (embedded) application") 548 549 #undef _ELF_DEFINE_EABI 550 #define _ELF_DEFINE_EABI(N, V, DESCR) N = V , 551 enum { 552 _ELF_DEFINE_ELF_OSABI() 553 ELFOSABI__LAST__ 554 }; 555 556 #define ELFOSABI_LINUX ELFOSABI_GNU 557 558 /* 559 * ELF Machine types: (EM_*). 560 */ 561 #define _ELF_DEFINE_ELF_MACHINES() \ 562 _ELF_DEFINE_EM(EM_NONE, 0, "No machine") \ 563 _ELF_DEFINE_EM(EM_M32, 1, "AT&T WE 32100") \ 564 _ELF_DEFINE_EM(EM_SPARC, 2, "SPARC") \ 565 _ELF_DEFINE_EM(EM_386, 3, "Intel 80386") \ 566 _ELF_DEFINE_EM(EM_68K, 4, "Motorola 68000") \ 567 _ELF_DEFINE_EM(EM_88K, 5, "Motorola 88000") \ 568 _ELF_DEFINE_EM(EM_IAMCU, 6, "Intel MCU") \ 569 _ELF_DEFINE_EM(EM_860, 7, "Intel 80860") \ 570 _ELF_DEFINE_EM(EM_MIPS, 8, "MIPS I Architecture") \ 571 _ELF_DEFINE_EM(EM_S370, 9, "IBM System/370 Processor") \ 572 _ELF_DEFINE_EM(EM_MIPS_RS3_LE, 10, "MIPS RS3000 Little-endian") \ 573 _ELF_DEFINE_EM(EM_PARISC, 15, "Hewlett-Packard PA-RISC") \ 574 _ELF_DEFINE_EM(EM_VPP500, 17, "Fujitsu VPP500") \ 575 _ELF_DEFINE_EM(EM_SPARC32PLUS, 18, \ 576 "Enhanced instruction set SPARC") \ 577 _ELF_DEFINE_EM(EM_960, 19, "Intel 80960") \ 578 _ELF_DEFINE_EM(EM_PPC, 20, "PowerPC") \ 579 _ELF_DEFINE_EM(EM_PPC64, 21, "64-bit PowerPC") \ 580 _ELF_DEFINE_EM(EM_S390, 22, "IBM System/390 Processor") \ 581 _ELF_DEFINE_EM(EM_SPU, 23, "IBM SPU/SPC") \ 582 _ELF_DEFINE_EM(EM_V800, 36, "NEC V800") \ 583 _ELF_DEFINE_EM(EM_FR20, 37, "Fujitsu FR20") \ 584 _ELF_DEFINE_EM(EM_RH32, 38, "TRW RH-32") \ 585 _ELF_DEFINE_EM(EM_RCE, 39, "Motorola RCE") \ 586 _ELF_DEFINE_EM(EM_ARM, 40, "Advanced RISC Machines ARM") \ 587 _ELF_DEFINE_EM(EM_ALPHA, 41, "Digital Alpha") \ 588 _ELF_DEFINE_EM(EM_SH, 42, "Hitachi SH") \ 589 _ELF_DEFINE_EM(EM_SPARCV9, 43, "SPARC Version 9") \ 590 _ELF_DEFINE_EM(EM_TRICORE, 44, \ 591 "Siemens TriCore embedded processor") \ 592 _ELF_DEFINE_EM(EM_ARC, 45, \ 593 "Argonaut RISC Core, Argonaut Technologies Inc.") \ 594 _ELF_DEFINE_EM(EM_H8_300, 46, "Hitachi H8/300") \ 595 _ELF_DEFINE_EM(EM_H8_300H, 47, "Hitachi H8/300H") \ 596 _ELF_DEFINE_EM(EM_H8S, 48, "Hitachi H8S") \ 597 _ELF_DEFINE_EM(EM_H8_500, 49, "Hitachi H8/500") \ 598 _ELF_DEFINE_EM(EM_IA_64, 50, \ 599 "Intel IA-64 processor architecture") \ 600 _ELF_DEFINE_EM(EM_MIPS_X, 51, "Stanford MIPS-X") \ 601 _ELF_DEFINE_EM(EM_COLDFIRE, 52, "Motorola ColdFire") \ 602 _ELF_DEFINE_EM(EM_68HC12, 53, "Motorola M68HC12") \ 603 _ELF_DEFINE_EM(EM_MMA, 54, \ 604 "Fujitsu MMA Multimedia Accelerator") \ 605 _ELF_DEFINE_EM(EM_PCP, 55, "Siemens PCP") \ 606 _ELF_DEFINE_EM(EM_NCPU, 56, \ 607 "Sony nCPU embedded RISC processor") \ 608 _ELF_DEFINE_EM(EM_NDR1, 57, "Denso NDR1 microprocessor") \ 609 _ELF_DEFINE_EM(EM_STARCORE, 58, "Motorola Star*Core processor") \ 610 _ELF_DEFINE_EM(EM_ME16, 59, "Toyota ME16 processor") \ 611 _ELF_DEFINE_EM(EM_ST100, 60, \ 612 "STMicroelectronics ST100 processor") \ 613 _ELF_DEFINE_EM(EM_TINYJ, 61, \ 614 "Advanced Logic Corp. TinyJ embedded processor family") \ 615 _ELF_DEFINE_EM(EM_X86_64, 62, "AMD x86-64 architecture") \ 616 _ELF_DEFINE_EM(EM_PDSP, 63, "Sony DSP Processor") \ 617 _ELF_DEFINE_EM(EM_PDP10, 64, \ 618 "Digital Equipment Corp. PDP-10") \ 619 _ELF_DEFINE_EM(EM_PDP11, 65, \ 620 "Digital Equipment Corp. PDP-11") \ 621 _ELF_DEFINE_EM(EM_FX66, 66, "Siemens FX66 microcontroller") \ 622 _ELF_DEFINE_EM(EM_ST9PLUS, 67, \ 623 "STMicroelectronics ST9+ 8/16 bit microcontroller") \ 624 _ELF_DEFINE_EM(EM_ST7, 68, \ 625 "STMicroelectronics ST7 8-bit microcontroller") \ 626 _ELF_DEFINE_EM(EM_68HC16, 69, \ 627 "Motorola MC68HC16 Microcontroller") \ 628 _ELF_DEFINE_EM(EM_68HC11, 70, \ 629 "Motorola MC68HC11 Microcontroller") \ 630 _ELF_DEFINE_EM(EM_68HC08, 71, \ 631 "Motorola MC68HC08 Microcontroller") \ 632 _ELF_DEFINE_EM(EM_68HC05, 72, \ 633 "Motorola MC68HC05 Microcontroller") \ 634 _ELF_DEFINE_EM(EM_SVX, 73, "Silicon Graphics SVx") \ 635 _ELF_DEFINE_EM(EM_ST19, 74, \ 636 "STMicroelectronics ST19 8-bit microcontroller") \ 637 _ELF_DEFINE_EM(EM_VAX, 75, "Digital VAX") \ 638 _ELF_DEFINE_EM(EM_CRIS, 76, \ 639 "Axis Communications 32-bit embedded processor") \ 640 _ELF_DEFINE_EM(EM_JAVELIN, 77, \ 641 "Infineon Technologies 32-bit embedded processor") \ 642 _ELF_DEFINE_EM(EM_FIREPATH, 78, \ 643 "Element 14 64-bit DSP Processor") \ 644 _ELF_DEFINE_EM(EM_ZSP, 79, \ 645 "LSI Logic 16-bit DSP Processor") \ 646 _ELF_DEFINE_EM(EM_MMIX, 80, \ 647 "Donald Knuth's educational 64-bit processor") \ 648 _ELF_DEFINE_EM(EM_HUANY, 81, \ 649 "Harvard University machine-independent object files") \ 650 _ELF_DEFINE_EM(EM_PRISM, 82, "SiTera Prism") \ 651 _ELF_DEFINE_EM(EM_AVR, 83, \ 652 "Atmel AVR 8-bit microcontroller") \ 653 _ELF_DEFINE_EM(EM_FR30, 84, "Fujitsu FR30") \ 654 _ELF_DEFINE_EM(EM_D10V, 85, "Mitsubishi D10V") \ 655 _ELF_DEFINE_EM(EM_D30V, 86, "Mitsubishi D30V") \ 656 _ELF_DEFINE_EM(EM_V850, 87, "NEC v850") \ 657 _ELF_DEFINE_EM(EM_M32R, 88, "Mitsubishi M32R") \ 658 _ELF_DEFINE_EM(EM_MN10300, 89, "Matsushita MN10300") \ 659 _ELF_DEFINE_EM(EM_MN10200, 90, "Matsushita MN10200") \ 660 _ELF_DEFINE_EM(EM_PJ, 91, "picoJava") \ 661 _ELF_DEFINE_EM(EM_OPENRISC, 92, \ 662 "OpenRISC 32-bit embedded processor") \ 663 _ELF_DEFINE_EM(EM_ARC_COMPACT, 93, \ 664 "ARC International ARCompact processor") \ 665 _ELF_DEFINE_EM(EM_XTENSA, 94, \ 666 "Tensilica Xtensa Architecture") \ 667 _ELF_DEFINE_EM(EM_VIDEOCORE, 95, \ 668 "Alphamosaic VideoCore processor") \ 669 _ELF_DEFINE_EM(EM_TMM_GPP, 96, \ 670 "Thompson Multimedia General Purpose Processor") \ 671 _ELF_DEFINE_EM(EM_NS32K, 97, \ 672 "National Semiconductor 32000 series") \ 673 _ELF_DEFINE_EM(EM_TPC, 98, "Tenor Network TPC processor") \ 674 _ELF_DEFINE_EM(EM_SNP1K, 99, "Trebia SNP 1000 processor") \ 675 _ELF_DEFINE_EM(EM_ST200, 100, \ 676 "STMicroelectronics (www.st.com) ST200 microcontroller") \ 677 _ELF_DEFINE_EM(EM_IP2K, 101, \ 678 "Ubicom IP2xxx microcontroller family") \ 679 _ELF_DEFINE_EM(EM_MAX, 102, "MAX Processor") \ 680 _ELF_DEFINE_EM(EM_CR, 103, \ 681 "National Semiconductor CompactRISC microprocessor") \ 682 _ELF_DEFINE_EM(EM_F2MC16, 104, "Fujitsu F2MC16") \ 683 _ELF_DEFINE_EM(EM_MSP430, 105, \ 684 "Texas Instruments embedded microcontroller msp430") \ 685 _ELF_DEFINE_EM(EM_BLACKFIN, 106, \ 686 "Analog Devices Blackfin (DSP) processor") \ 687 _ELF_DEFINE_EM(EM_SE_C33, 107, \ 688 "S1C33 Family of Seiko Epson processors") \ 689 _ELF_DEFINE_EM(EM_SEP, 108, \ 690 "Sharp embedded microprocessor") \ 691 _ELF_DEFINE_EM(EM_ARCA, 109, "Arca RISC Microprocessor") \ 692 _ELF_DEFINE_EM(EM_UNICORE, 110, \ 693 "Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University") \ 694 _ELF_DEFINE_EM(EM_EXCESS, 111, \ 695 "eXcess: 16/32/64-bit configurable embedded CPU") \ 696 _ELF_DEFINE_EM(EM_DXP, 112, \ 697 "Icera Semiconductor Inc. Deep Execution Processor") \ 698 _ELF_DEFINE_EM(EM_ALTERA_NIOS2, 113, \ 699 "Altera Nios II soft-core processor") \ 700 _ELF_DEFINE_EM(EM_CRX, 114, \ 701 "National Semiconductor CompactRISC CRX microprocessor") \ 702 _ELF_DEFINE_EM(EM_XGATE, 115, \ 703 "Motorola XGATE embedded processor") \ 704 _ELF_DEFINE_EM(EM_C166, 116, \ 705 "Infineon C16x/XC16x processor") \ 706 _ELF_DEFINE_EM(EM_M16C, 117, \ 707 "Renesas M16C series microprocessors") \ 708 _ELF_DEFINE_EM(EM_DSPIC30F, 118, \ 709 "Microchip Technology dsPIC30F Digital Signal Controller") \ 710 _ELF_DEFINE_EM(EM_CE, 119, \ 711 "Freescale Communication Engine RISC core") \ 712 _ELF_DEFINE_EM(EM_M32C, 120, \ 713 "Renesas M32C series microprocessors") \ 714 _ELF_DEFINE_EM(EM_TSK3000, 131, "Altium TSK3000 core") \ 715 _ELF_DEFINE_EM(EM_RS08, 132, \ 716 "Freescale RS08 embedded processor") \ 717 _ELF_DEFINE_EM(EM_SHARC, 133, \ 718 "Analog Devices SHARC family of 32-bit DSP processors") \ 719 _ELF_DEFINE_EM(EM_ECOG2, 134, \ 720 "Cyan Technology eCOG2 microprocessor") \ 721 _ELF_DEFINE_EM(EM_SCORE7, 135, \ 722 "Sunplus S+core7 RISC processor") \ 723 _ELF_DEFINE_EM(EM_DSP24, 136, \ 724 "New Japan Radio (NJR) 24-bit DSP Processor") \ 725 _ELF_DEFINE_EM(EM_VIDEOCORE3, 137, \ 726 "Broadcom VideoCore III processor") \ 727 _ELF_DEFINE_EM(EM_LATTICEMICO32, 138, \ 728 "RISC processor for Lattice FPGA architecture") \ 729 _ELF_DEFINE_EM(EM_SE_C17, 139, "Seiko Epson C17 family") \ 730 _ELF_DEFINE_EM(EM_TI_C6000, 140, \ 731 "The Texas Instruments TMS320C6000 DSP family") \ 732 _ELF_DEFINE_EM(EM_TI_C2000, 141, \ 733 "The Texas Instruments TMS320C2000 DSP family") \ 734 _ELF_DEFINE_EM(EM_TI_C5500, 142, \ 735 "The Texas Instruments TMS320C55x DSP family") \ 736 _ELF_DEFINE_EM(EM_MMDSP_PLUS, 160, \ 737 "STMicroelectronics 64bit VLIW Data Signal Processor") \ 738 _ELF_DEFINE_EM(EM_CYPRESS_M8C, 161, "Cypress M8C microprocessor") \ 739 _ELF_DEFINE_EM(EM_R32C, 162, \ 740 "Renesas R32C series microprocessors") \ 741 _ELF_DEFINE_EM(EM_TRIMEDIA, 163, \ 742 "NXP Semiconductors TriMedia architecture family") \ 743 _ELF_DEFINE_EM(EM_QDSP6, 164, "QUALCOMM DSP6 Processor") \ 744 _ELF_DEFINE_EM(EM_8051, 165, "Intel 8051 and variants") \ 745 _ELF_DEFINE_EM(EM_STXP7X, 166, \ 746 "STMicroelectronics STxP7x family of configurable and extensible RISC processors") \ 747 _ELF_DEFINE_EM(EM_NDS32, 167, \ 748 "Andes Technology compact code size embedded RISC processor family") \ 749 _ELF_DEFINE_EM(EM_ECOG1, 168, \ 750 "Cyan Technology eCOG1X family") \ 751 _ELF_DEFINE_EM(EM_ECOG1X, 168, \ 752 "Cyan Technology eCOG1X family") \ 753 _ELF_DEFINE_EM(EM_MAXQ30, 169, \ 754 "Dallas Semiconductor MAXQ30 Core Micro-controllers") \ 755 _ELF_DEFINE_EM(EM_XIMO16, 170, \ 756 "New Japan Radio (NJR) 16-bit DSP Processor") \ 757 _ELF_DEFINE_EM(EM_MANIK, 171, \ 758 "M2000 Reconfigurable RISC Microprocessor") \ 759 _ELF_DEFINE_EM(EM_CRAYNV2, 172, \ 760 "Cray Inc. NV2 vector architecture") \ 761 _ELF_DEFINE_EM(EM_RX, 173, "Renesas RX family") \ 762 _ELF_DEFINE_EM(EM_METAG, 174, \ 763 "Imagination Technologies META processor architecture") \ 764 _ELF_DEFINE_EM(EM_MCST_ELBRUS, 175, \ 765 "MCST Elbrus general purpose hardware architecture") \ 766 _ELF_DEFINE_EM(EM_ECOG16, 176, \ 767 "Cyan Technology eCOG16 family") \ 768 _ELF_DEFINE_EM(EM_CR16, 177, \ 769 "National Semiconductor CompactRISC CR16 16-bit microprocessor") \ 770 _ELF_DEFINE_EM(EM_ETPU, 178, \ 771 "Freescale Extended Time Processing Unit") \ 772 _ELF_DEFINE_EM(EM_SLE9X, 179, \ 773 "Infineon Technologies SLE9X core") \ 774 _ELF_DEFINE_EM(EM_AARCH64, 183, \ 775 "AArch64 (64-bit ARM)") \ 776 _ELF_DEFINE_EM(EM_AVR32, 185, \ 777 "Atmel Corporation 32-bit microprocessor family") \ 778 _ELF_DEFINE_EM(EM_STM8, 186, \ 779 "STMicroeletronics STM8 8-bit microcontroller") \ 780 _ELF_DEFINE_EM(EM_TILE64, 187, \ 781 "Tilera TILE64 multicore architecture family") \ 782 _ELF_DEFINE_EM(EM_TILEPRO, 188, \ 783 "Tilera TILEPro multicore architecture family") \ 784 _ELF_DEFINE_EM(EM_MICROBLAZE, 189, \ 785 "Xilinx MicroBlaze 32-bit RISC soft processor core") \ 786 _ELF_DEFINE_EM(EM_CUDA, 190, "NVIDIA CUDA architecture") \ 787 _ELF_DEFINE_EM(EM_TILEGX, 191, \ 788 "Tilera TILE-Gx multicore architecture family") \ 789 _ELF_DEFINE_EM(EM_CLOUDSHIELD, 192, \ 790 "CloudShield architecture family") \ 791 _ELF_DEFINE_EM(EM_COREA_1ST, 193, \ 792 "KIPO-KAIST Core-A 1st generation processor family") \ 793 _ELF_DEFINE_EM(EM_COREA_2ND, 194, \ 794 "KIPO-KAIST Core-A 2nd generation processor family") \ 795 _ELF_DEFINE_EM(EM_ARC_COMPACT2, 195, "Synopsys ARCompact V2") \ 796 _ELF_DEFINE_EM(EM_OPEN8, 196, \ 797 "Open8 8-bit RISC soft processor core") \ 798 _ELF_DEFINE_EM(EM_RL78, 197, "Renesas RL78 family") \ 799 _ELF_DEFINE_EM(EM_VIDEOCORE5, 198, "Broadcom VideoCore V processor") \ 800 _ELF_DEFINE_EM(EM_78KOR, 199, "Renesas 78KOR family") \ 801 _ELF_DEFINE_EM(EM_56800EX, 200, \ 802 "Freescale 56800EX Digital Signal Controller") \ 803 _ELF_DEFINE_EM(EM_BA1, 201, "Beyond BA1 CPU architecture") \ 804 _ELF_DEFINE_EM(EM_BA2, 202, "Beyond BA2 CPU architecture") \ 805 _ELF_DEFINE_EM(EM_XCORE, 203, "XMOS xCORE processor family") \ 806 _ELF_DEFINE_EM(EM_MCHP_PIC, 204, "Microchip 8-bit PIC(r) family") \ 807 _ELF_DEFINE_EM(EM_INTEL205, 205, "Reserved by Intel") \ 808 _ELF_DEFINE_EM(EM_INTEL206, 206, "Reserved by Intel") \ 809 _ELF_DEFINE_EM(EM_INTEL207, 207, "Reserved by Intel") \ 810 _ELF_DEFINE_EM(EM_INTEL208, 208, "Reserved by Intel") \ 811 _ELF_DEFINE_EM(EM_INTEL209, 209, "Reserved by Intel") \ 812 _ELF_DEFINE_EM(EM_KM32, 210, "KM211 KM32 32-bit processor") \ 813 _ELF_DEFINE_EM(EM_KMX32, 211, "KM211 KMX32 32-bit processor") \ 814 _ELF_DEFINE_EM(EM_KMX16, 212, "KM211 KMX16 16-bit processor") \ 815 _ELF_DEFINE_EM(EM_KMX8, 213, "KM211 KMX8 8-bit processor") \ 816 _ELF_DEFINE_EM(EM_KVARC, 214, "KM211 KMX32 KVARC processor") \ 817 _ELF_DEFINE_EM(EM_RISCV, 243, "RISC-V") 818 819 #undef _ELF_DEFINE_EM 820 #define _ELF_DEFINE_EM(N, V, DESCR) N = V , 821 enum { 822 _ELF_DEFINE_ELF_MACHINES() 823 EM__LAST__ 824 }; 825 826 /* Other synonyms. */ 827 #define EM_AMD64 EM_X86_64 828 #define EM_ARC_A5 EM_ARC_COMPACT 829 830 /* 831 * ELF file types: (ET_*). 832 */ 833 #define _ELF_DEFINE_ELF_TYPES() \ 834 _ELF_DEFINE_ET(ET_NONE, 0, "No file type") \ 835 _ELF_DEFINE_ET(ET_REL, 1, "Relocatable object") \ 836 _ELF_DEFINE_ET(ET_EXEC, 2, "Executable") \ 837 _ELF_DEFINE_ET(ET_DYN, 3, "Shared object") \ 838 _ELF_DEFINE_ET(ET_CORE, 4, "Core file") \ 839 _ELF_DEFINE_ET(ET_LOOS, 0xFE00U, "Begin OS-specific range") \ 840 _ELF_DEFINE_ET(ET_HIOS, 0xFEFFU, "End OS-specific range") \ 841 _ELF_DEFINE_ET(ET_LOPROC, 0xFF00U, "Begin processor-specific range") \ 842 _ELF_DEFINE_ET(ET_HIPROC, 0xFFFFU, "End processor-specific range") 843 844 #undef _ELF_DEFINE_ET 845 #define _ELF_DEFINE_ET(N, V, DESCR) N = V , 846 enum { 847 _ELF_DEFINE_ELF_TYPES() 848 ET__LAST__ 849 }; 850 851 /* ELF file format version numbers. */ 852 #define EV_NONE 0 853 #define EV_CURRENT 1 854 855 /* 856 * Flags for section groups. 857 */ 858 #define GRP_COMDAT 0x1 /* COMDAT semantics */ 859 #define GRP_MASKOS 0x0ff00000 /* OS-specific flags */ 860 #define GRP_MASKPROC 0xf0000000 /* processor-specific flags */ 861 862 /* 863 * Flags / mask for .gnu.versym sections. 864 */ 865 #define VERSYM_VERSION 0x7fff 866 #define VERSYM_HIDDEN 0x8000 867 868 /* 869 * Flags used by program header table entries. 870 */ 871 872 #define _ELF_DEFINE_PHDR_FLAGS() \ 873 _ELF_DEFINE_PF(PF_X, 0x1, "Execute") \ 874 _ELF_DEFINE_PF(PF_W, 0x2, "Write") \ 875 _ELF_DEFINE_PF(PF_R, 0x4, "Read") \ 876 _ELF_DEFINE_PF(PF_MASKOS, 0x0ff00000, "OS-specific flags") \ 877 _ELF_DEFINE_PF(PF_MASKPROC, 0xf0000000, "Processor-specific flags") \ 878 _ELF_DEFINE_PF(PF_ARM_SB, 0x10000000, \ 879 "segment contains the location addressed by the static base") \ 880 _ELF_DEFINE_PF(PF_ARM_PI, 0x20000000, \ 881 "segment is position-independent") \ 882 _ELF_DEFINE_PF(PF_ARM_ABS, 0x40000000, \ 883 "segment must be loaded at its base address") 884 885 #undef _ELF_DEFINE_PF 886 #define _ELF_DEFINE_PF(N, V, DESCR) N = V , 887 enum { 888 _ELF_DEFINE_PHDR_FLAGS() 889 PF__LAST__ 890 }; 891 892 /* 893 * Types of program header table entries. 894 */ 895 896 #define _ELF_DEFINE_PHDR_TYPES() \ 897 _ELF_DEFINE_PT(PT_NULL, 0, "ignored entry") \ 898 _ELF_DEFINE_PT(PT_LOAD, 1, "loadable segment") \ 899 _ELF_DEFINE_PT(PT_DYNAMIC, 2, \ 900 "contains dynamic linking information") \ 901 _ELF_DEFINE_PT(PT_INTERP, 3, "names an interpreter") \ 902 _ELF_DEFINE_PT(PT_NOTE, 4, "auxiliary information") \ 903 _ELF_DEFINE_PT(PT_SHLIB, 5, "reserved") \ 904 _ELF_DEFINE_PT(PT_PHDR, 6, \ 905 "describes the program header itself") \ 906 _ELF_DEFINE_PT(PT_TLS, 7, "thread local storage") \ 907 _ELF_DEFINE_PT(PT_LOOS, 0x60000000UL, \ 908 "start of OS-specific range") \ 909 _ELF_DEFINE_PT(PT_SUNW_UNWIND, 0x6464E550UL, \ 910 "Solaris/amd64 stack unwind tables") \ 911 _ELF_DEFINE_PT(PT_GNU_EH_FRAME, 0x6474E550UL, \ 912 "GCC generated .eh_frame_hdr segment") \ 913 _ELF_DEFINE_PT(PT_GNU_STACK, 0x6474E551UL, \ 914 "Stack flags") \ 915 _ELF_DEFINE_PT(PT_GNU_RELRO, 0x6474E552UL, \ 916 "Segment becomes read-only after relocation") \ 917 _ELF_DEFINE_PT(PT_SUNWBSS, 0x6FFFFFFAUL, \ 918 "A Solaris .SUNW_bss section") \ 919 _ELF_DEFINE_PT(PT_SUNWSTACK, 0x6FFFFFFBUL, \ 920 "A Solaris process stack") \ 921 _ELF_DEFINE_PT(PT_SUNWDTRACE, 0x6FFFFFFCUL, \ 922 "Used by dtrace(1)") \ 923 _ELF_DEFINE_PT(PT_SUNWCAP, 0x6FFFFFFDUL, \ 924 "Special hardware capability requirements") \ 925 _ELF_DEFINE_PT(PT_HIOS, 0x6FFFFFFFUL, \ 926 "end of OS-specific range") \ 927 _ELF_DEFINE_PT(PT_LOPROC, 0x70000000UL, \ 928 "start of processor-specific range") \ 929 _ELF_DEFINE_PT(PT_ARM_ARCHEXT, 0x70000000UL, \ 930 "platform architecture compatibility information") \ 931 _ELF_DEFINE_PT(PT_ARM_EXIDX, 0x70000001UL, \ 932 "exception unwind tables") \ 933 _ELF_DEFINE_PT(PT_MIPS_REGINFO, 0x70000000UL, \ 934 "register usage information") \ 935 _ELF_DEFINE_PT(PT_MIPS_RTPROC, 0x70000001UL, \ 936 "runtime procedure table") \ 937 _ELF_DEFINE_PT(PT_MIPS_OPTIONS, 0x70000002UL, \ 938 "options segment") \ 939 _ELF_DEFINE_PT(PT_HIPROC, 0x7FFFFFFFUL, \ 940 "end of processor-specific range") 941 942 #undef _ELF_DEFINE_PT 943 #define _ELF_DEFINE_PT(N, V, DESCR) N = V , 944 enum { 945 _ELF_DEFINE_PHDR_TYPES() 946 PT__LAST__ = PT_HIPROC 947 }; 948 949 /* synonyms. */ 950 #define PT_ARM_UNWIND PT_ARM_EXIDX 951 #define PT_HISUNW PT_HIOS 952 #define PT_LOSUNW PT_SUNWBSS 953 954 /* 955 * Section flags. 956 */ 957 958 #define _ELF_DEFINE_SECTION_FLAGS() \ 959 _ELF_DEFINE_SHF(SHF_WRITE, 0x1, \ 960 "writable during program execution") \ 961 _ELF_DEFINE_SHF(SHF_ALLOC, 0x2, \ 962 "occupies memory during program execution") \ 963 _ELF_DEFINE_SHF(SHF_EXECINSTR, 0x4, "executable instructions") \ 964 _ELF_DEFINE_SHF(SHF_MERGE, 0x10, \ 965 "may be merged to prevent duplication") \ 966 _ELF_DEFINE_SHF(SHF_STRINGS, 0x20, \ 967 "NUL-terminated character strings") \ 968 _ELF_DEFINE_SHF(SHF_INFO_LINK, 0x40, \ 969 "the sh_info field holds a link") \ 970 _ELF_DEFINE_SHF(SHF_LINK_ORDER, 0x80, \ 971 "special ordering requirements during linking") \ 972 _ELF_DEFINE_SHF(SHF_OS_NONCONFORMING, 0x100, \ 973 "requires OS-specific processing during linking") \ 974 _ELF_DEFINE_SHF(SHF_GROUP, 0x200, \ 975 "member of a section group") \ 976 _ELF_DEFINE_SHF(SHF_TLS, 0x400, \ 977 "holds thread-local storage") \ 978 _ELF_DEFINE_SHF(SHF_COMPRESSED, 0x800, \ 979 "holds compressed data") \ 980 _ELF_DEFINE_SHF(SHF_MASKOS, 0x0FF00000UL, \ 981 "bits reserved for OS-specific semantics") \ 982 _ELF_DEFINE_SHF(SHF_AMD64_LARGE, 0x10000000UL, \ 983 "section uses large code model") \ 984 _ELF_DEFINE_SHF(SHF_ENTRYSECT, 0x10000000UL, \ 985 "section contains an entry point (ARM)") \ 986 _ELF_DEFINE_SHF(SHF_COMDEF, 0x80000000UL, \ 987 "section may be multiply defined in input to link step (ARM)") \ 988 _ELF_DEFINE_SHF(SHF_MIPS_GPREL, 0x10000000UL, \ 989 "section must be part of global data area") \ 990 _ELF_DEFINE_SHF(SHF_MIPS_MERGE, 0x20000000UL, \ 991 "section data should be merged to eliminate duplication") \ 992 _ELF_DEFINE_SHF(SHF_MIPS_ADDR, 0x40000000UL, \ 993 "section data is addressed by default") \ 994 _ELF_DEFINE_SHF(SHF_MIPS_STRING, 0x80000000UL, \ 995 "section data is string data by default") \ 996 _ELF_DEFINE_SHF(SHF_MIPS_NOSTRIP, 0x08000000UL, \ 997 "section data may not be stripped") \ 998 _ELF_DEFINE_SHF(SHF_MIPS_LOCAL, 0x04000000UL, \ 999 "section data local to process") \ 1000 _ELF_DEFINE_SHF(SHF_MIPS_NAMES, 0x02000000UL, \ 1001 "linker must generate implicit hidden weak names") \ 1002 _ELF_DEFINE_SHF(SHF_MIPS_NODUPE, 0x01000000UL, \ 1003 "linker must retain only one copy") \ 1004 _ELF_DEFINE_SHF(SHF_ORDERED, 0x40000000UL, \ 1005 "section is ordered with respect to other sections") \ 1006 _ELF_DEFINE_SHF(SHF_EXCLUDE, 0x80000000UL, \ 1007 "section is excluded from executables and shared objects") \ 1008 _ELF_DEFINE_SHF(SHF_MASKPROC, 0xF0000000UL, \ 1009 "bits reserved for processor-specific semantics") 1010 1011 #undef _ELF_DEFINE_SHF 1012 #define _ELF_DEFINE_SHF(N, V, DESCR) N = V , 1013 enum { 1014 _ELF_DEFINE_SECTION_FLAGS() 1015 SHF__LAST__ 1016 }; 1017 1018 /* 1019 * Special section indices. 1020 */ 1021 #define _ELF_DEFINE_SECTION_INDICES() \ 1022 _ELF_DEFINE_SHN(SHN_UNDEF, 0, "undefined section") \ 1023 _ELF_DEFINE_SHN(SHN_LORESERVE, 0xFF00U, "start of reserved area") \ 1024 _ELF_DEFINE_SHN(SHN_LOPROC, 0xFF00U, \ 1025 "start of processor-specific range") \ 1026 _ELF_DEFINE_SHN(SHN_BEFORE, 0xFF00U, "used for section ordering") \ 1027 _ELF_DEFINE_SHN(SHN_AFTER, 0xFF01U, "used for section ordering") \ 1028 _ELF_DEFINE_SHN(SHN_AMD64_LCOMMON, 0xFF02U, "large common block label") \ 1029 _ELF_DEFINE_SHN(SHN_MIPS_ACOMMON, 0xFF00U, \ 1030 "allocated common symbols in a DSO") \ 1031 _ELF_DEFINE_SHN(SHN_MIPS_TEXT, 0xFF01U, "Reserved (obsolete)") \ 1032 _ELF_DEFINE_SHN(SHN_MIPS_DATA, 0xFF02U, "Reserved (obsolete)") \ 1033 _ELF_DEFINE_SHN(SHN_MIPS_SCOMMON, 0xFF03U, \ 1034 "gp-addressable common symbols") \ 1035 _ELF_DEFINE_SHN(SHN_MIPS_SUNDEFINED, 0xFF04U, \ 1036 "gp-addressable undefined symbols") \ 1037 _ELF_DEFINE_SHN(SHN_MIPS_LCOMMON, 0xFF05U, "local common symbols") \ 1038 _ELF_DEFINE_SHN(SHN_MIPS_LUNDEFINED, 0xFF06U, \ 1039 "local undefined symbols") \ 1040 _ELF_DEFINE_SHN(SHN_HIPROC, 0xFF1FU, \ 1041 "end of processor-specific range") \ 1042 _ELF_DEFINE_SHN(SHN_LOOS, 0xFF20U, \ 1043 "start of OS-specific range") \ 1044 _ELF_DEFINE_SHN(SHN_SUNW_IGNORE, 0xFF3FU, "used by dtrace") \ 1045 _ELF_DEFINE_SHN(SHN_HIOS, 0xFF3FU, \ 1046 "end of OS-specific range") \ 1047 _ELF_DEFINE_SHN(SHN_ABS, 0xFFF1U, "absolute references") \ 1048 _ELF_DEFINE_SHN(SHN_COMMON, 0xFFF2U, "references to COMMON areas") \ 1049 _ELF_DEFINE_SHN(SHN_XINDEX, 0xFFFFU, "extended index") \ 1050 _ELF_DEFINE_SHN(SHN_HIRESERVE, 0xFFFFU, "end of reserved area") 1051 1052 #undef _ELF_DEFINE_SHN 1053 #define _ELF_DEFINE_SHN(N, V, DESCR) N = V , 1054 enum { 1055 _ELF_DEFINE_SECTION_INDICES() 1056 SHN__LAST__ 1057 }; 1058 1059 /* 1060 * Section types. 1061 */ 1062 1063 #define _ELF_DEFINE_SECTION_TYPES() \ 1064 _ELF_DEFINE_SHT(SHT_NULL, 0, "inactive header") \ 1065 _ELF_DEFINE_SHT(SHT_PROGBITS, 1, "program defined information") \ 1066 _ELF_DEFINE_SHT(SHT_SYMTAB, 2, "symbol table") \ 1067 _ELF_DEFINE_SHT(SHT_STRTAB, 3, "string table") \ 1068 _ELF_DEFINE_SHT(SHT_RELA, 4, \ 1069 "relocation entries with addends") \ 1070 _ELF_DEFINE_SHT(SHT_HASH, 5, "symbol hash table") \ 1071 _ELF_DEFINE_SHT(SHT_DYNAMIC, 6, \ 1072 "information for dynamic linking") \ 1073 _ELF_DEFINE_SHT(SHT_NOTE, 7, "additional notes") \ 1074 _ELF_DEFINE_SHT(SHT_NOBITS, 8, "section occupying no space") \ 1075 _ELF_DEFINE_SHT(SHT_REL, 9, \ 1076 "relocation entries without addends") \ 1077 _ELF_DEFINE_SHT(SHT_SHLIB, 10, "reserved") \ 1078 _ELF_DEFINE_SHT(SHT_DYNSYM, 11, "symbol table") \ 1079 _ELF_DEFINE_SHT(SHT_INIT_ARRAY, 14, \ 1080 "pointers to initialization functions") \ 1081 _ELF_DEFINE_SHT(SHT_FINI_ARRAY, 15, \ 1082 "pointers to termination functions") \ 1083 _ELF_DEFINE_SHT(SHT_PREINIT_ARRAY, 16, \ 1084 "pointers to functions called before initialization") \ 1085 _ELF_DEFINE_SHT(SHT_GROUP, 17, "defines a section group") \ 1086 _ELF_DEFINE_SHT(SHT_SYMTAB_SHNDX, 18, \ 1087 "used for extended section numbering") \ 1088 _ELF_DEFINE_SHT(SHT_LOOS, 0x60000000UL, \ 1089 "start of OS-specific range") \ 1090 _ELF_DEFINE_SHT(SHT_SUNW_dof, 0x6FFFFFF4UL, \ 1091 "used by dtrace") \ 1092 _ELF_DEFINE_SHT(SHT_SUNW_cap, 0x6FFFFFF5UL, \ 1093 "capability requirements") \ 1094 _ELF_DEFINE_SHT(SHT_GNU_ATTRIBUTES, 0x6FFFFFF5UL, \ 1095 "object attributes") \ 1096 _ELF_DEFINE_SHT(SHT_SUNW_SIGNATURE, 0x6FFFFFF6UL, \ 1097 "module verification signature") \ 1098 _ELF_DEFINE_SHT(SHT_GNU_HASH, 0x6FFFFFF6UL, \ 1099 "GNU Hash sections") \ 1100 _ELF_DEFINE_SHT(SHT_GNU_LIBLIST, 0x6FFFFFF7UL, \ 1101 "List of libraries to be prelinked") \ 1102 _ELF_DEFINE_SHT(SHT_SUNW_ANNOTATE, 0x6FFFFFF7UL, \ 1103 "special section where unresolved references are allowed") \ 1104 _ELF_DEFINE_SHT(SHT_SUNW_DEBUGSTR, 0x6FFFFFF8UL, \ 1105 "debugging information") \ 1106 _ELF_DEFINE_SHT(SHT_CHECKSUM, 0x6FFFFFF8UL, \ 1107 "checksum for dynamic shared objects") \ 1108 _ELF_DEFINE_SHT(SHT_SUNW_DEBUG, 0x6FFFFFF9UL, \ 1109 "debugging information") \ 1110 _ELF_DEFINE_SHT(SHT_SUNW_move, 0x6FFFFFFAUL, \ 1111 "information to handle partially initialized symbols") \ 1112 _ELF_DEFINE_SHT(SHT_SUNW_COMDAT, 0x6FFFFFFBUL, \ 1113 "section supporting merging of multiple copies of data") \ 1114 _ELF_DEFINE_SHT(SHT_SUNW_syminfo, 0x6FFFFFFCUL, \ 1115 "additional symbol information") \ 1116 _ELF_DEFINE_SHT(SHT_SUNW_verdef, 0x6FFFFFFDUL, \ 1117 "symbol versioning information") \ 1118 _ELF_DEFINE_SHT(SHT_SUNW_verneed, 0x6FFFFFFEUL, \ 1119 "symbol versioning requirements") \ 1120 _ELF_DEFINE_SHT(SHT_SUNW_versym, 0x6FFFFFFFUL, \ 1121 "symbol versioning table") \ 1122 _ELF_DEFINE_SHT(SHT_HIOS, 0x6FFFFFFFUL, \ 1123 "end of OS-specific range") \ 1124 _ELF_DEFINE_SHT(SHT_LOPROC, 0x70000000UL, \ 1125 "start of processor-specific range") \ 1126 _ELF_DEFINE_SHT(SHT_ARM_EXIDX, 0x70000001UL, \ 1127 "exception index table") \ 1128 _ELF_DEFINE_SHT(SHT_ARM_PREEMPTMAP, 0x70000002UL, \ 1129 "BPABI DLL dynamic linking preemption map") \ 1130 _ELF_DEFINE_SHT(SHT_ARM_ATTRIBUTES, 0x70000003UL, \ 1131 "object file compatibility attributes") \ 1132 _ELF_DEFINE_SHT(SHT_ARM_DEBUGOVERLAY, 0x70000004UL, \ 1133 "overlay debug information") \ 1134 _ELF_DEFINE_SHT(SHT_ARM_OVERLAYSECTION, 0x70000005UL, \ 1135 "overlay debug information") \ 1136 _ELF_DEFINE_SHT(SHT_MIPS_LIBLIST, 0x70000000UL, \ 1137 "DSO library information used in link") \ 1138 _ELF_DEFINE_SHT(SHT_MIPS_MSYM, 0x70000001UL, \ 1139 "MIPS symbol table extension") \ 1140 _ELF_DEFINE_SHT(SHT_MIPS_CONFLICT, 0x70000002UL, \ 1141 "symbol conflicting with DSO-defined symbols ") \ 1142 _ELF_DEFINE_SHT(SHT_MIPS_GPTAB, 0x70000003UL, \ 1143 "global pointer table") \ 1144 _ELF_DEFINE_SHT(SHT_MIPS_UCODE, 0x70000004UL, \ 1145 "reserved") \ 1146 _ELF_DEFINE_SHT(SHT_MIPS_DEBUG, 0x70000005UL, \ 1147 "reserved (obsolete debug information)") \ 1148 _ELF_DEFINE_SHT(SHT_MIPS_REGINFO, 0x70000006UL, \ 1149 "register usage information") \ 1150 _ELF_DEFINE_SHT(SHT_MIPS_PACKAGE, 0x70000007UL, \ 1151 "OSF reserved") \ 1152 _ELF_DEFINE_SHT(SHT_MIPS_PACKSYM, 0x70000008UL, \ 1153 "OSF reserved") \ 1154 _ELF_DEFINE_SHT(SHT_MIPS_RELD, 0x70000009UL, \ 1155 "dynamic relocation") \ 1156 _ELF_DEFINE_SHT(SHT_MIPS_IFACE, 0x7000000BUL, \ 1157 "subprogram interface information") \ 1158 _ELF_DEFINE_SHT(SHT_MIPS_CONTENT, 0x7000000CUL, \ 1159 "section content classification") \ 1160 _ELF_DEFINE_SHT(SHT_MIPS_OPTIONS, 0x7000000DUL, \ 1161 "general options") \ 1162 _ELF_DEFINE_SHT(SHT_MIPS_DELTASYM, 0x7000001BUL, \ 1163 "Delta C++: symbol table") \ 1164 _ELF_DEFINE_SHT(SHT_MIPS_DELTAINST, 0x7000001CUL, \ 1165 "Delta C++: instance table") \ 1166 _ELF_DEFINE_SHT(SHT_MIPS_DELTACLASS, 0x7000001DUL, \ 1167 "Delta C++: class table") \ 1168 _ELF_DEFINE_SHT(SHT_MIPS_DWARF, 0x7000001EUL, \ 1169 "DWARF debug information") \ 1170 _ELF_DEFINE_SHT(SHT_MIPS_DELTADECL, 0x7000001FUL, \ 1171 "Delta C++: declarations") \ 1172 _ELF_DEFINE_SHT(SHT_MIPS_SYMBOL_LIB, 0x70000020UL, \ 1173 "symbol-to-library mapping") \ 1174 _ELF_DEFINE_SHT(SHT_MIPS_EVENTS, 0x70000021UL, \ 1175 "event locations") \ 1176 _ELF_DEFINE_SHT(SHT_MIPS_TRANSLATE, 0x70000022UL, \ 1177 "???") \ 1178 _ELF_DEFINE_SHT(SHT_MIPS_PIXIE, 0x70000023UL, \ 1179 "special pixie sections") \ 1180 _ELF_DEFINE_SHT(SHT_MIPS_XLATE, 0x70000024UL, \ 1181 "address translation table") \ 1182 _ELF_DEFINE_SHT(SHT_MIPS_XLATE_DEBUG, 0x70000025UL, \ 1183 "SGI internal address translation table") \ 1184 _ELF_DEFINE_SHT(SHT_MIPS_WHIRL, 0x70000026UL, \ 1185 "intermediate code") \ 1186 _ELF_DEFINE_SHT(SHT_MIPS_EH_REGION, 0x70000027UL, \ 1187 "C++ exception handling region info") \ 1188 _ELF_DEFINE_SHT(SHT_MIPS_XLATE_OLD, 0x70000028UL, \ 1189 "obsolete") \ 1190 _ELF_DEFINE_SHT(SHT_MIPS_PDR_EXCEPTION, 0x70000029UL, \ 1191 "runtime procedure descriptor table exception information") \ 1192 _ELF_DEFINE_SHT(SHT_MIPS_ABIFLAGS, 0x7000002AUL, \ 1193 "ABI flags") \ 1194 _ELF_DEFINE_SHT(SHT_SPARC_GOTDATA, 0x70000000UL, \ 1195 "SPARC-specific data") \ 1196 _ELF_DEFINE_SHT(SHT_AMD64_UNWIND, 0x70000001UL, \ 1197 "unwind tables for the AMD64") \ 1198 _ELF_DEFINE_SHT(SHT_ORDERED, 0x7FFFFFFFUL, \ 1199 "sort entries in the section") \ 1200 _ELF_DEFINE_SHT(SHT_HIPROC, 0x7FFFFFFFUL, \ 1201 "end of processor-specific range") \ 1202 _ELF_DEFINE_SHT(SHT_LOUSER, 0x80000000UL, \ 1203 "start of application-specific range") \ 1204 _ELF_DEFINE_SHT(SHT_HIUSER, 0xFFFFFFFFUL, \ 1205 "end of application-specific range") 1206 1207 #undef _ELF_DEFINE_SHT 1208 #define _ELF_DEFINE_SHT(N, V, DESCR) N = V , 1209 enum { 1210 _ELF_DEFINE_SECTION_TYPES() 1211 SHT__LAST__ = SHT_HIUSER 1212 }; 1213 1214 /* Aliases for section types. */ 1215 #define SHT_GNU_verdef SHT_SUNW_verdef 1216 #define SHT_GNU_verneed SHT_SUNW_verneed 1217 #define SHT_GNU_versym SHT_SUNW_versym 1218 1219 /* 1220 * Symbol binding information. 1221 */ 1222 1223 #define _ELF_DEFINE_SYMBOL_BINDING() \ 1224 _ELF_DEFINE_STB(STB_LOCAL, 0, \ 1225 "not visible outside defining object file") \ 1226 _ELF_DEFINE_STB(STB_GLOBAL, 1, \ 1227 "visible across all object files being combined") \ 1228 _ELF_DEFINE_STB(STB_WEAK, 2, \ 1229 "visible across all object files but with low precedence") \ 1230 _ELF_DEFINE_STB(STB_LOOS, 10, "start of OS-specific range") \ 1231 _ELF_DEFINE_STB(STB_GNU_UNIQUE, 10, "unique symbol (GNU)") \ 1232 _ELF_DEFINE_STB(STB_HIOS, 12, "end of OS-specific range") \ 1233 _ELF_DEFINE_STB(STB_LOPROC, 13, \ 1234 "start of processor-specific range") \ 1235 _ELF_DEFINE_STB(STB_HIPROC, 15, \ 1236 "end of processor-specific range") 1237 1238 #undef _ELF_DEFINE_STB 1239 #define _ELF_DEFINE_STB(N, V, DESCR) N = V , 1240 enum { 1241 _ELF_DEFINE_SYMBOL_BINDING() 1242 STB__LAST__ 1243 }; 1244 1245 /* 1246 * Symbol types 1247 */ 1248 1249 #define _ELF_DEFINE_SYMBOL_TYPES() \ 1250 _ELF_DEFINE_STT(STT_NOTYPE, 0, "unspecified type") \ 1251 _ELF_DEFINE_STT(STT_OBJECT, 1, "data object") \ 1252 _ELF_DEFINE_STT(STT_FUNC, 2, "executable code") \ 1253 _ELF_DEFINE_STT(STT_SECTION, 3, "section") \ 1254 _ELF_DEFINE_STT(STT_FILE, 4, "source file") \ 1255 _ELF_DEFINE_STT(STT_COMMON, 5, "uninitialized common block") \ 1256 _ELF_DEFINE_STT(STT_TLS, 6, "thread local storage") \ 1257 _ELF_DEFINE_STT(STT_LOOS, 10, "start of OS-specific types") \ 1258 _ELF_DEFINE_STT(STT_HIOS, 12, "end of OS-specific types") \ 1259 _ELF_DEFINE_STT(STT_LOPROC, 13, \ 1260 "start of processor-specific types") \ 1261 _ELF_DEFINE_STT(STT_ARM_TFUNC, 13, "Thumb function (GNU)") \ 1262 _ELF_DEFINE_STT(STT_ARM_16BIT, 15, "Thumb label (GNU)") \ 1263 _ELF_DEFINE_STT(STT_SPARC_REGISTER, 13, "SPARC register information") \ 1264 _ELF_DEFINE_STT(STT_HIPROC, 15, \ 1265 "end of processor-specific types") 1266 1267 #undef _ELF_DEFINE_STT 1268 #define _ELF_DEFINE_STT(N, V, DESCR) N = V , 1269 enum { 1270 _ELF_DEFINE_SYMBOL_TYPES() 1271 STT__LAST__ 1272 }; 1273 1274 /* 1275 * Symbol binding. 1276 */ 1277 1278 #define _ELF_DEFINE_SYMBOL_BINDING_KINDS() \ 1279 _ELF_DEFINE_SYB(SYMINFO_BT_SELF, 0xFFFFU, \ 1280 "bound to self") \ 1281 _ELF_DEFINE_SYB(SYMINFO_BT_PARENT, 0xFFFEU, \ 1282 "bound to parent") \ 1283 _ELF_DEFINE_SYB(SYMINFO_BT_NONE, 0xFFFDU, \ 1284 "no special binding") 1285 1286 #undef _ELF_DEFINE_SYB 1287 #define _ELF_DEFINE_SYB(N, V, DESCR) N = V , 1288 enum { 1289 _ELF_DEFINE_SYMBOL_BINDING_KINDS() 1290 SYMINFO__LAST__ 1291 }; 1292 1293 /* 1294 * Symbol visibility. 1295 */ 1296 1297 #define _ELF_DEFINE_SYMBOL_VISIBILITY() \ 1298 _ELF_DEFINE_STV(STV_DEFAULT, 0, \ 1299 "as specified by symbol type") \ 1300 _ELF_DEFINE_STV(STV_INTERNAL, 1, \ 1301 "as defined by processor semantics") \ 1302 _ELF_DEFINE_STV(STV_HIDDEN, 2, \ 1303 "hidden from other components") \ 1304 _ELF_DEFINE_STV(STV_PROTECTED, 3, \ 1305 "local references are not preemptable") 1306 1307 #undef _ELF_DEFINE_STV 1308 #define _ELF_DEFINE_STV(N, V, DESCR) N = V , 1309 enum { 1310 _ELF_DEFINE_SYMBOL_VISIBILITY() 1311 STV__LAST__ 1312 }; 1313 1314 /* 1315 * Symbol flags. 1316 */ 1317 #define _ELF_DEFINE_SYMBOL_FLAGS() \ 1318 _ELF_DEFINE_SYF(SYMINFO_FLG_DIRECT, 0x01, \ 1319 "directly assocated reference") \ 1320 _ELF_DEFINE_SYF(SYMINFO_FLG_COPY, 0x04, \ 1321 "definition by copy-relocation") \ 1322 _ELF_DEFINE_SYF(SYMINFO_FLG_LAZYLOAD, 0x08, \ 1323 "object should be lazily loaded") \ 1324 _ELF_DEFINE_SYF(SYMINFO_FLG_DIRECTBIND, 0x10, \ 1325 "reference should be directly bound") \ 1326 _ELF_DEFINE_SYF(SYMINFO_FLG_NOEXTDIRECT, 0x20, \ 1327 "external references not allowed to bind to definition") 1328 1329 #undef _ELF_DEFINE_SYF 1330 #define _ELF_DEFINE_SYF(N, V, DESCR) N = V , 1331 enum { 1332 _ELF_DEFINE_SYMBOL_FLAGS() 1333 SYMINFO_FLG__LAST__ 1334 }; 1335 1336 /* 1337 * Version dependencies. 1338 */ 1339 #define _ELF_DEFINE_VERSIONING_DEPENDENCIES() \ 1340 _ELF_DEFINE_VERD(VER_NDX_LOCAL, 0, "local scope") \ 1341 _ELF_DEFINE_VERD(VER_NDX_GLOBAL, 1, "global scope") 1342 #undef _ELF_DEFINE_VERD 1343 #define _ELF_DEFINE_VERD(N, V, DESCR) N = V , 1344 enum { 1345 _ELF_DEFINE_VERSIONING_DEPENDENCIES() 1346 VER_NDX__LAST__ 1347 }; 1348 1349 /* 1350 * Version flags. 1351 */ 1352 #define _ELF_DEFINE_VERSIONING_FLAGS() \ 1353 _ELF_DEFINE_VERF(VER_FLG_BASE, 0x1, "file version") \ 1354 _ELF_DEFINE_VERF(VER_FLG_WEAK, 0x2, "weak version") 1355 #undef _ELF_DEFINE_VERF 1356 #define _ELF_DEFINE_VERF(N, V, DESCR) N = V , 1357 enum { 1358 _ELF_DEFINE_VERSIONING_FLAGS() 1359 VER_FLG__LAST__ 1360 }; 1361 1362 /* 1363 * Version needs 1364 */ 1365 #define _ELF_DEFINE_VERSIONING_NEEDS() \ 1366 _ELF_DEFINE_VRN(VER_NEED_NONE, 0, "invalid version") \ 1367 _ELF_DEFINE_VRN(VER_NEED_CURRENT, 1, "current version") 1368 #undef _ELF_DEFINE_VRN 1369 #define _ELF_DEFINE_VRN(N, V, DESCR) N = V , 1370 enum { 1371 _ELF_DEFINE_VERSIONING_NEEDS() 1372 VER_NEED__LAST__ 1373 }; 1374 1375 /* 1376 * Version numbers. 1377 */ 1378 #define _ELF_DEFINE_VERSIONING_NUMBERS() \ 1379 _ELF_DEFINE_VRNU(VER_DEF_NONE, 0, "invalid version") \ 1380 _ELF_DEFINE_VRNU(VER_DEF_CURRENT, 1, "current version") 1381 #undef _ELF_DEFINE_VRNU 1382 #define _ELF_DEFINE_VRNU(N, V, DESCR) N = V , 1383 enum { 1384 _ELF_DEFINE_VERSIONING_NUMBERS() 1385 VER_DEF__LAST__ 1386 }; 1387 1388 /** 1389 ** Relocation types. 1390 **/ 1391 1392 #define _ELF_DEFINE_386_RELOCATIONS() \ 1393 _ELF_DEFINE_RELOC(R_386_NONE, 0) \ 1394 _ELF_DEFINE_RELOC(R_386_32, 1) \ 1395 _ELF_DEFINE_RELOC(R_386_PC32, 2) \ 1396 _ELF_DEFINE_RELOC(R_386_GOT32, 3) \ 1397 _ELF_DEFINE_RELOC(R_386_PLT32, 4) \ 1398 _ELF_DEFINE_RELOC(R_386_COPY, 5) \ 1399 _ELF_DEFINE_RELOC(R_386_GLOB_DAT, 6) \ 1400 _ELF_DEFINE_RELOC(R_386_JUMP_SLOT, 7) \ 1401 _ELF_DEFINE_RELOC(R_386_RELATIVE, 8) \ 1402 _ELF_DEFINE_RELOC(R_386_GOTOFF, 9) \ 1403 _ELF_DEFINE_RELOC(R_386_GOTPC, 10) \ 1404 _ELF_DEFINE_RELOC(R_386_32PLT, 11) \ 1405 _ELF_DEFINE_RELOC(R_386_16, 20) \ 1406 _ELF_DEFINE_RELOC(R_386_PC16, 21) \ 1407 _ELF_DEFINE_RELOC(R_386_8, 22) \ 1408 _ELF_DEFINE_RELOC(R_386_PC8, 23) 1409 1410 /* 1411 */ 1412 #define _ELF_DEFINE_AARCH64_RELOCATIONS() \ 1413 _ELF_DEFINE_RELOC(R_AARCH64_NONE, 0) \ 1414 _ELF_DEFINE_RELOC(R_AARCH64_ABS64, 257) \ 1415 _ELF_DEFINE_RELOC(R_AARCH64_ABS32, 258) \ 1416 _ELF_DEFINE_RELOC(R_AARCH64_ABS16, 259) \ 1417 _ELF_DEFINE_RELOC(R_AARCH64_PREL64, 260) \ 1418 _ELF_DEFINE_RELOC(R_AARCH64_PREL32, 261) \ 1419 _ELF_DEFINE_RELOC(R_AARCH64_PREL16, 262) \ 1420 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G0, 263) \ 1421 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G0_NC, 264) \ 1422 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G1, 265) \ 1423 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G1_NC, 266) \ 1424 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G2, 267) \ 1425 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G2_NC, 268) \ 1426 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_UABS_G3, 269) \ 1427 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G0, 270) \ 1428 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G1, 271) \ 1429 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_SABS_G2, 272) \ 1430 _ELF_DEFINE_RELOC(R_AARCH64_LD_PREL_LO19, 273) \ 1431 _ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_LO21, 274) \ 1432 _ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_PG_HI21, 275) \ 1433 _ELF_DEFINE_RELOC(R_AARCH64_ADR_PREL_PG_HI21_NC, 276) \ 1434 _ELF_DEFINE_RELOC(R_AARCH64_ADD_ABS_LO12_NC, 277) \ 1435 _ELF_DEFINE_RELOC(R_AARCH64_LDST8_ABS_LO12_NC, 278) \ 1436 _ELF_DEFINE_RELOC(R_AARCH64_TSTBR14, 279) \ 1437 _ELF_DEFINE_RELOC(R_AARCH64_CONDBR19, 280) \ 1438 _ELF_DEFINE_RELOC(R_AARCH64_JUMP26, 282) \ 1439 _ELF_DEFINE_RELOC(R_AARCH64_CALL26, 283) \ 1440 _ELF_DEFINE_RELOC(R_AARCH64_LDST16_ABS_LO12_NC, 284) \ 1441 _ELF_DEFINE_RELOC(R_AARCH64_LDST32_ABS_LO12_NC, 285) \ 1442 _ELF_DEFINE_RELOC(R_AARCH64_LDST64_ABS_LO12_NC, 286) \ 1443 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G0, 287) \ 1444 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G0_NC, 288) \ 1445 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G1, 289) \ 1446 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G1_NC, 290) \ 1447 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G2, 291) \ 1448 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G2_NC, 292) \ 1449 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_PREL_G3, 293) \ 1450 _ELF_DEFINE_RELOC(R_AARCH64_LDST128_ABS_LO12_NC, 299) \ 1451 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G0, 300) \ 1452 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G0_NC, 301) \ 1453 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G1, 302) \ 1454 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G1_NC, 303) \ 1455 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G2, 304) \ 1456 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G2_NC, 305) \ 1457 _ELF_DEFINE_RELOC(R_AARCH64_MOVW_GOTOFF_G3, 306) \ 1458 _ELF_DEFINE_RELOC(R_AARCH64_GOTREL64, 307) \ 1459 _ELF_DEFINE_RELOC(R_AARCH64_GOTREL32, 308) \ 1460 _ELF_DEFINE_RELOC(R_AARCH64_GOT_LD_PREL19, 309) \ 1461 _ELF_DEFINE_RELOC(R_AARCH64_LD64_GOTOFF_LO15, 310) \ 1462 _ELF_DEFINE_RELOC(R_AARCH64_ADR_GOT_PAGE, 311) \ 1463 _ELF_DEFINE_RELOC(R_AARCH64_LD64_GOT_LO12_NC, 312) \ 1464 _ELF_DEFINE_RELOC(R_AARCH64_LD64_GOTPAGE_LO15, 313) \ 1465 _ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADR_PREL21, 512) \ 1466 _ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADR_PAGE21, 513) \ 1467 _ELF_DEFINE_RELOC(R_AARCH64_TLSGD_ADD_LO12_NC, 514) \ 1468 _ELF_DEFINE_RELOC(R_AARCH64_TLSGD_MOVW_G1, 515) \ 1469 _ELF_DEFINE_RELOC(R_AARCH64_TLSGD_MOVW_G0_NC, 516) \ 1470 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADR_PREL21, 517) \ 1471 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADR_PAGE21, 518) \ 1472 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_LO12_NC, 519) \ 1473 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_G1, 520) \ 1474 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_G0_NC, 521) \ 1475 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LD_PREL19, 522) \ 1476 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G2, 523) \ 1477 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1, 524) \ 1478 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, 525) \ 1479 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0, 526) \ 1480 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, 527) \ 1481 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_HI12, 529) \ 1482 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, 530) \ 1483 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12, 531) \ 1484 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, 532) \ 1485 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12, 533) \ 1486 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, 534) \ 1487 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12, 535) \ 1488 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, 536) \ 1489 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12, 537) \ 1490 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, 538) \ 1491 _ELF_DEFINE_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G1, 539) \ 1492 _ELF_DEFINE_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, 540) \ 1493 _ELF_DEFINE_RELOC(R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, 541) \ 1494 _ELF_DEFINE_RELOC(R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC, 542) \ 1495 _ELF_DEFINE_RELOC(R_AARCH64_TLSIE_LD_GOTTPREL_PREL19, 543) \ 1496 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G2, 544) \ 1497 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1, 545) \ 1498 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1_NC, 546) \ 1499 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0, 547) \ 1500 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0_NC, 548) \ 1501 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_HI12, 549) \ 1502 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12, 550) \ 1503 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12_NC, 551) \ 1504 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12, 552) \ 1505 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC, 553) \ 1506 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12, 554) \ 1507 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC, 555) \ 1508 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12, 556) \ 1509 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC, 557) \ 1510 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12, 558) \ 1511 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC, 559) \ 1512 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LD_PREL19, 560) \ 1513 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADR_PREL21, 561) \ 1514 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADR_PAGE21, 562) \ 1515 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LD64_LO12, 563) \ 1516 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADD_LO12, 564) \ 1517 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_OFF_G1, 565) \ 1518 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_OFF_G0_NC, 566) \ 1519 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_LDR, 567) \ 1520 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_ADD, 568) \ 1521 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC_CALL, 569) \ 1522 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12, 570) \ 1523 _ELF_DEFINE_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC, 571) \ 1524 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12, 572) \ 1525 _ELF_DEFINE_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC, 573) \ 1526 _ELF_DEFINE_RELOC(R_AARCH64_COPY, 1024) \ 1527 _ELF_DEFINE_RELOC(R_AARCH64_GLOB_DAT, 1025) \ 1528 _ELF_DEFINE_RELOC(R_AARCH64_JUMP_SLOT, 1026) \ 1529 _ELF_DEFINE_RELOC(R_AARCH64_RELATIVE, 1027) \ 1530 _ELF_DEFINE_RELOC(R_AARCH64_TLS_DTPREL64, 1028) \ 1531 _ELF_DEFINE_RELOC(R_AARCH64_TLS_DTPMOD64, 1029) \ 1532 _ELF_DEFINE_RELOC(R_AARCH64_TLS_TPREL64, 1030) \ 1533 _ELF_DEFINE_RELOC(R_AARCH64_TLSDESC, 1031) \ 1534 _ELF_DEFINE_RELOC(R_AARCH64_IRELATIVE, 1032) 1535 1536 /* 1537 * These are the symbols used in the Sun ``Linkers and Loaders 1538 * Guide'', Document No: 817-1984-17. See the X86_64 relocations list 1539 * below for the spellings used in the ELF specification. 1540 */ 1541 #define _ELF_DEFINE_AMD64_RELOCATIONS() \ 1542 _ELF_DEFINE_RELOC(R_AMD64_NONE, 0) \ 1543 _ELF_DEFINE_RELOC(R_AMD64_64, 1) \ 1544 _ELF_DEFINE_RELOC(R_AMD64_PC32, 2) \ 1545 _ELF_DEFINE_RELOC(R_AMD64_GOT32, 3) \ 1546 _ELF_DEFINE_RELOC(R_AMD64_PLT32, 4) \ 1547 _ELF_DEFINE_RELOC(R_AMD64_COPY, 5) \ 1548 _ELF_DEFINE_RELOC(R_AMD64_GLOB_DAT, 6) \ 1549 _ELF_DEFINE_RELOC(R_AMD64_JUMP_SLOT, 7) \ 1550 _ELF_DEFINE_RELOC(R_AMD64_RELATIVE, 8) \ 1551 _ELF_DEFINE_RELOC(R_AMD64_GOTPCREL, 9) \ 1552 _ELF_DEFINE_RELOC(R_AMD64_32, 10) \ 1553 _ELF_DEFINE_RELOC(R_AMD64_32S, 11) \ 1554 _ELF_DEFINE_RELOC(R_AMD64_16, 12) \ 1555 _ELF_DEFINE_RELOC(R_AMD64_PC16, 13) \ 1556 _ELF_DEFINE_RELOC(R_AMD64_8, 14) \ 1557 _ELF_DEFINE_RELOC(R_AMD64_PC8, 15) \ 1558 _ELF_DEFINE_RELOC(R_AMD64_PC64, 24) \ 1559 _ELF_DEFINE_RELOC(R_AMD64_GOTOFF64, 25) \ 1560 _ELF_DEFINE_RELOC(R_AMD64_GOTPC32, 26) 1561 1562 /* 1563 * Relocation definitions from the ARM ELF ABI, version "ARM IHI 1564 * 0044E" released on 30th November 2012. 1565 */ 1566 #define _ELF_DEFINE_ARM_RELOCATIONS() \ 1567 _ELF_DEFINE_RELOC(R_ARM_NONE, 0) \ 1568 _ELF_DEFINE_RELOC(R_ARM_PC24, 1) \ 1569 _ELF_DEFINE_RELOC(R_ARM_ABS32, 2) \ 1570 _ELF_DEFINE_RELOC(R_ARM_REL32, 3) \ 1571 _ELF_DEFINE_RELOC(R_ARM_LDR_PC_G0, 4) \ 1572 _ELF_DEFINE_RELOC(R_ARM_ABS16, 5) \ 1573 _ELF_DEFINE_RELOC(R_ARM_ABS12, 6) \ 1574 _ELF_DEFINE_RELOC(R_ARM_THM_ABS5, 7) \ 1575 _ELF_DEFINE_RELOC(R_ARM_ABS8, 8) \ 1576 _ELF_DEFINE_RELOC(R_ARM_SBREL32, 9) \ 1577 _ELF_DEFINE_RELOC(R_ARM_THM_CALL, 10) \ 1578 _ELF_DEFINE_RELOC(R_ARM_THM_PC8, 11) \ 1579 _ELF_DEFINE_RELOC(R_ARM_BREL_ADJ, 12) \ 1580 _ELF_DEFINE_RELOC(R_ARM_SWI24, 13) \ 1581 _ELF_DEFINE_RELOC(R_ARM_TLS_DESC, 13) \ 1582 _ELF_DEFINE_RELOC(R_ARM_THM_SWI8, 14) \ 1583 _ELF_DEFINE_RELOC(R_ARM_XPC25, 15) \ 1584 _ELF_DEFINE_RELOC(R_ARM_THM_XPC22, 16) \ 1585 _ELF_DEFINE_RELOC(R_ARM_TLS_DTPMOD32, 17) \ 1586 _ELF_DEFINE_RELOC(R_ARM_TLS_DTPOFF32, 18) \ 1587 _ELF_DEFINE_RELOC(R_ARM_TLS_TPOFF32, 19) \ 1588 _ELF_DEFINE_RELOC(R_ARM_COPY, 20) \ 1589 _ELF_DEFINE_RELOC(R_ARM_GLOB_DAT, 21) \ 1590 _ELF_DEFINE_RELOC(R_ARM_JUMP_SLOT, 22) \ 1591 _ELF_DEFINE_RELOC(R_ARM_RELATIVE, 23) \ 1592 _ELF_DEFINE_RELOC(R_ARM_GOTOFF32, 24) \ 1593 _ELF_DEFINE_RELOC(R_ARM_BASE_PREL, 25) \ 1594 _ELF_DEFINE_RELOC(R_ARM_GOT_BREL, 26) \ 1595 _ELF_DEFINE_RELOC(R_ARM_PLT32, 27) \ 1596 _ELF_DEFINE_RELOC(R_ARM_CALL, 28) \ 1597 _ELF_DEFINE_RELOC(R_ARM_JUMP24, 29) \ 1598 _ELF_DEFINE_RELOC(R_ARM_THM_JUMP24, 30) \ 1599 _ELF_DEFINE_RELOC(R_ARM_BASE_ABS, 31) \ 1600 _ELF_DEFINE_RELOC(R_ARM_ALU_PCREL_7_0, 32) \ 1601 _ELF_DEFINE_RELOC(R_ARM_ALU_PCREL_15_8, 33) \ 1602 _ELF_DEFINE_RELOC(R_ARM_ALU_PCREL_23_15, 34) \ 1603 _ELF_DEFINE_RELOC(R_ARM_LDR_SBREL_11_0_NC, 35) \ 1604 _ELF_DEFINE_RELOC(R_ARM_ALU_SBREL_19_12_NC, 36) \ 1605 _ELF_DEFINE_RELOC(R_ARM_ALU_SBREL_27_20_CK, 37) \ 1606 _ELF_DEFINE_RELOC(R_ARM_TARGET1, 38) \ 1607 _ELF_DEFINE_RELOC(R_ARM_SBREL31, 39) \ 1608 _ELF_DEFINE_RELOC(R_ARM_V4BX, 40) \ 1609 _ELF_DEFINE_RELOC(R_ARM_TARGET2, 41) \ 1610 _ELF_DEFINE_RELOC(R_ARM_PREL31, 42) \ 1611 _ELF_DEFINE_RELOC(R_ARM_MOVW_ABS_NC, 43) \ 1612 _ELF_DEFINE_RELOC(R_ARM_MOVT_ABS, 44) \ 1613 _ELF_DEFINE_RELOC(R_ARM_MOVW_PREL_NC, 45) \ 1614 _ELF_DEFINE_RELOC(R_ARM_MOVT_PREL, 46) \ 1615 _ELF_DEFINE_RELOC(R_ARM_THM_MOVW_ABS_NC, 47) \ 1616 _ELF_DEFINE_RELOC(R_ARM_THM_MOVT_ABS, 48) \ 1617 _ELF_DEFINE_RELOC(R_ARM_THM_MOVW_PREL_NC, 49) \ 1618 _ELF_DEFINE_RELOC(R_ARM_THM_MOVT_PREL, 50) \ 1619 _ELF_DEFINE_RELOC(R_ARM_THM_JUMP19, 51) \ 1620 _ELF_DEFINE_RELOC(R_ARM_THM_JUMP6, 52) \ 1621 _ELF_DEFINE_RELOC(R_ARM_THM_ALU_PREL_11_0, 53) \ 1622 _ELF_DEFINE_RELOC(R_ARM_THM_PC12, 54) \ 1623 _ELF_DEFINE_RELOC(R_ARM_ABS32_NOI, 55) \ 1624 _ELF_DEFINE_RELOC(R_ARM_REL32_NOI, 56) \ 1625 _ELF_DEFINE_RELOC(R_ARM_ALU_PC_G0_NC, 57) \ 1626 _ELF_DEFINE_RELOC(R_ARM_ALU_PC_G0, 58) \ 1627 _ELF_DEFINE_RELOC(R_ARM_ALU_PC_G1_NC, 59) \ 1628 _ELF_DEFINE_RELOC(R_ARM_ALU_PC_G1, 60) \ 1629 _ELF_DEFINE_RELOC(R_ARM_ALU_PC_G2, 61) \ 1630 _ELF_DEFINE_RELOC(R_ARM_LDR_PC_G1, 62) \ 1631 _ELF_DEFINE_RELOC(R_ARM_LDR_PC_G2, 63) \ 1632 _ELF_DEFINE_RELOC(R_ARM_LDRS_PC_G0, 64) \ 1633 _ELF_DEFINE_RELOC(R_ARM_LDRS_PC_G1, 65) \ 1634 _ELF_DEFINE_RELOC(R_ARM_LDRS_PC_G2, 66) \ 1635 _ELF_DEFINE_RELOC(R_ARM_LDC_PC_G0, 67) \ 1636 _ELF_DEFINE_RELOC(R_ARM_LDC_PC_G1, 68) \ 1637 _ELF_DEFINE_RELOC(R_ARM_LDC_PC_G2, 69) \ 1638 _ELF_DEFINE_RELOC(R_ARM_ALU_SB_G0_NC, 70) \ 1639 _ELF_DEFINE_RELOC(R_ARM_ALU_SB_G0, 71) \ 1640 _ELF_DEFINE_RELOC(R_ARM_ALU_SB_G1_NC, 72) \ 1641 _ELF_DEFINE_RELOC(R_ARM_ALU_SB_G1, 73) \ 1642 _ELF_DEFINE_RELOC(R_ARM_ALU_SB_G2, 74) \ 1643 _ELF_DEFINE_RELOC(R_ARM_LDR_SB_G0, 75) \ 1644 _ELF_DEFINE_RELOC(R_ARM_LDR_SB_G1, 76) \ 1645 _ELF_DEFINE_RELOC(R_ARM_LDR_SB_G2, 77) \ 1646 _ELF_DEFINE_RELOC(R_ARM_LDRS_SB_G0, 78) \ 1647 _ELF_DEFINE_RELOC(R_ARM_LDRS_SB_G1, 79) \ 1648 _ELF_DEFINE_RELOC(R_ARM_LDRS_SB_G2, 80) \ 1649 _ELF_DEFINE_RELOC(R_ARM_LDC_SB_G0, 81) \ 1650 _ELF_DEFINE_RELOC(R_ARM_LDC_SB_G1, 82) \ 1651 _ELF_DEFINE_RELOC(R_ARM_LDC_SB_G2, 83) \ 1652 _ELF_DEFINE_RELOC(R_ARM_MOVW_BREL_NC, 84) \ 1653 _ELF_DEFINE_RELOC(R_ARM_MOVT_BREL, 85) \ 1654 _ELF_DEFINE_RELOC(R_ARM_MOVW_BREL, 86) \ 1655 _ELF_DEFINE_RELOC(R_ARM_THM_MOVW_BREL_NC, 87) \ 1656 _ELF_DEFINE_RELOC(R_ARM_THM_MOVT_BREL, 88) \ 1657 _ELF_DEFINE_RELOC(R_ARM_THM_MOVW_BREL, 89) \ 1658 _ELF_DEFINE_RELOC(R_ARM_TLS_GOTDESC, 90) \ 1659 _ELF_DEFINE_RELOC(R_ARM_TLS_CALL, 91) \ 1660 _ELF_DEFINE_RELOC(R_ARM_TLS_DESCSEQ, 92) \ 1661 _ELF_DEFINE_RELOC(R_ARM_THM_TLS_CALL, 93) \ 1662 _ELF_DEFINE_RELOC(R_ARM_PLT32_ABS, 94) \ 1663 _ELF_DEFINE_RELOC(R_ARM_GOT_ABS, 95) \ 1664 _ELF_DEFINE_RELOC(R_ARM_GOT_PREL, 96) \ 1665 _ELF_DEFINE_RELOC(R_ARM_GOT_BREL12, 97) \ 1666 _ELF_DEFINE_RELOC(R_ARM_GOTOFF12, 98) \ 1667 _ELF_DEFINE_RELOC(R_ARM_GOTRELAX, 99) \ 1668 _ELF_DEFINE_RELOC(R_ARM_GNU_VTENTRY, 100) \ 1669 _ELF_DEFINE_RELOC(R_ARM_GNU_VTINHERIT, 101) \ 1670 _ELF_DEFINE_RELOC(R_ARM_THM_JUMP11, 102) \ 1671 _ELF_DEFINE_RELOC(R_ARM_THM_JUMP8, 103) \ 1672 _ELF_DEFINE_RELOC(R_ARM_TLS_GD32, 104) \ 1673 _ELF_DEFINE_RELOC(R_ARM_TLS_LDM32, 105) \ 1674 _ELF_DEFINE_RELOC(R_ARM_TLS_LDO32, 106) \ 1675 _ELF_DEFINE_RELOC(R_ARM_TLS_IE32, 107) \ 1676 _ELF_DEFINE_RELOC(R_ARM_TLS_LE32, 108) \ 1677 _ELF_DEFINE_RELOC(R_ARM_TLS_LDO12, 109) \ 1678 _ELF_DEFINE_RELOC(R_ARM_TLS_LE12, 110) \ 1679 _ELF_DEFINE_RELOC(R_ARM_TLS_IE12GP, 111) \ 1680 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_0, 112) \ 1681 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_1, 113) \ 1682 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_2, 114) \ 1683 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_3, 115) \ 1684 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_4, 116) \ 1685 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_5, 117) \ 1686 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_6, 118) \ 1687 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_7, 119) \ 1688 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_8, 120) \ 1689 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_9, 121) \ 1690 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_10, 122) \ 1691 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_11, 123) \ 1692 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_12, 124) \ 1693 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_13, 125) \ 1694 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_14, 126) \ 1695 _ELF_DEFINE_RELOC(R_ARM_PRIVATE_15, 127) \ 1696 _ELF_DEFINE_RELOC(R_ARM_ME_TOO, 128) \ 1697 _ELF_DEFINE_RELOC(R_ARM_THM_TLS_DESCSEQ16, 129) \ 1698 _ELF_DEFINE_RELOC(R_ARM_THM_TLS_DESCSEQ32, 130) \ 1699 _ELF_DEFINE_RELOC(R_ARM_THM_GOT_BREL12, 131) \ 1700 _ELF_DEFINE_RELOC(R_ARM_IRELATIVE, 140) 1701 1702 #define _ELF_DEFINE_IA64_RELOCATIONS() \ 1703 _ELF_DEFINE_RELOC(R_IA_64_NONE, 0) \ 1704 _ELF_DEFINE_RELOC(R_IA_64_IMM14, 0x21) \ 1705 _ELF_DEFINE_RELOC(R_IA_64_IMM22, 0x22) \ 1706 _ELF_DEFINE_RELOC(R_IA_64_IMM64, 0x23) \ 1707 _ELF_DEFINE_RELOC(R_IA_64_DIR32MSB, 0x24) \ 1708 _ELF_DEFINE_RELOC(R_IA_64_DIR32LSB, 0x25) \ 1709 _ELF_DEFINE_RELOC(R_IA_64_DIR64MSB, 0x26) \ 1710 _ELF_DEFINE_RELOC(R_IA_64_DIR64LSB, 0x27) \ 1711 _ELF_DEFINE_RELOC(R_IA_64_GPREL22, 0x2a) \ 1712 _ELF_DEFINE_RELOC(R_IA_64_GPREL64I, 0x2b) \ 1713 _ELF_DEFINE_RELOC(R_IA_64_GPREL32MSB, 0x2c) \ 1714 _ELF_DEFINE_RELOC(R_IA_64_GPREL32LSB, 0x2d) \ 1715 _ELF_DEFINE_RELOC(R_IA_64_GPREL64MSB, 0x2e) \ 1716 _ELF_DEFINE_RELOC(R_IA_64_GPREL64LSB, 0x2f) \ 1717 _ELF_DEFINE_RELOC(R_IA_64_LTOFF22, 0x32) \ 1718 _ELF_DEFINE_RELOC(R_IA_64_LTOFF64I, 0x33) \ 1719 _ELF_DEFINE_RELOC(R_IA_64_PLTOFF22, 0x3a) \ 1720 _ELF_DEFINE_RELOC(R_IA_64_PLTOFF64I, 0x3b) \ 1721 _ELF_DEFINE_RELOC(R_IA_64_PLTOFF64MSB, 0x3e) \ 1722 _ELF_DEFINE_RELOC(R_IA_64_PLTOFF64LSB, 0x3f) \ 1723 _ELF_DEFINE_RELOC(R_IA_64_FPTR64I, 0x43) \ 1724 _ELF_DEFINE_RELOC(R_IA_64_FPTR32MSB, 0x44) \ 1725 _ELF_DEFINE_RELOC(R_IA_64_FPTR32LSB, 0x45) \ 1726 _ELF_DEFINE_RELOC(R_IA_64_FPTR64MSB, 0x46) \ 1727 _ELF_DEFINE_RELOC(R_IA_64_FPTR64LSB, 0x47) \ 1728 _ELF_DEFINE_RELOC(R_IA_64_PCREL60B, 0x48) \ 1729 _ELF_DEFINE_RELOC(R_IA_64_PCREL21B, 0x49) \ 1730 _ELF_DEFINE_RELOC(R_IA_64_PCREL21M, 0x4a) \ 1731 _ELF_DEFINE_RELOC(R_IA_64_PCREL21F, 0x4b) \ 1732 _ELF_DEFINE_RELOC(R_IA_64_PCREL32MSB, 0x4c) \ 1733 _ELF_DEFINE_RELOC(R_IA_64_PCREL32LSB, 0x4d) \ 1734 _ELF_DEFINE_RELOC(R_IA_64_PCREL64MSB, 0x4e) \ 1735 _ELF_DEFINE_RELOC(R_IA_64_PCREL64LSB, 0x4f) \ 1736 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_FPTR22, 0x52) \ 1737 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_FPTR64I, 0x53) \ 1738 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_FPTR32MSB, 0x54) \ 1739 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_FPTR32LSB, 0x55) \ 1740 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_FPTR64MSB, 0x56) \ 1741 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_FPTR64LSB, 0x57) \ 1742 _ELF_DEFINE_RELOC(R_IA_64_SEGREL32MSB, 0x5c) \ 1743 _ELF_DEFINE_RELOC(R_IA_64_SEGREL32LSB, 0x5d) \ 1744 _ELF_DEFINE_RELOC(R_IA_64_SEGREL64MSB, 0x5e) \ 1745 _ELF_DEFINE_RELOC(R_IA_64_SEGREL64LSB, 0x5f) \ 1746 _ELF_DEFINE_RELOC(R_IA_64_SECREL32MSB, 0x64) \ 1747 _ELF_DEFINE_RELOC(R_IA_64_SECREL32LSB, 0x65) \ 1748 _ELF_DEFINE_RELOC(R_IA_64_SECREL64MSB, 0x66) \ 1749 _ELF_DEFINE_RELOC(R_IA_64_SECREL64LSB, 0x67) \ 1750 _ELF_DEFINE_RELOC(R_IA_64_REL32MSB, 0x6c) \ 1751 _ELF_DEFINE_RELOC(R_IA_64_REL32LSB, 0x6d) \ 1752 _ELF_DEFINE_RELOC(R_IA_64_REL64MSB, 0x6e) \ 1753 _ELF_DEFINE_RELOC(R_IA_64_REL64LSB, 0x6f) \ 1754 _ELF_DEFINE_RELOC(R_IA_64_LTV32MSB, 0x74) \ 1755 _ELF_DEFINE_RELOC(R_IA_64_LTV32LSB, 0x75) \ 1756 _ELF_DEFINE_RELOC(R_IA_64_LTV64MSB, 0x76) \ 1757 _ELF_DEFINE_RELOC(R_IA_64_LTV64LSB, 0x77) \ 1758 _ELF_DEFINE_RELOC(R_IA_64_PCREL21BI, 0x79) \ 1759 _ELF_DEFINE_RELOC(R_IA_64_PCREL22, 0x7A) \ 1760 _ELF_DEFINE_RELOC(R_IA_64_PCREL64I, 0x7B) \ 1761 _ELF_DEFINE_RELOC(R_IA_64_IPLTMSB, 0x80) \ 1762 _ELF_DEFINE_RELOC(R_IA_64_IPLTLSB, 0x81) \ 1763 _ELF_DEFINE_RELOC(R_IA_64_SUB, 0x85) \ 1764 _ELF_DEFINE_RELOC(R_IA_64_LTOFF22X, 0x86) \ 1765 _ELF_DEFINE_RELOC(R_IA_64_LDXMOV, 0x87) \ 1766 _ELF_DEFINE_RELOC(R_IA_64_TPREL14, 0x91) \ 1767 _ELF_DEFINE_RELOC(R_IA_64_TPREL22, 0x92) \ 1768 _ELF_DEFINE_RELOC(R_IA_64_TPREL64I, 0x93) \ 1769 _ELF_DEFINE_RELOC(R_IA_64_TPREL64MSB, 0x96) \ 1770 _ELF_DEFINE_RELOC(R_IA_64_TPREL64LSB, 0x97) \ 1771 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_TPREL22, 0x9A) \ 1772 _ELF_DEFINE_RELOC(R_IA_64_DTPMOD64MSB, 0xA6) \ 1773 _ELF_DEFINE_RELOC(R_IA_64_DTPMOD64LSB, 0xA7) \ 1774 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_DTPMOD22, 0xAA) \ 1775 _ELF_DEFINE_RELOC(R_IA_64_DTPREL14, 0xB1) \ 1776 _ELF_DEFINE_RELOC(R_IA_64_DTPREL22, 0xB2) \ 1777 _ELF_DEFINE_RELOC(R_IA_64_DTPREL64I, 0xB3) \ 1778 _ELF_DEFINE_RELOC(R_IA_64_DTPREL32MSB, 0xB4) \ 1779 _ELF_DEFINE_RELOC(R_IA_64_DTPREL32LSB, 0xB5) \ 1780 _ELF_DEFINE_RELOC(R_IA_64_DTPREL64MSB, 0xB6) \ 1781 _ELF_DEFINE_RELOC(R_IA_64_DTPREL64LSB, 0xB7) \ 1782 _ELF_DEFINE_RELOC(R_IA_64_LTOFF_DTPREL22, 0xBA) 1783 1784 #define _ELF_DEFINE_MIPS_RELOCATIONS() \ 1785 _ELF_DEFINE_RELOC(R_MIPS_NONE, 0) \ 1786 _ELF_DEFINE_RELOC(R_MIPS_16, 1) \ 1787 _ELF_DEFINE_RELOC(R_MIPS_32, 2) \ 1788 _ELF_DEFINE_RELOC(R_MIPS_REL32, 3) \ 1789 _ELF_DEFINE_RELOC(R_MIPS_26, 4) \ 1790 _ELF_DEFINE_RELOC(R_MIPS_HI16, 5) \ 1791 _ELF_DEFINE_RELOC(R_MIPS_LO16, 6) \ 1792 _ELF_DEFINE_RELOC(R_MIPS_GPREL16, 7) \ 1793 _ELF_DEFINE_RELOC(R_MIPS_LITERAL, 8) \ 1794 _ELF_DEFINE_RELOC(R_MIPS_GOT16, 9) \ 1795 _ELF_DEFINE_RELOC(R_MIPS_PC16, 10) \ 1796 _ELF_DEFINE_RELOC(R_MIPS_CALL16, 11) \ 1797 _ELF_DEFINE_RELOC(R_MIPS_GPREL32, 12) \ 1798 _ELF_DEFINE_RELOC(R_MIPS_64, 18) \ 1799 _ELF_DEFINE_RELOC(R_MIPS_GOTHI16, 21) \ 1800 _ELF_DEFINE_RELOC(R_MIPS_GOTLO16, 22) \ 1801 _ELF_DEFINE_RELOC(R_MIPS_CALLHI16, 30) \ 1802 _ELF_DEFINE_RELOC(R_MIPS_CALLLO16, 31) \ 1803 _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPMOD32, 38) \ 1804 _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPREL32, 39) \ 1805 _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPMOD64, 40) \ 1806 _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPREL64, 41) \ 1807 _ELF_DEFINE_RELOC(R_MIPS_TLS_GD, 42) \ 1808 _ELF_DEFINE_RELOC(R_MIPS_TLS_LDM, 43) \ 1809 _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPREL_HI16, 44) \ 1810 _ELF_DEFINE_RELOC(R_MIPS_TLS_DTPREL_LO16, 45) \ 1811 _ELF_DEFINE_RELOC(R_MIPS_TLS_GOTTPREL, 46) \ 1812 _ELF_DEFINE_RELOC(R_MIPS_TLS_TPREL32, 47) \ 1813 _ELF_DEFINE_RELOC(R_MIPS_TLS_TPREL64, 48) \ 1814 _ELF_DEFINE_RELOC(R_MIPS_TLS_TPREL_HI16, 49) \ 1815 _ELF_DEFINE_RELOC(R_MIPS_TLS_TPREL_LO16, 50) 1816 1817 #define _ELF_DEFINE_PPC32_RELOCATIONS() \ 1818 _ELF_DEFINE_RELOC(R_PPC_NONE, 0) \ 1819 _ELF_DEFINE_RELOC(R_PPC_ADDR32, 1) \ 1820 _ELF_DEFINE_RELOC(R_PPC_ADDR24, 2) \ 1821 _ELF_DEFINE_RELOC(R_PPC_ADDR16, 3) \ 1822 _ELF_DEFINE_RELOC(R_PPC_ADDR16_LO, 4) \ 1823 _ELF_DEFINE_RELOC(R_PPC_ADDR16_HI, 5) \ 1824 _ELF_DEFINE_RELOC(R_PPC_ADDR16_HA, 6) \ 1825 _ELF_DEFINE_RELOC(R_PPC_ADDR14, 7) \ 1826 _ELF_DEFINE_RELOC(R_PPC_ADDR14_BRTAKEN, 8) \ 1827 _ELF_DEFINE_RELOC(R_PPC_ADDR14_BRNTAKEN, 9) \ 1828 _ELF_DEFINE_RELOC(R_PPC_REL24, 10) \ 1829 _ELF_DEFINE_RELOC(R_PPC_REL14, 11) \ 1830 _ELF_DEFINE_RELOC(R_PPC_REL14_BRTAKEN, 12) \ 1831 _ELF_DEFINE_RELOC(R_PPC_REL14_BRNTAKEN, 13) \ 1832 _ELF_DEFINE_RELOC(R_PPC_GOT16, 14) \ 1833 _ELF_DEFINE_RELOC(R_PPC_GOT16_LO, 15) \ 1834 _ELF_DEFINE_RELOC(R_PPC_GOT16_HI, 16) \ 1835 _ELF_DEFINE_RELOC(R_PPC_GOT16_HA, 17) \ 1836 _ELF_DEFINE_RELOC(R_PPC_PLTREL24, 18) \ 1837 _ELF_DEFINE_RELOC(R_PPC_COPY, 19) \ 1838 _ELF_DEFINE_RELOC(R_PPC_GLOB_DAT, 20) \ 1839 _ELF_DEFINE_RELOC(R_PPC_JMP_SLOT, 21) \ 1840 _ELF_DEFINE_RELOC(R_PPC_RELATIVE, 22) \ 1841 _ELF_DEFINE_RELOC(R_PPC_LOCAL24PC, 23) \ 1842 _ELF_DEFINE_RELOC(R_PPC_UADDR32, 24) \ 1843 _ELF_DEFINE_RELOC(R_PPC_UADDR16, 25) \ 1844 _ELF_DEFINE_RELOC(R_PPC_REL32, 26) \ 1845 _ELF_DEFINE_RELOC(R_PPC_PLT32, 27) \ 1846 _ELF_DEFINE_RELOC(R_PPC_PLTREL32, 28) \ 1847 _ELF_DEFINE_RELOC(R_PPC_PLT16_LO, 29) \ 1848 _ELF_DEFINE_RELOC(R_PPC_PLT16_HI, 30) \ 1849 _ELF_DEFINE_RELOC(R_PPC_PLT16_HA, 31) \ 1850 _ELF_DEFINE_RELOC(R_PPC_SDAREL16, 32) \ 1851 _ELF_DEFINE_RELOC(R_PPC_SECTOFF, 33) \ 1852 _ELF_DEFINE_RELOC(R_PPC_SECTOFF_LO, 34) \ 1853 _ELF_DEFINE_RELOC(R_PPC_SECTOFF_HI, 35) \ 1854 _ELF_DEFINE_RELOC(R_PPC_SECTOFF_HA, 36) \ 1855 _ELF_DEFINE_RELOC(R_PPC_ADDR30, 37) \ 1856 _ELF_DEFINE_RELOC(R_PPC_TLS, 67) \ 1857 _ELF_DEFINE_RELOC(R_PPC_DTPMOD32, 68) \ 1858 _ELF_DEFINE_RELOC(R_PPC_TPREL16, 69) \ 1859 _ELF_DEFINE_RELOC(R_PPC_TPREL16_LO, 70) \ 1860 _ELF_DEFINE_RELOC(R_PPC_TPREL16_HI, 71) \ 1861 _ELF_DEFINE_RELOC(R_PPC_TPREL16_HA, 72) \ 1862 _ELF_DEFINE_RELOC(R_PPC_TPREL32, 73) \ 1863 _ELF_DEFINE_RELOC(R_PPC_DTPREL16, 74) \ 1864 _ELF_DEFINE_RELOC(R_PPC_DTPREL16_LO, 75) \ 1865 _ELF_DEFINE_RELOC(R_PPC_DTPREL16_HI, 76) \ 1866 _ELF_DEFINE_RELOC(R_PPC_DTPREL16_HA, 77) \ 1867 _ELF_DEFINE_RELOC(R_PPC_DTPREL32, 78) \ 1868 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSGD16, 79) \ 1869 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSGD16_LO, 80) \ 1870 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSGD16_HI, 81) \ 1871 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSGD16_HA, 82) \ 1872 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSLD16, 83) \ 1873 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSLD16_LO, 84) \ 1874 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSLD16_HI, 85) \ 1875 _ELF_DEFINE_RELOC(R_PPC_GOT_TLSLD16_HA, 86) \ 1876 _ELF_DEFINE_RELOC(R_PPC_GOT_TPREL16, 87) \ 1877 _ELF_DEFINE_RELOC(R_PPC_GOT_TPREL16_LO, 88) \ 1878 _ELF_DEFINE_RELOC(R_PPC_GOT_TPREL16_HI, 89) \ 1879 _ELF_DEFINE_RELOC(R_PPC_GOT_TPREL16_HA, 90) \ 1880 _ELF_DEFINE_RELOC(R_PPC_GOT_DTPREL16, 91) \ 1881 _ELF_DEFINE_RELOC(R_PPC_GOT_DTPREL16_LO, 92) \ 1882 _ELF_DEFINE_RELOC(R_PPC_GOT_DTPREL16_HI, 93) \ 1883 _ELF_DEFINE_RELOC(R_PPC_GOT_DTPREL16_HA, 94) \ 1884 _ELF_DEFINE_RELOC(R_PPC_TLSGD, 95) \ 1885 _ELF_DEFINE_RELOC(R_PPC_TLSLD, 96) \ 1886 _ELF_DEFINE_RELOC(R_PPC_EMB_NADDR32, 101) \ 1887 _ELF_DEFINE_RELOC(R_PPC_EMB_NADDR16, 102) \ 1888 _ELF_DEFINE_RELOC(R_PPC_EMB_NADDR16_LO, 103) \ 1889 _ELF_DEFINE_RELOC(R_PPC_EMB_NADDR16_HI, 104) \ 1890 _ELF_DEFINE_RELOC(R_PPC_EMB_NADDR16_HA, 105) \ 1891 _ELF_DEFINE_RELOC(R_PPC_EMB_SDAI16, 106) \ 1892 _ELF_DEFINE_RELOC(R_PPC_EMB_SDA2I16, 107) \ 1893 _ELF_DEFINE_RELOC(R_PPC_EMB_SDA2REL, 108) \ 1894 _ELF_DEFINE_RELOC(R_PPC_EMB_SDA21, 109) \ 1895 _ELF_DEFINE_RELOC(R_PPC_EMB_MRKREF, 110) \ 1896 _ELF_DEFINE_RELOC(R_PPC_EMB_RELSEC16, 111) \ 1897 _ELF_DEFINE_RELOC(R_PPC_EMB_RELST_LO, 112) \ 1898 _ELF_DEFINE_RELOC(R_PPC_EMB_RELST_HI, 113) \ 1899 _ELF_DEFINE_RELOC(R_PPC_EMB_RELST_HA, 114) \ 1900 _ELF_DEFINE_RELOC(R_PPC_EMB_BIT_FLD, 115) \ 1901 _ELF_DEFINE_RELOC(R_PPC_EMB_RELSDA, 116) \ 1902 1903 #define _ELF_DEFINE_PPC64_RELOCATIONS() \ 1904 _ELF_DEFINE_RELOC(R_PPC64_NONE, 0) \ 1905 _ELF_DEFINE_RELOC(R_PPC64_ADDR32, 1) \ 1906 _ELF_DEFINE_RELOC(R_PPC64_ADDR24, 2) \ 1907 _ELF_DEFINE_RELOC(R_PPC64_ADDR16, 3) \ 1908 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_LO, 4) \ 1909 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_HI, 5) \ 1910 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_HA, 6) \ 1911 _ELF_DEFINE_RELOC(R_PPC64_ADDR14, 7) \ 1912 _ELF_DEFINE_RELOC(R_PPC64_ADDR14_BRTAKEN, 8) \ 1913 _ELF_DEFINE_RELOC(R_PPC64_ADDR14_BRNTAKEN, 9) \ 1914 _ELF_DEFINE_RELOC(R_PPC64_REL24, 10) \ 1915 _ELF_DEFINE_RELOC(R_PPC64_REL14, 11) \ 1916 _ELF_DEFINE_RELOC(R_PPC64_REL14_BRTAKEN, 12) \ 1917 _ELF_DEFINE_RELOC(R_PPC64_REL14_BRNTAKEN, 13) \ 1918 _ELF_DEFINE_RELOC(R_PPC64_GOT16, 14) \ 1919 _ELF_DEFINE_RELOC(R_PPC64_GOT16_LO, 15) \ 1920 _ELF_DEFINE_RELOC(R_PPC64_GOT16_HI, 16) \ 1921 _ELF_DEFINE_RELOC(R_PPC64_GOT16_HA, 17) \ 1922 _ELF_DEFINE_RELOC(R_PPC64_COPY, 19) \ 1923 _ELF_DEFINE_RELOC(R_PPC64_GLOB_DAT, 20) \ 1924 _ELF_DEFINE_RELOC(R_PPC64_JMP_SLOT, 21) \ 1925 _ELF_DEFINE_RELOC(R_PPC64_RELATIVE, 22) \ 1926 _ELF_DEFINE_RELOC(R_PPC64_UADDR32, 24) \ 1927 _ELF_DEFINE_RELOC(R_PPC64_UADDR16, 25) \ 1928 _ELF_DEFINE_RELOC(R_PPC64_REL32, 26) \ 1929 _ELF_DEFINE_RELOC(R_PPC64_PLT32, 27) \ 1930 _ELF_DEFINE_RELOC(R_PPC64_PLTREL32, 28) \ 1931 _ELF_DEFINE_RELOC(R_PPC64_PLT16_LO, 29) \ 1932 _ELF_DEFINE_RELOC(R_PPC64_PLT16_HI, 30) \ 1933 _ELF_DEFINE_RELOC(R_PPC64_PLT16_HA, 31) \ 1934 _ELF_DEFINE_RELOC(R_PPC64_SECTOFF, 33) \ 1935 _ELF_DEFINE_RELOC(R_PPC64_SECTOFF_LO, 34) \ 1936 _ELF_DEFINE_RELOC(R_PPC64_SECTOFF_HI, 35) \ 1937 _ELF_DEFINE_RELOC(R_PPC64_SECTOFF_HA, 36) \ 1938 _ELF_DEFINE_RELOC(R_PPC64_ADDR30, 37) \ 1939 _ELF_DEFINE_RELOC(R_PPC64_ADDR64, 38) \ 1940 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_HIGHER, 39) \ 1941 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_HIGHERA, 40) \ 1942 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_HIGHEST, 41) \ 1943 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_HIGHESTA, 42) \ 1944 _ELF_DEFINE_RELOC(R_PPC64_UADDR64, 43) \ 1945 _ELF_DEFINE_RELOC(R_PPC64_REL64, 44) \ 1946 _ELF_DEFINE_RELOC(R_PPC64_PLT64, 45) \ 1947 _ELF_DEFINE_RELOC(R_PPC64_PLTREL64, 46) \ 1948 _ELF_DEFINE_RELOC(R_PPC64_TOC16, 47) \ 1949 _ELF_DEFINE_RELOC(R_PPC64_TOC16_LO, 48) \ 1950 _ELF_DEFINE_RELOC(R_PPC64_TOC16_HI, 49) \ 1951 _ELF_DEFINE_RELOC(R_PPC64_TOC16_HA, 50) \ 1952 _ELF_DEFINE_RELOC(R_PPC64_TOC, 51) \ 1953 _ELF_DEFINE_RELOC(R_PPC64_PLTGOT16, 52) \ 1954 _ELF_DEFINE_RELOC(R_PPC64_PLTGOT16_LO, 53) \ 1955 _ELF_DEFINE_RELOC(R_PPC64_PLTGOT16_HI, 54) \ 1956 _ELF_DEFINE_RELOC(R_PPC64_PLTGOT16_HA, 55) \ 1957 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_DS, 56) \ 1958 _ELF_DEFINE_RELOC(R_PPC64_ADDR16_LO_DS, 57) \ 1959 _ELF_DEFINE_RELOC(R_PPC64_GOT16_DS, 58) \ 1960 _ELF_DEFINE_RELOC(R_PPC64_GOT16_LO_DS, 59) \ 1961 _ELF_DEFINE_RELOC(R_PPC64_PLT16_LO_DS, 60) \ 1962 _ELF_DEFINE_RELOC(R_PPC64_SECTOFF_DS, 61) \ 1963 _ELF_DEFINE_RELOC(R_PPC64_SECTOFF_LO_DS, 62) \ 1964 _ELF_DEFINE_RELOC(R_PPC64_TOC16_DS, 63) \ 1965 _ELF_DEFINE_RELOC(R_PPC64_TOC16_LO_DS, 64) \ 1966 _ELF_DEFINE_RELOC(R_PPC64_PLTGOT16_DS, 65) \ 1967 _ELF_DEFINE_RELOC(R_PPC64_PLTGOT16_LO_DS, 66) \ 1968 _ELF_DEFINE_RELOC(R_PPC64_TLS, 67) \ 1969 _ELF_DEFINE_RELOC(R_PPC64_DTPMOD64, 68) \ 1970 _ELF_DEFINE_RELOC(R_PPC64_TPREL16, 69) \ 1971 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_LO, 60) \ 1972 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_HI, 71) \ 1973 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_HA, 72) \ 1974 _ELF_DEFINE_RELOC(R_PPC64_TPREL64, 73) \ 1975 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16, 74) \ 1976 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_LO, 75) \ 1977 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_HI, 76) \ 1978 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_HA, 77) \ 1979 _ELF_DEFINE_RELOC(R_PPC64_DTPREL64, 78) \ 1980 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSGD16, 79) \ 1981 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSGD16_LO, 80) \ 1982 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSGD16_HI, 81) \ 1983 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSGD16_HA, 82) \ 1984 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSLD16, 83) \ 1985 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSLD16_LO, 84) \ 1986 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSLD16_HI, 85) \ 1987 _ELF_DEFINE_RELOC(R_PPC64_GOT_TLSLD16_HA, 86) \ 1988 _ELF_DEFINE_RELOC(R_PPC64_GOT_TPREL16_DS, 87) \ 1989 _ELF_DEFINE_RELOC(R_PPC64_GOT_TPREL16_LO_DS, 88) \ 1990 _ELF_DEFINE_RELOC(R_PPC64_GOT_TPREL16_HI, 89) \ 1991 _ELF_DEFINE_RELOC(R_PPC64_GOT_TPREL16_HA, 90) \ 1992 _ELF_DEFINE_RELOC(R_PPC64_GOT_DTPREL16_DS, 91) \ 1993 _ELF_DEFINE_RELOC(R_PPC64_GOT_DTPREL16_LO_DS, 92) \ 1994 _ELF_DEFINE_RELOC(R_PPC64_GOT_DTPREL16_HI, 93) \ 1995 _ELF_DEFINE_RELOC(R_PPC64_GOT_DTPREL16_HA, 94) \ 1996 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_DS, 95) \ 1997 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_LO_DS, 96) \ 1998 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_HIGHER, 97) \ 1999 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_HIGHERA, 98) \ 2000 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_HIGHEST, 99) \ 2001 _ELF_DEFINE_RELOC(R_PPC64_TPREL16_HIGHESTA, 100) \ 2002 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_DS, 101) \ 2003 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_LO_DS, 102) \ 2004 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_HIGHER, 103) \ 2005 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_HIGHERA, 104) \ 2006 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_HIGHEST, 105) \ 2007 _ELF_DEFINE_RELOC(R_PPC64_DTPREL16_HIGHESTA, 106) \ 2008 _ELF_DEFINE_RELOC(R_PPC64_TLSGD, 107) \ 2009 _ELF_DEFINE_RELOC(R_PPC64_TLSLD, 108) 2010 2011 #define _ELF_DEFINE_RISCV_RELOCATIONS() \ 2012 _ELF_DEFINE_RELOC(R_RISCV_NONE, 0) \ 2013 _ELF_DEFINE_RELOC(R_RISCV_32, 1) \ 2014 _ELF_DEFINE_RELOC(R_RISCV_64, 2) \ 2015 _ELF_DEFINE_RELOC(R_RISCV_RELATIVE, 3) \ 2016 _ELF_DEFINE_RELOC(R_RISCV_COPY, 4) \ 2017 _ELF_DEFINE_RELOC(R_RISCV_JUMP_SLOT, 5) \ 2018 _ELF_DEFINE_RELOC(R_RISCV_TLS_DTPMOD32, 6) \ 2019 _ELF_DEFINE_RELOC(R_RISCV_TLS_DTPMOD64, 7) \ 2020 _ELF_DEFINE_RELOC(R_RISCV_TLS_DTPREL32, 8) \ 2021 _ELF_DEFINE_RELOC(R_RISCV_TLS_DTPREL64, 9) \ 2022 _ELF_DEFINE_RELOC(R_RISCV_TLS_TPREL32, 10) \ 2023 _ELF_DEFINE_RELOC(R_RISCV_TLS_TPREL64, 11) \ 2024 _ELF_DEFINE_RELOC(R_RISCV_BRANCH, 16) \ 2025 _ELF_DEFINE_RELOC(R_RISCV_JAL, 17) \ 2026 _ELF_DEFINE_RELOC(R_RISCV_CALL, 18) \ 2027 _ELF_DEFINE_RELOC(R_RISCV_CALL_PLT, 19) \ 2028 _ELF_DEFINE_RELOC(R_RISCV_GOT_HI20, 20) \ 2029 _ELF_DEFINE_RELOC(R_RISCV_TLS_GOT_HI20, 21) \ 2030 _ELF_DEFINE_RELOC(R_RISCV_TLS_GD_HI20, 22) \ 2031 _ELF_DEFINE_RELOC(R_RISCV_PCREL_HI20, 23) \ 2032 _ELF_DEFINE_RELOC(R_RISCV_PCREL_LO12_I, 24) \ 2033 _ELF_DEFINE_RELOC(R_RISCV_PCREL_LO12_S, 25) \ 2034 _ELF_DEFINE_RELOC(R_RISCV_HI20, 26) \ 2035 _ELF_DEFINE_RELOC(R_RISCV_LO12_I, 27) \ 2036 _ELF_DEFINE_RELOC(R_RISCV_LO12_S, 28) \ 2037 _ELF_DEFINE_RELOC(R_RISCV_TPREL_HI20, 29) \ 2038 _ELF_DEFINE_RELOC(R_RISCV_TPREL_LO12_I, 30) \ 2039 _ELF_DEFINE_RELOC(R_RISCV_TPREL_LO12_S, 31) \ 2040 _ELF_DEFINE_RELOC(R_RISCV_TPREL_ADD, 32) \ 2041 _ELF_DEFINE_RELOC(R_RISCV_ADD8, 33) \ 2042 _ELF_DEFINE_RELOC(R_RISCV_ADD16, 34) \ 2043 _ELF_DEFINE_RELOC(R_RISCV_ADD32, 35) \ 2044 _ELF_DEFINE_RELOC(R_RISCV_ADD64, 36) \ 2045 _ELF_DEFINE_RELOC(R_RISCV_SUB8, 37) \ 2046 _ELF_DEFINE_RELOC(R_RISCV_SUB16, 38) \ 2047 _ELF_DEFINE_RELOC(R_RISCV_SUB32, 39) \ 2048 _ELF_DEFINE_RELOC(R_RISCV_SUB64, 40) \ 2049 _ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, 41) \ 2050 _ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \ 2051 _ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \ 2052 _ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \ 2053 _ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) 2054 2055 #define _ELF_DEFINE_SPARC_RELOCATIONS() \ 2056 _ELF_DEFINE_RELOC(R_SPARC_NONE, 0) \ 2057 _ELF_DEFINE_RELOC(R_SPARC_8, 1) \ 2058 _ELF_DEFINE_RELOC(R_SPARC_16, 2) \ 2059 _ELF_DEFINE_RELOC(R_SPARC_32, 3) \ 2060 _ELF_DEFINE_RELOC(R_SPARC_DISP8, 4) \ 2061 _ELF_DEFINE_RELOC(R_SPARC_DISP16, 5) \ 2062 _ELF_DEFINE_RELOC(R_SPARC_DISP32, 6) \ 2063 _ELF_DEFINE_RELOC(R_SPARC_WDISP30, 7) \ 2064 _ELF_DEFINE_RELOC(R_SPARC_WDISP22, 8) \ 2065 _ELF_DEFINE_RELOC(R_SPARC_HI22, 9) \ 2066 _ELF_DEFINE_RELOC(R_SPARC_22, 10) \ 2067 _ELF_DEFINE_RELOC(R_SPARC_13, 11) \ 2068 _ELF_DEFINE_RELOC(R_SPARC_LO10, 12) \ 2069 _ELF_DEFINE_RELOC(R_SPARC_GOT10, 13) \ 2070 _ELF_DEFINE_RELOC(R_SPARC_GOT13, 14) \ 2071 _ELF_DEFINE_RELOC(R_SPARC_GOT22, 15) \ 2072 _ELF_DEFINE_RELOC(R_SPARC_PC10, 16) \ 2073 _ELF_DEFINE_RELOC(R_SPARC_PC22, 17) \ 2074 _ELF_DEFINE_RELOC(R_SPARC_WPLT30, 18) \ 2075 _ELF_DEFINE_RELOC(R_SPARC_COPY, 19) \ 2076 _ELF_DEFINE_RELOC(R_SPARC_GLOB_DAT, 20) \ 2077 _ELF_DEFINE_RELOC(R_SPARC_JMP_SLOT, 21) \ 2078 _ELF_DEFINE_RELOC(R_SPARC_RELATIVE, 22) \ 2079 _ELF_DEFINE_RELOC(R_SPARC_UA32, 23) \ 2080 _ELF_DEFINE_RELOC(R_SPARC_PLT32, 24) \ 2081 _ELF_DEFINE_RELOC(R_SPARC_HIPLT22, 25) \ 2082 _ELF_DEFINE_RELOC(R_SPARC_LOPLT10, 26) \ 2083 _ELF_DEFINE_RELOC(R_SPARC_PCPLT32, 27) \ 2084 _ELF_DEFINE_RELOC(R_SPARC_PCPLT22, 28) \ 2085 _ELF_DEFINE_RELOC(R_SPARC_PCPLT10, 29) \ 2086 _ELF_DEFINE_RELOC(R_SPARC_10, 30) \ 2087 _ELF_DEFINE_RELOC(R_SPARC_11, 31) \ 2088 _ELF_DEFINE_RELOC(R_SPARC_64, 32) \ 2089 _ELF_DEFINE_RELOC(R_SPARC_OLO10, 33) \ 2090 _ELF_DEFINE_RELOC(R_SPARC_HH22, 34) \ 2091 _ELF_DEFINE_RELOC(R_SPARC_HM10, 35) \ 2092 _ELF_DEFINE_RELOC(R_SPARC_LM22, 36) \ 2093 _ELF_DEFINE_RELOC(R_SPARC_PC_HH22, 37) \ 2094 _ELF_DEFINE_RELOC(R_SPARC_PC_HM10, 38) \ 2095 _ELF_DEFINE_RELOC(R_SPARC_PC_LM22, 39) \ 2096 _ELF_DEFINE_RELOC(R_SPARC_WDISP16, 40) \ 2097 _ELF_DEFINE_RELOC(R_SPARC_WDISP19, 41) \ 2098 _ELF_DEFINE_RELOC(R_SPARC_7, 43) \ 2099 _ELF_DEFINE_RELOC(R_SPARC_5, 44) \ 2100 _ELF_DEFINE_RELOC(R_SPARC_6, 45) \ 2101 _ELF_DEFINE_RELOC(R_SPARC_DISP64, 46) \ 2102 _ELF_DEFINE_RELOC(R_SPARC_PLT64, 47) \ 2103 _ELF_DEFINE_RELOC(R_SPARC_HIX22, 48) \ 2104 _ELF_DEFINE_RELOC(R_SPARC_LOX10, 49) \ 2105 _ELF_DEFINE_RELOC(R_SPARC_H44, 50) \ 2106 _ELF_DEFINE_RELOC(R_SPARC_M44, 51) \ 2107 _ELF_DEFINE_RELOC(R_SPARC_L44, 52) \ 2108 _ELF_DEFINE_RELOC(R_SPARC_REGISTER, 53) \ 2109 _ELF_DEFINE_RELOC(R_SPARC_UA64, 54) \ 2110 _ELF_DEFINE_RELOC(R_SPARC_UA16, 55) \ 2111 _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_HIX22, 80) \ 2112 _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_LOX10, 81) \ 2113 _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_OP_HIX22, 82) \ 2114 _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_OP_LOX10, 83) \ 2115 _ELF_DEFINE_RELOC(R_SPARC_GOTDATA_OP, 84) \ 2116 _ELF_DEFINE_RELOC(R_SPARC_H34, 85) 2117 2118 #define _ELF_DEFINE_X86_64_RELOCATIONS() \ 2119 _ELF_DEFINE_RELOC(R_X86_64_NONE, 0) \ 2120 _ELF_DEFINE_RELOC(R_X86_64_64, 1) \ 2121 _ELF_DEFINE_RELOC(R_X86_64_PC32, 2) \ 2122 _ELF_DEFINE_RELOC(R_X86_64_GOT32, 3) \ 2123 _ELF_DEFINE_RELOC(R_X86_64_PLT32, 4) \ 2124 _ELF_DEFINE_RELOC(R_X86_64_COPY, 5) \ 2125 _ELF_DEFINE_RELOC(R_X86_64_GLOB_DAT, 6) \ 2126 _ELF_DEFINE_RELOC(R_X86_64_JUMP_SLOT, 7) \ 2127 _ELF_DEFINE_RELOC(R_X86_64_RELATIVE, 8) \ 2128 _ELF_DEFINE_RELOC(R_X86_64_GOTPCREL, 9) \ 2129 _ELF_DEFINE_RELOC(R_X86_64_32, 10) \ 2130 _ELF_DEFINE_RELOC(R_X86_64_32S, 11) \ 2131 _ELF_DEFINE_RELOC(R_X86_64_16, 12) \ 2132 _ELF_DEFINE_RELOC(R_X86_64_PC16, 13) \ 2133 _ELF_DEFINE_RELOC(R_X86_64_8, 14) \ 2134 _ELF_DEFINE_RELOC(R_X86_64_PC8, 15) \ 2135 _ELF_DEFINE_RELOC(R_X86_64_DTPMOD64, 16) \ 2136 _ELF_DEFINE_RELOC(R_X86_64_DTPOFF64, 17) \ 2137 _ELF_DEFINE_RELOC(R_X86_64_TPOFF64, 18) \ 2138 _ELF_DEFINE_RELOC(R_X86_64_TLSGD, 19) \ 2139 _ELF_DEFINE_RELOC(R_X86_64_TLSLD, 20) \ 2140 _ELF_DEFINE_RELOC(R_X86_64_DTPOFF32, 21) \ 2141 _ELF_DEFINE_RELOC(R_X86_64_GOTTPOFF, 22) \ 2142 _ELF_DEFINE_RELOC(R_X86_64_TPOFF32, 23) \ 2143 _ELF_DEFINE_RELOC(R_X86_64_PC64, 24) \ 2144 _ELF_DEFINE_RELOC(R_X86_64_GOTOFF64, 25) \ 2145 _ELF_DEFINE_RELOC(R_X86_64_GOTPC32, 26) \ 2146 _ELF_DEFINE_RELOC(R_X86_64_GOT64, 27) \ 2147 _ELF_DEFINE_RELOC(R_X86_64_GOTPCREL64, 28) \ 2148 _ELF_DEFINE_RELOC(R_X86_64_GOTPC64, 29) \ 2149 _ELF_DEFINE_RELOC(R_X86_64_GOTPLT64, 30) \ 2150 _ELF_DEFINE_RELOC(R_X86_64_PLTOFF64, 31) \ 2151 _ELF_DEFINE_RELOC(R_X86_64_SIZE32, 32) \ 2152 _ELF_DEFINE_RELOC(R_X86_64_SIZE64, 33) \ 2153 _ELF_DEFINE_RELOC(R_X86_64_GOTPC32_TLSDESC, 34) \ 2154 _ELF_DEFINE_RELOC(R_X86_64_TLSDESC_CALL, 35) \ 2155 _ELF_DEFINE_RELOC(R_X86_64_TLSDESC, 36) \ 2156 _ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37) 2157 2158 #define _ELF_DEFINE_RELOCATIONS() \ 2159 _ELF_DEFINE_386_RELOCATIONS() \ 2160 _ELF_DEFINE_AARCH64_RELOCATIONS() \ 2161 _ELF_DEFINE_AMD64_RELOCATIONS() \ 2162 _ELF_DEFINE_ARM_RELOCATIONS() \ 2163 _ELF_DEFINE_IA64_RELOCATIONS() \ 2164 _ELF_DEFINE_MIPS_RELOCATIONS() \ 2165 _ELF_DEFINE_PPC32_RELOCATIONS() \ 2166 _ELF_DEFINE_PPC64_RELOCATIONS() \ 2167 _ELF_DEFINE_RISCV_RELOCATIONS() \ 2168 _ELF_DEFINE_SPARC_RELOCATIONS() \ 2169 _ELF_DEFINE_X86_64_RELOCATIONS() 2170 2171 #undef _ELF_DEFINE_RELOC 2172 #define _ELF_DEFINE_RELOC(N, V) N = V , 2173 enum { 2174 _ELF_DEFINE_RELOCATIONS() 2175 R__LAST__ 2176 }; 2177 2178 #define PN_XNUM 0xFFFFU /* Use extended section numbering. */ 2179 2180 /** 2181 ** ELF Types. 2182 **/ 2183 2184 typedef uint32_t Elf32_Addr; /* Program address. */ 2185 typedef uint8_t Elf32_Byte; /* Unsigned tiny integer. */ 2186 typedef uint16_t Elf32_Half; /* Unsigned medium integer. */ 2187 typedef uint32_t Elf32_Off; /* File offset. */ 2188 typedef uint16_t Elf32_Section; /* Section index. */ 2189 typedef int32_t Elf32_Sword; /* Signed integer. */ 2190 typedef uint32_t Elf32_Word; /* Unsigned integer. */ 2191 typedef uint64_t Elf32_Lword; /* Unsigned long integer. */ 2192 2193 typedef uint64_t Elf64_Addr; /* Program address. */ 2194 typedef uint8_t Elf64_Byte; /* Unsigned tiny integer. */ 2195 typedef uint16_t Elf64_Half; /* Unsigned medium integer. */ 2196 typedef uint64_t Elf64_Off; /* File offset. */ 2197 typedef uint16_t Elf64_Section; /* Section index. */ 2198 typedef int32_t Elf64_Sword; /* Signed integer. */ 2199 typedef uint32_t Elf64_Word; /* Unsigned integer. */ 2200 typedef uint64_t Elf64_Lword; /* Unsigned long integer. */ 2201 typedef uint64_t Elf64_Xword; /* Unsigned long integer. */ 2202 typedef int64_t Elf64_Sxword; /* Signed long integer. */ 2203 2204 2205 /* 2206 * Capability descriptors. 2207 */ 2208 2209 /* 32-bit capability descriptor. */ 2210 typedef struct { 2211 Elf32_Word c_tag; /* Type of entry. */ 2212 union { 2213 Elf32_Word c_val; /* Integer value. */ 2214 Elf32_Addr c_ptr; /* Pointer value. */ 2215 } c_un; 2216 } Elf32_Cap; 2217 2218 /* 64-bit capability descriptor. */ 2219 typedef struct { 2220 Elf64_Xword c_tag; /* Type of entry. */ 2221 union { 2222 Elf64_Xword c_val; /* Integer value. */ 2223 Elf64_Addr c_ptr; /* Pointer value. */ 2224 } c_un; 2225 } Elf64_Cap; 2226 2227 /* 2228 * MIPS .conflict section entries. 2229 */ 2230 2231 /* 32-bit entry. */ 2232 typedef struct { 2233 Elf32_Addr c_index; 2234 } Elf32_Conflict; 2235 2236 /* 64-bit entry. */ 2237 typedef struct { 2238 Elf64_Addr c_index; 2239 } Elf64_Conflict; 2240 2241 /* 2242 * Dynamic section entries. 2243 */ 2244 2245 /* 32-bit entry. */ 2246 typedef struct { 2247 Elf32_Sword d_tag; /* Type of entry. */ 2248 union { 2249 Elf32_Word d_val; /* Integer value. */ 2250 Elf32_Addr d_ptr; /* Pointer value. */ 2251 } d_un; 2252 } Elf32_Dyn; 2253 2254 /* 64-bit entry. */ 2255 typedef struct { 2256 Elf64_Sxword d_tag; /* Type of entry. */ 2257 union { 2258 Elf64_Xword d_val; /* Integer value. */ 2259 Elf64_Addr d_ptr; /* Pointer value; */ 2260 } d_un; 2261 } Elf64_Dyn; 2262 2263 2264 /* 2265 * The executable header (EHDR). 2266 */ 2267 2268 /* 32 bit EHDR. */ 2269 typedef struct { 2270 unsigned char e_ident[EI_NIDENT]; /* ELF identification. */ 2271 Elf32_Half e_type; /* Object file type (ET_*). */ 2272 Elf32_Half e_machine; /* Machine type (EM_*). */ 2273 Elf32_Word e_version; /* File format version (EV_*). */ 2274 Elf32_Addr e_entry; /* Start address. */ 2275 Elf32_Off e_phoff; /* File offset to the PHDR table. */ 2276 Elf32_Off e_shoff; /* File offset to the SHDRheader. */ 2277 Elf32_Word e_flags; /* Flags (EF_*). */ 2278 Elf32_Half e_ehsize; /* Elf header size in bytes. */ 2279 Elf32_Half e_phentsize; /* PHDR table entry size in bytes. */ 2280 Elf32_Half e_phnum; /* Number of PHDR entries. */ 2281 Elf32_Half e_shentsize; /* SHDR table entry size in bytes. */ 2282 Elf32_Half e_shnum; /* Number of SHDR entries. */ 2283 Elf32_Half e_shstrndx; /* Index of section name string table. */ 2284 } Elf32_Ehdr; 2285 2286 2287 /* 64 bit EHDR. */ 2288 typedef struct { 2289 unsigned char e_ident[EI_NIDENT]; /* ELF identification. */ 2290 Elf64_Half e_type; /* Object file type (ET_*). */ 2291 Elf64_Half e_machine; /* Machine type (EM_*). */ 2292 Elf64_Word e_version; /* File format version (EV_*). */ 2293 Elf64_Addr e_entry; /* Start address. */ 2294 Elf64_Off e_phoff; /* File offset to the PHDR table. */ 2295 Elf64_Off e_shoff; /* File offset to the SHDRheader. */ 2296 Elf64_Word e_flags; /* Flags (EF_*). */ 2297 Elf64_Half e_ehsize; /* Elf header size in bytes. */ 2298 Elf64_Half e_phentsize; /* PHDR table entry size in bytes. */ 2299 Elf64_Half e_phnum; /* Number of PHDR entries. */ 2300 Elf64_Half e_shentsize; /* SHDR table entry size in bytes. */ 2301 Elf64_Half e_shnum; /* Number of SHDR entries. */ 2302 Elf64_Half e_shstrndx; /* Index of section name string table. */ 2303 } Elf64_Ehdr; 2304 2305 2306 /* 2307 * Shared object information. 2308 */ 2309 2310 /* 32-bit entry. */ 2311 typedef struct { 2312 Elf32_Word l_name; /* The name of a shared object. */ 2313 Elf32_Word l_time_stamp; /* 32-bit timestamp. */ 2314 Elf32_Word l_checksum; /* Checksum of visible symbols, sizes. */ 2315 Elf32_Word l_version; /* Interface version string index. */ 2316 Elf32_Word l_flags; /* Flags (LL_*). */ 2317 } Elf32_Lib; 2318 2319 /* 64-bit entry. */ 2320 typedef struct { 2321 Elf64_Word l_name; /* The name of a shared object. */ 2322 Elf64_Word l_time_stamp; /* 32-bit timestamp. */ 2323 Elf64_Word l_checksum; /* Checksum of visible symbols, sizes. */ 2324 Elf64_Word l_version; /* Interface version string index. */ 2325 Elf64_Word l_flags; /* Flags (LL_*). */ 2326 } Elf64_Lib; 2327 2328 #define _ELF_DEFINE_LL_FLAGS() \ 2329 _ELF_DEFINE_LL(LL_NONE, 0, \ 2330 "no flags") \ 2331 _ELF_DEFINE_LL(LL_EXACT_MATCH, 0x1, \ 2332 "require an exact match") \ 2333 _ELF_DEFINE_LL(LL_IGNORE_INT_VER, 0x2, \ 2334 "ignore version incompatibilities") \ 2335 _ELF_DEFINE_LL(LL_REQUIRE_MINOR, 0x4, \ 2336 "") \ 2337 _ELF_DEFINE_LL(LL_EXPORTS, 0x8, \ 2338 "") \ 2339 _ELF_DEFINE_LL(LL_DELAY_LOAD, 0x10, \ 2340 "") \ 2341 _ELF_DEFINE_LL(LL_DELTA, 0x20, \ 2342 "") 2343 2344 #undef _ELF_DEFINE_LL 2345 #define _ELF_DEFINE_LL(N, V, DESCR) N = V , 2346 enum { 2347 _ELF_DEFINE_LL_FLAGS() 2348 LL__LAST__ 2349 }; 2350 2351 /* 2352 * Note tags 2353 */ 2354 2355 #define _ELF_DEFINE_NOTE_ENTRY_TYPES() \ 2356 _ELF_DEFINE_NT(NT_ABI_TAG, 1, "Tag indicating the ABI") \ 2357 _ELF_DEFINE_NT(NT_GNU_HWCAP, 2, "Hardware capabilities") \ 2358 _ELF_DEFINE_NT(NT_GNU_BUILD_ID, 3, "Build id, set by ld(1)") \ 2359 _ELF_DEFINE_NT(NT_GNU_GOLD_VERSION, 4, \ 2360 "Version number of the GNU gold linker") \ 2361 _ELF_DEFINE_NT(NT_PRSTATUS, 1, "Process status") \ 2362 _ELF_DEFINE_NT(NT_FPREGSET, 2, "Floating point information") \ 2363 _ELF_DEFINE_NT(NT_PRPSINFO, 3, "Process information") \ 2364 _ELF_DEFINE_NT(NT_AUXV, 6, "Auxiliary vector") \ 2365 _ELF_DEFINE_NT(NT_PRXFPREG, 0x46E62B7FUL, \ 2366 "Linux user_xfpregs structure") \ 2367 _ELF_DEFINE_NT(NT_PSTATUS, 10, "Linux process status") \ 2368 _ELF_DEFINE_NT(NT_FPREGS, 12, "Linux floating point regset") \ 2369 _ELF_DEFINE_NT(NT_PSINFO, 13, "Linux process information") \ 2370 _ELF_DEFINE_NT(NT_LWPSTATUS, 16, "Linux lwpstatus_t type") \ 2371 _ELF_DEFINE_NT(NT_LWPSINFO, 17, "Linux lwpinfo_t type") 2372 2373 #undef _ELF_DEFINE_NT 2374 #define _ELF_DEFINE_NT(N, V, DESCR) N = V , 2375 enum { 2376 _ELF_DEFINE_NOTE_ENTRY_TYPES() 2377 NT__LAST__ 2378 }; 2379 2380 /* Aliases for the ABI tag. */ 2381 #define NT_FREEBSD_ABI_TAG NT_ABI_TAG 2382 #define NT_GNU_ABI_TAG NT_ABI_TAG 2383 #define NT_NETBSD_IDENT NT_ABI_TAG 2384 #define NT_OPENBSD_IDENT NT_ABI_TAG 2385 2386 /* 2387 * Note descriptors. 2388 */ 2389 2390 typedef struct { 2391 uint32_t n_namesz; /* Length of note's name. */ 2392 uint32_t n_descsz; /* Length of note's value. */ 2393 uint32_t n_type; /* Type of note. */ 2394 } Elf_Note; 2395 2396 typedef Elf_Note Elf32_Nhdr; /* 32-bit note header. */ 2397 typedef Elf_Note Elf64_Nhdr; /* 64-bit note header. */ 2398 2399 /* 2400 * MIPS ELF options descriptor header. 2401 */ 2402 2403 typedef struct { 2404 Elf64_Byte kind; /* Type of options. */ 2405 Elf64_Byte size; /* Size of option descriptor. */ 2406 Elf64_Half section; /* Index of section affected. */ 2407 Elf64_Word info; /* Kind-specific information. */ 2408 } Elf_Options; 2409 2410 /* 2411 * Option kinds. 2412 */ 2413 2414 #define _ELF_DEFINE_OPTION_KINDS() \ 2415 _ELF_DEFINE_ODK(ODK_NULL, 0, "undefined") \ 2416 _ELF_DEFINE_ODK(ODK_REGINFO, 1, "register usage info") \ 2417 _ELF_DEFINE_ODK(ODK_EXCEPTIONS, 2, "exception processing info") \ 2418 _ELF_DEFINE_ODK(ODK_PAD, 3, "section padding") \ 2419 _ELF_DEFINE_ODK(ODK_HWPATCH, 4, "hardware patch applied") \ 2420 _ELF_DEFINE_ODK(ODK_FILL, 5, "fill value used by linker") \ 2421 _ELF_DEFINE_ODK(ODK_TAGS, 6, "reserved space for tools") \ 2422 _ELF_DEFINE_ODK(ODK_HWAND, 7, "hardware AND patch applied") \ 2423 _ELF_DEFINE_ODK(ODK_HWOR, 8, "hardware OR patch applied") \ 2424 _ELF_DEFINE_ODK(ODK_GP_GROUP, 9, \ 2425 "GP group to use for text/data sections") \ 2426 _ELF_DEFINE_ODK(ODK_IDENT, 10, "ID information") \ 2427 _ELF_DEFINE_ODK(ODK_PAGESIZE, 11, "page size infomation") 2428 2429 #undef _ELF_DEFINE_ODK 2430 #define _ELF_DEFINE_ODK(N, V, DESCR) N = V , 2431 enum { 2432 _ELF_DEFINE_OPTION_KINDS() 2433 ODK__LAST__ 2434 }; 2435 2436 /* 2437 * ODK_EXCEPTIONS info field masks. 2438 */ 2439 2440 #define _ELF_DEFINE_ODK_EXCEPTIONS_MASK() \ 2441 _ELF_DEFINE_OEX(OEX_FPU_MIN, 0x0000001FUL, \ 2442 "minimum FPU exception which must be enabled") \ 2443 _ELF_DEFINE_OEX(OEX_FPU_MAX, 0x00001F00UL, \ 2444 "maximum FPU exception which can be enabled") \ 2445 _ELF_DEFINE_OEX(OEX_PAGE0, 0x00010000UL, \ 2446 "page zero must be mapped") \ 2447 _ELF_DEFINE_OEX(OEX_SMM, 0x00020000UL, \ 2448 "run in sequential memory mode") \ 2449 _ELF_DEFINE_OEX(OEX_PRECISEFP, 0x00040000UL, \ 2450 "run in precise FP exception mode") \ 2451 _ELF_DEFINE_OEX(OEX_DISMISS, 0x00080000UL, \ 2452 "dismiss invalid address traps") 2453 2454 #undef _ELF_DEFINE_OEX 2455 #define _ELF_DEFINE_OEX(N, V, DESCR) N = V , 2456 enum { 2457 _ELF_DEFINE_ODK_EXCEPTIONS_MASK() 2458 OEX__LAST__ 2459 }; 2460 2461 /* 2462 * ODK_PAD info field masks. 2463 */ 2464 2465 #define _ELF_DEFINE_ODK_PAD_MASK() \ 2466 _ELF_DEFINE_OPAD(OPAD_PREFIX, 0x0001) \ 2467 _ELF_DEFINE_OPAD(OPAD_POSTFIX, 0x0002) \ 2468 _ELF_DEFINE_OPAD(OPAD_SYMBOL, 0x0004) 2469 2470 #undef _ELF_DEFINE_OPAD 2471 #define _ELF_DEFINE_OPAD(N, V) N = V , 2472 enum { 2473 _ELF_DEFINE_ODK_PAD_MASK() 2474 OPAD__LAST__ 2475 }; 2476 2477 /* 2478 * ODK_HWPATCH info field masks. 2479 */ 2480 2481 #define _ELF_DEFINE_ODK_HWPATCH_MASK() \ 2482 _ELF_DEFINE_OHW(OHW_R4KEOP, 0x00000001UL, \ 2483 "patch for R4000 branch at end-of-page bug") \ 2484 _ELF_DEFINE_OHW(OHW_R8KPFETCH, 0x00000002UL, \ 2485 "R8000 prefetch bug may occur") \ 2486 _ELF_DEFINE_OHW(OHW_R5KEOP, 0x00000004UL, \ 2487 "patch for R5000 branch at end-of-page bug") \ 2488 _ELF_DEFINE_OHW(OHW_R5KCVTL, 0x00000008UL, \ 2489 "R5000 cvt.[ds].l bug: clean == 1") \ 2490 _ELF_DEFINE_OHW(OHW_R10KLDL, 0x00000010UL, \ 2491 "needd patch for R10000 misaligned load") 2492 2493 #undef _ELF_DEFINE_OHW 2494 #define _ELF_DEFINE_OHW(N, V, DESCR) N = V , 2495 enum { 2496 _ELF_DEFINE_ODK_HWPATCH_MASK() 2497 OHW__LAST__ 2498 }; 2499 2500 /* 2501 * ODK_HWAND/ODK_HWOR info field and hwp_flags[12] masks. 2502 */ 2503 2504 #define _ELF_DEFINE_ODK_HWP_MASK() \ 2505 _ELF_DEFINE_HWP(OHWA0_R4KEOP_CHECKED, 0x00000001UL, \ 2506 "object checked for R4000 end-of-page bug") \ 2507 _ELF_DEFINE_HWP(OHWA0_R4KEOP_CLEAN, 0x00000002UL, \ 2508 "object verified clean for R4000 end-of-page bug") \ 2509 _ELF_DEFINE_HWP(OHWO0_FIXADE, 0x00000001UL, \ 2510 "object requires call to fixade") 2511 2512 #undef _ELF_DEFINE_HWP 2513 #define _ELF_DEFINE_HWP(N, V, DESCR) N = V , 2514 enum { 2515 _ELF_DEFINE_ODK_HWP_MASK() 2516 OHWX0__LAST__ 2517 }; 2518 2519 /* 2520 * ODK_IDENT/ODK_GP_GROUP info field masks. 2521 */ 2522 2523 #define _ELF_DEFINE_ODK_GP_MASK() \ 2524 _ELF_DEFINE_OGP(OGP_GROUP, 0x0000FFFFUL, "GP group number") \ 2525 _ELF_DEFINE_OGP(OGP_SELF, 0x00010000UL, \ 2526 "GP group is self-contained") 2527 2528 #undef _ELF_DEFINE_OGP 2529 #define _ELF_DEFINE_OGP(N, V, DESCR) N = V , 2530 enum { 2531 _ELF_DEFINE_ODK_GP_MASK() 2532 OGP__LAST__ 2533 }; 2534 2535 /* 2536 * MIPS ELF register info descriptor. 2537 */ 2538 2539 /* 32 bit RegInfo entry. */ 2540 typedef struct { 2541 Elf32_Word ri_gprmask; /* Mask of general register used. */ 2542 Elf32_Word ri_cprmask[4]; /* Mask of coprocessor register used. */ 2543 Elf32_Addr ri_gp_value; /* GP register value. */ 2544 } Elf32_RegInfo; 2545 2546 /* 64 bit RegInfo entry. */ 2547 typedef struct { 2548 Elf64_Word ri_gprmask; /* Mask of general register used. */ 2549 Elf64_Word ri_pad; /* Padding. */ 2550 Elf64_Word ri_cprmask[4]; /* Mask of coprocessor register used. */ 2551 Elf64_Addr ri_gp_value; /* GP register value. */ 2552 } Elf64_RegInfo; 2553 2554 /* 2555 * Program Header Table (PHDR) entries. 2556 */ 2557 2558 /* 32 bit PHDR entry. */ 2559 typedef struct { 2560 Elf32_Word p_type; /* Type of segment. */ 2561 Elf32_Off p_offset; /* File offset to segment. */ 2562 Elf32_Addr p_vaddr; /* Virtual address in memory. */ 2563 Elf32_Addr p_paddr; /* Physical address (if relevant). */ 2564 Elf32_Word p_filesz; /* Size of segment in file. */ 2565 Elf32_Word p_memsz; /* Size of segment in memory. */ 2566 Elf32_Word p_flags; /* Segment flags. */ 2567 Elf32_Word p_align; /* Alignment constraints. */ 2568 } Elf32_Phdr; 2569 2570 /* 64 bit PHDR entry. */ 2571 typedef struct { 2572 Elf64_Word p_type; /* Type of segment. */ 2573 Elf64_Word p_flags; /* Segment flags. */ 2574 Elf64_Off p_offset; /* File offset to segment. */ 2575 Elf64_Addr p_vaddr; /* Virtual address in memory. */ 2576 Elf64_Addr p_paddr; /* Physical address (if relevant). */ 2577 Elf64_Xword p_filesz; /* Size of segment in file. */ 2578 Elf64_Xword p_memsz; /* Size of segment in memory. */ 2579 Elf64_Xword p_align; /* Alignment constraints. */ 2580 } Elf64_Phdr; 2581 2582 2583 /* 2584 * Move entries, for describing data in COMMON blocks in a compact 2585 * manner. 2586 */ 2587 2588 /* 32-bit move entry. */ 2589 typedef struct { 2590 Elf32_Lword m_value; /* Initialization value. */ 2591 Elf32_Word m_info; /* Encoded size and index. */ 2592 Elf32_Word m_poffset; /* Offset relative to symbol. */ 2593 Elf32_Half m_repeat; /* Repeat count. */ 2594 Elf32_Half m_stride; /* Number of units to skip. */ 2595 } Elf32_Move; 2596 2597 /* 64-bit move entry. */ 2598 typedef struct { 2599 Elf64_Lword m_value; /* Initialization value. */ 2600 Elf64_Xword m_info; /* Encoded size and index. */ 2601 Elf64_Xword m_poffset; /* Offset relative to symbol. */ 2602 Elf64_Half m_repeat; /* Repeat count. */ 2603 Elf64_Half m_stride; /* Number of units to skip. */ 2604 } Elf64_Move; 2605 2606 #define ELF32_M_SYM(I) ((I) >> 8) 2607 #define ELF32_M_SIZE(I) ((unsigned char) (I)) 2608 #define ELF32_M_INFO(M, S) (((M) << 8) + (unsigned char) (S)) 2609 2610 #define ELF64_M_SYM(I) ((I) >> 8) 2611 #define ELF64_M_SIZE(I) ((unsigned char) (I)) 2612 #define ELF64_M_INFO(M, S) (((M) << 8) + (unsigned char) (S)) 2613 2614 /* 2615 * Section Header Table (SHDR) entries. 2616 */ 2617 2618 /* 32 bit SHDR */ 2619 typedef struct { 2620 Elf32_Word sh_name; /* index of section name */ 2621 Elf32_Word sh_type; /* section type */ 2622 Elf32_Word sh_flags; /* section flags */ 2623 Elf32_Addr sh_addr; /* in-memory address of section */ 2624 Elf32_Off sh_offset; /* file offset of section */ 2625 Elf32_Word sh_size; /* section size in bytes */ 2626 Elf32_Word sh_link; /* section header table link */ 2627 Elf32_Word sh_info; /* extra information */ 2628 Elf32_Word sh_addralign; /* alignment constraint */ 2629 Elf32_Word sh_entsize; /* size for fixed-size entries */ 2630 } Elf32_Shdr; 2631 2632 /* 64 bit SHDR */ 2633 typedef struct { 2634 Elf64_Word sh_name; /* index of section name */ 2635 Elf64_Word sh_type; /* section type */ 2636 Elf64_Xword sh_flags; /* section flags */ 2637 Elf64_Addr sh_addr; /* in-memory address of section */ 2638 Elf64_Off sh_offset; /* file offset of section */ 2639 Elf64_Xword sh_size; /* section size in bytes */ 2640 Elf64_Word sh_link; /* section header table link */ 2641 Elf64_Word sh_info; /* extra information */ 2642 Elf64_Xword sh_addralign; /* alignment constraint */ 2643 Elf64_Xword sh_entsize; /* size for fixed-size entries */ 2644 } Elf64_Shdr; 2645 2646 2647 /* 2648 * Symbol table entries. 2649 */ 2650 2651 typedef struct { 2652 Elf32_Word st_name; /* index of symbol's name */ 2653 Elf32_Addr st_value; /* value for the symbol */ 2654 Elf32_Word st_size; /* size of associated data */ 2655 unsigned char st_info; /* type and binding attributes */ 2656 unsigned char st_other; /* visibility */ 2657 Elf32_Half st_shndx; /* index of related section */ 2658 } Elf32_Sym; 2659 2660 typedef struct { 2661 Elf64_Word st_name; /* index of symbol's name */ 2662 unsigned char st_info; /* type and binding attributes */ 2663 unsigned char st_other; /* visibility */ 2664 Elf64_Half st_shndx; /* index of related section */ 2665 Elf64_Addr st_value; /* value for the symbol */ 2666 Elf64_Xword st_size; /* size of associated data */ 2667 } Elf64_Sym; 2668 2669 #define ELF32_ST_BIND(I) ((I) >> 4) 2670 #define ELF32_ST_TYPE(I) ((I) & 0xFU) 2671 #define ELF32_ST_INFO(B,T) (((B) << 4) + ((T) & 0xF)) 2672 2673 #define ELF64_ST_BIND(I) ((I) >> 4) 2674 #define ELF64_ST_TYPE(I) ((I) & 0xFU) 2675 #define ELF64_ST_INFO(B,T) (((B) << 4) + ((T) & 0xF)) 2676 2677 #define ELF32_ST_VISIBILITY(O) ((O) & 0x3) 2678 #define ELF64_ST_VISIBILITY(O) ((O) & 0x3) 2679 2680 /* 2681 * Syminfo descriptors, containing additional symbol information. 2682 */ 2683 2684 /* 32-bit entry. */ 2685 typedef struct { 2686 Elf32_Half si_boundto; /* Entry index with additional flags. */ 2687 Elf32_Half si_flags; /* Flags. */ 2688 } Elf32_Syminfo; 2689 2690 /* 64-bit entry. */ 2691 typedef struct { 2692 Elf64_Half si_boundto; /* Entry index with additional flags. */ 2693 Elf64_Half si_flags; /* Flags. */ 2694 } Elf64_Syminfo; 2695 2696 /* 2697 * Relocation descriptors. 2698 */ 2699 2700 typedef struct { 2701 Elf32_Addr r_offset; /* location to apply relocation to */ 2702 Elf32_Word r_info; /* type+section for relocation */ 2703 } Elf32_Rel; 2704 2705 typedef struct { 2706 Elf32_Addr r_offset; /* location to apply relocation to */ 2707 Elf32_Word r_info; /* type+section for relocation */ 2708 Elf32_Sword r_addend; /* constant addend */ 2709 } Elf32_Rela; 2710 2711 typedef struct { 2712 Elf64_Addr r_offset; /* location to apply relocation to */ 2713 Elf64_Xword r_info; /* type+section for relocation */ 2714 } Elf64_Rel; 2715 2716 typedef struct { 2717 Elf64_Addr r_offset; /* location to apply relocation to */ 2718 Elf64_Xword r_info; /* type+section for relocation */ 2719 Elf64_Sxword r_addend; /* constant addend */ 2720 } Elf64_Rela; 2721 2722 2723 #define ELF32_R_SYM(I) ((I) >> 8) 2724 #define ELF32_R_TYPE(I) ((unsigned char) (I)) 2725 #define ELF32_R_INFO(S,T) (((S) << 8) + (unsigned char) (T)) 2726 2727 #define ELF64_R_SYM(I) ((I) >> 32) 2728 #define ELF64_R_TYPE(I) ((I) & 0xFFFFFFFFUL) 2729 #define ELF64_R_INFO(S,T) (((S) << 32) + ((T) & 0xFFFFFFFFUL)) 2730 2731 /* 2732 * Symbol versioning structures. 2733 */ 2734 2735 /* 32-bit structures. */ 2736 typedef struct 2737 { 2738 Elf32_Word vda_name; /* Index to name. */ 2739 Elf32_Word vda_next; /* Offset to next entry. */ 2740 } Elf32_Verdaux; 2741 2742 typedef struct 2743 { 2744 Elf32_Word vna_hash; /* Hash value of dependency name. */ 2745 Elf32_Half vna_flags; /* Flags. */ 2746 Elf32_Half vna_other; /* Unused. */ 2747 Elf32_Word vna_name; /* Offset to dependency name. */ 2748 Elf32_Word vna_next; /* Offset to next vernaux entry. */ 2749 } Elf32_Vernaux; 2750 2751 typedef struct 2752 { 2753 Elf32_Half vd_version; /* Version information. */ 2754 Elf32_Half vd_flags; /* Flags. */ 2755 Elf32_Half vd_ndx; /* Index into the versym section. */ 2756 Elf32_Half vd_cnt; /* Number of aux entries. */ 2757 Elf32_Word vd_hash; /* Hash value of name. */ 2758 Elf32_Word vd_aux; /* Offset to aux entries. */ 2759 Elf32_Word vd_next; /* Offset to next version definition. */ 2760 } Elf32_Verdef; 2761 2762 typedef struct 2763 { 2764 Elf32_Half vn_version; /* Version number. */ 2765 Elf32_Half vn_cnt; /* Number of aux entries. */ 2766 Elf32_Word vn_file; /* Offset of associated file name. */ 2767 Elf32_Word vn_aux; /* Offset of vernaux array. */ 2768 Elf32_Word vn_next; /* Offset of next verneed entry. */ 2769 } Elf32_Verneed; 2770 2771 typedef Elf32_Half Elf32_Versym; 2772 2773 /* 64-bit structures. */ 2774 2775 typedef struct { 2776 Elf64_Word vda_name; /* Index to name. */ 2777 Elf64_Word vda_next; /* Offset to next entry. */ 2778 } Elf64_Verdaux; 2779 2780 typedef struct { 2781 Elf64_Word vna_hash; /* Hash value of dependency name. */ 2782 Elf64_Half vna_flags; /* Flags. */ 2783 Elf64_Half vna_other; /* Unused. */ 2784 Elf64_Word vna_name; /* Offset to dependency name. */ 2785 Elf64_Word vna_next; /* Offset to next vernaux entry. */ 2786 } Elf64_Vernaux; 2787 2788 typedef struct { 2789 Elf64_Half vd_version; /* Version information. */ 2790 Elf64_Half vd_flags; /* Flags. */ 2791 Elf64_Half vd_ndx; /* Index into the versym section. */ 2792 Elf64_Half vd_cnt; /* Number of aux entries. */ 2793 Elf64_Word vd_hash; /* Hash value of name. */ 2794 Elf64_Word vd_aux; /* Offset to aux entries. */ 2795 Elf64_Word vd_next; /* Offset to next version definition. */ 2796 } Elf64_Verdef; 2797 2798 typedef struct { 2799 Elf64_Half vn_version; /* Version number. */ 2800 Elf64_Half vn_cnt; /* Number of aux entries. */ 2801 Elf64_Word vn_file; /* Offset of associated file name. */ 2802 Elf64_Word vn_aux; /* Offset of vernaux array. */ 2803 Elf64_Word vn_next; /* Offset of next verneed entry. */ 2804 } Elf64_Verneed; 2805 2806 typedef Elf64_Half Elf64_Versym; 2807 2808 2809 /* 2810 * The header for GNU-style hash sections. 2811 */ 2812 2813 typedef struct { 2814 uint32_t gh_nbuckets; /* Number of hash buckets. */ 2815 uint32_t gh_symndx; /* First visible symbol in .dynsym. */ 2816 uint32_t gh_maskwords; /* #maskwords used in bloom filter. */ 2817 uint32_t gh_shift2; /* Bloom filter shift count. */ 2818 } Elf_GNU_Hash_Header; 2819 2820 #endif /* _ELFDEFINITIONS_H_ */ 2821