1193323Sed//===-- llvm/Support/ELF.h - ELF constants and data structures --*- C++ -*-===// 2193323Sed// 3193323Sed// The LLVM Compiler Infrastructure 4193323Sed// 5193323Sed// This file is distributed under the University of Illinois Open Source 6193323Sed// License. See LICENSE.TXT for details. 7193323Sed// 8193323Sed//===----------------------------------------------------------------------===// 9193323Sed// 10193323Sed// This header contains common, non-processor-specific data structures and 11193323Sed// constants for the ELF file format. 12193323Sed// 13210299Sed// The details of the ELF32 bits in this file are largely based on the Tool 14210299Sed// Interface Standard (TIS) Executable and Linking Format (ELF) Specification 15210299Sed// Version 1.2, May 1995. The ELF64 stuff is based on ELF-64 Object File Format 16210299Sed// Version 1.5, Draft 2, May 1998 as well as OpenBSD header files. 17193323Sed// 18193323Sed//===----------------------------------------------------------------------===// 19193323Sed 20193323Sed#ifndef LLVM_SUPPORT_ELF_H 21193323Sed#define LLVM_SUPPORT_ELF_H 22193323Sed 23263508Sdim#include "llvm/Support/Compiler.h" 24218893Sdim#include "llvm/Support/DataTypes.h" 25193323Sed#include <cstring> 26193323Sed 27193323Sednamespace llvm { 28193323Sed 29193323Sednamespace ELF { 30193323Sed 31193323Sedtypedef uint32_t Elf32_Addr; // Program address 32226633Sdimtypedef uint32_t Elf32_Off; // File offset 33193323Sedtypedef uint16_t Elf32_Half; 34226633Sdimtypedef uint32_t Elf32_Word; 35193323Sedtypedef int32_t Elf32_Sword; 36193323Sed 37193323Sedtypedef uint64_t Elf64_Addr; 38193323Sedtypedef uint64_t Elf64_Off; 39226633Sdimtypedef uint16_t Elf64_Half; 40226633Sdimtypedef uint32_t Elf64_Word; 41193323Sedtypedef int32_t Elf64_Sword; 42226633Sdimtypedef uint64_t Elf64_Xword; 43193323Sedtypedef int64_t Elf64_Sxword; 44193323Sed 45193323Sed// Object file magic string. 46193323Sedstatic const char ElfMagic[] = { 0x7f, 'E', 'L', 'F', '\0' }; 47193323Sed 48210299Sed// e_ident size and indices. 49210299Sedenum { 50210299Sed EI_MAG0 = 0, // File identification index. 51210299Sed EI_MAG1 = 1, // File identification index. 52210299Sed EI_MAG2 = 2, // File identification index. 53210299Sed EI_MAG3 = 3, // File identification index. 54210299Sed EI_CLASS = 4, // File class. 55210299Sed EI_DATA = 5, // Data encoding. 56210299Sed EI_VERSION = 6, // File version. 57210299Sed EI_OSABI = 7, // OS/ABI identification. 58210299Sed EI_ABIVERSION = 8, // ABI version. 59210299Sed EI_PAD = 9, // Start of padding bytes. 60210299Sed EI_NIDENT = 16 // Number of bytes in e_ident. 61210299Sed}; 62210299Sed 63193323Sedstruct Elf32_Ehdr { 64210299Sed unsigned char e_ident[EI_NIDENT]; // ELF Identification bytes 65193323Sed Elf32_Half e_type; // Type of file (see ET_* below) 66193323Sed Elf32_Half e_machine; // Required architecture for this file (see EM_*) 67193323Sed Elf32_Word e_version; // Must be equal to 1 68193323Sed Elf32_Addr e_entry; // Address to jump to in order to start program 69193323Sed Elf32_Off e_phoff; // Program header table's file offset, in bytes 70193323Sed Elf32_Off e_shoff; // Section header table's file offset, in bytes 71193323Sed Elf32_Word e_flags; // Processor-specific flags 72193323Sed Elf32_Half e_ehsize; // Size of ELF header, in bytes 73193323Sed Elf32_Half e_phentsize; // Size of an entry in the program header table 74193323Sed Elf32_Half e_phnum; // Number of entries in the program header table 75193323Sed Elf32_Half e_shentsize; // Size of an entry in the section header table 76193323Sed Elf32_Half e_shnum; // Number of entries in the section header table 77193323Sed Elf32_Half e_shstrndx; // Sect hdr table index of sect name string table 78210299Sed bool checkMagic() const { 79210299Sed return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0; 80193323Sed } 81210299Sed unsigned char getFileClass() const { return e_ident[EI_CLASS]; } 82210299Sed unsigned char getDataEncoding() const { return e_ident[EI_DATA]; } 83193323Sed}; 84193323Sed 85193323Sed// 64-bit ELF header. Fields are the same as for ELF32, but with different 86193323Sed// types (see above). 87193323Sedstruct Elf64_Ehdr { 88210299Sed unsigned char e_ident[EI_NIDENT]; 89226633Sdim Elf64_Half e_type; 90226633Sdim Elf64_Half e_machine; 91226633Sdim Elf64_Word e_version; 92193323Sed Elf64_Addr e_entry; 93193323Sed Elf64_Off e_phoff; 94193323Sed Elf64_Off e_shoff; 95226633Sdim Elf64_Word e_flags; 96226633Sdim Elf64_Half e_ehsize; 97226633Sdim Elf64_Half e_phentsize; 98226633Sdim Elf64_Half e_phnum; 99226633Sdim Elf64_Half e_shentsize; 100226633Sdim Elf64_Half e_shnum; 101226633Sdim Elf64_Half e_shstrndx; 102210299Sed bool checkMagic() const { 103210299Sed return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0; 104210299Sed } 105210299Sed unsigned char getFileClass() const { return e_ident[EI_CLASS]; } 106210299Sed unsigned char getDataEncoding() const { return e_ident[EI_DATA]; } 107193323Sed}; 108193323Sed 109193323Sed// File types 110193323Sedenum { 111193323Sed ET_NONE = 0, // No file type 112193323Sed ET_REL = 1, // Relocatable file 113193323Sed ET_EXEC = 2, // Executable file 114193323Sed ET_DYN = 3, // Shared object file 115193323Sed ET_CORE = 4, // Core file 116193323Sed ET_LOPROC = 0xff00, // Beginning of processor-specific codes 117193323Sed ET_HIPROC = 0xffff // Processor-specific 118193323Sed}; 119193323Sed 120207618Srdivacky// Versioning 121207618Srdivackyenum { 122207618Srdivacky EV_NONE = 0, 123207618Srdivacky EV_CURRENT = 1 124207618Srdivacky}; 125207618Srdivacky 126193323Sed// Machine architectures 127193323Sedenum { 128226633Sdim EM_NONE = 0, // No machine 129226633Sdim EM_M32 = 1, // AT&T WE 32100 130226633Sdim EM_SPARC = 2, // SPARC 131226633Sdim EM_386 = 3, // Intel 386 132226633Sdim EM_68K = 4, // Motorola 68000 133226633Sdim EM_88K = 5, // Motorola 88000 134226633Sdim EM_486 = 6, // Intel 486 (deprecated) 135226633Sdim EM_860 = 7, // Intel 80860 136226633Sdim EM_MIPS = 8, // MIPS R3000 137226633Sdim EM_S370 = 9, // IBM System/370 138226633Sdim EM_MIPS_RS3_LE = 10, // MIPS RS3000 Little-endian 139226633Sdim EM_PARISC = 15, // Hewlett-Packard PA-RISC 140226633Sdim EM_VPP500 = 17, // Fujitsu VPP500 141226633Sdim EM_SPARC32PLUS = 18, // Enhanced instruction set SPARC 142226633Sdim EM_960 = 19, // Intel 80960 143226633Sdim EM_PPC = 20, // PowerPC 144226633Sdim EM_PPC64 = 21, // PowerPC64 145226633Sdim EM_S390 = 22, // IBM System/390 146226633Sdim EM_SPU = 23, // IBM SPU/SPC 147226633Sdim EM_V800 = 36, // NEC V800 148226633Sdim EM_FR20 = 37, // Fujitsu FR20 149226633Sdim EM_RH32 = 38, // TRW RH-32 150226633Sdim EM_RCE = 39, // Motorola RCE 151226633Sdim EM_ARM = 40, // ARM 152226633Sdim EM_ALPHA = 41, // DEC Alpha 153226633Sdim EM_SH = 42, // Hitachi SH 154226633Sdim EM_SPARCV9 = 43, // SPARC V9 155226633Sdim EM_TRICORE = 44, // Siemens TriCore 156226633Sdim EM_ARC = 45, // Argonaut RISC Core 157226633Sdim EM_H8_300 = 46, // Hitachi H8/300 158226633Sdim EM_H8_300H = 47, // Hitachi H8/300H 159226633Sdim EM_H8S = 48, // Hitachi H8S 160226633Sdim EM_H8_500 = 49, // Hitachi H8/500 161226633Sdim EM_IA_64 = 50, // Intel IA-64 processor architecture 162226633Sdim EM_MIPS_X = 51, // Stanford MIPS-X 163226633Sdim EM_COLDFIRE = 52, // Motorola ColdFire 164226633Sdim EM_68HC12 = 53, // Motorola M68HC12 165226633Sdim EM_MMA = 54, // Fujitsu MMA Multimedia Accelerator 166226633Sdim EM_PCP = 55, // Siemens PCP 167226633Sdim EM_NCPU = 56, // Sony nCPU embedded RISC processor 168226633Sdim EM_NDR1 = 57, // Denso NDR1 microprocessor 169226633Sdim EM_STARCORE = 58, // Motorola Star*Core processor 170226633Sdim EM_ME16 = 59, // Toyota ME16 processor 171226633Sdim EM_ST100 = 60, // STMicroelectronics ST100 processor 172226633Sdim EM_TINYJ = 61, // Advanced Logic Corp. TinyJ embedded processor family 173226633Sdim EM_X86_64 = 62, // AMD x86-64 architecture 174226633Sdim EM_PDSP = 63, // Sony DSP Processor 175226633Sdim EM_PDP10 = 64, // Digital Equipment Corp. PDP-10 176226633Sdim EM_PDP11 = 65, // Digital Equipment Corp. PDP-11 177226633Sdim EM_FX66 = 66, // Siemens FX66 microcontroller 178226633Sdim EM_ST9PLUS = 67, // STMicroelectronics ST9+ 8/16 bit microcontroller 179226633Sdim EM_ST7 = 68, // STMicroelectronics ST7 8-bit microcontroller 180226633Sdim EM_68HC16 = 69, // Motorola MC68HC16 Microcontroller 181226633Sdim EM_68HC11 = 70, // Motorola MC68HC11 Microcontroller 182226633Sdim EM_68HC08 = 71, // Motorola MC68HC08 Microcontroller 183226633Sdim EM_68HC05 = 72, // Motorola MC68HC05 Microcontroller 184226633Sdim EM_SVX = 73, // Silicon Graphics SVx 185226633Sdim EM_ST19 = 74, // STMicroelectronics ST19 8-bit microcontroller 186226633Sdim EM_VAX = 75, // Digital VAX 187226633Sdim EM_CRIS = 76, // Axis Communications 32-bit embedded processor 188226633Sdim EM_JAVELIN = 77, // Infineon Technologies 32-bit embedded processor 189226633Sdim EM_FIREPATH = 78, // Element 14 64-bit DSP Processor 190226633Sdim EM_ZSP = 79, // LSI Logic 16-bit DSP Processor 191226633Sdim EM_MMIX = 80, // Donald Knuth's educational 64-bit processor 192226633Sdim EM_HUANY = 81, // Harvard University machine-independent object files 193226633Sdim EM_PRISM = 82, // SiTera Prism 194226633Sdim EM_AVR = 83, // Atmel AVR 8-bit microcontroller 195226633Sdim EM_FR30 = 84, // Fujitsu FR30 196226633Sdim EM_D10V = 85, // Mitsubishi D10V 197226633Sdim EM_D30V = 86, // Mitsubishi D30V 198226633Sdim EM_V850 = 87, // NEC v850 199226633Sdim EM_M32R = 88, // Mitsubishi M32R 200226633Sdim EM_MN10300 = 89, // Matsushita MN10300 201226633Sdim EM_MN10200 = 90, // Matsushita MN10200 202226633Sdim EM_PJ = 91, // picoJava 203226633Sdim EM_OPENRISC = 92, // OpenRISC 32-bit embedded processor 204226633Sdim EM_ARC_COMPACT = 93, // ARC International ARCompact processor (old 205226633Sdim // spelling/synonym: EM_ARC_A5) 206226633Sdim EM_XTENSA = 94, // Tensilica Xtensa Architecture 207226633Sdim EM_VIDEOCORE = 95, // Alphamosaic VideoCore processor 208226633Sdim EM_TMM_GPP = 96, // Thompson Multimedia General Purpose Processor 209226633Sdim EM_NS32K = 97, // National Semiconductor 32000 series 210226633Sdim EM_TPC = 98, // Tenor Network TPC processor 211226633Sdim EM_SNP1K = 99, // Trebia SNP 1000 processor 212226633Sdim EM_ST200 = 100, // STMicroelectronics (www.st.com) ST200 213226633Sdim EM_IP2K = 101, // Ubicom IP2xxx microcontroller family 214226633Sdim EM_MAX = 102, // MAX Processor 215226633Sdim EM_CR = 103, // National Semiconductor CompactRISC microprocessor 216226633Sdim EM_F2MC16 = 104, // Fujitsu F2MC16 217226633Sdim EM_MSP430 = 105, // Texas Instruments embedded microcontroller msp430 218226633Sdim EM_BLACKFIN = 106, // Analog Devices Blackfin (DSP) processor 219226633Sdim EM_SE_C33 = 107, // S1C33 Family of Seiko Epson processors 220226633Sdim EM_SEP = 108, // Sharp embedded microprocessor 221226633Sdim EM_ARCA = 109, // Arca RISC Microprocessor 222226633Sdim EM_UNICORE = 110, // Microprocessor series from PKU-Unity Ltd. and MPRC 223226633Sdim // of Peking University 224226633Sdim EM_EXCESS = 111, // eXcess: 16/32/64-bit configurable embedded CPU 225226633Sdim EM_DXP = 112, // Icera Semiconductor Inc. Deep Execution Processor 226226633Sdim EM_ALTERA_NIOS2 = 113, // Altera Nios II soft-core processor 227226633Sdim EM_CRX = 114, // National Semiconductor CompactRISC CRX 228226633Sdim EM_XGATE = 115, // Motorola XGATE embedded processor 229226633Sdim EM_C166 = 116, // Infineon C16x/XC16x processor 230226633Sdim EM_M16C = 117, // Renesas M16C series microprocessors 231226633Sdim EM_DSPIC30F = 118, // Microchip Technology dsPIC30F Digital Signal 232226633Sdim // Controller 233226633Sdim EM_CE = 119, // Freescale Communication Engine RISC core 234226633Sdim EM_M32C = 120, // Renesas M32C series microprocessors 235226633Sdim EM_TSK3000 = 131, // Altium TSK3000 core 236226633Sdim EM_RS08 = 132, // Freescale RS08 embedded processor 237226633Sdim EM_SHARC = 133, // Analog Devices SHARC family of 32-bit DSP 238226633Sdim // processors 239226633Sdim EM_ECOG2 = 134, // Cyan Technology eCOG2 microprocessor 240226633Sdim EM_SCORE7 = 135, // Sunplus S+core7 RISC processor 241226633Sdim EM_DSP24 = 136, // New Japan Radio (NJR) 24-bit DSP Processor 242226633Sdim EM_VIDEOCORE3 = 137, // Broadcom VideoCore III processor 243226633Sdim EM_LATTICEMICO32 = 138, // RISC processor for Lattice FPGA architecture 244226633Sdim EM_SE_C17 = 139, // Seiko Epson C17 family 245226633Sdim EM_TI_C6000 = 140, // The Texas Instruments TMS320C6000 DSP family 246226633Sdim EM_TI_C2000 = 141, // The Texas Instruments TMS320C2000 DSP family 247226633Sdim EM_TI_C5500 = 142, // The Texas Instruments TMS320C55x DSP family 248226633Sdim EM_MMDSP_PLUS = 160, // STMicroelectronics 64bit VLIW Data Signal Processor 249226633Sdim EM_CYPRESS_M8C = 161, // Cypress M8C microprocessor 250226633Sdim EM_R32C = 162, // Renesas R32C series microprocessors 251226633Sdim EM_TRIMEDIA = 163, // NXP Semiconductors TriMedia architecture family 252239462Sdim EM_HEXAGON = 164, // Qualcomm Hexagon processor 253226633Sdim EM_8051 = 165, // Intel 8051 and variants 254226633Sdim EM_STXP7X = 166, // STMicroelectronics STxP7x family of configurable 255226633Sdim // and extensible RISC processors 256226633Sdim EM_NDS32 = 167, // Andes Technology compact code size embedded RISC 257226633Sdim // processor family 258226633Sdim EM_ECOG1 = 168, // Cyan Technology eCOG1X family 259226633Sdim EM_ECOG1X = 168, // Cyan Technology eCOG1X family 260226633Sdim EM_MAXQ30 = 169, // Dallas Semiconductor MAXQ30 Core Micro-controllers 261226633Sdim EM_XIMO16 = 170, // New Japan Radio (NJR) 16-bit DSP Processor 262226633Sdim EM_MANIK = 171, // M2000 Reconfigurable RISC Microprocessor 263226633Sdim EM_CRAYNV2 = 172, // Cray Inc. NV2 vector architecture 264226633Sdim EM_RX = 173, // Renesas RX family 265226633Sdim EM_METAG = 174, // Imagination Technologies META processor 266226633Sdim // architecture 267226633Sdim EM_MCST_ELBRUS = 175, // MCST Elbrus general purpose hardware architecture 268226633Sdim EM_ECOG16 = 176, // Cyan Technology eCOG16 family 269226633Sdim EM_CR16 = 177, // National Semiconductor CompactRISC CR16 16-bit 270226633Sdim // microprocessor 271226633Sdim EM_ETPU = 178, // Freescale Extended Time Processing Unit 272226633Sdim EM_SLE9X = 179, // Infineon Technologies SLE9X core 273226633Sdim EM_L10M = 180, // Intel L10M 274226633Sdim EM_K10M = 181, // Intel K10M 275249423Sdim EM_AARCH64 = 183, // ARM AArch64 276226633Sdim EM_AVR32 = 185, // Atmel Corporation 32-bit microprocessor family 277226633Sdim EM_STM8 = 186, // STMicroeletronics STM8 8-bit microcontroller 278226633Sdim EM_TILE64 = 187, // Tilera TILE64 multicore architecture family 279226633Sdim EM_TILEPRO = 188, // Tilera TILEPro multicore architecture family 280226633Sdim EM_CUDA = 190, // NVIDIA CUDA architecture 281226633Sdim EM_TILEGX = 191, // Tilera TILE-Gx multicore architecture family 282226633Sdim EM_CLOUDSHIELD = 192, // CloudShield architecture family 283226633Sdim EM_COREA_1ST = 193, // KIPO-KAIST Core-A 1st generation processor family 284226633Sdim EM_COREA_2ND = 194, // KIPO-KAIST Core-A 2nd generation processor family 285226633Sdim EM_ARC_COMPACT2 = 195, // Synopsys ARCompact V2 286226633Sdim EM_OPEN8 = 196, // Open8 8-bit RISC soft processor core 287226633Sdim EM_RL78 = 197, // Renesas RL78 family 288226633Sdim EM_VIDEOCORE5 = 198, // Broadcom VideoCore V processor 289226633Sdim EM_78KOR = 199, // Renesas 78KOR family 290263508Sdim EM_56800EX = 200 // Freescale 56800EX Digital Signal Controller (DSC) 291193323Sed}; 292193323Sed 293193323Sed// Object file classes. 294193323Sedenum { 295218893Sdim ELFCLASSNONE = 0, 296193323Sed ELFCLASS32 = 1, // 32-bit object file 297193323Sed ELFCLASS64 = 2 // 64-bit object file 298193323Sed}; 299193323Sed 300193323Sed// Object file byte orderings. 301193323Sedenum { 302210299Sed ELFDATANONE = 0, // Invalid data encoding. 303193323Sed ELFDATA2LSB = 1, // Little-endian object file 304193323Sed ELFDATA2MSB = 2 // Big-endian object file 305193323Sed}; 306193323Sed 307210299Sed// OS ABI identification. 308207618Srdivackyenum { 309210299Sed ELFOSABI_NONE = 0, // UNIX System V ABI 310210299Sed ELFOSABI_HPUX = 1, // HP-UX operating system 311210299Sed ELFOSABI_NETBSD = 2, // NetBSD 312263508Sdim ELFOSABI_GNU = 3, // GNU/Linux 313263508Sdim ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU. 314210299Sed ELFOSABI_HURD = 4, // GNU/Hurd 315210299Sed ELFOSABI_SOLARIS = 6, // Solaris 316210299Sed ELFOSABI_AIX = 7, // AIX 317210299Sed ELFOSABI_IRIX = 8, // IRIX 318210299Sed ELFOSABI_FREEBSD = 9, // FreeBSD 319210299Sed ELFOSABI_TRU64 = 10, // TRU64 UNIX 320210299Sed ELFOSABI_MODESTO = 11, // Novell Modesto 321210299Sed ELFOSABI_OPENBSD = 12, // OpenBSD 322210299Sed ELFOSABI_OPENVMS = 13, // OpenVMS 323210299Sed ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel 324210299Sed ELFOSABI_AROS = 15, // AROS 325210299Sed ELFOSABI_FENIXOS = 16, // FenixOS 326210299Sed ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000 327210299Sed ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000 328210299Sed ELFOSABI_ARM = 97, // ARM 329210299Sed ELFOSABI_STANDALONE = 255 // Standalone (embedded) application 330207618Srdivacky}; 331207618Srdivacky 332210299Sed// X86_64 relocations. 333210299Sedenum { 334210299Sed R_X86_64_NONE = 0, 335210299Sed R_X86_64_64 = 1, 336210299Sed R_X86_64_PC32 = 2, 337210299Sed R_X86_64_GOT32 = 3, 338210299Sed R_X86_64_PLT32 = 4, 339210299Sed R_X86_64_COPY = 5, 340210299Sed R_X86_64_GLOB_DAT = 6, 341210299Sed R_X86_64_JUMP_SLOT = 7, 342210299Sed R_X86_64_RELATIVE = 8, 343210299Sed R_X86_64_GOTPCREL = 9, 344210299Sed R_X86_64_32 = 10, 345210299Sed R_X86_64_32S = 11, 346210299Sed R_X86_64_16 = 12, 347210299Sed R_X86_64_PC16 = 13, 348210299Sed R_X86_64_8 = 14, 349210299Sed R_X86_64_PC8 = 15, 350210299Sed R_X86_64_DTPMOD64 = 16, 351210299Sed R_X86_64_DTPOFF64 = 17, 352210299Sed R_X86_64_TPOFF64 = 18, 353210299Sed R_X86_64_TLSGD = 19, 354210299Sed R_X86_64_TLSLD = 20, 355210299Sed R_X86_64_DTPOFF32 = 21, 356210299Sed R_X86_64_GOTTPOFF = 22, 357210299Sed R_X86_64_TPOFF32 = 23, 358210299Sed R_X86_64_PC64 = 24, 359210299Sed R_X86_64_GOTOFF64 = 25, 360210299Sed R_X86_64_GOTPC32 = 26, 361226633Sdim R_X86_64_GOT64 = 27, 362226633Sdim R_X86_64_GOTPCREL64 = 28, 363226633Sdim R_X86_64_GOTPC64 = 29, 364226633Sdim R_X86_64_GOTPLT64 = 30, 365226633Sdim R_X86_64_PLTOFF64 = 31, 366210299Sed R_X86_64_SIZE32 = 32, 367210299Sed R_X86_64_SIZE64 = 33, 368210299Sed R_X86_64_GOTPC32_TLSDESC = 34, 369210299Sed R_X86_64_TLSDESC_CALL = 35, 370249423Sdim R_X86_64_TLSDESC = 36, 371249423Sdim R_X86_64_IRELATIVE = 37 372210299Sed}; 373210299Sed 374212904Sdim// i386 relocations. 375212904Sdim// TODO: this is just a subset 376212904Sdimenum { 377212904Sdim R_386_NONE = 0, 378212904Sdim R_386_32 = 1, 379212904Sdim R_386_PC32 = 2, 380212904Sdim R_386_GOT32 = 3, 381212904Sdim R_386_PLT32 = 4, 382212904Sdim R_386_COPY = 5, 383212904Sdim R_386_GLOB_DAT = 6, 384212904Sdim R_386_JUMP_SLOT = 7, 385212904Sdim R_386_RELATIVE = 8, 386212904Sdim R_386_GOTOFF = 9, 387212904Sdim R_386_GOTPC = 10, 388212904Sdim R_386_32PLT = 11, 389218893Sdim R_386_TLS_TPOFF = 14, 390218893Sdim R_386_TLS_IE = 15, 391218893Sdim R_386_TLS_GOTIE = 16, 392218893Sdim R_386_TLS_LE = 17, 393218893Sdim R_386_TLS_GD = 18, 394218893Sdim R_386_TLS_LDM = 19, 395212904Sdim R_386_16 = 20, 396212904Sdim R_386_PC16 = 21, 397212904Sdim R_386_8 = 22, 398218893Sdim R_386_PC8 = 23, 399218893Sdim R_386_TLS_GD_32 = 24, 400218893Sdim R_386_TLS_GD_PUSH = 25, 401218893Sdim R_386_TLS_GD_CALL = 26, 402218893Sdim R_386_TLS_GD_POP = 27, 403218893Sdim R_386_TLS_LDM_32 = 28, 404218893Sdim R_386_TLS_LDM_PUSH = 29, 405218893Sdim R_386_TLS_LDM_CALL = 30, 406218893Sdim R_386_TLS_LDM_POP = 31, 407218893Sdim R_386_TLS_LDO_32 = 32, 408218893Sdim R_386_TLS_IE_32 = 33, 409218893Sdim R_386_TLS_LE_32 = 34, 410218893Sdim R_386_TLS_DTPMOD32 = 35, 411218893Sdim R_386_TLS_DTPOFF32 = 36, 412218893Sdim R_386_TLS_TPOFF32 = 37, 413218893Sdim R_386_TLS_GOTDESC = 39, 414218893Sdim R_386_TLS_DESC_CALL = 40, 415218893Sdim R_386_TLS_DESC = 41, 416218893Sdim R_386_IRELATIVE = 42, 417218893Sdim R_386_NUM = 43 418212904Sdim}; 419212904Sdim 420243830Sdim// ELF Relocation types for PPC32 421226633Sdimenum { 422226633Sdim R_PPC_NONE = 0, /* No relocation. */ 423226633Sdim R_PPC_ADDR32 = 1, 424226633Sdim R_PPC_ADDR24 = 2, 425226633Sdim R_PPC_ADDR16 = 3, 426226633Sdim R_PPC_ADDR16_LO = 4, 427226633Sdim R_PPC_ADDR16_HI = 5, 428226633Sdim R_PPC_ADDR16_HA = 6, 429226633Sdim R_PPC_ADDR14 = 7, 430226633Sdim R_PPC_ADDR14_BRTAKEN = 8, 431226633Sdim R_PPC_ADDR14_BRNTAKEN = 9, 432226633Sdim R_PPC_REL24 = 10, 433226633Sdim R_PPC_REL14 = 11, 434226633Sdim R_PPC_REL14_BRTAKEN = 12, 435226633Sdim R_PPC_REL14_BRNTAKEN = 13, 436263508Sdim R_PPC_GOT16 = 14, 437263508Sdim R_PPC_GOT16_LO = 15, 438263508Sdim R_PPC_GOT16_HI = 16, 439263508Sdim R_PPC_GOT16_HA = 17, 440243830Sdim R_PPC_REL32 = 26, 441263508Sdim R_PPC_TLS = 67, 442263508Sdim R_PPC_DTPMOD32 = 68, 443263508Sdim R_PPC_TPREL16 = 69, 444243830Sdim R_PPC_TPREL16_LO = 70, 445263508Sdim R_PPC_TPREL16_HI = 71, 446263508Sdim R_PPC_TPREL16_HA = 72, 447263508Sdim R_PPC_TPREL32 = 73, 448263508Sdim R_PPC_DTPREL16 = 74, 449263508Sdim R_PPC_DTPREL16_LO = 75, 450263508Sdim R_PPC_DTPREL16_HI = 76, 451263508Sdim R_PPC_DTPREL16_HA = 77, 452263508Sdim R_PPC_DTPREL32 = 78, 453263508Sdim R_PPC_GOT_TLSGD16 = 79, 454263508Sdim R_PPC_GOT_TLSGD16_LO = 80, 455263508Sdim R_PPC_GOT_TLSGD16_HI = 81, 456263508Sdim R_PPC_GOT_TLSGD16_HA = 82, 457263508Sdim R_PPC_GOT_TLSLD16 = 83, 458263508Sdim R_PPC_GOT_TLSLD16_LO = 84, 459263508Sdim R_PPC_GOT_TLSLD16_HI = 85, 460263508Sdim R_PPC_GOT_TLSLD16_HA = 86, 461263508Sdim R_PPC_GOT_TPREL16 = 87, 462263508Sdim R_PPC_GOT_TPREL16_LO = 88, 463263508Sdim R_PPC_GOT_TPREL16_HI = 89, 464263508Sdim R_PPC_GOT_TPREL16_HA = 90, 465263508Sdim R_PPC_GOT_DTPREL16 = 91, 466263508Sdim R_PPC_GOT_DTPREL16_LO = 92, 467263508Sdim R_PPC_GOT_DTPREL16_HI = 93, 468263508Sdim R_PPC_GOT_DTPREL16_HA = 94, 469263508Sdim R_PPC_TLSGD = 95, 470263508Sdim R_PPC_TLSLD = 96, 471263508Sdim R_PPC_REL16 = 249, 472263508Sdim R_PPC_REL16_LO = 250, 473263508Sdim R_PPC_REL16_HI = 251, 474263508Sdim R_PPC_REL16_HA = 252 475226633Sdim}; 476218893Sdim 477243830Sdim// ELF Relocation types for PPC64 478243830Sdimenum { 479251662Sdim R_PPC64_NONE = 0, 480249423Sdim R_PPC64_ADDR32 = 1, 481263508Sdim R_PPC64_ADDR24 = 2, 482263508Sdim R_PPC64_ADDR16 = 3, 483243830Sdim R_PPC64_ADDR16_LO = 4, 484243830Sdim R_PPC64_ADDR16_HI = 5, 485263508Sdim R_PPC64_ADDR16_HA = 6, 486243830Sdim R_PPC64_ADDR14 = 7, 487263508Sdim R_PPC64_ADDR14_BRTAKEN = 8, 488263508Sdim R_PPC64_ADDR14_BRNTAKEN = 9, 489243830Sdim R_PPC64_REL24 = 10, 490263508Sdim R_PPC64_REL14 = 11, 491263508Sdim R_PPC64_REL14_BRTAKEN = 12, 492263508Sdim R_PPC64_REL14_BRNTAKEN = 13, 493263508Sdim R_PPC64_GOT16 = 14, 494263508Sdim R_PPC64_GOT16_LO = 15, 495263508Sdim R_PPC64_GOT16_HI = 16, 496263508Sdim R_PPC64_GOT16_HA = 17, 497249423Sdim R_PPC64_REL32 = 26, 498243830Sdim R_PPC64_ADDR64 = 38, 499243830Sdim R_PPC64_ADDR16_HIGHER = 39, 500263508Sdim R_PPC64_ADDR16_HIGHERA = 40, 501243830Sdim R_PPC64_ADDR16_HIGHEST = 41, 502263508Sdim R_PPC64_ADDR16_HIGHESTA = 42, 503249423Sdim R_PPC64_REL64 = 44, 504243830Sdim R_PPC64_TOC16 = 47, 505249423Sdim R_PPC64_TOC16_LO = 48, 506263508Sdim R_PPC64_TOC16_HI = 49, 507249423Sdim R_PPC64_TOC16_HA = 50, 508243830Sdim R_PPC64_TOC = 51, 509249423Sdim R_PPC64_ADDR16_DS = 56, 510249423Sdim R_PPC64_ADDR16_LO_DS = 57, 511263508Sdim R_PPC64_GOT16_DS = 58, 512263508Sdim R_PPC64_GOT16_LO_DS = 59, 513249423Sdim R_PPC64_TOC16_DS = 63, 514249423Sdim R_PPC64_TOC16_LO_DS = 64, 515249423Sdim R_PPC64_TLS = 67, 516263508Sdim R_PPC64_DTPMOD64 = 68, 517263508Sdim R_PPC64_TPREL16 = 69, 518249423Sdim R_PPC64_TPREL16_LO = 70, 519263508Sdim R_PPC64_TPREL16_HI = 71, 520251662Sdim R_PPC64_TPREL16_HA = 72, 521263508Sdim R_PPC64_TPREL64 = 73, 522263508Sdim R_PPC64_DTPREL16 = 74, 523249423Sdim R_PPC64_DTPREL16_LO = 75, 524263508Sdim R_PPC64_DTPREL16_HI = 76, 525249423Sdim R_PPC64_DTPREL16_HA = 77, 526263508Sdim R_PPC64_DTPREL64 = 78, 527263508Sdim R_PPC64_GOT_TLSGD16 = 79, 528249423Sdim R_PPC64_GOT_TLSGD16_LO = 80, 529263508Sdim R_PPC64_GOT_TLSGD16_HI = 81, 530249423Sdim R_PPC64_GOT_TLSGD16_HA = 82, 531263508Sdim R_PPC64_GOT_TLSLD16 = 83, 532249423Sdim R_PPC64_GOT_TLSLD16_LO = 84, 533263508Sdim R_PPC64_GOT_TLSLD16_HI = 85, 534249423Sdim R_PPC64_GOT_TLSLD16_HA = 86, 535263508Sdim R_PPC64_GOT_TPREL16_DS = 87, 536249423Sdim R_PPC64_GOT_TPREL16_LO_DS = 88, 537263508Sdim R_PPC64_GOT_TPREL16_HI = 89, 538249423Sdim R_PPC64_GOT_TPREL16_HA = 90, 539263508Sdim R_PPC64_GOT_DTPREL16_DS = 91, 540263508Sdim R_PPC64_GOT_DTPREL16_LO_DS = 92, 541263508Sdim R_PPC64_GOT_DTPREL16_HI = 93, 542263508Sdim R_PPC64_GOT_DTPREL16_HA = 94, 543263508Sdim R_PPC64_TPREL16_DS = 95, 544263508Sdim R_PPC64_TPREL16_LO_DS = 96, 545263508Sdim R_PPC64_TPREL16_HIGHER = 97, 546263508Sdim R_PPC64_TPREL16_HIGHERA = 98, 547263508Sdim R_PPC64_TPREL16_HIGHEST = 99, 548263508Sdim R_PPC64_TPREL16_HIGHESTA = 100, 549263508Sdim R_PPC64_DTPREL16_DS = 101, 550263508Sdim R_PPC64_DTPREL16_LO_DS = 102, 551263508Sdim R_PPC64_DTPREL16_HIGHER = 103, 552263508Sdim R_PPC64_DTPREL16_HIGHERA = 104, 553263508Sdim R_PPC64_DTPREL16_HIGHEST = 105, 554263508Sdim R_PPC64_DTPREL16_HIGHESTA = 106, 555249423Sdim R_PPC64_TLSGD = 107, 556263508Sdim R_PPC64_TLSLD = 108, 557263508Sdim R_PPC64_REL16 = 249, 558263508Sdim R_PPC64_REL16_LO = 250, 559263508Sdim R_PPC64_REL16_HI = 251, 560263508Sdim R_PPC64_REL16_HA = 252 561243830Sdim}; 562243830Sdim 563249423Sdim// ELF Relocation types for AArch64 564249423Sdim 565249423Sdimenum { 566249423Sdim R_AARCH64_NONE = 0x100, 567249423Sdim 568249423Sdim R_AARCH64_ABS64 = 0x101, 569249423Sdim R_AARCH64_ABS32 = 0x102, 570249423Sdim R_AARCH64_ABS16 = 0x103, 571249423Sdim R_AARCH64_PREL64 = 0x104, 572249423Sdim R_AARCH64_PREL32 = 0x105, 573249423Sdim R_AARCH64_PREL16 = 0x106, 574249423Sdim 575249423Sdim R_AARCH64_MOVW_UABS_G0 = 0x107, 576249423Sdim R_AARCH64_MOVW_UABS_G0_NC = 0x108, 577249423Sdim R_AARCH64_MOVW_UABS_G1 = 0x109, 578249423Sdim R_AARCH64_MOVW_UABS_G1_NC = 0x10a, 579249423Sdim R_AARCH64_MOVW_UABS_G2 = 0x10b, 580249423Sdim R_AARCH64_MOVW_UABS_G2_NC = 0x10c, 581249423Sdim R_AARCH64_MOVW_UABS_G3 = 0x10d, 582249423Sdim R_AARCH64_MOVW_SABS_G0 = 0x10e, 583249423Sdim R_AARCH64_MOVW_SABS_G1 = 0x10f, 584249423Sdim R_AARCH64_MOVW_SABS_G2 = 0x110, 585249423Sdim 586249423Sdim R_AARCH64_LD_PREL_LO19 = 0x111, 587249423Sdim R_AARCH64_ADR_PREL_LO21 = 0x112, 588249423Sdim R_AARCH64_ADR_PREL_PG_HI21 = 0x113, 589249423Sdim R_AARCH64_ADD_ABS_LO12_NC = 0x115, 590249423Sdim R_AARCH64_LDST8_ABS_LO12_NC = 0x116, 591249423Sdim 592249423Sdim R_AARCH64_TSTBR14 = 0x117, 593249423Sdim R_AARCH64_CONDBR19 = 0x118, 594249423Sdim R_AARCH64_JUMP26 = 0x11a, 595249423Sdim R_AARCH64_CALL26 = 0x11b, 596249423Sdim 597249423Sdim R_AARCH64_LDST16_ABS_LO12_NC = 0x11c, 598249423Sdim R_AARCH64_LDST32_ABS_LO12_NC = 0x11d, 599249423Sdim R_AARCH64_LDST64_ABS_LO12_NC = 0x11e, 600249423Sdim 601249423Sdim R_AARCH64_LDST128_ABS_LO12_NC = 0x12b, 602249423Sdim 603249423Sdim R_AARCH64_ADR_GOT_PAGE = 0x137, 604249423Sdim R_AARCH64_LD64_GOT_LO12_NC = 0x138, 605249423Sdim 606249423Sdim R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 0x20b, 607249423Sdim R_AARCH64_TLSLD_MOVW_DTPREL_G1 = 0x20c, 608249423Sdim R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC = 0x20d, 609249423Sdim R_AARCH64_TLSLD_MOVW_DTPREL_G0 = 0x20e, 610249423Sdim R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC = 0x20f, 611249423Sdim R_AARCH64_TLSLD_ADD_DTPREL_HI12 = 0x210, 612249423Sdim R_AARCH64_TLSLD_ADD_DTPREL_LO12 = 0x211, 613249423Sdim R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC = 0x212, 614249423Sdim R_AARCH64_TLSLD_LDST8_DTPREL_LO12 = 0x213, 615249423Sdim R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC = 0x214, 616249423Sdim R_AARCH64_TLSLD_LDST16_DTPREL_LO12 = 0x215, 617249423Sdim R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 0x216, 618249423Sdim R_AARCH64_TLSLD_LDST32_DTPREL_LO12 = 0x217, 619249423Sdim R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 0x218, 620249423Sdim R_AARCH64_TLSLD_LDST64_DTPREL_LO12 = 0x219, 621249423Sdim R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 0x21a, 622249423Sdim 623249423Sdim R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 = 0x21b, 624249423Sdim R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC = 0x21c, 625249423Sdim R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 = 0x21d, 626249423Sdim R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 0x21e, 627249423Sdim R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 = 0x21f, 628249423Sdim 629249423Sdim R_AARCH64_TLSLE_MOVW_TPREL_G2 = 0x220, 630249423Sdim R_AARCH64_TLSLE_MOVW_TPREL_G1 = 0x221, 631249423Sdim R_AARCH64_TLSLE_MOVW_TPREL_G1_NC = 0x222, 632249423Sdim R_AARCH64_TLSLE_MOVW_TPREL_G0 = 0x223, 633249423Sdim R_AARCH64_TLSLE_MOVW_TPREL_G0_NC = 0x224, 634249423Sdim R_AARCH64_TLSLE_ADD_TPREL_HI12 = 0x225, 635249423Sdim R_AARCH64_TLSLE_ADD_TPREL_LO12 = 0x226, 636249423Sdim R_AARCH64_TLSLE_ADD_TPREL_LO12_NC = 0x227, 637249423Sdim R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 0x228, 638249423Sdim R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 0x229, 639249423Sdim R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 0x22a, 640249423Sdim R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 0x22b, 641249423Sdim R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 0x22c, 642249423Sdim R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 0x22d, 643249423Sdim R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 0x22e, 644249423Sdim R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC = 0x22f, 645249423Sdim 646249423Sdim R_AARCH64_TLSDESC_ADR_PAGE = 0x232, 647249423Sdim R_AARCH64_TLSDESC_LD64_LO12_NC = 0x233, 648249423Sdim R_AARCH64_TLSDESC_ADD_LO12_NC = 0x234, 649249423Sdim 650249423Sdim R_AARCH64_TLSDESC_CALL = 0x239 651249423Sdim}; 652249423Sdim 653218893Sdim// ARM Specific e_flags 654263508Sdimenum LLVM_ENUM_INT_TYPE(unsigned) { 655249423Sdim EF_ARM_SOFT_FLOAT = 0x00000200U, 656249423Sdim EF_ARM_VFP_FLOAT = 0x00000400U, 657249423Sdim EF_ARM_EABI_UNKNOWN = 0x00000000U, 658249423Sdim EF_ARM_EABI_VER1 = 0x01000000U, 659249423Sdim EF_ARM_EABI_VER2 = 0x02000000U, 660249423Sdim EF_ARM_EABI_VER3 = 0x03000000U, 661249423Sdim EF_ARM_EABI_VER4 = 0x04000000U, 662249423Sdim EF_ARM_EABI_VER5 = 0x05000000U, 663249423Sdim EF_ARM_EABIMASK = 0xFF000000U 664249423Sdim}; 665218893Sdim 666218893Sdim// ELF Relocation types for ARM 667218893Sdim// Meets 2.08 ABI Specs. 668218893Sdim 669218893Sdimenum { 670218893Sdim R_ARM_NONE = 0x00, 671218893Sdim R_ARM_PC24 = 0x01, 672218893Sdim R_ARM_ABS32 = 0x02, 673218893Sdim R_ARM_REL32 = 0x03, 674218893Sdim R_ARM_LDR_PC_G0 = 0x04, 675218893Sdim R_ARM_ABS16 = 0x05, 676218893Sdim R_ARM_ABS12 = 0x06, 677218893Sdim R_ARM_THM_ABS5 = 0x07, 678218893Sdim R_ARM_ABS8 = 0x08, 679218893Sdim R_ARM_SBREL32 = 0x09, 680218893Sdim R_ARM_THM_CALL = 0x0a, 681218893Sdim R_ARM_THM_PC8 = 0x0b, 682218893Sdim R_ARM_BREL_ADJ = 0x0c, 683218893Sdim R_ARM_TLS_DESC = 0x0d, 684218893Sdim R_ARM_THM_SWI8 = 0x0e, 685218893Sdim R_ARM_XPC25 = 0x0f, 686218893Sdim R_ARM_THM_XPC22 = 0x10, 687218893Sdim R_ARM_TLS_DTPMOD32 = 0x11, 688218893Sdim R_ARM_TLS_DTPOFF32 = 0x12, 689218893Sdim R_ARM_TLS_TPOFF32 = 0x13, 690218893Sdim R_ARM_COPY = 0x14, 691218893Sdim R_ARM_GLOB_DAT = 0x15, 692218893Sdim R_ARM_JUMP_SLOT = 0x16, 693218893Sdim R_ARM_RELATIVE = 0x17, 694218893Sdim R_ARM_GOTOFF32 = 0x18, 695218893Sdim R_ARM_BASE_PREL = 0x19, 696218893Sdim R_ARM_GOT_BREL = 0x1a, 697218893Sdim R_ARM_PLT32 = 0x1b, 698218893Sdim R_ARM_CALL = 0x1c, 699218893Sdim R_ARM_JUMP24 = 0x1d, 700218893Sdim R_ARM_THM_JUMP24 = 0x1e, 701218893Sdim R_ARM_BASE_ABS = 0x1f, 702218893Sdim R_ARM_ALU_PCREL_7_0 = 0x20, 703218893Sdim R_ARM_ALU_PCREL_15_8 = 0x21, 704218893Sdim R_ARM_ALU_PCREL_23_15 = 0x22, 705218893Sdim R_ARM_LDR_SBREL_11_0_NC = 0x23, 706218893Sdim R_ARM_ALU_SBREL_19_12_NC = 0x24, 707218893Sdim R_ARM_ALU_SBREL_27_20_CK = 0x25, 708218893Sdim R_ARM_TARGET1 = 0x26, 709218893Sdim R_ARM_SBREL31 = 0x27, 710218893Sdim R_ARM_V4BX = 0x28, 711218893Sdim R_ARM_TARGET2 = 0x29, 712218893Sdim R_ARM_PREL31 = 0x2a, 713218893Sdim R_ARM_MOVW_ABS_NC = 0x2b, 714218893Sdim R_ARM_MOVT_ABS = 0x2c, 715218893Sdim R_ARM_MOVW_PREL_NC = 0x2d, 716218893Sdim R_ARM_MOVT_PREL = 0x2e, 717218893Sdim R_ARM_THM_MOVW_ABS_NC = 0x2f, 718218893Sdim R_ARM_THM_MOVT_ABS = 0x30, 719218893Sdim R_ARM_THM_MOVW_PREL_NC = 0x31, 720218893Sdim R_ARM_THM_MOVT_PREL = 0x32, 721218893Sdim R_ARM_THM_JUMP19 = 0x33, 722218893Sdim R_ARM_THM_JUMP6 = 0x34, 723218893Sdim R_ARM_THM_ALU_PREL_11_0 = 0x35, 724218893Sdim R_ARM_THM_PC12 = 0x36, 725218893Sdim R_ARM_ABS32_NOI = 0x37, 726218893Sdim R_ARM_REL32_NOI = 0x38, 727218893Sdim R_ARM_ALU_PC_G0_NC = 0x39, 728218893Sdim R_ARM_ALU_PC_G0 = 0x3a, 729218893Sdim R_ARM_ALU_PC_G1_NC = 0x3b, 730218893Sdim R_ARM_ALU_PC_G1 = 0x3c, 731218893Sdim R_ARM_ALU_PC_G2 = 0x3d, 732218893Sdim R_ARM_LDR_PC_G1 = 0x3e, 733218893Sdim R_ARM_LDR_PC_G2 = 0x3f, 734218893Sdim R_ARM_LDRS_PC_G0 = 0x40, 735218893Sdim R_ARM_LDRS_PC_G1 = 0x41, 736218893Sdim R_ARM_LDRS_PC_G2 = 0x42, 737218893Sdim R_ARM_LDC_PC_G0 = 0x43, 738218893Sdim R_ARM_LDC_PC_G1 = 0x44, 739218893Sdim R_ARM_LDC_PC_G2 = 0x45, 740218893Sdim R_ARM_ALU_SB_G0_NC = 0x46, 741218893Sdim R_ARM_ALU_SB_G0 = 0x47, 742218893Sdim R_ARM_ALU_SB_G1_NC = 0x48, 743218893Sdim R_ARM_ALU_SB_G1 = 0x49, 744218893Sdim R_ARM_ALU_SB_G2 = 0x4a, 745218893Sdim R_ARM_LDR_SB_G0 = 0x4b, 746218893Sdim R_ARM_LDR_SB_G1 = 0x4c, 747218893Sdim R_ARM_LDR_SB_G2 = 0x4d, 748218893Sdim R_ARM_LDRS_SB_G0 = 0x4e, 749218893Sdim R_ARM_LDRS_SB_G1 = 0x4f, 750218893Sdim R_ARM_LDRS_SB_G2 = 0x50, 751218893Sdim R_ARM_LDC_SB_G0 = 0x51, 752218893Sdim R_ARM_LDC_SB_G1 = 0x52, 753218893Sdim R_ARM_LDC_SB_G2 = 0x53, 754218893Sdim R_ARM_MOVW_BREL_NC = 0x54, 755218893Sdim R_ARM_MOVT_BREL = 0x55, 756218893Sdim R_ARM_MOVW_BREL = 0x56, 757218893Sdim R_ARM_THM_MOVW_BREL_NC = 0x57, 758218893Sdim R_ARM_THM_MOVT_BREL = 0x58, 759218893Sdim R_ARM_THM_MOVW_BREL = 0x59, 760218893Sdim R_ARM_TLS_GOTDESC = 0x5a, 761218893Sdim R_ARM_TLS_CALL = 0x5b, 762218893Sdim R_ARM_TLS_DESCSEQ = 0x5c, 763218893Sdim R_ARM_THM_TLS_CALL = 0x5d, 764218893Sdim R_ARM_PLT32_ABS = 0x5e, 765218893Sdim R_ARM_GOT_ABS = 0x5f, 766218893Sdim R_ARM_GOT_PREL = 0x60, 767218893Sdim R_ARM_GOT_BREL12 = 0x61, 768218893Sdim R_ARM_GOTOFF12 = 0x62, 769218893Sdim R_ARM_GOTRELAX = 0x63, 770218893Sdim R_ARM_GNU_VTENTRY = 0x64, 771218893Sdim R_ARM_GNU_VTINHERIT = 0x65, 772218893Sdim R_ARM_THM_JUMP11 = 0x66, 773218893Sdim R_ARM_THM_JUMP8 = 0x67, 774218893Sdim R_ARM_TLS_GD32 = 0x68, 775218893Sdim R_ARM_TLS_LDM32 = 0x69, 776218893Sdim R_ARM_TLS_LDO32 = 0x6a, 777218893Sdim R_ARM_TLS_IE32 = 0x6b, 778218893Sdim R_ARM_TLS_LE32 = 0x6c, 779218893Sdim R_ARM_TLS_LDO12 = 0x6d, 780218893Sdim R_ARM_TLS_LE12 = 0x6e, 781218893Sdim R_ARM_TLS_IE12GP = 0x6f, 782218893Sdim R_ARM_PRIVATE_0 = 0x70, 783218893Sdim R_ARM_PRIVATE_1 = 0x71, 784218893Sdim R_ARM_PRIVATE_2 = 0x72, 785218893Sdim R_ARM_PRIVATE_3 = 0x73, 786218893Sdim R_ARM_PRIVATE_4 = 0x74, 787218893Sdim R_ARM_PRIVATE_5 = 0x75, 788218893Sdim R_ARM_PRIVATE_6 = 0x76, 789218893Sdim R_ARM_PRIVATE_7 = 0x77, 790218893Sdim R_ARM_PRIVATE_8 = 0x78, 791218893Sdim R_ARM_PRIVATE_9 = 0x79, 792218893Sdim R_ARM_PRIVATE_10 = 0x7a, 793218893Sdim R_ARM_PRIVATE_11 = 0x7b, 794218893Sdim R_ARM_PRIVATE_12 = 0x7c, 795218893Sdim R_ARM_PRIVATE_13 = 0x7d, 796218893Sdim R_ARM_PRIVATE_14 = 0x7e, 797218893Sdim R_ARM_PRIVATE_15 = 0x7f, 798218893Sdim R_ARM_ME_TOO = 0x80, 799218893Sdim R_ARM_THM_TLS_DESCSEQ16 = 0x81, 800218893Sdim R_ARM_THM_TLS_DESCSEQ32 = 0x82 801218893Sdim}; 802218893Sdim 803234353Sdim// Mips Specific e_flags 804263508Sdimenum LLVM_ENUM_INT_TYPE(unsigned) { 805234353Sdim EF_MIPS_NOREORDER = 0x00000001, // Don't reorder instructions 806234353Sdim EF_MIPS_PIC = 0x00000002, // Position independent code 807234353Sdim EF_MIPS_CPIC = 0x00000004, // Call object with Position independent code 808249423Sdim EF_MIPS_ABI_O32 = 0x00001000, // This file follows the first MIPS 32 bit ABI 809249423Sdim 810249423Sdim //ARCH_ASE 811249423Sdim EF_MIPS_MICROMIPS = 0x02000000, // microMIPS 812249423Sdim EF_MIPS_ARCH_ASE_M16 = 813249423Sdim 0x04000000, // Has Mips-16 ISA extensions 814249423Sdim //ARCH 815234353Sdim EF_MIPS_ARCH_1 = 0x00000000, // MIPS1 instruction set 816234353Sdim EF_MIPS_ARCH_2 = 0x10000000, // MIPS2 instruction set 817234353Sdim EF_MIPS_ARCH_3 = 0x20000000, // MIPS3 instruction set 818234353Sdim EF_MIPS_ARCH_4 = 0x30000000, // MIPS4 instruction set 819234353Sdim EF_MIPS_ARCH_5 = 0x40000000, // MIPS5 instruction set 820234353Sdim EF_MIPS_ARCH_32 = 0x50000000, // MIPS32 instruction set per linux not elf.h 821234353Sdim EF_MIPS_ARCH_64 = 0x60000000, // MIPS64 instruction set per linux not elf.h 822234353Sdim EF_MIPS_ARCH_32R2 = 0x70000000, // mips32r2 823234353Sdim EF_MIPS_ARCH_64R2 = 0x80000000, // mips64r2 824234353Sdim EF_MIPS_ARCH = 0xf0000000 // Mask for applying EF_MIPS_ARCH_ variant 825234353Sdim}; 826234353Sdim 827226633Sdim// ELF Relocation types for Mips 828234353Sdim// . 829226633Sdimenum { 830226633Sdim R_MIPS_NONE = 0, 831226633Sdim R_MIPS_16 = 1, 832226633Sdim R_MIPS_32 = 2, 833226633Sdim R_MIPS_REL32 = 3, 834226633Sdim R_MIPS_26 = 4, 835226633Sdim R_MIPS_HI16 = 5, 836226633Sdim R_MIPS_LO16 = 6, 837226633Sdim R_MIPS_GPREL16 = 7, 838226633Sdim R_MIPS_LITERAL = 8, 839226633Sdim R_MIPS_GOT16 = 9, 840234353Sdim R_MIPS_GOT = 9, 841226633Sdim R_MIPS_PC16 = 10, 842226633Sdim R_MIPS_CALL16 = 11, 843226633Sdim R_MIPS_GPREL32 = 12, 844263508Sdim R_MIPS_UNUSED1 = 13, 845263508Sdim R_MIPS_UNUSED2 = 14, 846226633Sdim R_MIPS_SHIFT5 = 16, 847226633Sdim R_MIPS_SHIFT6 = 17, 848226633Sdim R_MIPS_64 = 18, 849226633Sdim R_MIPS_GOT_DISP = 19, 850226633Sdim R_MIPS_GOT_PAGE = 20, 851226633Sdim R_MIPS_GOT_OFST = 21, 852226633Sdim R_MIPS_GOT_HI16 = 22, 853226633Sdim R_MIPS_GOT_LO16 = 23, 854226633Sdim R_MIPS_SUB = 24, 855226633Sdim R_MIPS_INSERT_A = 25, 856226633Sdim R_MIPS_INSERT_B = 26, 857226633Sdim R_MIPS_DELETE = 27, 858226633Sdim R_MIPS_HIGHER = 28, 859226633Sdim R_MIPS_HIGHEST = 29, 860226633Sdim R_MIPS_CALL_HI16 = 30, 861226633Sdim R_MIPS_CALL_LO16 = 31, 862226633Sdim R_MIPS_SCN_DISP = 32, 863226633Sdim R_MIPS_REL16 = 33, 864226633Sdim R_MIPS_ADD_IMMEDIATE = 34, 865226633Sdim R_MIPS_PJUMP = 35, 866226633Sdim R_MIPS_RELGOT = 36, 867226633Sdim R_MIPS_JALR = 37, 868226633Sdim R_MIPS_TLS_DTPMOD32 = 38, 869226633Sdim R_MIPS_TLS_DTPREL32 = 39, 870226633Sdim R_MIPS_TLS_DTPMOD64 = 40, 871226633Sdim R_MIPS_TLS_DTPREL64 = 41, 872226633Sdim R_MIPS_TLS_GD = 42, 873226633Sdim R_MIPS_TLS_LDM = 43, 874226633Sdim R_MIPS_TLS_DTPREL_HI16 = 44, 875226633Sdim R_MIPS_TLS_DTPREL_LO16 = 45, 876226633Sdim R_MIPS_TLS_GOTTPREL = 46, 877226633Sdim R_MIPS_TLS_TPREL32 = 47, 878226633Sdim R_MIPS_TLS_TPREL64 = 48, 879226633Sdim R_MIPS_TLS_TPREL_HI16 = 49, 880226633Sdim R_MIPS_TLS_TPREL_LO16 = 50, 881226633Sdim R_MIPS_GLOB_DAT = 51, 882226633Sdim R_MIPS_COPY = 126, 883226633Sdim R_MIPS_JUMP_SLOT = 127, 884263508Sdim R_MICROMIPS_26_S1 = 133, 885263508Sdim R_MICROMIPS_HI16 = 134, 886263508Sdim R_MICROMIPS_LO16 = 135, 887263508Sdim R_MICROMIPS_GOT16 = 138, 888263508Sdim R_MICROMIPS_PC16_S1 = 141, 889263508Sdim R_MICROMIPS_CALL16 = 142, 890263508Sdim R_MICROMIPS_GOT_DISP = 145, 891263508Sdim R_MICROMIPS_GOT_PAGE = 146, 892263508Sdim R_MICROMIPS_GOT_OFST = 147, 893263508Sdim R_MICROMIPS_TLS_DTPREL_HI16 = 164, 894263508Sdim R_MICROMIPS_TLS_DTPREL_LO16 = 165, 895263508Sdim R_MICROMIPS_TLS_TPREL_HI16 = 169, 896263508Sdim R_MICROMIPS_TLS_TPREL_LO16 = 170, 897226633Sdim R_MIPS_NUM = 218 898226633Sdim}; 899218893Sdim 900249423Sdim// Special values for the st_other field in the symbol table entry for MIPS. 901249423Sdimenum { 902249423Sdim STO_MIPS_MICROMIPS = 0x80 // MIPS Specific ISA for MicroMips 903249423Sdim}; 904249423Sdim 905243830Sdim// Hexagon Specific e_flags 906243830Sdim// Release 5 ABI 907243830Sdimenum { 908243830Sdim // Object processor version flags, bits[3:0] 909243830Sdim EF_HEXAGON_MACH_V2 = 0x00000001, // Hexagon V2 910243830Sdim EF_HEXAGON_MACH_V3 = 0x00000002, // Hexagon V3 911243830Sdim EF_HEXAGON_MACH_V4 = 0x00000003, // Hexagon V4 912243830Sdim EF_HEXAGON_MACH_V5 = 0x00000004, // Hexagon V5 913243830Sdim 914243830Sdim // Highest ISA version flags 915243830Sdim EF_HEXAGON_ISA_MACH = 0x00000000, // Same as specified in bits[3:0] 916243830Sdim // of e_flags 917243830Sdim EF_HEXAGON_ISA_V2 = 0x00000010, // Hexagon V2 ISA 918243830Sdim EF_HEXAGON_ISA_V3 = 0x00000020, // Hexagon V3 ISA 919243830Sdim EF_HEXAGON_ISA_V4 = 0x00000030, // Hexagon V4 ISA 920243830Sdim EF_HEXAGON_ISA_V5 = 0x00000040 // Hexagon V5 ISA 921243830Sdim}; 922243830Sdim 923243830Sdim// Hexagon specific Section indexes for common small data 924249423Sdim// Release 5 ABI 925243830Sdimenum { 926243830Sdim SHN_HEXAGON_SCOMMON = 0xff00, // Other access sizes 927243830Sdim SHN_HEXAGON_SCOMMON_1 = 0xff01, // Byte-sized access 928243830Sdim SHN_HEXAGON_SCOMMON_2 = 0xff02, // Half-word-sized access 929243830Sdim SHN_HEXAGON_SCOMMON_4 = 0xff03, // Word-sized access 930243830Sdim SHN_HEXAGON_SCOMMON_8 = 0xff04 // Double-word-size access 931249423Sdim}; 932243830Sdim 933239462Sdim// ELF Relocation types for Hexagon 934243830Sdim// Release 5 ABI 935239462Sdimenum { 936239462Sdim R_HEX_NONE = 0, 937239462Sdim R_HEX_B22_PCREL = 1, 938239462Sdim R_HEX_B15_PCREL = 2, 939239462Sdim R_HEX_B7_PCREL = 3, 940239462Sdim R_HEX_LO16 = 4, 941239462Sdim R_HEX_HI16 = 5, 942239462Sdim R_HEX_32 = 6, 943239462Sdim R_HEX_16 = 7, 944239462Sdim R_HEX_8 = 8, 945239462Sdim R_HEX_GPREL16_0 = 9, 946239462Sdim R_HEX_GPREL16_1 = 10, 947239462Sdim R_HEX_GPREL16_2 = 11, 948239462Sdim R_HEX_GPREL16_3 = 12, 949239462Sdim R_HEX_HL16 = 13, 950239462Sdim R_HEX_B13_PCREL = 14, 951239462Sdim R_HEX_B9_PCREL = 15, 952239462Sdim R_HEX_B32_PCREL_X = 16, 953239462Sdim R_HEX_32_6_X = 17, 954239462Sdim R_HEX_B22_PCREL_X = 18, 955239462Sdim R_HEX_B15_PCREL_X = 19, 956239462Sdim R_HEX_B13_PCREL_X = 20, 957239462Sdim R_HEX_B9_PCREL_X = 21, 958239462Sdim R_HEX_B7_PCREL_X = 22, 959239462Sdim R_HEX_16_X = 23, 960239462Sdim R_HEX_12_X = 24, 961239462Sdim R_HEX_11_X = 25, 962239462Sdim R_HEX_10_X = 26, 963239462Sdim R_HEX_9_X = 27, 964239462Sdim R_HEX_8_X = 28, 965239462Sdim R_HEX_7_X = 29, 966239462Sdim R_HEX_6_X = 30, 967239462Sdim R_HEX_32_PCREL = 31, 968239462Sdim R_HEX_COPY = 32, 969239462Sdim R_HEX_GLOB_DAT = 33, 970239462Sdim R_HEX_JMP_SLOT = 34, 971239462Sdim R_HEX_RELATIVE = 35, 972239462Sdim R_HEX_PLT_B22_PCREL = 36, 973239462Sdim R_HEX_GOTREL_LO16 = 37, 974239462Sdim R_HEX_GOTREL_HI16 = 38, 975239462Sdim R_HEX_GOTREL_32 = 39, 976239462Sdim R_HEX_GOT_LO16 = 40, 977239462Sdim R_HEX_GOT_HI16 = 41, 978239462Sdim R_HEX_GOT_32 = 42, 979239462Sdim R_HEX_GOT_16 = 43, 980239462Sdim R_HEX_DTPMOD_32 = 44, 981239462Sdim R_HEX_DTPREL_LO16 = 45, 982239462Sdim R_HEX_DTPREL_HI16 = 46, 983239462Sdim R_HEX_DTPREL_32 = 47, 984239462Sdim R_HEX_DTPREL_16 = 48, 985239462Sdim R_HEX_GD_PLT_B22_PCREL = 49, 986239462Sdim R_HEX_GD_GOT_LO16 = 50, 987239462Sdim R_HEX_GD_GOT_HI16 = 51, 988239462Sdim R_HEX_GD_GOT_32 = 52, 989239462Sdim R_HEX_GD_GOT_16 = 53, 990239462Sdim R_HEX_IE_LO16 = 54, 991239462Sdim R_HEX_IE_HI16 = 55, 992239462Sdim R_HEX_IE_32 = 56, 993239462Sdim R_HEX_IE_GOT_LO16 = 57, 994239462Sdim R_HEX_IE_GOT_HI16 = 58, 995239462Sdim R_HEX_IE_GOT_32 = 59, 996239462Sdim R_HEX_IE_GOT_16 = 60, 997239462Sdim R_HEX_TPREL_LO16 = 61, 998239462Sdim R_HEX_TPREL_HI16 = 62, 999239462Sdim R_HEX_TPREL_32 = 63, 1000239462Sdim R_HEX_TPREL_16 = 64, 1001239462Sdim R_HEX_6_PCREL_X = 65, 1002239462Sdim R_HEX_GOTREL_32_6_X = 66, 1003239462Sdim R_HEX_GOTREL_16_X = 67, 1004239462Sdim R_HEX_GOTREL_11_X = 68, 1005239462Sdim R_HEX_GOT_32_6_X = 69, 1006239462Sdim R_HEX_GOT_16_X = 70, 1007239462Sdim R_HEX_GOT_11_X = 71, 1008239462Sdim R_HEX_DTPREL_32_6_X = 72, 1009239462Sdim R_HEX_DTPREL_16_X = 73, 1010239462Sdim R_HEX_DTPREL_11_X = 74, 1011239462Sdim R_HEX_GD_GOT_32_6_X = 75, 1012239462Sdim R_HEX_GD_GOT_16_X = 76, 1013239462Sdim R_HEX_GD_GOT_11_X = 77, 1014239462Sdim R_HEX_IE_32_6_X = 78, 1015239462Sdim R_HEX_IE_16_X = 79, 1016239462Sdim R_HEX_IE_GOT_32_6_X = 80, 1017239462Sdim R_HEX_IE_GOT_16_X = 81, 1018239462Sdim R_HEX_IE_GOT_11_X = 82, 1019239462Sdim R_HEX_TPREL_32_6_X = 83, 1020239462Sdim R_HEX_TPREL_16_X = 84, 1021239462Sdim R_HEX_TPREL_11_X = 85 1022239462Sdim}; 1023239462Sdim 1024251662Sdim// ELF Relocation types for S390/zSeries 1025251662Sdimenum { 1026251662Sdim R_390_NONE = 0, 1027251662Sdim R_390_8 = 1, 1028251662Sdim R_390_12 = 2, 1029251662Sdim R_390_16 = 3, 1030251662Sdim R_390_32 = 4, 1031251662Sdim R_390_PC32 = 5, 1032251662Sdim R_390_GOT12 = 6, 1033251662Sdim R_390_GOT32 = 7, 1034251662Sdim R_390_PLT32 = 8, 1035251662Sdim R_390_COPY = 9, 1036251662Sdim R_390_GLOB_DAT = 10, 1037251662Sdim R_390_JMP_SLOT = 11, 1038251662Sdim R_390_RELATIVE = 12, 1039251662Sdim R_390_GOTOFF = 13, 1040251662Sdim R_390_GOTPC = 14, 1041251662Sdim R_390_GOT16 = 15, 1042251662Sdim R_390_PC16 = 16, 1043251662Sdim R_390_PC16DBL = 17, 1044251662Sdim R_390_PLT16DBL = 18, 1045251662Sdim R_390_PC32DBL = 19, 1046251662Sdim R_390_PLT32DBL = 20, 1047251662Sdim R_390_GOTPCDBL = 21, 1048251662Sdim R_390_64 = 22, 1049251662Sdim R_390_PC64 = 23, 1050251662Sdim R_390_GOT64 = 24, 1051251662Sdim R_390_PLT64 = 25, 1052251662Sdim R_390_GOTENT = 26, 1053251662Sdim R_390_GOTOFF16 = 27, 1054251662Sdim R_390_GOTOFF64 = 28, 1055251662Sdim R_390_GOTPLT12 = 29, 1056251662Sdim R_390_GOTPLT16 = 30, 1057251662Sdim R_390_GOTPLT32 = 31, 1058251662Sdim R_390_GOTPLT64 = 32, 1059251662Sdim R_390_GOTPLTENT = 33, 1060251662Sdim R_390_PLTOFF16 = 34, 1061251662Sdim R_390_PLTOFF32 = 35, 1062251662Sdim R_390_PLTOFF64 = 36, 1063251662Sdim R_390_TLS_LOAD = 37, 1064251662Sdim R_390_TLS_GDCALL = 38, 1065251662Sdim R_390_TLS_LDCALL = 39, 1066251662Sdim R_390_TLS_GD32 = 40, 1067251662Sdim R_390_TLS_GD64 = 41, 1068251662Sdim R_390_TLS_GOTIE12 = 42, 1069251662Sdim R_390_TLS_GOTIE32 = 43, 1070251662Sdim R_390_TLS_GOTIE64 = 44, 1071251662Sdim R_390_TLS_LDM32 = 45, 1072251662Sdim R_390_TLS_LDM64 = 46, 1073251662Sdim R_390_TLS_IE32 = 47, 1074251662Sdim R_390_TLS_IE64 = 48, 1075251662Sdim R_390_TLS_IEENT = 49, 1076251662Sdim R_390_TLS_LE32 = 50, 1077251662Sdim R_390_TLS_LE64 = 51, 1078251662Sdim R_390_TLS_LDO32 = 52, 1079251662Sdim R_390_TLS_LDO64 = 53, 1080251662Sdim R_390_TLS_DTPMOD = 54, 1081251662Sdim R_390_TLS_DTPOFF = 55, 1082251662Sdim R_390_TLS_TPOFF = 56, 1083251662Sdim R_390_20 = 57, 1084251662Sdim R_390_GOT20 = 58, 1085251662Sdim R_390_GOTPLT20 = 59, 1086251662Sdim R_390_TLS_GOTIE20 = 60, 1087251662Sdim R_390_IRELATIVE = 61 1088251662Sdim}; 1089251662Sdim 1090263763Sdim// ELF Relocation type for Sparc. 1091263763Sdimenum { 1092263763Sdim R_SPARC_NONE = 0, 1093263763Sdim R_SPARC_8 = 1, 1094263763Sdim R_SPARC_16 = 2, 1095263763Sdim R_SPARC_32 = 3, 1096263763Sdim R_SPARC_DISP8 = 4, 1097263763Sdim R_SPARC_DISP16 = 5, 1098263763Sdim R_SPARC_DISP32 = 6, 1099263763Sdim R_SPARC_WDISP30 = 7, 1100263763Sdim R_SPARC_WDISP22 = 8, 1101263763Sdim R_SPARC_HI22 = 9, 1102263763Sdim R_SPARC_22 = 10, 1103263763Sdim R_SPARC_13 = 11, 1104263763Sdim R_SPARC_LO10 = 12, 1105263763Sdim R_SPARC_GOT10 = 13, 1106263763Sdim R_SPARC_GOT13 = 14, 1107263763Sdim R_SPARC_GOT22 = 15, 1108263763Sdim R_SPARC_PC10 = 16, 1109263763Sdim R_SPARC_PC22 = 17, 1110263763Sdim R_SPARC_WPLT30 = 18, 1111263763Sdim R_SPARC_COPY = 19, 1112263763Sdim R_SPARC_GLOB_DAT = 20, 1113263763Sdim R_SPARC_JMP_SLOT = 21, 1114263763Sdim R_SPARC_RELATIVE = 22, 1115263763Sdim R_SPARC_UA32 = 23, 1116263763Sdim R_SPARC_PLT32 = 24, 1117263763Sdim R_SPARC_HIPLT22 = 25, 1118263763Sdim R_SPARC_LOPLT10 = 26, 1119263763Sdim R_SPARC_PCPLT32 = 27, 1120263763Sdim R_SPARC_PCPLT22 = 28, 1121263763Sdim R_SPARC_PCPLT10 = 29, 1122263763Sdim R_SPARC_10 = 30, 1123263763Sdim R_SPARC_11 = 31, 1124263763Sdim R_SPARC_64 = 32, 1125263763Sdim R_SPARC_OLO10 = 33, 1126263763Sdim R_SPARC_HH22 = 34, 1127263763Sdim R_SPARC_HM10 = 35, 1128263763Sdim R_SPARC_LM22 = 36, 1129263763Sdim R_SPARC_PC_HH22 = 37, 1130263763Sdim R_SPARC_PC_HM10 = 38, 1131263763Sdim R_SPARC_PC_LM22 = 39, 1132263763Sdim R_SPARC_WDISP16 = 40, 1133263763Sdim R_SPARC_WDISP19 = 41, 1134263763Sdim R_SPARC_7 = 43, 1135263763Sdim R_SPARC_5 = 44, 1136263763Sdim R_SPARC_6 = 45, 1137263763Sdim R_SPARC_DISP64 = 46, 1138263763Sdim R_SPARC_PLT64 = 47, 1139263763Sdim R_SPARC_HIX22 = 48, 1140263763Sdim R_SPARC_LOX10 = 49, 1141263763Sdim R_SPARC_H44 = 50, 1142263763Sdim R_SPARC_M44 = 51, 1143263763Sdim R_SPARC_L44 = 52, 1144263763Sdim R_SPARC_REGISTER = 53, 1145263763Sdim R_SPARC_UA64 = 54, 1146263763Sdim R_SPARC_UA16 = 55, 1147263763Sdim R_SPARC_TLS_GD_HI22 = 56, 1148263763Sdim R_SPARC_TLS_GD_LO10 = 57, 1149263763Sdim R_SPARC_TLS_GD_ADD = 58, 1150263763Sdim R_SPARC_TLS_GD_CALL = 59, 1151263763Sdim R_SPARC_TLS_LDM_HI22 = 60, 1152263763Sdim R_SPARC_TLS_LDM_LO10 = 61, 1153263763Sdim R_SPARC_TLS_LDM_ADD = 62, 1154263763Sdim R_SPARC_TLS_LDM_CALL = 63, 1155263763Sdim R_SPARC_TLS_LDO_HIX22 = 64, 1156263763Sdim R_SPARC_TLS_LDO_LOX10 = 65, 1157263763Sdim R_SPARC_TLS_LDO_ADD = 66, 1158263763Sdim R_SPARC_TLS_IE_HI22 = 67, 1159263763Sdim R_SPARC_TLS_IE_LO10 = 68, 1160263763Sdim R_SPARC_TLS_IE_LD = 69, 1161263763Sdim R_SPARC_TLS_IE_LDX = 70, 1162263763Sdim R_SPARC_TLS_IE_ADD = 71, 1163263763Sdim R_SPARC_TLS_LE_HIX22 = 72, 1164263763Sdim R_SPARC_TLS_LE_LOX10 = 73, 1165263763Sdim R_SPARC_TLS_DTPMOD32 = 74, 1166263763Sdim R_SPARC_TLS_DTPMOD64 = 75, 1167263763Sdim R_SPARC_TLS_DTPOFF32 = 76, 1168263763Sdim R_SPARC_TLS_DTPOFF64 = 77, 1169263763Sdim R_SPARC_TLS_TPOFF32 = 78, 1170263763Sdim R_SPARC_TLS_TPOFF64 = 79, 1171263763Sdim R_SPARC_GOTDATA_HIX22 = 80, 1172263763Sdim R_SPARC_GOTDATA_LOX22 = 81, 1173263763Sdim R_SPARC_GOTDATA_OP_HIX22 = 82, 1174263763Sdim R_SPARC_GOTDATA_OP_LOX22 = 83, 1175263763Sdim R_SPARC_GOTDATA_OP = 84 1176263763Sdim}; 1177263763Sdim 1178193323Sed// Section header. 1179193323Sedstruct Elf32_Shdr { 1180193323Sed Elf32_Word sh_name; // Section name (index into string table) 1181193323Sed Elf32_Word sh_type; // Section type (SHT_*) 1182193323Sed Elf32_Word sh_flags; // Section flags (SHF_*) 1183193323Sed Elf32_Addr sh_addr; // Address where section is to be loaded 1184193323Sed Elf32_Off sh_offset; // File offset of section data, in bytes 1185193323Sed Elf32_Word sh_size; // Size of section, in bytes 1186193323Sed Elf32_Word sh_link; // Section type-specific header table index link 1187193323Sed Elf32_Word sh_info; // Section type-specific extra information 1188193323Sed Elf32_Word sh_addralign; // Section address alignment 1189193323Sed Elf32_Word sh_entsize; // Size of records contained within the section 1190193323Sed}; 1191193323Sed 1192193323Sed// Section header for ELF64 - same fields as ELF32, different types. 1193193323Sedstruct Elf64_Shdr { 1194226633Sdim Elf64_Word sh_name; 1195226633Sdim Elf64_Word sh_type; 1196193323Sed Elf64_Xword sh_flags; 1197193323Sed Elf64_Addr sh_addr; 1198193323Sed Elf64_Off sh_offset; 1199193323Sed Elf64_Xword sh_size; 1200226633Sdim Elf64_Word sh_link; 1201226633Sdim Elf64_Word sh_info; 1202193323Sed Elf64_Xword sh_addralign; 1203193323Sed Elf64_Xword sh_entsize; 1204193323Sed}; 1205193323Sed 1206193323Sed// Special section indices. 1207193323Sedenum { 1208193323Sed SHN_UNDEF = 0, // Undefined, missing, irrelevant, or meaningless 1209193323Sed SHN_LORESERVE = 0xff00, // Lowest reserved index 1210193323Sed SHN_LOPROC = 0xff00, // Lowest processor-specific index 1211193323Sed SHN_HIPROC = 0xff1f, // Highest processor-specific index 1212226633Sdim SHN_LOOS = 0xff20, // Lowest operating system-specific index 1213226633Sdim SHN_HIOS = 0xff3f, // Highest operating system-specific index 1214193323Sed SHN_ABS = 0xfff1, // Symbol has absolute value; does not need relocation 1215193323Sed SHN_COMMON = 0xfff2, // FORTRAN COMMON or C external global variables 1216218893Sdim SHN_XINDEX = 0xffff, // Mark that the index is >= SHN_LORESERVE 1217193323Sed SHN_HIRESERVE = 0xffff // Highest reserved index 1218193323Sed}; 1219193323Sed 1220193323Sed// Section types. 1221263508Sdimenum LLVM_ENUM_INT_TYPE(unsigned) { 1222212904Sdim SHT_NULL = 0, // No associated section (inactive entry). 1223212904Sdim SHT_PROGBITS = 1, // Program-defined contents. 1224212904Sdim SHT_SYMTAB = 2, // Symbol table. 1225212904Sdim SHT_STRTAB = 3, // String table. 1226212904Sdim SHT_RELA = 4, // Relocation entries; explicit addends. 1227212904Sdim SHT_HASH = 5, // Symbol hash table. 1228212904Sdim SHT_DYNAMIC = 6, // Information for dynamic linking. 1229212904Sdim SHT_NOTE = 7, // Information about the file. 1230212904Sdim SHT_NOBITS = 8, // Data occupies no space in the file. 1231212904Sdim SHT_REL = 9, // Relocation entries; no explicit addends. 1232212904Sdim SHT_SHLIB = 10, // Reserved. 1233212904Sdim SHT_DYNSYM = 11, // Symbol table. 1234224145Sdim SHT_INIT_ARRAY = 14, // Pointers to initialization functions. 1235212904Sdim SHT_FINI_ARRAY = 15, // Pointers to termination functions. 1236212904Sdim SHT_PREINIT_ARRAY = 16, // Pointers to pre-init functions. 1237212904Sdim SHT_GROUP = 17, // Section group. 1238224145Sdim SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries. 1239212904Sdim SHT_LOOS = 0x60000000, // Lowest operating system-specific type. 1240239462Sdim SHT_GNU_ATTRIBUTES= 0x6ffffff5, // Object attributes. 1241239462Sdim SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table. 1242234353Sdim SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions. 1243234353Sdim SHT_GNU_verneed = 0x6ffffffe, // GNU version references. 1244234353Sdim SHT_GNU_versym = 0x6fffffff, // GNU symbol versions table. 1245212904Sdim SHT_HIOS = 0x6fffffff, // Highest operating system-specific type. 1246249423Sdim SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type. 1247218893Sdim // Fixme: All this is duplicated in MCSectionELF. Why?? 1248218893Sdim // Exception Index table 1249218893Sdim SHT_ARM_EXIDX = 0x70000001U, 1250218893Sdim // BPABI DLL dynamic linking pre-emption map 1251218893Sdim SHT_ARM_PREEMPTMAP = 0x70000002U, 1252218893Sdim // Object file compatibility attributes 1253218893Sdim SHT_ARM_ATTRIBUTES = 0x70000003U, 1254218893Sdim SHT_ARM_DEBUGOVERLAY = 0x70000004U, 1255218893Sdim SHT_ARM_OVERLAYSECTION = 0x70000005U, 1256249423Sdim SHT_HEX_ORDERED = 0x70000000, // Link editor is to sort the entries in 1257249423Sdim // this section based on their sizes 1258218893Sdim SHT_X86_64_UNWIND = 0x70000001, // Unwind information 1259218893Sdim 1260249423Sdim SHT_MIPS_REGINFO = 0x70000006, // Register usage information 1261249423Sdim SHT_MIPS_OPTIONS = 0x7000000d, // General options 1262249423Sdim 1263249423Sdim SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type. 1264212904Sdim SHT_LOUSER = 0x80000000, // Lowest type reserved for applications. 1265212904Sdim SHT_HIUSER = 0xffffffff // Highest type reserved for applications. 1266193323Sed}; 1267193323Sed 1268193323Sed// Section flags. 1269263508Sdimenum LLVM_ENUM_INT_TYPE(unsigned) { 1270218893Sdim // Section data should be writable during execution. 1271218893Sdim SHF_WRITE = 0x1, 1272218893Sdim 1273218893Sdim // Section occupies memory during program execution. 1274218893Sdim SHF_ALLOC = 0x2, 1275218893Sdim 1276218893Sdim // Section contains executable machine instructions. 1277218893Sdim SHF_EXECINSTR = 0x4, 1278218893Sdim 1279218893Sdim // The data in this section may be merged. 1280218893Sdim SHF_MERGE = 0x10, 1281218893Sdim 1282218893Sdim // The data in this section is null-terminated strings. 1283218893Sdim SHF_STRINGS = 0x20, 1284218893Sdim 1285218893Sdim // A field in this section holds a section header table index. 1286218893Sdim SHF_INFO_LINK = 0x40U, 1287218893Sdim 1288218893Sdim // Adds special ordering requirements for link editors. 1289218893Sdim SHF_LINK_ORDER = 0x80U, 1290218893Sdim 1291218893Sdim // This section requires special OS-specific processing to avoid incorrect 1292218893Sdim // behavior. 1293218893Sdim SHF_OS_NONCONFORMING = 0x100U, 1294218893Sdim 1295218893Sdim // This section is a member of a section group. 1296218893Sdim SHF_GROUP = 0x200U, 1297218893Sdim 1298218893Sdim // This section holds Thread-Local Storage. 1299218893Sdim SHF_TLS = 0x400U, 1300218893Sdim 1301263508Sdim // This section is excluded from the final executable or shared library. 1302263508Sdim SHF_EXCLUDE = 0x80000000U, 1303263508Sdim 1304218893Sdim // Start of target-specific flags. 1305218893Sdim 1306218893Sdim /// XCORE_SHF_CP_SECTION - All sections with the "c" flag are grouped 1307218893Sdim /// together by the linker to form the constant pool and the cp register is 1308218893Sdim /// set to the start of the constant pool by the boot code. 1309218893Sdim XCORE_SHF_CP_SECTION = 0x800U, 1310218893Sdim 1311218893Sdim /// XCORE_SHF_DP_SECTION - All sections with the "d" flag are grouped 1312218893Sdim /// together by the linker to form the data section and the dp register is 1313218893Sdim /// set to the start of the section by the boot code. 1314218893Sdim XCORE_SHF_DP_SECTION = 0x1000U, 1315218893Sdim 1316226633Sdim SHF_MASKOS = 0x0ff00000, 1317226633Sdim 1318218893Sdim // Bits indicating processor-specific flags. 1319226633Sdim SHF_MASKPROC = 0xf0000000, 1320226633Sdim 1321226633Sdim // If an object file section does not have this flag set, then it may not hold 1322226633Sdim // more than 2GB and can be freely referred to in objects using smaller code 1323226633Sdim // models. Otherwise, only objects using larger code models can refer to them. 1324226633Sdim // For example, a medium code model object can refer to data in a section that 1325226633Sdim // sets this flag besides being able to refer to data in a section that does 1326226633Sdim // not set it; likewise, a small code model object can refer only to code in a 1327226633Sdim // section that does not set this flag. 1328249423Sdim SHF_X86_64_LARGE = 0x10000000, 1329249423Sdim 1330249423Sdim // All sections with the GPREL flag are grouped into a global data area 1331249423Sdim // for faster accesses 1332249423Sdim SHF_HEX_GPREL = 0x10000000, 1333249423Sdim 1334263508Sdim // Section contains text/data which may be replicated in other sections. 1335263508Sdim // Linker must retain only one copy. 1336263508Sdim SHF_MIPS_NODUPES = 0x01000000, 1337263508Sdim 1338263508Sdim // Linker must generate implicit hidden weak names. 1339263508Sdim SHF_MIPS_NAMES = 0x02000000, 1340263508Sdim 1341263508Sdim // Section data local to process. 1342263508Sdim SHF_MIPS_LOCAL = 0x04000000, 1343263508Sdim 1344263508Sdim // Do not strip this section. 1345263508Sdim SHF_MIPS_NOSTRIP = 0x08000000, 1346263508Sdim 1347263508Sdim // Section must be part of global data area. 1348263508Sdim SHF_MIPS_GPREL = 0x10000000, 1349263508Sdim 1350263508Sdim // This section should be merged. 1351263508Sdim SHF_MIPS_MERGE = 0x20000000, 1352263508Sdim 1353263508Sdim // Address size to be inferred from section entry size. 1354263508Sdim SHF_MIPS_ADDR = 0x40000000, 1355263508Sdim 1356263508Sdim // Section data is string data by default. 1357263508Sdim SHF_MIPS_STRING = 0x80000000 1358193323Sed}; 1359193323Sed 1360218893Sdim// Section Group Flags 1361263508Sdimenum LLVM_ENUM_INT_TYPE(unsigned) { 1362218893Sdim GRP_COMDAT = 0x1, 1363218893Sdim GRP_MASKOS = 0x0ff00000, 1364218893Sdim GRP_MASKPROC = 0xf0000000 1365218893Sdim}; 1366218893Sdim 1367210299Sed// Symbol table entries for ELF32. 1368193323Sedstruct Elf32_Sym { 1369193323Sed Elf32_Word st_name; // Symbol name (index into string table) 1370193323Sed Elf32_Addr st_value; // Value or address associated with the symbol 1371193323Sed Elf32_Word st_size; // Size of the symbol 1372193323Sed unsigned char st_info; // Symbol's type and binding attributes 1373193323Sed unsigned char st_other; // Must be zero; reserved 1374193323Sed Elf32_Half st_shndx; // Which section (header table index) it's defined in 1375193323Sed 1376193323Sed // These accessors and mutators correspond to the ELF32_ST_BIND, 1377193323Sed // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification: 1378210299Sed unsigned char getBinding() const { return st_info >> 4; } 1379210299Sed unsigned char getType() const { return st_info & 0x0f; } 1380210299Sed void setBinding(unsigned char b) { setBindingAndType(b, getType()); } 1381210299Sed void setType(unsigned char t) { setBindingAndType(getBinding(), t); } 1382210299Sed void setBindingAndType(unsigned char b, unsigned char t) { 1383193323Sed st_info = (b << 4) + (t & 0x0f); 1384193323Sed } 1385193323Sed}; 1386193323Sed 1387210299Sed// Symbol table entries for ELF64. 1388210299Sedstruct Elf64_Sym { 1389210299Sed Elf64_Word st_name; // Symbol name (index into string table) 1390210299Sed unsigned char st_info; // Symbol's type and binding attributes 1391210299Sed unsigned char st_other; // Must be zero; reserved 1392249423Sdim Elf64_Half st_shndx; // Which section (header tbl index) it's defined in 1393210299Sed Elf64_Addr st_value; // Value or address associated with the symbol 1394210299Sed Elf64_Xword st_size; // Size of the symbol 1395210299Sed 1396210299Sed // These accessors and mutators are identical to those defined for ELF32 1397210299Sed // symbol table entries. 1398210299Sed unsigned char getBinding() const { return st_info >> 4; } 1399210299Sed unsigned char getType() const { return st_info & 0x0f; } 1400210299Sed void setBinding(unsigned char b) { setBindingAndType(b, getType()); } 1401210299Sed void setType(unsigned char t) { setBindingAndType(getBinding(), t); } 1402210299Sed void setBindingAndType(unsigned char b, unsigned char t) { 1403210299Sed st_info = (b << 4) + (t & 0x0f); 1404210299Sed } 1405210299Sed}; 1406210299Sed 1407212904Sdim// The size (in bytes) of symbol table entries. 1408212904Sdimenum { 1409212904Sdim SYMENTRY_SIZE32 = 16, // 32-bit symbol entry size 1410212904Sdim SYMENTRY_SIZE64 = 24 // 64-bit symbol entry size. 1411212904Sdim}; 1412212904Sdim 1413193323Sed// Symbol bindings. 1414193323Sedenum { 1415193323Sed STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def 1416193323Sed STB_GLOBAL = 1, // Global symbol, visible to all object files being combined 1417193323Sed STB_WEAK = 2, // Weak symbol, like global but lower-precedence 1418226633Sdim STB_LOOS = 10, // Lowest operating system-specific binding type 1419226633Sdim STB_HIOS = 12, // Highest operating system-specific binding type 1420193323Sed STB_LOPROC = 13, // Lowest processor-specific binding type 1421193323Sed STB_HIPROC = 15 // Highest processor-specific binding type 1422193323Sed}; 1423193323Sed 1424193323Sed// Symbol types. 1425193323Sedenum { 1426193323Sed STT_NOTYPE = 0, // Symbol's type is not specified 1427193323Sed STT_OBJECT = 1, // Symbol is a data object (variable, array, etc.) 1428193323Sed STT_FUNC = 2, // Symbol is executable code (function, etc.) 1429193323Sed STT_SECTION = 3, // Symbol refers to a section 1430193323Sed STT_FILE = 4, // Local, absolute symbol that refers to a file 1431224145Sdim STT_COMMON = 5, // An uninitialized common block 1432212904Sdim STT_TLS = 6, // Thread local data object 1433226633Sdim STT_LOOS = 7, // Lowest operating system-specific symbol type 1434226633Sdim STT_HIOS = 8, // Highest operating system-specific symbol type 1435234353Sdim STT_GNU_IFUNC = 10, // GNU indirect function 1436193323Sed STT_LOPROC = 13, // Lowest processor-specific symbol type 1437193323Sed STT_HIPROC = 15 // Highest processor-specific symbol type 1438193323Sed}; 1439193323Sed 1440212904Sdimenum { 1441212904Sdim STV_DEFAULT = 0, // Visibility is specified by binding type 1442212904Sdim STV_INTERNAL = 1, // Defined by processor supplements 1443212904Sdim STV_HIDDEN = 2, // Not visible to other components 1444212904Sdim STV_PROTECTED = 3 // Visible in other components but not preemptable 1445212904Sdim}; 1446212904Sdim 1447249423Sdim// Symbol number. 1448249423Sdimenum { 1449249423Sdim STN_UNDEF = 0 1450249423Sdim}; 1451249423Sdim 1452193323Sed// Relocation entry, without explicit addend. 1453193323Sedstruct Elf32_Rel { 1454193323Sed Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr) 1455193323Sed Elf32_Word r_info; // Symbol table index and type of relocation to apply 1456193323Sed 1457193323Sed // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE, 1458193323Sed // and ELF32_R_INFO macros defined in the ELF specification: 1459210299Sed Elf32_Word getSymbol() const { return (r_info >> 8); } 1460210299Sed unsigned char getType() const { return (unsigned char) (r_info & 0x0ff); } 1461210299Sed void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); } 1462210299Sed void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); } 1463210299Sed void setSymbolAndType(Elf32_Word s, unsigned char t) { 1464193323Sed r_info = (s << 8) + t; 1465212904Sdim } 1466193323Sed}; 1467193323Sed 1468193323Sed// Relocation entry with explicit addend. 1469193323Sedstruct Elf32_Rela { 1470193323Sed Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr) 1471193323Sed Elf32_Word r_info; // Symbol table index and type of relocation to apply 1472193323Sed Elf32_Sword r_addend; // Compute value for relocatable field by adding this 1473193323Sed 1474193323Sed // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE, 1475193323Sed // and ELF32_R_INFO macros defined in the ELF specification: 1476210299Sed Elf32_Word getSymbol() const { return (r_info >> 8); } 1477210299Sed unsigned char getType() const { return (unsigned char) (r_info & 0x0ff); } 1478210299Sed void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); } 1479210299Sed void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); } 1480210299Sed void setSymbolAndType(Elf32_Word s, unsigned char t) { 1481193323Sed r_info = (s << 8) + t; 1482212904Sdim } 1483193323Sed}; 1484193323Sed 1485210299Sed// Relocation entry, without explicit addend. 1486210299Sedstruct Elf64_Rel { 1487210299Sed Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr). 1488210299Sed Elf64_Xword r_info; // Symbol table index and type of relocation to apply. 1489210299Sed 1490210299Sed // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE, 1491210299Sed // and ELF64_R_INFO macros defined in the ELF specification: 1492249423Sdim Elf64_Word getSymbol() const { return (r_info >> 32); } 1493249423Sdim Elf64_Word getType() const { 1494249423Sdim return (Elf64_Word) (r_info & 0xffffffffL); 1495210299Sed } 1496249423Sdim void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); } 1497249423Sdim void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); } 1498249423Sdim void setSymbolAndType(Elf64_Word s, Elf64_Word t) { 1499249423Sdim r_info = ((Elf64_Xword)s << 32) + (t&0xffffffffL); 1500212904Sdim } 1501210299Sed}; 1502210299Sed 1503210299Sed// Relocation entry with explicit addend. 1504210299Sedstruct Elf64_Rela { 1505210299Sed Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr). 1506210299Sed Elf64_Xword r_info; // Symbol table index and type of relocation to apply. 1507210299Sed Elf64_Sxword r_addend; // Compute value for relocatable field by adding this. 1508210299Sed 1509210299Sed // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE, 1510210299Sed // and ELF64_R_INFO macros defined in the ELF specification: 1511249423Sdim Elf64_Word getSymbol() const { return (r_info >> 32); } 1512249423Sdim Elf64_Word getType() const { 1513249423Sdim return (Elf64_Word) (r_info & 0xffffffffL); 1514210299Sed } 1515249423Sdim void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); } 1516249423Sdim void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); } 1517249423Sdim void setSymbolAndType(Elf64_Word s, Elf64_Word t) { 1518249423Sdim r_info = ((Elf64_Xword)s << 32) + (t&0xffffffffL); 1519212904Sdim } 1520210299Sed}; 1521210299Sed 1522210299Sed// Program header for ELF32. 1523193323Sedstruct Elf32_Phdr { 1524193323Sed Elf32_Word p_type; // Type of segment 1525193323Sed Elf32_Off p_offset; // File offset where segment is located, in bytes 1526193323Sed Elf32_Addr p_vaddr; // Virtual address of beginning of segment 1527193323Sed Elf32_Addr p_paddr; // Physical address of beginning of segment (OS-specific) 1528193323Sed Elf32_Word p_filesz; // Num. of bytes in file image of segment (may be zero) 1529193323Sed Elf32_Word p_memsz; // Num. of bytes in mem image of segment (may be zero) 1530193323Sed Elf32_Word p_flags; // Segment flags 1531193323Sed Elf32_Word p_align; // Segment alignment constraint 1532193323Sed}; 1533193323Sed 1534210299Sed// Program header for ELF64. 1535210299Sedstruct Elf64_Phdr { 1536210299Sed Elf64_Word p_type; // Type of segment 1537210299Sed Elf64_Word p_flags; // Segment flags 1538210299Sed Elf64_Off p_offset; // File offset where segment is located, in bytes 1539210299Sed Elf64_Addr p_vaddr; // Virtual address of beginning of segment 1540249423Sdim Elf64_Addr p_paddr; // Physical addr of beginning of segment (OS-specific) 1541210299Sed Elf64_Xword p_filesz; // Num. of bytes in file image of segment (may be zero) 1542210299Sed Elf64_Xword p_memsz; // Num. of bytes in mem image of segment (may be zero) 1543210299Sed Elf64_Xword p_align; // Segment alignment constraint 1544210299Sed}; 1545210299Sed 1546193323Sed// Segment types. 1547193323Sedenum { 1548193323Sed PT_NULL = 0, // Unused segment. 1549193323Sed PT_LOAD = 1, // Loadable segment. 1550193323Sed PT_DYNAMIC = 2, // Dynamic linking information. 1551193323Sed PT_INTERP = 3, // Interpreter pathname. 1552193323Sed PT_NOTE = 4, // Auxiliary information. 1553193323Sed PT_SHLIB = 5, // Reserved. 1554193323Sed PT_PHDR = 6, // The program header table itself. 1555226633Sdim PT_TLS = 7, // The thread-local storage template. 1556226633Sdim PT_LOOS = 0x60000000, // Lowest operating system-specific pt entry type. 1557243830Sdim PT_HIOS = 0x6fffffff, // Highest operating system-specific pt entry type. 1558243830Sdim PT_LOPROC = 0x70000000, // Lowest processor-specific program hdr entry type. 1559243830Sdim PT_HIPROC = 0x7fffffff, // Highest processor-specific program hdr entry type. 1560226633Sdim 1561226633Sdim // x86-64 program header types. 1562226633Sdim // These all contain stack unwind tables. 1563226633Sdim PT_GNU_EH_FRAME = 0x6474e550, 1564226633Sdim PT_SUNW_EH_FRAME = 0x6474e550, 1565226633Sdim PT_SUNW_UNWIND = 0x6464e550, 1566226633Sdim 1567239462Sdim PT_GNU_STACK = 0x6474e551, // Indicates stack executability. 1568239462Sdim PT_GNU_RELRO = 0x6474e552, // Read-only after relocation. 1569239462Sdim 1570243830Sdim // ARM program header types. 1571249423Sdim PT_ARM_ARCHEXT = 0x70000000, // Platform architecture compatibility info 1572243830Sdim // These all contain stack unwind tables. 1573243830Sdim PT_ARM_EXIDX = 0x70000001, 1574263508Sdim PT_ARM_UNWIND = 0x70000001, 1575263508Sdim 1576263508Sdim // MIPS program header types. 1577263508Sdim PT_MIPS_REGINFO = 0x70000000, // Register usage information. 1578263508Sdim PT_MIPS_RTPROC = 0x70000001, // Runtime procedure table. 1579263508Sdim PT_MIPS_OPTIONS = 0x70000002 // Options segment. 1580193323Sed}; 1581193323Sed 1582193323Sed// Segment flag bits. 1583263508Sdimenum LLVM_ENUM_INT_TYPE(unsigned) { 1584193323Sed PF_X = 1, // Execute 1585193323Sed PF_W = 2, // Write 1586193323Sed PF_R = 4, // Read 1587226633Sdim PF_MASKOS = 0x0ff00000,// Bits for operating system-specific semantics. 1588226633Sdim PF_MASKPROC = 0xf0000000 // Bits for processor-specific semantics. 1589193323Sed}; 1590193323Sed 1591210299Sed// Dynamic table entry for ELF32. 1592210299Sedstruct Elf32_Dyn 1593210299Sed{ 1594210299Sed Elf32_Sword d_tag; // Type of dynamic table entry. 1595210299Sed union 1596210299Sed { 1597210299Sed Elf32_Word d_val; // Integer value of entry. 1598210299Sed Elf32_Addr d_ptr; // Pointer value of entry. 1599210299Sed } d_un; 1600210299Sed}; 1601210299Sed 1602210299Sed// Dynamic table entry for ELF64. 1603210299Sedstruct Elf64_Dyn 1604210299Sed{ 1605210299Sed Elf64_Sxword d_tag; // Type of dynamic table entry. 1606210299Sed union 1607210299Sed { 1608210299Sed Elf64_Xword d_val; // Integer value of entry. 1609210299Sed Elf64_Addr d_ptr; // Pointer value of entry. 1610210299Sed } d_un; 1611210299Sed}; 1612210299Sed 1613210299Sed// Dynamic table entry tags. 1614210299Sedenum { 1615210299Sed DT_NULL = 0, // Marks end of dynamic array. 1616210299Sed DT_NEEDED = 1, // String table offset of needed library. 1617210299Sed DT_PLTRELSZ = 2, // Size of relocation entries in PLT. 1618210299Sed DT_PLTGOT = 3, // Address associated with linkage table. 1619210299Sed DT_HASH = 4, // Address of symbolic hash table. 1620210299Sed DT_STRTAB = 5, // Address of dynamic string table. 1621210299Sed DT_SYMTAB = 6, // Address of dynamic symbol table. 1622210299Sed DT_RELA = 7, // Address of relocation table (Rela entries). 1623210299Sed DT_RELASZ = 8, // Size of Rela relocation table. 1624210299Sed DT_RELAENT = 9, // Size of a Rela relocation entry. 1625210299Sed DT_STRSZ = 10, // Total size of the string table. 1626210299Sed DT_SYMENT = 11, // Size of a symbol table entry. 1627210299Sed DT_INIT = 12, // Address of initialization function. 1628210299Sed DT_FINI = 13, // Address of termination function. 1629210299Sed DT_SONAME = 14, // String table offset of a shared objects name. 1630210299Sed DT_RPATH = 15, // String table offset of library search path. 1631210299Sed DT_SYMBOLIC = 16, // Changes symbol resolution algorithm. 1632210299Sed DT_REL = 17, // Address of relocation table (Rel entries). 1633210299Sed DT_RELSZ = 18, // Size of Rel relocation table. 1634210299Sed DT_RELENT = 19, // Size of a Rel relocation entry. 1635210299Sed DT_PLTREL = 20, // Type of relocation entry used for linking. 1636210299Sed DT_DEBUG = 21, // Reserved for debugger. 1637224145Sdim DT_TEXTREL = 22, // Relocations exist for non-writable segments. 1638210299Sed DT_JMPREL = 23, // Address of relocations associated with PLT. 1639210299Sed DT_BIND_NOW = 24, // Process all relocations before execution. 1640210299Sed DT_INIT_ARRAY = 25, // Pointer to array of initialization functions. 1641210299Sed DT_FINI_ARRAY = 26, // Pointer to array of termination functions. 1642210299Sed DT_INIT_ARRAYSZ = 27, // Size of DT_INIT_ARRAY. 1643210299Sed DT_FINI_ARRAYSZ = 28, // Size of DT_FINI_ARRAY. 1644226633Sdim DT_RUNPATH = 29, // String table offset of lib search path. 1645226633Sdim DT_FLAGS = 30, // Flags. 1646226633Sdim DT_ENCODING = 32, // Values from here to DT_LOOS follow the rules 1647226633Sdim // for the interpretation of the d_un union. 1648226633Sdim 1649226633Sdim DT_PREINIT_ARRAY = 32, // Pointer to array of preinit functions. 1650226633Sdim DT_PREINIT_ARRAYSZ = 33, // Size of the DT_PREINIT_ARRAY array. 1651226633Sdim 1652210299Sed DT_LOOS = 0x60000000, // Start of environment specific tags. 1653210299Sed DT_HIOS = 0x6FFFFFFF, // End of environment specific tags. 1654210299Sed DT_LOPROC = 0x70000000, // Start of processor specific tags. 1655239462Sdim DT_HIPROC = 0x7FFFFFFF, // End of processor specific tags. 1656239462Sdim 1657239462Sdim DT_RELACOUNT = 0x6FFFFFF9, // ELF32_Rela count. 1658239462Sdim DT_RELCOUNT = 0x6FFFFFFA, // ELF32_Rel count. 1659239462Sdim 1660239462Sdim DT_FLAGS_1 = 0X6FFFFFFB, // Flags_1. 1661263508Sdim DT_VERSYM = 0x6FFFFFF0, // The address of .gnu.version section. 1662239462Sdim DT_VERDEF = 0X6FFFFFFC, // The address of the version definition table. 1663239462Sdim DT_VERDEFNUM = 0X6FFFFFFD, // The number of entries in DT_VERDEF. 1664239462Sdim DT_VERNEED = 0X6FFFFFFE, // The address of the version Dependency table. 1665263374Semaste DT_VERNEEDNUM = 0X6FFFFFFF, // The number of entries in DT_VERNEED. 1666263374Semaste 1667263374Semaste // Mips specific dynamic table entry tags. 1668263374Semaste DT_MIPS_RLD_VERSION = 0x70000001, // 32 bit version number for runtime 1669263374Semaste // linker interface. 1670263374Semaste DT_MIPS_TIME_STAMP = 0x70000002, // Time stamp. 1671263374Semaste DT_MIPS_ICHECKSUM = 0x70000003, // Checksum of external strings 1672263374Semaste // and common sizes. 1673263374Semaste DT_MIPS_IVERSION = 0x70000004, // Index of version string 1674263374Semaste // in string table. 1675263374Semaste DT_MIPS_FLAGS = 0x70000005, // 32 bits of flags. 1676263374Semaste DT_MIPS_BASE_ADDRESS = 0x70000006, // Base address of the segment. 1677263374Semaste DT_MIPS_MSYM = 0x70000007, // Address of .msym section. 1678263374Semaste DT_MIPS_CONFLICT = 0x70000008, // Address of .conflict section. 1679263374Semaste DT_MIPS_LIBLIST = 0x70000009, // Address of .liblist section. 1680263374Semaste DT_MIPS_LOCAL_GOTNO = 0x7000000a, // Number of local global offset 1681263374Semaste // table entries. 1682263374Semaste DT_MIPS_CONFLICTNO = 0x7000000b, // Number of entries 1683263374Semaste // in the .conflict section. 1684263374Semaste DT_MIPS_LIBLISTNO = 0x70000010, // Number of entries 1685263374Semaste // in the .liblist section. 1686263374Semaste DT_MIPS_SYMTABNO = 0x70000011, // Number of entries 1687263374Semaste // in the .dynsym section. 1688263374Semaste DT_MIPS_UNREFEXTNO = 0x70000012, // Index of first external dynamic symbol 1689263374Semaste // not referenced locally. 1690263374Semaste DT_MIPS_GOTSYM = 0x70000013, // Index of first dynamic symbol 1691263374Semaste // in global offset table. 1692263374Semaste DT_MIPS_HIPAGENO = 0x70000014, // Number of page table entries 1693263374Semaste // in global offset table. 1694263374Semaste DT_MIPS_RLD_MAP = 0x70000016, // Address of run time loader map, 1695263374Semaste // used for debugging. 1696263374Semaste DT_MIPS_DELTA_CLASS = 0x70000017, // Delta C++ class definition. 1697263374Semaste DT_MIPS_DELTA_CLASS_NO = 0x70000018, // Number of entries 1698263374Semaste // in DT_MIPS_DELTA_CLASS. 1699263374Semaste DT_MIPS_DELTA_INSTANCE = 0x70000019, // Delta C++ class instances. 1700263374Semaste DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A, // Number of entries 1701263374Semaste // in DT_MIPS_DELTA_INSTANCE. 1702263374Semaste DT_MIPS_DELTA_RELOC = 0x7000001B, // Delta relocations. 1703263374Semaste DT_MIPS_DELTA_RELOC_NO = 0x7000001C, // Number of entries 1704263374Semaste // in DT_MIPS_DELTA_RELOC. 1705263374Semaste DT_MIPS_DELTA_SYM = 0x7000001D, // Delta symbols that Delta 1706263374Semaste // relocations refer to. 1707263374Semaste DT_MIPS_DELTA_SYM_NO = 0x7000001E, // Number of entries 1708263374Semaste // in DT_MIPS_DELTA_SYM. 1709263374Semaste DT_MIPS_DELTA_CLASSSYM = 0x70000020, // Delta symbols that hold 1710263374Semaste // class declarations. 1711263374Semaste DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021, // Number of entries 1712263374Semaste // in DT_MIPS_DELTA_CLASSSYM. 1713263374Semaste DT_MIPS_CXX_FLAGS = 0x70000022, // Flags indicating information 1714263374Semaste // about C++ flavor. 1715263374Semaste DT_MIPS_PIXIE_INIT = 0x70000023, // Pixie information. 1716263374Semaste DT_MIPS_SYMBOL_LIB = 0x70000024, // Address of .MIPS.symlib 1717263374Semaste DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025, // The GOT index of the first PTE 1718263374Semaste // for a segment 1719263374Semaste DT_MIPS_LOCAL_GOTIDX = 0x70000026, // The GOT index of the first PTE 1720263374Semaste // for a local symbol 1721263374Semaste DT_MIPS_HIDDEN_GOTIDX = 0x70000027, // The GOT index of the first PTE 1722263374Semaste // for a hidden symbol 1723263374Semaste DT_MIPS_PROTECTED_GOTIDX = 0x70000028, // The GOT index of the first PTE 1724263374Semaste // for a protected symbol 1725263374Semaste DT_MIPS_OPTIONS = 0x70000029, // Address of `.MIPS.options'. 1726263374Semaste DT_MIPS_INTERFACE = 0x7000002A, // Address of `.interface'. 1727263374Semaste DT_MIPS_DYNSTR_ALIGN = 0x7000002B, // Unknown. 1728263374Semaste DT_MIPS_INTERFACE_SIZE = 0x7000002C, // Size of the .interface section. 1729263374Semaste DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D, // Size of rld_text_resolve 1730263374Semaste // function stored in the GOT. 1731263374Semaste DT_MIPS_PERF_SUFFIX = 0x7000002E, // Default suffix of DSO to be added 1732263374Semaste // by rld on dlopen() calls. 1733263374Semaste DT_MIPS_COMPACT_SIZE = 0x7000002F, // Size of compact relocation 1734263374Semaste // section (O32). 1735263374Semaste DT_MIPS_GP_VALUE = 0x70000030, // GP value for auxiliary GOTs. 1736263374Semaste DT_MIPS_AUX_DYNAMIC = 0x70000031, // Address of auxiliary .dynamic. 1737263374Semaste DT_MIPS_PLTGOT = 0x70000032, // Address of the base of the PLTGOT. 1738263374Semaste DT_MIPS_RWPLT = 0x70000034 // Points to the base 1739263374Semaste // of a writable PLT. 1740210299Sed}; 1741210299Sed 1742226633Sdim// DT_FLAGS values. 1743226633Sdimenum { 1744226633Sdim DF_ORIGIN = 0x01, // The object may reference $ORIGIN. 1745226633Sdim DF_SYMBOLIC = 0x02, // Search the shared lib before searching the exe. 1746226633Sdim DF_TEXTREL = 0x04, // Relocations may modify a non-writable segment. 1747226633Sdim DF_BIND_NOW = 0x08, // Process all relocations on load. 1748226633Sdim DF_STATIC_TLS = 0x10 // Reject attempts to load dynamically. 1749226633Sdim}; 1750226633Sdim 1751239462Sdim// State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry. 1752239462Sdimenum { 1753239462Sdim DF_1_NOW = 0x00000001, // Set RTLD_NOW for this object. 1754239462Sdim DF_1_GLOBAL = 0x00000002, // Set RTLD_GLOBAL for this object. 1755239462Sdim DF_1_GROUP = 0x00000004, // Set RTLD_GROUP for this object. 1756239462Sdim DF_1_NODELETE = 0x00000008, // Set RTLD_NODELETE for this object. 1757239462Sdim DF_1_LOADFLTR = 0x00000010, // Trigger filtee loading at runtime. 1758239462Sdim DF_1_INITFIRST = 0x00000020, // Set RTLD_INITFIRST for this object. 1759239462Sdim DF_1_NOOPEN = 0x00000040, // Set RTLD_NOOPEN for this object. 1760239462Sdim DF_1_ORIGIN = 0x00000080, // $ORIGIN must be handled. 1761239462Sdim DF_1_DIRECT = 0x00000100, // Direct binding enabled. 1762239462Sdim DF_1_TRANS = 0x00000200, 1763239462Sdim DF_1_INTERPOSE = 0x00000400, // Object is used to interpose. 1764239462Sdim DF_1_NODEFLIB = 0x00000800, // Ignore default lib search path. 1765239462Sdim DF_1_NODUMP = 0x00001000, // Object can't be dldump'ed. 1766239462Sdim DF_1_CONFALT = 0x00002000, // Configuration alternative created. 1767239462Sdim DF_1_ENDFILTEE = 0x00004000, // Filtee terminates filters search. 1768239462Sdim DF_1_DISPRELDNE = 0x00008000, // Disp reloc applied at build time. 1769239462Sdim DF_1_DISPRELPND = 0x00010000 // Disp reloc applied at run-time. 1770239462Sdim}; 1771239462Sdim 1772263374Semaste// DT_MIPS_FLAGS values. 1773263374Semasteenum { 1774263374Semaste RHF_NONE = 0x00000000, // No flags. 1775263374Semaste RHF_QUICKSTART = 0x00000001, // Uses shortcut pointers. 1776263374Semaste RHF_NOTPOT = 0x00000002, // Hash size is not a power of two. 1777263374Semaste RHS_NO_LIBRARY_REPLACEMENT = 0x00000004, // Ignore LD_LIBRARY_PATH. 1778263374Semaste RHF_NO_MOVE = 0x00000008, // DSO address may not be relocated. 1779263374Semaste RHF_SGI_ONLY = 0x00000010, // SGI specific features. 1780263374Semaste RHF_GUARANTEE_INIT = 0x00000020, // Guarantee that .init will finish 1781263374Semaste // executing before any non-init 1782263374Semaste // code in DSO is called. 1783263374Semaste RHF_DELTA_C_PLUS_PLUS = 0x00000040, // Contains Delta C++ code. 1784263374Semaste RHF_GUARANTEE_START_INIT = 0x00000080, // Guarantee that .init will start 1785263374Semaste // executing before any non-init 1786263374Semaste // code in DSO is called. 1787263374Semaste RHF_PIXIE = 0x00000100, // Generated by pixie. 1788263374Semaste RHF_DEFAULT_DELAY_LOAD = 0x00000200, // Delay-load DSO by default. 1789263374Semaste RHF_REQUICKSTART = 0x00000400, // Object may be requickstarted 1790263374Semaste RHF_REQUICKSTARTED = 0x00000800, // Object has been requickstarted 1791263374Semaste RHF_CORD = 0x00001000, // Generated by cord. 1792263374Semaste RHF_NO_UNRES_UNDEF = 0x00002000, // Object contains no unresolved 1793263374Semaste // undef symbols. 1794263374Semaste RHF_RLD_ORDER_SAFE = 0x00004000 // Symbol table is in a safe order. 1795263374Semaste}; 1796263374Semaste 1797234353Sdim// ElfXX_VerDef structure version (GNU versioning) 1798234353Sdimenum { 1799234353Sdim VER_DEF_NONE = 0, 1800234353Sdim VER_DEF_CURRENT = 1 1801234353Sdim}; 1802234353Sdim 1803234353Sdim// VerDef Flags (ElfXX_VerDef::vd_flags) 1804234353Sdimenum { 1805234353Sdim VER_FLG_BASE = 0x1, 1806234353Sdim VER_FLG_WEAK = 0x2, 1807234353Sdim VER_FLG_INFO = 0x4 1808234353Sdim}; 1809234353Sdim 1810234353Sdim// Special constants for the version table. (SHT_GNU_versym/.gnu.version) 1811234353Sdimenum { 1812234353Sdim VER_NDX_LOCAL = 0, // Unversioned local symbol 1813234353Sdim VER_NDX_GLOBAL = 1, // Unversioned global symbol 1814234353Sdim VERSYM_VERSION = 0x7fff, // Version Index mask 1815234353Sdim VERSYM_HIDDEN = 0x8000 // Hidden bit (non-default version) 1816234353Sdim}; 1817234353Sdim 1818234353Sdim// ElfXX_VerNeed structure version (GNU versioning) 1819234353Sdimenum { 1820234353Sdim VER_NEED_NONE = 0, 1821234353Sdim VER_NEED_CURRENT = 1 1822234353Sdim}; 1823234353Sdim 1824193323Sed} // end namespace ELF 1825193323Sed 1826193323Sed} // end namespace llvm 1827193323Sed 1828193323Sed#endif 1829