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