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
23263509Sdim#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
32226890Sdimtypedef uint32_t Elf32_Off;  // File offset
33193323Sedtypedef uint16_t Elf32_Half;
34226890Sdimtypedef uint32_t Elf32_Word;
35193323Sedtypedef int32_t  Elf32_Sword;
36193323Sed
37193323Sedtypedef uint64_t Elf64_Addr;
38193323Sedtypedef uint64_t Elf64_Off;
39226890Sdimtypedef uint16_t Elf64_Half;
40226890Sdimtypedef uint32_t Elf64_Word;
41193323Sedtypedef int32_t  Elf64_Sword;
42226890Sdimtypedef 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];
89226890Sdim  Elf64_Half    e_type;
90226890Sdim  Elf64_Half    e_machine;
91226890Sdim  Elf64_Word    e_version;
92193323Sed  Elf64_Addr    e_entry;
93193323Sed  Elf64_Off     e_phoff;
94193323Sed  Elf64_Off     e_shoff;
95226890Sdim  Elf64_Word    e_flags;
96226890Sdim  Elf64_Half    e_ehsize;
97226890Sdim  Elf64_Half    e_phentsize;
98226890Sdim  Elf64_Half    e_phnum;
99226890Sdim  Elf64_Half    e_shentsize;
100226890Sdim  Elf64_Half    e_shnum;
101226890Sdim  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 {
128226890Sdim  EM_NONE          = 0, // No machine
129226890Sdim  EM_M32           = 1, // AT&T WE 32100
130226890Sdim  EM_SPARC         = 2, // SPARC
131226890Sdim  EM_386           = 3, // Intel 386
132226890Sdim  EM_68K           = 4, // Motorola 68000
133226890Sdim  EM_88K           = 5, // Motorola 88000
134226890Sdim  EM_486           = 6, // Intel 486 (deprecated)
135226890Sdim  EM_860           = 7, // Intel 80860
136226890Sdim  EM_MIPS          = 8, // MIPS R3000
137226890Sdim  EM_S370          = 9, // IBM System/370
138226890Sdim  EM_MIPS_RS3_LE   = 10, // MIPS RS3000 Little-endian
139226890Sdim  EM_PARISC        = 15, // Hewlett-Packard PA-RISC
140226890Sdim  EM_VPP500        = 17, // Fujitsu VPP500
141226890Sdim  EM_SPARC32PLUS   = 18, // Enhanced instruction set SPARC
142226890Sdim  EM_960           = 19, // Intel 80960
143226890Sdim  EM_PPC           = 20, // PowerPC
144226890Sdim  EM_PPC64         = 21, // PowerPC64
145226890Sdim  EM_S390          = 22, // IBM System/390
146226890Sdim  EM_SPU           = 23, // IBM SPU/SPC
147226890Sdim  EM_V800          = 36, // NEC V800
148226890Sdim  EM_FR20          = 37, // Fujitsu FR20
149226890Sdim  EM_RH32          = 38, // TRW RH-32
150226890Sdim  EM_RCE           = 39, // Motorola RCE
151226890Sdim  EM_ARM           = 40, // ARM
152226890Sdim  EM_ALPHA         = 41, // DEC Alpha
153226890Sdim  EM_SH            = 42, // Hitachi SH
154226890Sdim  EM_SPARCV9       = 43, // SPARC V9
155226890Sdim  EM_TRICORE       = 44, // Siemens TriCore
156226890Sdim  EM_ARC           = 45, // Argonaut RISC Core
157226890Sdim  EM_H8_300        = 46, // Hitachi H8/300
158226890Sdim  EM_H8_300H       = 47, // Hitachi H8/300H
159226890Sdim  EM_H8S           = 48, // Hitachi H8S
160226890Sdim  EM_H8_500        = 49, // Hitachi H8/500
161226890Sdim  EM_IA_64         = 50, // Intel IA-64 processor architecture
162226890Sdim  EM_MIPS_X        = 51, // Stanford MIPS-X
163226890Sdim  EM_COLDFIRE      = 52, // Motorola ColdFire
164226890Sdim  EM_68HC12        = 53, // Motorola M68HC12
165226890Sdim  EM_MMA           = 54, // Fujitsu MMA Multimedia Accelerator
166226890Sdim  EM_PCP           = 55, // Siemens PCP
167226890Sdim  EM_NCPU          = 56, // Sony nCPU embedded RISC processor
168226890Sdim  EM_NDR1          = 57, // Denso NDR1 microprocessor
169226890Sdim  EM_STARCORE      = 58, // Motorola Star*Core processor
170226890Sdim  EM_ME16          = 59, // Toyota ME16 processor
171226890Sdim  EM_ST100         = 60, // STMicroelectronics ST100 processor
172226890Sdim  EM_TINYJ         = 61, // Advanced Logic Corp. TinyJ embedded processor family
173226890Sdim  EM_X86_64        = 62, // AMD x86-64 architecture
174226890Sdim  EM_PDSP          = 63, // Sony DSP Processor
175226890Sdim  EM_PDP10         = 64, // Digital Equipment Corp. PDP-10
176226890Sdim  EM_PDP11         = 65, // Digital Equipment Corp. PDP-11
177226890Sdim  EM_FX66          = 66, // Siemens FX66 microcontroller
178226890Sdim  EM_ST9PLUS       = 67, // STMicroelectronics ST9+ 8/16 bit microcontroller
179226890Sdim  EM_ST7           = 68, // STMicroelectronics ST7 8-bit microcontroller
180226890Sdim  EM_68HC16        = 69, // Motorola MC68HC16 Microcontroller
181226890Sdim  EM_68HC11        = 70, // Motorola MC68HC11 Microcontroller
182226890Sdim  EM_68HC08        = 71, // Motorola MC68HC08 Microcontroller
183226890Sdim  EM_68HC05        = 72, // Motorola MC68HC05 Microcontroller
184226890Sdim  EM_SVX           = 73, // Silicon Graphics SVx
185226890Sdim  EM_ST19          = 74, // STMicroelectronics ST19 8-bit microcontroller
186226890Sdim  EM_VAX           = 75, // Digital VAX
187226890Sdim  EM_CRIS          = 76, // Axis Communications 32-bit embedded processor
188226890Sdim  EM_JAVELIN       = 77, // Infineon Technologies 32-bit embedded processor
189226890Sdim  EM_FIREPATH      = 78, // Element 14 64-bit DSP Processor
190226890Sdim  EM_ZSP           = 79, // LSI Logic 16-bit DSP Processor
191226890Sdim  EM_MMIX          = 80, // Donald Knuth's educational 64-bit processor
192226890Sdim  EM_HUANY         = 81, // Harvard University machine-independent object files
193226890Sdim  EM_PRISM         = 82, // SiTera Prism
194226890Sdim  EM_AVR           = 83, // Atmel AVR 8-bit microcontroller
195226890Sdim  EM_FR30          = 84, // Fujitsu FR30
196226890Sdim  EM_D10V          = 85, // Mitsubishi D10V
197226890Sdim  EM_D30V          = 86, // Mitsubishi D30V
198226890Sdim  EM_V850          = 87, // NEC v850
199226890Sdim  EM_M32R          = 88, // Mitsubishi M32R
200226890Sdim  EM_MN10300       = 89, // Matsushita MN10300
201226890Sdim  EM_MN10200       = 90, // Matsushita MN10200
202226890Sdim  EM_PJ            = 91, // picoJava
203226890Sdim  EM_OPENRISC      = 92, // OpenRISC 32-bit embedded processor
204226890Sdim  EM_ARC_COMPACT   = 93, // ARC International ARCompact processor (old
205226890Sdim                         // spelling/synonym: EM_ARC_A5)
206226890Sdim  EM_XTENSA        = 94, // Tensilica Xtensa Architecture
207226890Sdim  EM_VIDEOCORE     = 95, // Alphamosaic VideoCore processor
208226890Sdim  EM_TMM_GPP       = 96, // Thompson Multimedia General Purpose Processor
209226890Sdim  EM_NS32K         = 97, // National Semiconductor 32000 series
210226890Sdim  EM_TPC           = 98, // Tenor Network TPC processor
211226890Sdim  EM_SNP1K         = 99, // Trebia SNP 1000 processor
212226890Sdim  EM_ST200         = 100, // STMicroelectronics (www.st.com) ST200
213226890Sdim  EM_IP2K          = 101, // Ubicom IP2xxx microcontroller family
214226890Sdim  EM_MAX           = 102, // MAX Processor
215226890Sdim  EM_CR            = 103, // National Semiconductor CompactRISC microprocessor
216226890Sdim  EM_F2MC16        = 104, // Fujitsu F2MC16
217226890Sdim  EM_MSP430        = 105, // Texas Instruments embedded microcontroller msp430
218226890Sdim  EM_BLACKFIN      = 106, // Analog Devices Blackfin (DSP) processor
219226890Sdim  EM_SE_C33        = 107, // S1C33 Family of Seiko Epson processors
220226890Sdim  EM_SEP           = 108, // Sharp embedded microprocessor
221226890Sdim  EM_ARCA          = 109, // Arca RISC Microprocessor
222226890Sdim  EM_UNICORE       = 110, // Microprocessor series from PKU-Unity Ltd. and MPRC
223226890Sdim                          // of Peking University
224226890Sdim  EM_EXCESS        = 111, // eXcess: 16/32/64-bit configurable embedded CPU
225226890Sdim  EM_DXP           = 112, // Icera Semiconductor Inc. Deep Execution Processor
226226890Sdim  EM_ALTERA_NIOS2  = 113, // Altera Nios II soft-core processor
227226890Sdim  EM_CRX           = 114, // National Semiconductor CompactRISC CRX
228226890Sdim  EM_XGATE         = 115, // Motorola XGATE embedded processor
229226890Sdim  EM_C166          = 116, // Infineon C16x/XC16x processor
230226890Sdim  EM_M16C          = 117, // Renesas M16C series microprocessors
231226890Sdim  EM_DSPIC30F      = 118, // Microchip Technology dsPIC30F Digital Signal
232226890Sdim                          // Controller
233226890Sdim  EM_CE            = 119, // Freescale Communication Engine RISC core
234226890Sdim  EM_M32C          = 120, // Renesas M32C series microprocessors
235226890Sdim  EM_TSK3000       = 131, // Altium TSK3000 core
236226890Sdim  EM_RS08          = 132, // Freescale RS08 embedded processor
237226890Sdim  EM_SHARC         = 133, // Analog Devices SHARC family of 32-bit DSP
238226890Sdim                          // processors
239226890Sdim  EM_ECOG2         = 134, // Cyan Technology eCOG2 microprocessor
240226890Sdim  EM_SCORE7        = 135, // Sunplus S+core7 RISC processor
241226890Sdim  EM_DSP24         = 136, // New Japan Radio (NJR) 24-bit DSP Processor
242226890Sdim  EM_VIDEOCORE3    = 137, // Broadcom VideoCore III processor
243226890Sdim  EM_LATTICEMICO32 = 138, // RISC processor for Lattice FPGA architecture
244226890Sdim  EM_SE_C17        = 139, // Seiko Epson C17 family
245226890Sdim  EM_TI_C6000      = 140, // The Texas Instruments TMS320C6000 DSP family
246226890Sdim  EM_TI_C2000      = 141, // The Texas Instruments TMS320C2000 DSP family
247226890Sdim  EM_TI_C5500      = 142, // The Texas Instruments TMS320C55x DSP family
248226890Sdim  EM_MMDSP_PLUS    = 160, // STMicroelectronics 64bit VLIW Data Signal Processor
249226890Sdim  EM_CYPRESS_M8C   = 161, // Cypress M8C microprocessor
250226890Sdim  EM_R32C          = 162, // Renesas R32C series microprocessors
251226890Sdim  EM_TRIMEDIA      = 163, // NXP Semiconductors TriMedia architecture family
252245431Sdim  EM_HEXAGON       = 164, // Qualcomm Hexagon processor
253226890Sdim  EM_8051          = 165, // Intel 8051 and variants
254226890Sdim  EM_STXP7X        = 166, // STMicroelectronics STxP7x family of configurable
255226890Sdim                          // and extensible RISC processors
256226890Sdim  EM_NDS32         = 167, // Andes Technology compact code size embedded RISC
257226890Sdim                          // processor family
258226890Sdim  EM_ECOG1         = 168, // Cyan Technology eCOG1X family
259226890Sdim  EM_ECOG1X        = 168, // Cyan Technology eCOG1X family
260226890Sdim  EM_MAXQ30        = 169, // Dallas Semiconductor MAXQ30 Core Micro-controllers
261226890Sdim  EM_XIMO16        = 170, // New Japan Radio (NJR) 16-bit DSP Processor
262226890Sdim  EM_MANIK         = 171, // M2000 Reconfigurable RISC Microprocessor
263226890Sdim  EM_CRAYNV2       = 172, // Cray Inc. NV2 vector architecture
264226890Sdim  EM_RX            = 173, // Renesas RX family
265226890Sdim  EM_METAG         = 174, // Imagination Technologies META processor
266226890Sdim                          // architecture
267226890Sdim  EM_MCST_ELBRUS   = 175, // MCST Elbrus general purpose hardware architecture
268226890Sdim  EM_ECOG16        = 176, // Cyan Technology eCOG16 family
269226890Sdim  EM_CR16          = 177, // National Semiconductor CompactRISC CR16 16-bit
270226890Sdim                          // microprocessor
271226890Sdim  EM_ETPU          = 178, // Freescale Extended Time Processing Unit
272226890Sdim  EM_SLE9X         = 179, // Infineon Technologies SLE9X core
273226890Sdim  EM_L10M          = 180, // Intel L10M
274226890Sdim  EM_K10M          = 181, // Intel K10M
275252723Sdim  EM_AARCH64       = 183, // ARM AArch64
276226890Sdim  EM_AVR32         = 185, // Atmel Corporation 32-bit microprocessor family
277226890Sdim  EM_STM8          = 186, // STMicroeletronics STM8 8-bit microcontroller
278226890Sdim  EM_TILE64        = 187, // Tilera TILE64 multicore architecture family
279226890Sdim  EM_TILEPRO       = 188, // Tilera TILEPro multicore architecture family
280226890Sdim  EM_CUDA          = 190, // NVIDIA CUDA architecture
281226890Sdim  EM_TILEGX        = 191, // Tilera TILE-Gx multicore architecture family
282226890Sdim  EM_CLOUDSHIELD   = 192, // CloudShield architecture family
283226890Sdim  EM_COREA_1ST     = 193, // KIPO-KAIST Core-A 1st generation processor family
284226890Sdim  EM_COREA_2ND     = 194, // KIPO-KAIST Core-A 2nd generation processor family
285226890Sdim  EM_ARC_COMPACT2  = 195, // Synopsys ARCompact V2
286226890Sdim  EM_OPEN8         = 196, // Open8 8-bit RISC soft processor core
287226890Sdim  EM_RL78          = 197, // Renesas RL78 family
288226890Sdim  EM_VIDEOCORE5    = 198, // Broadcom VideoCore V processor
289226890Sdim  EM_78KOR         = 199, // Renesas 78KOR family
290263509Sdim  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
312263509Sdim  ELFOSABI_GNU = 3,           // GNU/Linux
313263509Sdim  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,
361226890Sdim  R_X86_64_GOT64      = 27,
362226890Sdim  R_X86_64_GOTPCREL64 = 28,
363226890Sdim  R_X86_64_GOTPC64    = 29,
364226890Sdim  R_X86_64_GOTPLT64   = 30,
365226890Sdim  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,
370252723Sdim  R_X86_64_TLSDESC    = 36,
371252723Sdim  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
420245431Sdim// ELF Relocation types for PPC32
421226890Sdimenum {
422226890Sdim  R_PPC_NONE                  = 0,      /* No relocation. */
423226890Sdim  R_PPC_ADDR32                = 1,
424226890Sdim  R_PPC_ADDR24                = 2,
425226890Sdim  R_PPC_ADDR16                = 3,
426226890Sdim  R_PPC_ADDR16_LO             = 4,
427226890Sdim  R_PPC_ADDR16_HI             = 5,
428226890Sdim  R_PPC_ADDR16_HA             = 6,
429226890Sdim  R_PPC_ADDR14                = 7,
430226890Sdim  R_PPC_ADDR14_BRTAKEN        = 8,
431226890Sdim  R_PPC_ADDR14_BRNTAKEN       = 9,
432226890Sdim  R_PPC_REL24                 = 10,
433226890Sdim  R_PPC_REL14                 = 11,
434226890Sdim  R_PPC_REL14_BRTAKEN         = 12,
435226890Sdim  R_PPC_REL14_BRNTAKEN        = 13,
436263509Sdim  R_PPC_GOT16                 = 14,
437263509Sdim  R_PPC_GOT16_LO              = 15,
438263509Sdim  R_PPC_GOT16_HI              = 16,
439263509Sdim  R_PPC_GOT16_HA              = 17,
440245431Sdim  R_PPC_REL32                 = 26,
441263509Sdim  R_PPC_TLS                   = 67,
442263509Sdim  R_PPC_DTPMOD32              = 68,
443263509Sdim  R_PPC_TPREL16               = 69,
444245431Sdim  R_PPC_TPREL16_LO            = 70,
445263509Sdim  R_PPC_TPREL16_HI            = 71,
446263509Sdim  R_PPC_TPREL16_HA            = 72,
447263509Sdim  R_PPC_TPREL32               = 73,
448263509Sdim  R_PPC_DTPREL16              = 74,
449263509Sdim  R_PPC_DTPREL16_LO           = 75,
450263509Sdim  R_PPC_DTPREL16_HI           = 76,
451263509Sdim  R_PPC_DTPREL16_HA           = 77,
452263509Sdim  R_PPC_DTPREL32              = 78,
453263509Sdim  R_PPC_GOT_TLSGD16           = 79,
454263509Sdim  R_PPC_GOT_TLSGD16_LO        = 80,
455263509Sdim  R_PPC_GOT_TLSGD16_HI        = 81,
456263509Sdim  R_PPC_GOT_TLSGD16_HA        = 82,
457263509Sdim  R_PPC_GOT_TLSLD16           = 83,
458263509Sdim  R_PPC_GOT_TLSLD16_LO        = 84,
459263509Sdim  R_PPC_GOT_TLSLD16_HI        = 85,
460263509Sdim  R_PPC_GOT_TLSLD16_HA        = 86,
461263509Sdim  R_PPC_GOT_TPREL16           = 87,
462263509Sdim  R_PPC_GOT_TPREL16_LO        = 88,
463263509Sdim  R_PPC_GOT_TPREL16_HI        = 89,
464263509Sdim  R_PPC_GOT_TPREL16_HA        = 90,
465263509Sdim  R_PPC_GOT_DTPREL16          = 91,
466263509Sdim  R_PPC_GOT_DTPREL16_LO       = 92,
467263509Sdim  R_PPC_GOT_DTPREL16_HI       = 93,
468263509Sdim  R_PPC_GOT_DTPREL16_HA       = 94,
469263509Sdim  R_PPC_TLSGD                 = 95,
470263509Sdim  R_PPC_TLSLD                 = 96,
471263509Sdim  R_PPC_REL16                 = 249,
472263509Sdim  R_PPC_REL16_LO              = 250,
473263509Sdim  R_PPC_REL16_HI              = 251,
474263509Sdim  R_PPC_REL16_HA              = 252
475226890Sdim};
476218893Sdim
477245431Sdim// ELF Relocation types for PPC64
478245431Sdimenum {
479252723Sdim  R_PPC64_NONE                = 0,
480252723Sdim  R_PPC64_ADDR32              = 1,
481263509Sdim  R_PPC64_ADDR24              = 2,
482263509Sdim  R_PPC64_ADDR16              = 3,
483245431Sdim  R_PPC64_ADDR16_LO           = 4,
484245431Sdim  R_PPC64_ADDR16_HI           = 5,
485263509Sdim  R_PPC64_ADDR16_HA           = 6,
486245431Sdim  R_PPC64_ADDR14              = 7,
487263509Sdim  R_PPC64_ADDR14_BRTAKEN      = 8,
488263509Sdim  R_PPC64_ADDR14_BRNTAKEN     = 9,
489245431Sdim  R_PPC64_REL24               = 10,
490263509Sdim  R_PPC64_REL14               = 11,
491263509Sdim  R_PPC64_REL14_BRTAKEN       = 12,
492263509Sdim  R_PPC64_REL14_BRNTAKEN      = 13,
493263509Sdim  R_PPC64_GOT16               = 14,
494263509Sdim  R_PPC64_GOT16_LO            = 15,
495263509Sdim  R_PPC64_GOT16_HI            = 16,
496263509Sdim  R_PPC64_GOT16_HA            = 17,
497252723Sdim  R_PPC64_REL32               = 26,
498245431Sdim  R_PPC64_ADDR64              = 38,
499245431Sdim  R_PPC64_ADDR16_HIGHER       = 39,
500263509Sdim  R_PPC64_ADDR16_HIGHERA      = 40,
501245431Sdim  R_PPC64_ADDR16_HIGHEST      = 41,
502263509Sdim  R_PPC64_ADDR16_HIGHESTA     = 42,
503252723Sdim  R_PPC64_REL64               = 44,
504245431Sdim  R_PPC64_TOC16               = 47,
505252723Sdim  R_PPC64_TOC16_LO            = 48,
506263509Sdim  R_PPC64_TOC16_HI            = 49,
507252723Sdim  R_PPC64_TOC16_HA            = 50,
508245431Sdim  R_PPC64_TOC                 = 51,
509252723Sdim  R_PPC64_ADDR16_DS           = 56,
510252723Sdim  R_PPC64_ADDR16_LO_DS        = 57,
511263509Sdim  R_PPC64_GOT16_DS            = 58,
512263509Sdim  R_PPC64_GOT16_LO_DS         = 59,
513252723Sdim  R_PPC64_TOC16_DS            = 63,
514252723Sdim  R_PPC64_TOC16_LO_DS         = 64,
515252723Sdim  R_PPC64_TLS                 = 67,
516263509Sdim  R_PPC64_DTPMOD64            = 68,
517263509Sdim  R_PPC64_TPREL16             = 69,
518252723Sdim  R_PPC64_TPREL16_LO          = 70,
519263509Sdim  R_PPC64_TPREL16_HI          = 71,
520252723Sdim  R_PPC64_TPREL16_HA          = 72,
521263509Sdim  R_PPC64_TPREL64             = 73,
522263509Sdim  R_PPC64_DTPREL16            = 74,
523252723Sdim  R_PPC64_DTPREL16_LO         = 75,
524263509Sdim  R_PPC64_DTPREL16_HI         = 76,
525252723Sdim  R_PPC64_DTPREL16_HA         = 77,
526263509Sdim  R_PPC64_DTPREL64            = 78,
527263509Sdim  R_PPC64_GOT_TLSGD16         = 79,
528252723Sdim  R_PPC64_GOT_TLSGD16_LO      = 80,
529263509Sdim  R_PPC64_GOT_TLSGD16_HI      = 81,
530252723Sdim  R_PPC64_GOT_TLSGD16_HA      = 82,
531263509Sdim  R_PPC64_GOT_TLSLD16         = 83,
532252723Sdim  R_PPC64_GOT_TLSLD16_LO      = 84,
533263509Sdim  R_PPC64_GOT_TLSLD16_HI      = 85,
534252723Sdim  R_PPC64_GOT_TLSLD16_HA      = 86,
535263509Sdim  R_PPC64_GOT_TPREL16_DS      = 87,
536252723Sdim  R_PPC64_GOT_TPREL16_LO_DS   = 88,
537263509Sdim  R_PPC64_GOT_TPREL16_HI      = 89,
538252723Sdim  R_PPC64_GOT_TPREL16_HA      = 90,
539263509Sdim  R_PPC64_GOT_DTPREL16_DS     = 91,
540263509Sdim  R_PPC64_GOT_DTPREL16_LO_DS  = 92,
541263509Sdim  R_PPC64_GOT_DTPREL16_HI     = 93,
542263509Sdim  R_PPC64_GOT_DTPREL16_HA     = 94,
543263509Sdim  R_PPC64_TPREL16_DS          = 95,
544263509Sdim  R_PPC64_TPREL16_LO_DS       = 96,
545263509Sdim  R_PPC64_TPREL16_HIGHER      = 97,
546263509Sdim  R_PPC64_TPREL16_HIGHERA     = 98,
547263509Sdim  R_PPC64_TPREL16_HIGHEST     = 99,
548263509Sdim  R_PPC64_TPREL16_HIGHESTA    = 100,
549263509Sdim  R_PPC64_DTPREL16_DS         = 101,
550263509Sdim  R_PPC64_DTPREL16_LO_DS      = 102,
551263509Sdim  R_PPC64_DTPREL16_HIGHER     = 103,
552263509Sdim  R_PPC64_DTPREL16_HIGHERA    = 104,
553263509Sdim  R_PPC64_DTPREL16_HIGHEST    = 105,
554263509Sdim  R_PPC64_DTPREL16_HIGHESTA   = 106,
555252723Sdim  R_PPC64_TLSGD               = 107,
556263509Sdim  R_PPC64_TLSLD               = 108,
557263509Sdim  R_PPC64_REL16               = 249,
558263509Sdim  R_PPC64_REL16_LO            = 250,
559263509Sdim  R_PPC64_REL16_HI            = 251,
560263509Sdim  R_PPC64_REL16_HA            = 252
561245431Sdim};
562245431Sdim
563252723Sdim// ELF Relocation types for AArch64
564252723Sdim
565252723Sdimenum {
566252723Sdim  R_AARCH64_NONE                        = 0x100,
567252723Sdim
568252723Sdim  R_AARCH64_ABS64                       = 0x101,
569252723Sdim  R_AARCH64_ABS32                       = 0x102,
570252723Sdim  R_AARCH64_ABS16                       = 0x103,
571252723Sdim  R_AARCH64_PREL64                      = 0x104,
572252723Sdim  R_AARCH64_PREL32                      = 0x105,
573252723Sdim  R_AARCH64_PREL16                      = 0x106,
574252723Sdim
575252723Sdim  R_AARCH64_MOVW_UABS_G0                = 0x107,
576252723Sdim  R_AARCH64_MOVW_UABS_G0_NC             = 0x108,
577252723Sdim  R_AARCH64_MOVW_UABS_G1                = 0x109,
578252723Sdim  R_AARCH64_MOVW_UABS_G1_NC             = 0x10a,
579252723Sdim  R_AARCH64_MOVW_UABS_G2                = 0x10b,
580252723Sdim  R_AARCH64_MOVW_UABS_G2_NC             = 0x10c,
581252723Sdim  R_AARCH64_MOVW_UABS_G3                = 0x10d,
582252723Sdim  R_AARCH64_MOVW_SABS_G0                = 0x10e,
583252723Sdim  R_AARCH64_MOVW_SABS_G1                = 0x10f,
584252723Sdim  R_AARCH64_MOVW_SABS_G2                = 0x110,
585252723Sdim
586252723Sdim  R_AARCH64_LD_PREL_LO19                = 0x111,
587252723Sdim  R_AARCH64_ADR_PREL_LO21               = 0x112,
588252723Sdim  R_AARCH64_ADR_PREL_PG_HI21            = 0x113,
589252723Sdim  R_AARCH64_ADD_ABS_LO12_NC             = 0x115,
590252723Sdim  R_AARCH64_LDST8_ABS_LO12_NC           = 0x116,
591252723Sdim
592252723Sdim  R_AARCH64_TSTBR14                     = 0x117,
593252723Sdim  R_AARCH64_CONDBR19                    = 0x118,
594252723Sdim  R_AARCH64_JUMP26                      = 0x11a,
595252723Sdim  R_AARCH64_CALL26                      = 0x11b,
596252723Sdim
597252723Sdim  R_AARCH64_LDST16_ABS_LO12_NC          = 0x11c,
598252723Sdim  R_AARCH64_LDST32_ABS_LO12_NC          = 0x11d,
599252723Sdim  R_AARCH64_LDST64_ABS_LO12_NC          = 0x11e,
600252723Sdim
601252723Sdim  R_AARCH64_LDST128_ABS_LO12_NC         = 0x12b,
602252723Sdim
603252723Sdim  R_AARCH64_ADR_GOT_PAGE                = 0x137,
604252723Sdim  R_AARCH64_LD64_GOT_LO12_NC            = 0x138,
605252723Sdim
606252723Sdim  R_AARCH64_TLSLD_MOVW_DTPREL_G2        = 0x20b,
607252723Sdim  R_AARCH64_TLSLD_MOVW_DTPREL_G1        = 0x20c,
608252723Sdim  R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC     = 0x20d,
609252723Sdim  R_AARCH64_TLSLD_MOVW_DTPREL_G0        = 0x20e,
610252723Sdim  R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC     = 0x20f,
611252723Sdim  R_AARCH64_TLSLD_ADD_DTPREL_HI12       = 0x210,
612252723Sdim  R_AARCH64_TLSLD_ADD_DTPREL_LO12       = 0x211,
613252723Sdim  R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC    = 0x212,
614252723Sdim  R_AARCH64_TLSLD_LDST8_DTPREL_LO12     = 0x213,
615252723Sdim  R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC  = 0x214,
616252723Sdim  R_AARCH64_TLSLD_LDST16_DTPREL_LO12    = 0x215,
617252723Sdim  R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC = 0x216,
618252723Sdim  R_AARCH64_TLSLD_LDST32_DTPREL_LO12    = 0x217,
619252723Sdim  R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 0x218,
620252723Sdim  R_AARCH64_TLSLD_LDST64_DTPREL_LO12    = 0x219,
621252723Sdim  R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC = 0x21a,
622252723Sdim
623252723Sdim  R_AARCH64_TLSIE_MOVW_GOTTPREL_G1      = 0x21b,
624252723Sdim  R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC   = 0x21c,
625252723Sdim  R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21   = 0x21d,
626252723Sdim  R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC = 0x21e,
627252723Sdim  R_AARCH64_TLSIE_LD_GOTTPREL_PREL19    = 0x21f,
628252723Sdim
629252723Sdim  R_AARCH64_TLSLE_MOVW_TPREL_G2         = 0x220,
630252723Sdim  R_AARCH64_TLSLE_MOVW_TPREL_G1         = 0x221,
631252723Sdim  R_AARCH64_TLSLE_MOVW_TPREL_G1_NC      = 0x222,
632252723Sdim  R_AARCH64_TLSLE_MOVW_TPREL_G0         = 0x223,
633252723Sdim  R_AARCH64_TLSLE_MOVW_TPREL_G0_NC      = 0x224,
634252723Sdim  R_AARCH64_TLSLE_ADD_TPREL_HI12        = 0x225,
635252723Sdim  R_AARCH64_TLSLE_ADD_TPREL_LO12        = 0x226,
636252723Sdim  R_AARCH64_TLSLE_ADD_TPREL_LO12_NC     = 0x227,
637252723Sdim  R_AARCH64_TLSLE_LDST8_TPREL_LO12      = 0x228,
638252723Sdim  R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC   = 0x229,
639252723Sdim  R_AARCH64_TLSLE_LDST16_TPREL_LO12     = 0x22a,
640252723Sdim  R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC  = 0x22b,
641252723Sdim  R_AARCH64_TLSLE_LDST32_TPREL_LO12     = 0x22c,
642252723Sdim  R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC  = 0x22d,
643252723Sdim  R_AARCH64_TLSLE_LDST64_TPREL_LO12     = 0x22e,
644252723Sdim  R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC  = 0x22f,
645252723Sdim
646252723Sdim  R_AARCH64_TLSDESC_ADR_PAGE            = 0x232,
647252723Sdim  R_AARCH64_TLSDESC_LD64_LO12_NC        = 0x233,
648252723Sdim  R_AARCH64_TLSDESC_ADD_LO12_NC         = 0x234,
649252723Sdim
650252723Sdim  R_AARCH64_TLSDESC_CALL                = 0x239
651252723Sdim};
652252723Sdim
653218893Sdim// ARM Specific e_flags
654263509Sdimenum LLVM_ENUM_INT_TYPE(unsigned) {
655252723Sdim  EF_ARM_SOFT_FLOAT =     0x00000200U,
656252723Sdim  EF_ARM_VFP_FLOAT =      0x00000400U,
657252723Sdim  EF_ARM_EABI_UNKNOWN =   0x00000000U,
658252723Sdim  EF_ARM_EABI_VER1 =      0x01000000U,
659252723Sdim  EF_ARM_EABI_VER2 =      0x02000000U,
660252723Sdim  EF_ARM_EABI_VER3 =      0x03000000U,
661252723Sdim  EF_ARM_EABI_VER4 =      0x04000000U,
662252723Sdim  EF_ARM_EABI_VER5 =      0x05000000U,
663252723Sdim  EF_ARM_EABIMASK =       0xFF000000U
664252723Sdim};
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
803235633Sdim// Mips Specific e_flags
804263509Sdimenum LLVM_ENUM_INT_TYPE(unsigned) {
805235633Sdim  EF_MIPS_NOREORDER = 0x00000001, // Don't reorder instructions
806235633Sdim  EF_MIPS_PIC       = 0x00000002, // Position independent code
807235633Sdim  EF_MIPS_CPIC      = 0x00000004, // Call object with Position independent code
808252723Sdim  EF_MIPS_ABI_O32   = 0x00001000, // This file follows the first MIPS 32 bit ABI
809252723Sdim
810252723Sdim  //ARCH_ASE
811252723Sdim  EF_MIPS_MICROMIPS = 0x02000000, // microMIPS
812252723Sdim  EF_MIPS_ARCH_ASE_M16 =
813252723Sdim                      0x04000000, // Has Mips-16 ISA extensions
814252723Sdim  //ARCH
815235633Sdim  EF_MIPS_ARCH_1    = 0x00000000, // MIPS1 instruction set
816235633Sdim  EF_MIPS_ARCH_2    = 0x10000000, // MIPS2 instruction set
817235633Sdim  EF_MIPS_ARCH_3    = 0x20000000, // MIPS3 instruction set
818235633Sdim  EF_MIPS_ARCH_4    = 0x30000000, // MIPS4 instruction set
819235633Sdim  EF_MIPS_ARCH_5    = 0x40000000, // MIPS5 instruction set
820235633Sdim  EF_MIPS_ARCH_32   = 0x50000000, // MIPS32 instruction set per linux not elf.h
821235633Sdim  EF_MIPS_ARCH_64   = 0x60000000, // MIPS64 instruction set per linux not elf.h
822235633Sdim  EF_MIPS_ARCH_32R2 = 0x70000000, // mips32r2
823235633Sdim  EF_MIPS_ARCH_64R2 = 0x80000000, // mips64r2
824235633Sdim  EF_MIPS_ARCH      = 0xf0000000  // Mask for applying EF_MIPS_ARCH_ variant
825235633Sdim};
826235633Sdim
827226890Sdim// ELF Relocation types for Mips
828235633Sdim// .
829226890Sdimenum {
830226890Sdim  R_MIPS_NONE              =  0,
831226890Sdim  R_MIPS_16                =  1,
832226890Sdim  R_MIPS_32                =  2,
833226890Sdim  R_MIPS_REL32             =  3,
834226890Sdim  R_MIPS_26                =  4,
835226890Sdim  R_MIPS_HI16              =  5,
836226890Sdim  R_MIPS_LO16              =  6,
837226890Sdim  R_MIPS_GPREL16           =  7,
838226890Sdim  R_MIPS_LITERAL           =  8,
839226890Sdim  R_MIPS_GOT16             =  9,
840235633Sdim  R_MIPS_GOT               =  9,
841226890Sdim  R_MIPS_PC16              = 10,
842226890Sdim  R_MIPS_CALL16            = 11,
843226890Sdim  R_MIPS_GPREL32           = 12,
844263509Sdim  R_MIPS_UNUSED1           = 13,
845263509Sdim  R_MIPS_UNUSED2           = 14,
846226890Sdim  R_MIPS_SHIFT5            = 16,
847226890Sdim  R_MIPS_SHIFT6            = 17,
848226890Sdim  R_MIPS_64                = 18,
849226890Sdim  R_MIPS_GOT_DISP          = 19,
850226890Sdim  R_MIPS_GOT_PAGE          = 20,
851226890Sdim  R_MIPS_GOT_OFST          = 21,
852226890Sdim  R_MIPS_GOT_HI16          = 22,
853226890Sdim  R_MIPS_GOT_LO16          = 23,
854226890Sdim  R_MIPS_SUB               = 24,
855226890Sdim  R_MIPS_INSERT_A          = 25,
856226890Sdim  R_MIPS_INSERT_B          = 26,
857226890Sdim  R_MIPS_DELETE            = 27,
858226890Sdim  R_MIPS_HIGHER            = 28,
859226890Sdim  R_MIPS_HIGHEST           = 29,
860226890Sdim  R_MIPS_CALL_HI16         = 30,
861226890Sdim  R_MIPS_CALL_LO16         = 31,
862226890Sdim  R_MIPS_SCN_DISP          = 32,
863226890Sdim  R_MIPS_REL16             = 33,
864226890Sdim  R_MIPS_ADD_IMMEDIATE     = 34,
865226890Sdim  R_MIPS_PJUMP             = 35,
866226890Sdim  R_MIPS_RELGOT            = 36,
867226890Sdim  R_MIPS_JALR              = 37,
868226890Sdim  R_MIPS_TLS_DTPMOD32      = 38,
869226890Sdim  R_MIPS_TLS_DTPREL32      = 39,
870226890Sdim  R_MIPS_TLS_DTPMOD64      = 40,
871226890Sdim  R_MIPS_TLS_DTPREL64      = 41,
872226890Sdim  R_MIPS_TLS_GD            = 42,
873226890Sdim  R_MIPS_TLS_LDM           = 43,
874226890Sdim  R_MIPS_TLS_DTPREL_HI16   = 44,
875226890Sdim  R_MIPS_TLS_DTPREL_LO16   = 45,
876226890Sdim  R_MIPS_TLS_GOTTPREL      = 46,
877226890Sdim  R_MIPS_TLS_TPREL32       = 47,
878226890Sdim  R_MIPS_TLS_TPREL64       = 48,
879226890Sdim  R_MIPS_TLS_TPREL_HI16    = 49,
880226890Sdim  R_MIPS_TLS_TPREL_LO16    = 50,
881226890Sdim  R_MIPS_GLOB_DAT          = 51,
882226890Sdim  R_MIPS_COPY              = 126,
883226890Sdim  R_MIPS_JUMP_SLOT         = 127,
884263509Sdim  R_MICROMIPS_26_S1        = 133,
885263509Sdim  R_MICROMIPS_HI16         = 134,
886263509Sdim  R_MICROMIPS_LO16         = 135,
887263509Sdim  R_MICROMIPS_GOT16        = 138,
888263509Sdim  R_MICROMIPS_PC16_S1      = 141,
889263509Sdim  R_MICROMIPS_CALL16       = 142,
890263509Sdim  R_MICROMIPS_GOT_DISP     = 145,
891263509Sdim  R_MICROMIPS_GOT_PAGE     = 146,
892263509Sdim  R_MICROMIPS_GOT_OFST     = 147,
893263509Sdim  R_MICROMIPS_TLS_DTPREL_HI16 = 164,
894263509Sdim  R_MICROMIPS_TLS_DTPREL_LO16 = 165,
895263509Sdim  R_MICROMIPS_TLS_TPREL_HI16  = 169,
896263509Sdim  R_MICROMIPS_TLS_TPREL_LO16  = 170,
897226890Sdim  R_MIPS_NUM               = 218
898226890Sdim};
899218893Sdim
900252723Sdim// Special values for the st_other field in the symbol table entry for MIPS.
901252723Sdimenum {
902252723Sdim  STO_MIPS_MICROMIPS       = 0x80 // MIPS Specific ISA for MicroMips
903252723Sdim};
904252723Sdim
905245431Sdim// Hexagon Specific e_flags
906245431Sdim// Release 5 ABI
907245431Sdimenum {
908245431Sdim  // Object processor version flags, bits[3:0]
909245431Sdim  EF_HEXAGON_MACH_V2      = 0x00000001,   // Hexagon V2
910245431Sdim  EF_HEXAGON_MACH_V3      = 0x00000002,   // Hexagon V3
911245431Sdim  EF_HEXAGON_MACH_V4      = 0x00000003,   // Hexagon V4
912245431Sdim  EF_HEXAGON_MACH_V5      = 0x00000004,   // Hexagon V5
913245431Sdim
914245431Sdim  // Highest ISA version flags
915245431Sdim  EF_HEXAGON_ISA_MACH     = 0x00000000,   // Same as specified in bits[3:0]
916245431Sdim                                          // of e_flags
917245431Sdim  EF_HEXAGON_ISA_V2       = 0x00000010,   // Hexagon V2 ISA
918245431Sdim  EF_HEXAGON_ISA_V3       = 0x00000020,   // Hexagon V3 ISA
919245431Sdim  EF_HEXAGON_ISA_V4       = 0x00000030,   // Hexagon V4 ISA
920245431Sdim  EF_HEXAGON_ISA_V5       = 0x00000040    // Hexagon V5 ISA
921245431Sdim};
922245431Sdim
923245431Sdim// Hexagon specific Section indexes for common small data
924252723Sdim// Release 5 ABI
925245431Sdimenum {
926245431Sdim  SHN_HEXAGON_SCOMMON     = 0xff00,       // Other access sizes
927245431Sdim  SHN_HEXAGON_SCOMMON_1   = 0xff01,       // Byte-sized access
928245431Sdim  SHN_HEXAGON_SCOMMON_2   = 0xff02,       // Half-word-sized access
929245431Sdim  SHN_HEXAGON_SCOMMON_4   = 0xff03,       // Word-sized access
930245431Sdim  SHN_HEXAGON_SCOMMON_8   = 0xff04        // Double-word-size access
931252723Sdim};
932245431Sdim
933245431Sdim// ELF Relocation types for Hexagon
934245431Sdim// Release 5 ABI
935245431Sdimenum {
936245431Sdim  R_HEX_NONE              =  0,
937245431Sdim  R_HEX_B22_PCREL         =  1,
938245431Sdim  R_HEX_B15_PCREL         =  2,
939245431Sdim  R_HEX_B7_PCREL          =  3,
940245431Sdim  R_HEX_LO16              =  4,
941245431Sdim  R_HEX_HI16              =  5,
942245431Sdim  R_HEX_32                =  6,
943245431Sdim  R_HEX_16                =  7,
944245431Sdim  R_HEX_8                 =  8,
945245431Sdim  R_HEX_GPREL16_0         =  9,
946245431Sdim  R_HEX_GPREL16_1         =  10,
947245431Sdim  R_HEX_GPREL16_2         =  11,
948245431Sdim  R_HEX_GPREL16_3         =  12,
949245431Sdim  R_HEX_HL16              =  13,
950245431Sdim  R_HEX_B13_PCREL         =  14,
951245431Sdim  R_HEX_B9_PCREL          =  15,
952245431Sdim  R_HEX_B32_PCREL_X       =  16,
953245431Sdim  R_HEX_32_6_X            =  17,
954245431Sdim  R_HEX_B22_PCREL_X       =  18,
955245431Sdim  R_HEX_B15_PCREL_X       =  19,
956245431Sdim  R_HEX_B13_PCREL_X       =  20,
957245431Sdim  R_HEX_B9_PCREL_X        =  21,
958245431Sdim  R_HEX_B7_PCREL_X        =  22,
959245431Sdim  R_HEX_16_X              =  23,
960245431Sdim  R_HEX_12_X              =  24,
961245431Sdim  R_HEX_11_X              =  25,
962245431Sdim  R_HEX_10_X              =  26,
963245431Sdim  R_HEX_9_X               =  27,
964245431Sdim  R_HEX_8_X               =  28,
965245431Sdim  R_HEX_7_X               =  29,
966245431Sdim  R_HEX_6_X               =  30,
967245431Sdim  R_HEX_32_PCREL          =  31,
968245431Sdim  R_HEX_COPY              =  32,
969245431Sdim  R_HEX_GLOB_DAT          =  33,
970245431Sdim  R_HEX_JMP_SLOT          =  34,
971245431Sdim  R_HEX_RELATIVE          =  35,
972245431Sdim  R_HEX_PLT_B22_PCREL     =  36,
973245431Sdim  R_HEX_GOTREL_LO16       =  37,
974245431Sdim  R_HEX_GOTREL_HI16       =  38,
975245431Sdim  R_HEX_GOTREL_32         =  39,
976245431Sdim  R_HEX_GOT_LO16          =  40,
977245431Sdim  R_HEX_GOT_HI16          =  41,
978245431Sdim  R_HEX_GOT_32            =  42,
979245431Sdim  R_HEX_GOT_16            =  43,
980245431Sdim  R_HEX_DTPMOD_32         =  44,
981245431Sdim  R_HEX_DTPREL_LO16       =  45,
982245431Sdim  R_HEX_DTPREL_HI16       =  46,
983245431Sdim  R_HEX_DTPREL_32         =  47,
984245431Sdim  R_HEX_DTPREL_16         =  48,
985245431Sdim  R_HEX_GD_PLT_B22_PCREL  =  49,
986245431Sdim  R_HEX_GD_GOT_LO16       =  50,
987245431Sdim  R_HEX_GD_GOT_HI16       =  51,
988245431Sdim  R_HEX_GD_GOT_32         =  52,
989245431Sdim  R_HEX_GD_GOT_16         =  53,
990245431Sdim  R_HEX_IE_LO16           =  54,
991245431Sdim  R_HEX_IE_HI16           =  55,
992245431Sdim  R_HEX_IE_32             =  56,
993245431Sdim  R_HEX_IE_GOT_LO16       =  57,
994245431Sdim  R_HEX_IE_GOT_HI16       =  58,
995245431Sdim  R_HEX_IE_GOT_32         =  59,
996245431Sdim  R_HEX_IE_GOT_16         =  60,
997245431Sdim  R_HEX_TPREL_LO16        =  61,
998245431Sdim  R_HEX_TPREL_HI16        =  62,
999245431Sdim  R_HEX_TPREL_32          =  63,
1000245431Sdim  R_HEX_TPREL_16          =  64,
1001245431Sdim  R_HEX_6_PCREL_X         =  65,
1002245431Sdim  R_HEX_GOTREL_32_6_X     =  66,
1003245431Sdim  R_HEX_GOTREL_16_X       =  67,
1004245431Sdim  R_HEX_GOTREL_11_X       =  68,
1005245431Sdim  R_HEX_GOT_32_6_X        =  69,
1006245431Sdim  R_HEX_GOT_16_X          =  70,
1007245431Sdim  R_HEX_GOT_11_X          =  71,
1008245431Sdim  R_HEX_DTPREL_32_6_X     =  72,
1009245431Sdim  R_HEX_DTPREL_16_X       =  73,
1010245431Sdim  R_HEX_DTPREL_11_X       =  74,
1011245431Sdim  R_HEX_GD_GOT_32_6_X     =  75,
1012245431Sdim  R_HEX_GD_GOT_16_X       =  76,
1013245431Sdim  R_HEX_GD_GOT_11_X       =  77,
1014245431Sdim  R_HEX_IE_32_6_X         =  78,
1015245431Sdim  R_HEX_IE_16_X           =  79,
1016245431Sdim  R_HEX_IE_GOT_32_6_X     =  80,
1017245431Sdim  R_HEX_IE_GOT_16_X       =  81,
1018245431Sdim  R_HEX_IE_GOT_11_X       =  82,
1019245431Sdim  R_HEX_TPREL_32_6_X      =  83,
1020245431Sdim  R_HEX_TPREL_16_X        =  84,
1021245431Sdim  R_HEX_TPREL_11_X        =  85
1022245431Sdim};
1023245431Sdim
1024252723Sdim// ELF Relocation types for S390/zSeries
1025252723Sdimenum {
1026252723Sdim  R_390_NONE        =  0,
1027252723Sdim  R_390_8           =  1,
1028252723Sdim  R_390_12          =  2,
1029252723Sdim  R_390_16          =  3,
1030252723Sdim  R_390_32          =  4,
1031252723Sdim  R_390_PC32        =  5,
1032252723Sdim  R_390_GOT12       =  6,
1033252723Sdim  R_390_GOT32       =  7,
1034252723Sdim  R_390_PLT32       =  8,
1035252723Sdim  R_390_COPY        =  9,
1036252723Sdim  R_390_GLOB_DAT    = 10,
1037252723Sdim  R_390_JMP_SLOT    = 11,
1038252723Sdim  R_390_RELATIVE    = 12,
1039252723Sdim  R_390_GOTOFF      = 13,
1040252723Sdim  R_390_GOTPC       = 14,
1041252723Sdim  R_390_GOT16       = 15,
1042252723Sdim  R_390_PC16        = 16,
1043252723Sdim  R_390_PC16DBL     = 17,
1044252723Sdim  R_390_PLT16DBL    = 18,
1045252723Sdim  R_390_PC32DBL     = 19,
1046252723Sdim  R_390_PLT32DBL    = 20,
1047252723Sdim  R_390_GOTPCDBL    = 21,
1048252723Sdim  R_390_64          = 22,
1049252723Sdim  R_390_PC64        = 23,
1050252723Sdim  R_390_GOT64       = 24,
1051252723Sdim  R_390_PLT64       = 25,
1052252723Sdim  R_390_GOTENT      = 26,
1053252723Sdim  R_390_GOTOFF16    = 27,
1054252723Sdim  R_390_GOTOFF64    = 28,
1055252723Sdim  R_390_GOTPLT12    = 29,
1056252723Sdim  R_390_GOTPLT16    = 30,
1057252723Sdim  R_390_GOTPLT32    = 31,
1058252723Sdim  R_390_GOTPLT64    = 32,
1059252723Sdim  R_390_GOTPLTENT   = 33,
1060252723Sdim  R_390_PLTOFF16    = 34,
1061252723Sdim  R_390_PLTOFF32    = 35,
1062252723Sdim  R_390_PLTOFF64    = 36,
1063252723Sdim  R_390_TLS_LOAD    = 37,
1064252723Sdim  R_390_TLS_GDCALL  = 38,
1065252723Sdim  R_390_TLS_LDCALL  = 39,
1066252723Sdim  R_390_TLS_GD32    = 40,
1067252723Sdim  R_390_TLS_GD64    = 41,
1068252723Sdim  R_390_TLS_GOTIE12 = 42,
1069252723Sdim  R_390_TLS_GOTIE32 = 43,
1070252723Sdim  R_390_TLS_GOTIE64 = 44,
1071252723Sdim  R_390_TLS_LDM32   = 45,
1072252723Sdim  R_390_TLS_LDM64   = 46,
1073252723Sdim  R_390_TLS_IE32    = 47,
1074252723Sdim  R_390_TLS_IE64    = 48,
1075252723Sdim  R_390_TLS_IEENT   = 49,
1076252723Sdim  R_390_TLS_LE32    = 50,
1077252723Sdim  R_390_TLS_LE64    = 51,
1078252723Sdim  R_390_TLS_LDO32   = 52,
1079252723Sdim  R_390_TLS_LDO64   = 53,
1080252723Sdim  R_390_TLS_DTPMOD  = 54,
1081252723Sdim  R_390_TLS_DTPOFF  = 55,
1082252723Sdim  R_390_TLS_TPOFF   = 56,
1083252723Sdim  R_390_20          = 57,
1084252723Sdim  R_390_GOT20       = 58,
1085252723Sdim  R_390_GOTPLT20    = 59,
1086252723Sdim  R_390_TLS_GOTIE20 = 60,
1087252723Sdim  R_390_IRELATIVE   = 61
1088252723Sdim};
1089252723Sdim
1090263764Sdim// ELF Relocation type for Sparc.
1091263764Sdimenum {
1092263764Sdim  R_SPARC_NONE        = 0,
1093263764Sdim  R_SPARC_8           = 1,
1094263764Sdim  R_SPARC_16          = 2,
1095263764Sdim  R_SPARC_32          = 3,
1096263764Sdim  R_SPARC_DISP8       = 4,
1097263764Sdim  R_SPARC_DISP16      = 5,
1098263764Sdim  R_SPARC_DISP32      = 6,
1099263764Sdim  R_SPARC_WDISP30     = 7,
1100263764Sdim  R_SPARC_WDISP22     = 8,
1101263764Sdim  R_SPARC_HI22        = 9,
1102263764Sdim  R_SPARC_22          = 10,
1103263764Sdim  R_SPARC_13          = 11,
1104263764Sdim  R_SPARC_LO10        = 12,
1105263764Sdim  R_SPARC_GOT10       = 13,
1106263764Sdim  R_SPARC_GOT13       = 14,
1107263764Sdim  R_SPARC_GOT22       = 15,
1108263764Sdim  R_SPARC_PC10        = 16,
1109263764Sdim  R_SPARC_PC22        = 17,
1110263764Sdim  R_SPARC_WPLT30      = 18,
1111263764Sdim  R_SPARC_COPY        = 19,
1112263764Sdim  R_SPARC_GLOB_DAT    = 20,
1113263764Sdim  R_SPARC_JMP_SLOT    = 21,
1114263764Sdim  R_SPARC_RELATIVE    = 22,
1115263764Sdim  R_SPARC_UA32        = 23,
1116263764Sdim  R_SPARC_PLT32       = 24,
1117263764Sdim  R_SPARC_HIPLT22     = 25,
1118263764Sdim  R_SPARC_LOPLT10     = 26,
1119263764Sdim  R_SPARC_PCPLT32     = 27,
1120263764Sdim  R_SPARC_PCPLT22     = 28,
1121263764Sdim  R_SPARC_PCPLT10     = 29,
1122263764Sdim  R_SPARC_10          = 30,
1123263764Sdim  R_SPARC_11          = 31,
1124263764Sdim  R_SPARC_64          = 32,
1125263764Sdim  R_SPARC_OLO10       = 33,
1126263764Sdim  R_SPARC_HH22        = 34,
1127263764Sdim  R_SPARC_HM10        = 35,
1128263764Sdim  R_SPARC_LM22        = 36,
1129263764Sdim  R_SPARC_PC_HH22     = 37,
1130263764Sdim  R_SPARC_PC_HM10     = 38,
1131263764Sdim  R_SPARC_PC_LM22     = 39,
1132263764Sdim  R_SPARC_WDISP16     = 40,
1133263764Sdim  R_SPARC_WDISP19     = 41,
1134263764Sdim  R_SPARC_7           = 43,
1135263764Sdim  R_SPARC_5           = 44,
1136263764Sdim  R_SPARC_6           = 45,
1137263764Sdim  R_SPARC_DISP64      = 46,
1138263764Sdim  R_SPARC_PLT64       = 47,
1139263764Sdim  R_SPARC_HIX22       = 48,
1140263764Sdim  R_SPARC_LOX10       = 49,
1141263764Sdim  R_SPARC_H44         = 50,
1142263764Sdim  R_SPARC_M44         = 51,
1143263764Sdim  R_SPARC_L44         = 52,
1144263764Sdim  R_SPARC_REGISTER    = 53,
1145263764Sdim  R_SPARC_UA64        = 54,
1146263764Sdim  R_SPARC_UA16        = 55,
1147263764Sdim  R_SPARC_TLS_GD_HI22   = 56,
1148263764Sdim  R_SPARC_TLS_GD_LO10   = 57,
1149263764Sdim  R_SPARC_TLS_GD_ADD    = 58,
1150263764Sdim  R_SPARC_TLS_GD_CALL   = 59,
1151263764Sdim  R_SPARC_TLS_LDM_HI22  = 60,
1152263764Sdim  R_SPARC_TLS_LDM_LO10  = 61,
1153263764Sdim  R_SPARC_TLS_LDM_ADD   = 62,
1154263764Sdim  R_SPARC_TLS_LDM_CALL  = 63,
1155263764Sdim  R_SPARC_TLS_LDO_HIX22 = 64,
1156263764Sdim  R_SPARC_TLS_LDO_LOX10 = 65,
1157263764Sdim  R_SPARC_TLS_LDO_ADD   = 66,
1158263764Sdim  R_SPARC_TLS_IE_HI22   = 67,
1159263764Sdim  R_SPARC_TLS_IE_LO10   = 68,
1160263764Sdim  R_SPARC_TLS_IE_LD     = 69,
1161263764Sdim  R_SPARC_TLS_IE_LDX    = 70,
1162263764Sdim  R_SPARC_TLS_IE_ADD    = 71,
1163263764Sdim  R_SPARC_TLS_LE_HIX22  = 72,
1164263764Sdim  R_SPARC_TLS_LE_LOX10  = 73,
1165263764Sdim  R_SPARC_TLS_DTPMOD32  = 74,
1166263764Sdim  R_SPARC_TLS_DTPMOD64  = 75,
1167263764Sdim  R_SPARC_TLS_DTPOFF32  = 76,
1168263764Sdim  R_SPARC_TLS_DTPOFF64  = 77,
1169263764Sdim  R_SPARC_TLS_TPOFF32   = 78,
1170263764Sdim  R_SPARC_TLS_TPOFF64   = 79,
1171263764Sdim  R_SPARC_GOTDATA_HIX22 = 80,
1172263764Sdim  R_SPARC_GOTDATA_LOX22 = 81,
1173263764Sdim  R_SPARC_GOTDATA_OP_HIX22 = 82,
1174263764Sdim  R_SPARC_GOTDATA_OP_LOX22 = 83,
1175263764Sdim  R_SPARC_GOTDATA_OP    = 84
1176263764Sdim};
1177263764Sdim
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 {
1194226890Sdim  Elf64_Word  sh_name;
1195226890Sdim  Elf64_Word  sh_type;
1196193323Sed  Elf64_Xword sh_flags;
1197193323Sed  Elf64_Addr  sh_addr;
1198193323Sed  Elf64_Off   sh_offset;
1199193323Sed  Elf64_Xword sh_size;
1200226890Sdim  Elf64_Word  sh_link;
1201226890Sdim  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
1212226890Sdim  SHN_LOOS      = 0xff20, // Lowest operating system-specific index
1213226890Sdim  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.
1221263509Sdimenum 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.
1240245431Sdim  SHT_GNU_ATTRIBUTES= 0x6ffffff5, // Object attributes.
1241245431Sdim  SHT_GNU_HASH      = 0x6ffffff6, // GNU-style hash table.
1242235633Sdim  SHT_GNU_verdef    = 0x6ffffffd, // GNU version definitions.
1243235633Sdim  SHT_GNU_verneed   = 0x6ffffffe, // GNU version references.
1244235633Sdim  SHT_GNU_versym    = 0x6fffffff, // GNU symbol versions table.
1245212904Sdim  SHT_HIOS          = 0x6fffffff, // Highest operating system-specific type.
1246252723Sdim  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,
1256252723Sdim  SHT_HEX_ORDERED         = 0x70000000, // Link editor is to sort the entries in
1257252723Sdim                                        // this section based on their sizes
1258218893Sdim  SHT_X86_64_UNWIND       = 0x70000001, // Unwind information
1259218893Sdim
1260252723Sdim  SHT_MIPS_REGINFO        = 0x70000006, // Register usage information
1261252723Sdim  SHT_MIPS_OPTIONS        = 0x7000000d, // General options
1262252723Sdim
1263252723Sdim  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.
1269263509Sdimenum 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
1301263509Sdim  // This section is excluded from the final executable or shared library.
1302263509Sdim  SHF_EXCLUDE = 0x80000000U,
1303263509Sdim
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
1316226890Sdim  SHF_MASKOS   = 0x0ff00000,
1317226890Sdim
1318218893Sdim  // Bits indicating processor-specific flags.
1319226890Sdim  SHF_MASKPROC = 0xf0000000,
1320226890Sdim
1321226890Sdim  // If an object file section does not have this flag set, then it may not hold
1322226890Sdim  // more than 2GB and can be freely referred to in objects using smaller code
1323226890Sdim  // models. Otherwise, only objects using larger code models can refer to them.
1324226890Sdim  // For example, a medium code model object can refer to data in a section that
1325226890Sdim  // sets this flag besides being able to refer to data in a section that does
1326226890Sdim  // not set it; likewise, a small code model object can refer only to code in a
1327226890Sdim  // section that does not set this flag.
1328252723Sdim  SHF_X86_64_LARGE = 0x10000000,
1329252723Sdim
1330252723Sdim  // All sections with the GPREL flag are grouped into a global data area
1331252723Sdim  // for faster accesses
1332252723Sdim  SHF_HEX_GPREL = 0x10000000,
1333252723Sdim
1334263509Sdim  // Section contains text/data which may be replicated in other sections.
1335263509Sdim  // Linker must retain only one copy.
1336263509Sdim  SHF_MIPS_NODUPES = 0x01000000,
1337263509Sdim
1338263509Sdim  // Linker must generate implicit hidden weak names.
1339263509Sdim  SHF_MIPS_NAMES   = 0x02000000,
1340263509Sdim
1341263509Sdim  // Section data local to process.
1342263509Sdim  SHF_MIPS_LOCAL   = 0x04000000,
1343263509Sdim
1344263509Sdim  // Do not strip this section.
1345263509Sdim  SHF_MIPS_NOSTRIP = 0x08000000,
1346263509Sdim
1347263509Sdim  // Section must be part of global data area.
1348263509Sdim  SHF_MIPS_GPREL   = 0x10000000,
1349263509Sdim
1350263509Sdim  // This section should be merged.
1351263509Sdim  SHF_MIPS_MERGE   = 0x20000000,
1352263509Sdim
1353263509Sdim  // Address size to be inferred from section entry size.
1354263509Sdim  SHF_MIPS_ADDR    = 0x40000000,
1355263509Sdim
1356263509Sdim  // Section data is string data by default.
1357263509Sdim  SHF_MIPS_STRING  = 0x80000000
1358193323Sed};
1359193323Sed
1360218893Sdim// Section Group Flags
1361263509Sdimenum 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
1392252723Sdim  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
1418226890Sdim  STB_LOOS   = 10, // Lowest operating system-specific binding type
1419226890Sdim  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
1433226890Sdim  STT_LOOS    = 7,   // Lowest operating system-specific symbol type
1434226890Sdim  STT_HIOS    = 8,   // Highest operating system-specific symbol type
1435235633Sdim  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
1447252723Sdim// Symbol number.
1448252723Sdimenum {
1449252723Sdim  STN_UNDEF = 0
1450252723Sdim};
1451252723Sdim
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:
1492252723Sdim  Elf64_Word getSymbol() const { return (r_info >> 32); }
1493252723Sdim  Elf64_Word getType() const {
1494252723Sdim    return (Elf64_Word) (r_info & 0xffffffffL);
1495210299Sed  }
1496252723Sdim  void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
1497252723Sdim  void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
1498252723Sdim  void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
1499252723Sdim    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:
1511252723Sdim  Elf64_Word getSymbol() const { return (r_info >> 32); }
1512252723Sdim  Elf64_Word getType() const {
1513252723Sdim    return (Elf64_Word) (r_info & 0xffffffffL);
1514210299Sed  }
1515252723Sdim  void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
1516252723Sdim  void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
1517252723Sdim  void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
1518252723Sdim    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
1540252723Sdim  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.
1555226890Sdim  PT_TLS     = 7, // The thread-local storage template.
1556226890Sdim  PT_LOOS    = 0x60000000, // Lowest operating system-specific pt entry type.
1557245431Sdim  PT_HIOS    = 0x6fffffff, // Highest operating system-specific pt entry type.
1558245431Sdim  PT_LOPROC  = 0x70000000, // Lowest processor-specific program hdr entry type.
1559245431Sdim  PT_HIPROC  = 0x7fffffff, // Highest processor-specific program hdr entry type.
1560226890Sdim
1561226890Sdim  // x86-64 program header types.
1562226890Sdim  // These all contain stack unwind tables.
1563226890Sdim  PT_GNU_EH_FRAME  = 0x6474e550,
1564226890Sdim  PT_SUNW_EH_FRAME = 0x6474e550,
1565226890Sdim  PT_SUNW_UNWIND   = 0x6464e550,
1566226890Sdim
1567245431Sdim  PT_GNU_STACK  = 0x6474e551, // Indicates stack executability.
1568245431Sdim  PT_GNU_RELRO  = 0x6474e552, // Read-only after relocation.
1569245431Sdim
1570245431Sdim  // ARM program header types.
1571252723Sdim  PT_ARM_ARCHEXT = 0x70000000, // Platform architecture compatibility info
1572245431Sdim  // These all contain stack unwind tables.
1573245431Sdim  PT_ARM_EXIDX   = 0x70000001,
1574263509Sdim  PT_ARM_UNWIND  = 0x70000001,
1575263509Sdim
1576263509Sdim  // MIPS program header types.
1577263509Sdim  PT_MIPS_REGINFO  = 0x70000000,  // Register usage information.
1578263509Sdim  PT_MIPS_RTPROC   = 0x70000001,  // Runtime procedure table.
1579263509Sdim  PT_MIPS_OPTIONS  = 0x70000002   // Options segment.
1580193323Sed};
1581193323Sed
1582193323Sed// Segment flag bits.
1583263509Sdimenum LLVM_ENUM_INT_TYPE(unsigned) {
1584193323Sed  PF_X        = 1,         // Execute
1585193323Sed  PF_W        = 2,         // Write
1586193323Sed  PF_R        = 4,         // Read
1587226890Sdim  PF_MASKOS   = 0x0ff00000,// Bits for operating system-specific semantics.
1588226890Sdim  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.
1644226890Sdim  DT_RUNPATH      = 29,       // String table offset of lib search path.
1645226890Sdim  DT_FLAGS        = 30,       // Flags.
1646226890Sdim  DT_ENCODING     = 32,       // Values from here to DT_LOOS follow the rules
1647226890Sdim                              // for the interpretation of the d_un union.
1648226890Sdim
1649226890Sdim  DT_PREINIT_ARRAY = 32,      // Pointer to array of preinit functions.
1650226890Sdim  DT_PREINIT_ARRAYSZ = 33,    // Size of the DT_PREINIT_ARRAY array.
1651226890Sdim
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.
1655245431Sdim  DT_HIPROC       = 0x7FFFFFFF, // End of processor specific tags.
1656245431Sdim
1657245431Sdim  DT_RELACOUNT    = 0x6FFFFFF9, // ELF32_Rela count.
1658245431Sdim  DT_RELCOUNT     = 0x6FFFFFFA, // ELF32_Rel count.
1659245431Sdim
1660245431Sdim  DT_FLAGS_1      = 0X6FFFFFFB, // Flags_1.
1661263509Sdim  DT_VERSYM       = 0x6FFFFFF0, // The address of .gnu.version section.
1662245431Sdim  DT_VERDEF       = 0X6FFFFFFC, // The address of the version definition table.
1663245431Sdim  DT_VERDEFNUM    = 0X6FFFFFFD, // The number of entries in DT_VERDEF.
1664245431Sdim  DT_VERNEED      = 0X6FFFFFFE, // The address of the version Dependency table.
1665263509Sdim  DT_VERNEEDNUM   = 0X6FFFFFFF, // The number of entries in DT_VERNEED.
1666263509Sdim
1667263509Sdim  // Mips specific dynamic table entry tags.
1668263509Sdim  DT_MIPS_RLD_VERSION   = 0x70000001, // 32 bit version number for runtime
1669263509Sdim                                      // linker interface.
1670263509Sdim  DT_MIPS_TIME_STAMP    = 0x70000002, // Time stamp.
1671263509Sdim  DT_MIPS_ICHECKSUM     = 0x70000003, // Checksum of external strings
1672263509Sdim                                      // and common sizes.
1673263509Sdim  DT_MIPS_IVERSION      = 0x70000004, // Index of version string
1674263509Sdim                                      // in string table.
1675263509Sdim  DT_MIPS_FLAGS         = 0x70000005, // 32 bits of flags.
1676263509Sdim  DT_MIPS_BASE_ADDRESS  = 0x70000006, // Base address of the segment.
1677263509Sdim  DT_MIPS_MSYM          = 0x70000007, // Address of .msym section.
1678263509Sdim  DT_MIPS_CONFLICT      = 0x70000008, // Address of .conflict section.
1679263509Sdim  DT_MIPS_LIBLIST       = 0x70000009, // Address of .liblist section.
1680263509Sdim  DT_MIPS_LOCAL_GOTNO   = 0x7000000a, // Number of local global offset
1681263509Sdim                                      // table entries.
1682263509Sdim  DT_MIPS_CONFLICTNO    = 0x7000000b, // Number of entries
1683263509Sdim                                      // in the .conflict section.
1684263509Sdim  DT_MIPS_LIBLISTNO     = 0x70000010, // Number of entries
1685263509Sdim                                      // in the .liblist section.
1686263509Sdim  DT_MIPS_SYMTABNO      = 0x70000011, // Number of entries
1687263509Sdim                                      // in the .dynsym section.
1688263509Sdim  DT_MIPS_UNREFEXTNO    = 0x70000012, // Index of first external dynamic symbol
1689263509Sdim                                      // not referenced locally.
1690263509Sdim  DT_MIPS_GOTSYM        = 0x70000013, // Index of first dynamic symbol
1691263509Sdim                                      // in global offset table.
1692263509Sdim  DT_MIPS_HIPAGENO      = 0x70000014, // Number of page table entries
1693263509Sdim                                      // in global offset table.
1694263509Sdim  DT_MIPS_RLD_MAP       = 0x70000016, // Address of run time loader map,
1695263509Sdim                                      // used for debugging.
1696263509Sdim  DT_MIPS_DELTA_CLASS       = 0x70000017, // Delta C++ class definition.
1697263509Sdim  DT_MIPS_DELTA_CLASS_NO    = 0x70000018, // Number of entries
1698263509Sdim                                          // in DT_MIPS_DELTA_CLASS.
1699263509Sdim  DT_MIPS_DELTA_INSTANCE    = 0x70000019, // Delta C++ class instances.
1700263509Sdim  DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A, // Number of entries
1701263509Sdim                                          // in DT_MIPS_DELTA_INSTANCE.
1702263509Sdim  DT_MIPS_DELTA_RELOC       = 0x7000001B, // Delta relocations.
1703263509Sdim  DT_MIPS_DELTA_RELOC_NO    = 0x7000001C, // Number of entries
1704263509Sdim                                          // in DT_MIPS_DELTA_RELOC.
1705263509Sdim  DT_MIPS_DELTA_SYM         = 0x7000001D, // Delta symbols that Delta
1706263509Sdim                                          // relocations refer to.
1707263509Sdim  DT_MIPS_DELTA_SYM_NO      = 0x7000001E, // Number of entries
1708263509Sdim                                          // in DT_MIPS_DELTA_SYM.
1709263509Sdim  DT_MIPS_DELTA_CLASSSYM    = 0x70000020, // Delta symbols that hold
1710263509Sdim                                          // class declarations.
1711263509Sdim  DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021, // Number of entries
1712263509Sdim                                          // in DT_MIPS_DELTA_CLASSSYM.
1713263509Sdim  DT_MIPS_CXX_FLAGS         = 0x70000022, // Flags indicating information
1714263509Sdim                                          // about C++ flavor.
1715263509Sdim  DT_MIPS_PIXIE_INIT        = 0x70000023, // Pixie information.
1716263509Sdim  DT_MIPS_SYMBOL_LIB        = 0x70000024, // Address of .MIPS.symlib
1717263509Sdim  DT_MIPS_LOCALPAGE_GOTIDX  = 0x70000025, // The GOT index of the first PTE
1718263509Sdim                                          // for a segment
1719263509Sdim  DT_MIPS_LOCAL_GOTIDX      = 0x70000026, // The GOT index of the first PTE
1720263509Sdim                                          // for a local symbol
1721263509Sdim  DT_MIPS_HIDDEN_GOTIDX     = 0x70000027, // The GOT index of the first PTE
1722263509Sdim                                          // for a hidden symbol
1723263509Sdim  DT_MIPS_PROTECTED_GOTIDX  = 0x70000028, // The GOT index of the first PTE
1724263509Sdim                                          // for a protected symbol
1725263509Sdim  DT_MIPS_OPTIONS           = 0x70000029, // Address of `.MIPS.options'.
1726263509Sdim  DT_MIPS_INTERFACE         = 0x7000002A, // Address of `.interface'.
1727263509Sdim  DT_MIPS_DYNSTR_ALIGN      = 0x7000002B, // Unknown.
1728263509Sdim  DT_MIPS_INTERFACE_SIZE    = 0x7000002C, // Size of the .interface section.
1729263509Sdim  DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D, // Size of rld_text_resolve
1730263509Sdim                                              // function stored in the GOT.
1731263509Sdim  DT_MIPS_PERF_SUFFIX       = 0x7000002E, // Default suffix of DSO to be added
1732263509Sdim                                          // by rld on dlopen() calls.
1733263509Sdim  DT_MIPS_COMPACT_SIZE      = 0x7000002F, // Size of compact relocation
1734263509Sdim                                          // section (O32).
1735263509Sdim  DT_MIPS_GP_VALUE          = 0x70000030, // GP value for auxiliary GOTs.
1736263509Sdim  DT_MIPS_AUX_DYNAMIC       = 0x70000031, // Address of auxiliary .dynamic.
1737263509Sdim  DT_MIPS_PLTGOT            = 0x70000032, // Address of the base of the PLTGOT.
1738263509Sdim  DT_MIPS_RWPLT             = 0x70000034  // Points to the base
1739263509Sdim                                          // of a writable PLT.
1740210299Sed};
1741210299Sed
1742226890Sdim// DT_FLAGS values.
1743226890Sdimenum {
1744226890Sdim  DF_ORIGIN     = 0x01, // The object may reference $ORIGIN.
1745226890Sdim  DF_SYMBOLIC   = 0x02, // Search the shared lib before searching the exe.
1746226890Sdim  DF_TEXTREL    = 0x04, // Relocations may modify a non-writable segment.
1747226890Sdim  DF_BIND_NOW   = 0x08, // Process all relocations on load.
1748226890Sdim  DF_STATIC_TLS = 0x10  // Reject attempts to load dynamically.
1749226890Sdim};
1750226890Sdim
1751245431Sdim// State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry.
1752245431Sdimenum {
1753245431Sdim  DF_1_NOW        = 0x00000001, // Set RTLD_NOW for this object.
1754245431Sdim  DF_1_GLOBAL     = 0x00000002, // Set RTLD_GLOBAL for this object.
1755245431Sdim  DF_1_GROUP      = 0x00000004, // Set RTLD_GROUP for this object.
1756245431Sdim  DF_1_NODELETE   = 0x00000008, // Set RTLD_NODELETE for this object.
1757245431Sdim  DF_1_LOADFLTR   = 0x00000010, // Trigger filtee loading at runtime.
1758245431Sdim  DF_1_INITFIRST  = 0x00000020, // Set RTLD_INITFIRST for this object.
1759245431Sdim  DF_1_NOOPEN     = 0x00000040, // Set RTLD_NOOPEN for this object.
1760245431Sdim  DF_1_ORIGIN     = 0x00000080, // $ORIGIN must be handled.
1761245431Sdim  DF_1_DIRECT     = 0x00000100, // Direct binding enabled.
1762245431Sdim  DF_1_TRANS      = 0x00000200,
1763245431Sdim  DF_1_INTERPOSE  = 0x00000400, // Object is used to interpose.
1764245431Sdim  DF_1_NODEFLIB   = 0x00000800, // Ignore default lib search path.
1765245431Sdim  DF_1_NODUMP     = 0x00001000, // Object can't be dldump'ed.
1766245431Sdim  DF_1_CONFALT    = 0x00002000, // Configuration alternative created.
1767245431Sdim  DF_1_ENDFILTEE  = 0x00004000, // Filtee terminates filters search.
1768245431Sdim  DF_1_DISPRELDNE = 0x00008000, // Disp reloc applied at build time.
1769245431Sdim  DF_1_DISPRELPND = 0x00010000  // Disp reloc applied at run-time.
1770245431Sdim};
1771245431Sdim
1772263509Sdim// DT_MIPS_FLAGS values.
1773263509Sdimenum {
1774263509Sdim  RHF_NONE                    = 0x00000000, // No flags.
1775263509Sdim  RHF_QUICKSTART              = 0x00000001, // Uses shortcut pointers.
1776263509Sdim  RHF_NOTPOT                  = 0x00000002, // Hash size is not a power of two.
1777263509Sdim  RHS_NO_LIBRARY_REPLACEMENT  = 0x00000004, // Ignore LD_LIBRARY_PATH.
1778263509Sdim  RHF_NO_MOVE                 = 0x00000008, // DSO address may not be relocated.
1779263509Sdim  RHF_SGI_ONLY                = 0x00000010, // SGI specific features.
1780263509Sdim  RHF_GUARANTEE_INIT          = 0x00000020, // Guarantee that .init will finish
1781263509Sdim                                            // executing before any non-init
1782263509Sdim                                            // code in DSO is called.
1783263509Sdim  RHF_DELTA_C_PLUS_PLUS       = 0x00000040, // Contains Delta C++ code.
1784263509Sdim  RHF_GUARANTEE_START_INIT    = 0x00000080, // Guarantee that .init will start
1785263509Sdim                                            // executing before any non-init
1786263509Sdim                                            // code in DSO is called.
1787263509Sdim  RHF_PIXIE                   = 0x00000100, // Generated by pixie.
1788263509Sdim  RHF_DEFAULT_DELAY_LOAD      = 0x00000200, // Delay-load DSO by default.
1789263509Sdim  RHF_REQUICKSTART            = 0x00000400, // Object may be requickstarted
1790263509Sdim  RHF_REQUICKSTARTED          = 0x00000800, // Object has been requickstarted
1791263509Sdim  RHF_CORD                    = 0x00001000, // Generated by cord.
1792263509Sdim  RHF_NO_UNRES_UNDEF          = 0x00002000, // Object contains no unresolved
1793263509Sdim                                            // undef symbols.
1794263509Sdim  RHF_RLD_ORDER_SAFE          = 0x00004000  // Symbol table is in a safe order.
1795263509Sdim};
1796263509Sdim
1797235633Sdim// ElfXX_VerDef structure version (GNU versioning)
1798235633Sdimenum {
1799235633Sdim  VER_DEF_NONE    = 0,
1800235633Sdim  VER_DEF_CURRENT = 1
1801235633Sdim};
1802235633Sdim
1803235633Sdim// VerDef Flags (ElfXX_VerDef::vd_flags)
1804235633Sdimenum {
1805235633Sdim  VER_FLG_BASE = 0x1,
1806235633Sdim  VER_FLG_WEAK = 0x2,
1807235633Sdim  VER_FLG_INFO = 0x4
1808235633Sdim};
1809235633Sdim
1810235633Sdim// Special constants for the version table. (SHT_GNU_versym/.gnu.version)
1811235633Sdimenum {
1812235633Sdim  VER_NDX_LOCAL  = 0,      // Unversioned local symbol
1813235633Sdim  VER_NDX_GLOBAL = 1,      // Unversioned global symbol
1814235633Sdim  VERSYM_VERSION = 0x7fff, // Version Index mask
1815235633Sdim  VERSYM_HIDDEN  = 0x8000  // Hidden bit (non-default version)
1816235633Sdim};
1817235633Sdim
1818235633Sdim// ElfXX_VerNeed structure version (GNU versioning)
1819235633Sdimenum {
1820235633Sdim  VER_NEED_NONE = 0,
1821235633Sdim  VER_NEED_CURRENT = 1
1822235633Sdim};
1823235633Sdim
1824193323Sed} // end namespace ELF
1825193323Sed
1826193323Sed} // end namespace llvm
1827193323Sed
1828193323Sed#endif
1829