source: soft/giet_vm/memo/include/libelfpp/elfpp/elfpp_bits.hh @ 188

Last change on this file since 188 was 163, checked in by karaoui, 12 years ago

changing mover to memo
changing soft.bin to soft.elf
...

File size: 84.9 KB
Line 
1/*
2    This file is part of Libelfpp.
3
4    Libelfpp is free software: you can redistribute it and/or modify
5    it under the terms of the GNU Lesser General Public License as
6    published by the Free Software Foundation, either version 3 of the
7    License, or (at your option) any later version.
8
9    Libelfpp is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with Libelfpp.  If not, see
16    <http://www.gnu.org/licenses/>.
17
18    Based on part of the GNU C Library (LGPL).
19    Copyright (C) 1995-2003,2004,2005,2006,2007 Free Software Foundation, Inc.
20*/
21
22#ifndef ELFPP_BITS_H_
23#define ELFPP_BITS_H_
24
25#include <stdint.h>
26
27/// Provide bit mask operations for an enum type
28#define ELF_ENUM_OPS(type)                      \
29                                                \
30    inline type operator| (type a, type b)      \
31    {                                           \
32      return (type)((int)a | (int)b);           \
33    }                                           \
34                                                \
35    inline type operator& (type a, type b)      \
36    {                                           \
37      return (type)((int)a & (int)b);           \
38    }                                           \
39                                                \
40    inline type operator~ (type a)              \
41    {                                           \
42      return (type)(~(int)a);                   \
43    }
44
45namespace elfpp
46{
47
48/* Standard ELF types.  */
49
50/** @multiple Type for a 16-bit quantity.  */
51typedef uint16_t Elf32_Half;
52typedef uint16_t Elf64_Half;
53
54/** @multiple Type for signed and unsigned 32-bit quantities.  */
55typedef uint32_t Elf32_Word;
56typedef int32_t  Elf32_Sword;
57typedef uint32_t Elf64_Word;
58typedef int32_t  Elf64_Sword;
59
60/**  @multiple Type for signed and unsigned 64-bit quantities.  */
61typedef uint64_t Elf32_Xword;
62typedef int64_t  Elf32_Sxword;
63typedef uint64_t Elf64_Xword;
64typedef int64_t  Elf64_Sxword;
65
66/** @multiple Type of addresses.  */
67typedef uint32_t Elf32_Addr;
68typedef uint64_t Elf64_Addr;
69
70/** @multiple Type of file offsets.  */
71typedef uint32_t Elf32_Off;
72typedef uint64_t Elf64_Off;
73
74/** @multiple Type for section indices, which are 16-bit quantities.  */
75typedef uint16_t Elf32_Section;
76typedef uint16_t Elf64_Section;
77
78/** @multiple Type for version symbol information.  */
79typedef Elf32_Half Elf32_Versym;
80typedef Elf64_Half Elf64_Versym;
81
82
83/** @multiple The ELF file header.  This appears at the start of every ELF file.  */
84
85  static const unsigned int EI_NIDENT = 16;
86
87  struct Elf32_Ehdr
88  {
89    unsigned char       e_ident[EI_NIDENT];     //< Magic number and other info
90    Elf32_Half  e_type;         //< Object file type
91    Elf32_Half  e_machine;      //< Architecture
92    Elf32_Word  e_version;      //< Object file version
93    Elf32_Addr  e_entry;        //< Entry point virtual address
94    Elf32_Off   e_phoff;        //< Program header table file offset
95    Elf32_Off   e_shoff;        //< Section header table file offset
96    Elf32_Word  e_flags;        //< Processor-specific flags
97    Elf32_Half  e_ehsize;       //< ELF header size in bytes
98    Elf32_Half  e_phentsize;    //< Program header table entry size
99    Elf32_Half  e_phnum;        //< Program header table entry count
100    Elf32_Half  e_shentsize;    //< Section header table entry size
101    Elf32_Half  e_shnum;        //< Section header table entry count
102    Elf32_Half  e_shstrndx;     //< Section header string table index
103  };
104
105  struct Elf64_Ehdr
106  {
107    unsigned char       e_ident[EI_NIDENT];     //< Magic number and other info
108    Elf64_Half  e_type;         //< Object file type
109    Elf64_Half  e_machine;      //< Architecture
110    Elf64_Word  e_version;      //< Object file version
111    Elf64_Addr  e_entry;        //< Entry point virtual address
112    Elf64_Off   e_phoff;        //< Program header table file offset
113    Elf64_Off   e_shoff;        //< Section header table file offset
114    Elf64_Word  e_flags;        //< Processor-specific flags
115    Elf64_Half  e_ehsize;       //< ELF header size in bytes
116    Elf64_Half  e_phentsize;    //< Program header table entry size
117    Elf64_Half  e_phnum;        //< Program header table entry count
118    Elf64_Half  e_shentsize;    //< Section header table entry size
119    Elf64_Half  e_shnum;        //< Section header table entry count
120    Elf64_Half  e_shstrndx;     //< Section header string table index
121  };
122
123/* Fields in the e_ident array.  The EI_* macros are indices into the
124   array.  The macros under each EI_* macro are the values the byte
125   may have.  */
126
127/** @multiple Conglomeration of the identification bytes, for easy testing as a word.  */
128#define ELFMAG          "\177ELF"
129
130  static const unsigned int EI_CLASS = 4;       //< File class byte index
131
132  enum ei_class_e
133    {
134      ELFCLASSNONE = 0,         //< Invalid class
135      ELFCLASS32 = 1,           //< 32-bit objects
136      ELFCLASS64 = 2,           //< 64-bit objects
137      ELFCLASSNUM = 3,
138    };
139
140  static const unsigned int EI_DATA = 5;        //< Data encoding byte index
141
142  enum ei_data_e
143    {
144      ELFDATANONE = 0,  //< Invalid data encoding
145      ELFDATA2LSB = 1,  //< 2's complement, little endian
146      ELFDATA2MSB = 2,  //< 2's complement, big endian
147      ELFDATANUM = 3,
148    };
149
150  static const unsigned int EI_VERSION = 6;     //< File version byte index Value must be EV_CURRENT
151
152  static const unsigned int EI_OSABI = 7;       //< OS ABI identification
153
154  enum ei_osabi_e
155    {
156      ELFOSABI_NONE = 0,        //< UNIX System V ABI
157      ELFOSABI_SYSV = 0,        //< Alias. 
158      ELFOSABI_HPUX = 1,        //< HP-UX
159      ELFOSABI_NETBSD = 2,      //< NetBSD. 
160      ELFOSABI_LINUX = 3,       //< Linux. 
161      ELFOSABI_SOLARIS = 6,     //< Sun Solaris. 
162      ELFOSABI_AIX = 7,         //< IBM AIX. 
163      ELFOSABI_IRIX = 8,        //< SGI Irix. 
164      ELFOSABI_FREEBSD = 9,     //< FreeBSD. 
165      ELFOSABI_TRU64 = 10,      //< Compaq TRU64 UNIX. 
166      ELFOSABI_MODESTO = 11,    //< Novell Modesto. 
167      ELFOSABI_OPENBSD = 12,    //< OpenBSD. 
168      ELFOSABI_ARM = 97,        //< ARM
169      ELFOSABI_STANDALONE = 255,        //< Standalone (embedded) application
170    };
171
172  static const unsigned int EI_ABIVERSION       = 8;    //< ABI version
173
174  static const unsigned int EI_PAD = 9; //< Byte index of padding bytes
175
176/** Legal values for e_type (object file type).  */
177
178  enum e_type_e
179    {
180      ET_NONE = 0,      //< No file type
181      ET_REL = 1,       //< Relocatable file
182      ET_EXEC = 2,      //< Executable file
183      ET_DYN = 3,       //< Shared object file
184      ET_CORE = 4,      //< Core file
185      ET_NUM = 5,       //< Number of defined types
186      ET_LOOS = 0xfe00, //< OS-specific range start
187      ET_HIOS = 0xfeff, //< OS-specific range end
188      ET_LOPROC = 0xff00,       //< Processor-specific range start
189      ET_HIPROC = 0xffff,       //< Processor-specific range end
190    };
191
192/** Legal values for e_machine (architecture).  */
193
194  enum e_machine_e
195    {
196      EM_NONE = 0,      //< No machine
197      EM_M32 = 1,       //< AT&T WE 32100
198      EM_SPARC = 2,     //< SUN SPARC
199      EM_386 = 3,       //< Intel 80386
200      EM_68K = 4,       //< Motorola m68k family
201      EM_88K = 5,       //< Motorola m88k family
202      EM_860 = 7,       //< Intel 80860
203      EM_MIPS = 8,      //< MIPS R3000 big-endian
204      EM_S370 = 9,      //< IBM System/370
205      EM_MIPS_RS3_LE = 10,      //< MIPS R3000 little-endian
206      EM_PARISC = 15,   //< HPPA
207      EM_VPP500 = 17,   //< Fujitsu VPP500
208      EM_SPARC32PLUS = 18,      //< Sun's "v8plus"
209      EM_960 = 19,      //< Intel 80960
210      EM_PPC = 20,      //< PowerPC
211      EM_PPC64 = 21,    //< PowerPC 64-bit
212      EM_S390 = 22,     //< IBM S390
213      EM_V800 = 36,     //< NEC V800 series
214      EM_FR20 = 37,     //< Fujitsu FR20
215      EM_RH32 = 38,     //< TRW RH-32
216      EM_RCE = 39,      //< Motorola RCE
217      EM_ARM = 40,      //< ARM
218      EM_FAKE_ALPHA = 41,       //< Digital Alpha
219      EM_SH = 42,       //< Hitachi SH
220      EM_SPARCV9 = 43,  //< SPARC v9 64-bit
221      EM_TRICORE = 44,  //< Siemens Tricore
222      EM_ARC = 45,      //< Argonaut RISC Core
223      EM_H8_300 = 46,   //< Hitachi H8/300
224      EM_H8_300H = 47,  //< Hitachi H8/300H
225      EM_H8S = 48,      //< Hitachi H8S
226      EM_H8_500 = 49,   //< Hitachi H8/500
227      EM_IA_64 = 50,    //< Intel Merced
228      EM_MIPS_X = 51,   //< Stanford MIPS-X
229      EM_COLDFIRE = 52, //< Motorola Coldfire
230      EM_68HC12 = 53,   //< Motorola M68HC12
231      EM_MMA = 54,      //< Fujitsu MMA Multimedia Accelerator
232      EM_PCP = 55,      //< Siemens PCP
233      EM_NCPU = 56,     //< Sony nCPU embeeded RISC
234      EM_NDR1 = 57,     //< Denso NDR1 microprocessor
235      EM_STARCORE = 58, //< Motorola Start*Core processor
236      EM_ME16 = 59,     //< Toyota ME16 processor
237      EM_ST100 = 60,    //< STMicroelectronic ST100 processor
238      EM_TINYJ = 61,    //< Advanced Logic Corp. Tinyj emb.fam
239      EM_X86_64 = 62,   //< AMD x86-64 architecture
240      EM_PDSP = 63,     //< Sony DSP Processor
241      EM_FX66 = 66,     //< Siemens FX66 microcontroller
242      EM_ST9PLUS = 67,  //< STMicroelectronics ST9+ 8/16 mc
243      EM_ST7 = 68,      //< STmicroelectronics ST7 8 bit mc
244      EM_68HC16 = 69,   //< Motorola MC68HC16 microcontroller
245      EM_68HC11 = 70,   //< Motorola MC68HC11 microcontroller
246      EM_68HC08 = 71,   //< Motorola MC68HC08 microcontroller
247      EM_68HC05 = 72,   //< Motorola MC68HC05 microcontroller
248      EM_SVX = 73,      //< Silicon Graphics SVx
249      EM_ST19 = 74,     //< STMicroelectronics ST19 8 bit mc
250      EM_VAX = 75,      //< Digital VAX
251      EM_CRIS = 76,     //< Axis Communications 32-bit embedded processor
252      EM_JAVELIN = 77,  //< Infineon Technologies 32-bit embedded processor
253      EM_FIREPATH = 78, //< Element 14 64-bit DSP Processor
254      EM_ZSP = 79,      //< LSI Logic 16-bit DSP Processor
255      EM_MMIX = 80,     //< Donald Knuth's educational 64-bit processor
256      EM_HUANY = 81,    //< Harvard University machine-independent object files
257      EM_PRISM = 82,    //< SiTera Prism
258      EM_AVR = 83,      //< Atmel AVR 8-bit microcontroller
259      EM_FR30 = 84,     //< Fujitsu FR30
260      EM_D10V = 85,     //< Mitsubishi D10V
261      EM_D30V = 86,     //< Mitsubishi D30V
262      EM_V850 = 87,     //< NEC v850
263      EM_M32R = 88,     //< Mitsubishi M32R
264      EM_MN10300 = 89,  //< Matsushita MN10300
265      EM_MN10200 = 90,  //< Matsushita MN10200
266      EM_PJ = 91,       //< picoJava
267      EM_OPENRISC = 92, //< OpenRISC 32-bit embedded processor
268      EM_ARC_A5 = 93,   //< ARC Cores Tangent-A5
269      EM_XTENSA = 94,   //< Tensilica Xtensa Architecture
270      EM_NUM = 95,
271
272/* If it is necessary to assign new unofficial EM_* values, please
273   pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
274   chances of collision with official or non-GNU unofficial values.  */
275
276      EM_ALPHA = 0x9026,
277    };
278
279  /** Legal values for e_version (version).  */
280
281  static const unsigned int EV_NONE = 0;        //< Invalid ELF version
282  static const unsigned int EV_CURRENT = 1;     //< Current version
283  static const unsigned int EV_NUM = 2;
284
285/** 32 bits section header.  */
286struct Elf32_Shdr
287{
288  Elf32_Word    sh_name;        //< Section name (string tbl index)
289  Elf32_Word    sh_type;        //< Section type
290  Elf32_Word    sh_flags;       //< Section flags
291  Elf32_Addr    sh_addr;        //< Section virtual addr at execution
292  Elf32_Off     sh_offset;      //< Section file offset
293  Elf32_Word    sh_size;        //< Section size in bytes
294  Elf32_Word    sh_link;        //< Link to another section
295  Elf32_Word    sh_info;        //< Additional section information
296  Elf32_Word    sh_addralign;   //< Section alignment
297  Elf32_Word    sh_entsize;     //< Entry size if section holds table
298};
299
300/** 64 bits section header.  */
301struct Elf64_Shdr
302{
303  Elf64_Word    sh_name;        //< Section name (string tbl index)
304  Elf64_Word    sh_type;        //< Section type
305  Elf64_Xword   sh_flags;       //< Section flags
306  Elf64_Addr    sh_addr;        //< Section virtual addr at execution
307  Elf64_Off     sh_offset;      //< Section file offset
308  Elf64_Xword   sh_size;        //< Section size in bytes
309  Elf64_Word    sh_link;        //< Link to another section
310  Elf64_Word    sh_info;        //< Additional section information
311  Elf64_Xword   sh_addralign;   //< Section alignment
312  Elf64_Xword   sh_entsize;     //< Entry size if section holds table
313};
314
315/** Special section indices.  */
316
317#define SHN_UNDEF       0
318          //< Undefined section
319#define SHN_LORESERVE   0xff00
320          //< Start of reserved indices
321#define SHN_LOPROC      0xff00
322          //< Start of processor-specific
323#define SHN_BEFORE      0xff00
324          //< Order section before all others (Solaris). 
325#define SHN_AFTER       0xff01
326          //< Order section after all others (Solaris). 
327#define SHN_HIPROC      0xff1f
328          //< End of processor-specific
329#define SHN_LOOS        0xff20
330          //< Start of OS-specific
331#define SHN_HIOS        0xff3f
332          //< End of OS-specific
333#define SHN_ABS         0xfff1
334          //< Associated symbol is absolute
335#define SHN_COMMON      0xfff2
336          //< Associated symbol is common
337#define SHN_XINDEX      0xffff
338          //< Index is in extra table. 
339#define SHN_HIRESERVE   0xffff
340          //< End of reserved indices
341
342/** Legal values for sh_type (section type).  */
343
344enum sh_type_e
345  {
346    SHT_NULL = 0,       //< Section header table entry unused
347    SHT_PROGBITS = 1,   //< Program data
348    SHT_SYMTAB = 2,     //< Symbol table
349    SHT_STRTAB = 3,     //< String table
350    SHT_RELA = 4,       //< Relocation entries with addends
351    SHT_HASH = 5,       //< Symbol hash table
352    SHT_DYNAMIC = 6,    //< Dynamic linking information
353    SHT_NOTE = 7,       //< Notes
354    SHT_NOBITS = 8,     //< Program space with no data (bss)
355    SHT_REL = 9,        //< Relocation entries, no addends
356    SHT_SHLIB = 10,     //< Reserved
357    SHT_DYNSYM = 11,    //< Dynamic linker symbol table
358    SHT_INIT_ARRAY = 14,        //< Array of constructors
359    SHT_FINI_ARRAY = 15,        //< Array of destructors
360    SHT_PREINIT_ARRAY = 16,     //< Array of pre-constructors
361    SHT_GROUP = 17,     //< Section group
362    SHT_SYMTAB_SHNDX = 18,      //< Extended section indeces
363    SHT_NUM = 19,       //< Number of defined types. 
364    SHT_LOOS = 0x60000000,      //< Start OS-specific. 
365    SHT_GNU_HASH = 0x6ffffff6,  //< GNU-style hash table. 
366    SHT_GNU_LIBLIST = 0x6ffffff7,       //< Prelink library list
367    SHT_CHECKSUM = 0x6ffffff8,  //< Checksum for DSO content. 
368    SHT_LOSUNW = 0x6ffffffa,    //< Sun-specific low bound. 
369    SHT_SUNW_move = 0x6ffffffa,
370    SHT_SUNW_COMDAT = 0x6ffffffb,
371    SHT_SUNW_syminfo = 0x6ffffffc,
372    SHT_GNU_verdef = 0x6ffffffd,        //< Version definition section. 
373    SHT_GNU_verneed = 0x6ffffffe,       //< Version needs section. 
374    SHT_GNU_versym = 0x6fffffff,        //< Version symbol table. 
375    SHT_HISUNW = 0x6fffffff,    //< Sun-specific high bound. 
376    SHT_HIOS = 0x6fffffff,      //< End OS-specific type
377    SHT_LOPROC = 0x70000000,    //< Start of processor-specific
378    SHT_HIPROC = 0x7fffffff,    //< End of processor-specific
379    SHT_LOUSER = 0x80000000,    //< Start of application-specific
380    SHT_HIUSER = 0x8fffffff,    //< End of application-specific
381  };
382
383/** Legal values for sh_flags (section flags).  */
384
385enum sh_flags_e
386  {
387    SHF_NONE =             0,
388    SHF_WRITE =            (1 << 0),    //< Writable
389    SHF_ALLOC =            (1 << 1),    //< Occupies memory during execution
390    SHF_EXECINSTR =        (1 << 2),    //< Executable
391    SHF_MERGE =            (1 << 4),    //< Might be merged
392    SHF_STRINGS =          (1 << 5),    //< Contains nul-terminated strings
393    SHF_INFO_LINK =        (1 << 6),    //< `sh_info' contains SHT index
394    SHF_LINK_ORDER =       (1 << 7),    //< Preserve order after combining
395    SHF_OS_NONCONFORMING = (1 << 8),    //< Non-standard OS specific handling required
396    SHF_GROUP =            (1 << 9),    //< Section is member of a group. 
397    SHF_TLS =              (1 << 10),   //< Section hold thread-local data. 
398    SHF_MASKOS =           0x0ff00000,  //< OS-specific. 
399    SHF_MASKPROC =         0xf0000000,  //< Processor-specific
400    SHF_ORDERED =          (1 << 30),   //< Special ordering requirement (Solaris). 
401    SHF_EXCLUDE =          (1 << 31),   //< Section is excluded unless referenced or allocated (Solaris).
402  };
403
404ELF_ENUM_OPS(sh_flags_e)
405
406/** Section group handling.  */
407static const unsigned int  GRP_COMDAT = 0x1;    //< Mark group as COMDAT. 
408
409/** 32 bits symbol table entry.  */
410struct Elf32_Sym
411{
412  Elf32_Word    st_name;        //< Symbol name (string tbl index)
413  Elf32_Addr    st_value;       //< Symbol value
414  Elf32_Word    st_size;        //< Symbol size
415  unsigned char st_info;        //< Symbol type and binding
416  unsigned char st_other;       //< Symbol visibility
417  Elf32_Section st_shndx;       //< Section index
418};
419
420/** 64 bits symbol table entry.  */
421struct Elf64_Sym
422{
423  Elf64_Word    st_name;        //< Symbol name (string tbl index)
424  unsigned char st_info;        //< Symbol type and binding
425  unsigned char st_other;       //< Symbol visibility
426  Elf64_Section st_shndx;       //< Section index
427  Elf64_Addr    st_value;       //< Symbol value
428  Elf64_Xword   st_size;        //< Symbol size
429};
430
431/** 32 bits syminfo section if available contains additional information about every dynamic symbol.  */
432struct Elf32_Syminfo
433{
434  Elf32_Half si_boundto;        //< Direct bindings, symbol bound to
435  Elf32_Half si_flags;  //< Per symbol flags
436};
437
438/** 64 bits syminfo section if available contains additional information about every dynamic symbol.  */
439struct Elf64_Syminfo
440{
441  Elf64_Half si_boundto;        //< Direct bindings, symbol bound to
442  Elf64_Half si_flags;  //< Per symbol flags
443};
444
445/** Possible values for si_boundto.  */
446enum si_boundto_e
447  {
448    SYMINFO_BT_SELF =         0xffff,   //< Symbol bound to self
449    SYMINFO_BT_PARENT =       0xfffe,   //< Symbol bound to parent
450    SYMINFO_BT_LOWRESERVE =   0xff00,   //< Beginning of reserved entries
451  };
452
453/** Possible bitmasks for si_flags.  */
454enum si_flags_e
455  {
456    SYMINFO_FLG_DIRECT =      0x0001,   //< Direct bound symbol
457    SYMINFO_FLG_PASSTHRU =    0x0002,   //< Pass-thru symbol for translator
458    SYMINFO_FLG_COPY =        0x0004,   //< Symbol is a copy-reloc
459    SYMINFO_FLG_LAZYLOAD =    0x0008,   //< Symbol bound to object to be lazy loaded
460  };
461
462/** Syminfo version values.  */
463enum si_version_e {
464    SYMINFO_NONE = 0,
465    SYMINFO_CURRENT = 1,
466    SYMINFO_NUM = 2,
467  };
468
469/** Extract bind information held in the st_info field.  */
470#define ELF_ST_BIND(val)              ((::elfpp::st_info_bind_e)(((unsigned char) (val)) >> 4))
471/** Extract type information held in the st_info field.  */
472#define ELF_ST_TYPE(val)              ((::elfpp::st_info_type_e)((val) & 0xf))
473/** Insert information held in the st_info field.  */
474#define ELF_ST_INFO(bind, type)       (((bind) << 4) + ((type) & 0xf))
475
476/** Legal values for ST_BIND subfield of st_info (symbol binding).  */
477enum st_info_bind_e
478  {
479    STB_LOCAL =       0,        //< Local symbol
480    STB_GLOBAL =      1,        //< Global symbol
481    STB_WEAK =        2,        //< Weak symbol
482    STB_NUM =         3,        //< Number of defined types. 
483    STB_LOOS =        10,       //< Start of OS-specific
484    STB_HIOS =        12,       //< End of OS-specific
485    STB_LOPROC =      13,       //< Start of processor-specific
486    STB_HIPROC =      15,       //< End of processor-specific
487  };
488
489/** Legal values for ST_TYPE subfield of st_info (symbol type).  */
490enum st_info_type_e
491  {
492    STT_NOTYPE =      0,        //< Symbol type is unspecified
493    STT_OBJECT =      1,        //< Symbol is a data object
494    STT_FUNC =        2,        //< Symbol is a code object
495    STT_SECTION =     3,        //< Symbol associated with a section
496    STT_FILE =        4,        //< Symbol's name is file name
497    STT_COMMON =      5,        //< Symbol is a common data object
498    STT_TLS =         6,        //< Symbol is thread-local data object
499    STT_NUM =         7,        //< Number of defined types. 
500    STT_LOOS =        10,       //< Start of OS-specific
501    STT_HIOS =        12,       //< End of OS-specific
502    STT_LOPROC =      13,       //< Start of processor-specific
503    STT_HIPROC =      15,       //< End of processor-specific
504  };
505
506/* Symbol table indices are found in the hash buckets and chain table
507   of a symbol hash table section.  This special index value indicates
508   the end of a chain, meaning no further symbols are found in that bucket.  */
509
510static const unsigned int STN_UNDEF = 0;        //< End of a chain. 
511
512/** @multiple How to extract and insert information held in the st_other field.  */
513
514#define ELF32_ST_VISIBILITY(o)  ((o) & 0x03)
515#define ELF64_ST_VISIBILITY(o)  ELF32_ST_VISIBILITY (o)
516
517/** Symbol visibility specification encoded in the st_other field.  */
518enum st_other_e
519  {
520    STV_DEFAULT =     0,        //< Default symbol visibility rules
521    STV_INTERNAL =    1,        //< Processor specific hidden class
522    STV_HIDDEN =      2,        //< Sym unavailable in other modules
523    STV_PROTECTED =   3,        //< Not preemptible, not exported
524  };
525
526/** Relocation table entry without addend (in section of type SHT_REL).  */
527struct Elf32_Rel
528{
529  Elf32_Addr    r_offset;       //< Address
530  Elf32_Word    r_info; //< Relocation type and symbol index
531};
532
533/* I have seen two different definitions of the Elf64_Rel and
534   Elf64_Rela structures, so we'll leave them out until Novell (or
535   whoever) gets their act together.  */
536/** The following, at least, is used on Sparc v9, MIPS, and Alpha.  */
537
538struct Elf64_Rel
539{
540  Elf64_Addr    r_offset;       //< Address
541  Elf64_Xword   r_info; //< Relocation type and symbol index
542};
543
544/** @multiple Relocation table entry with addend (in section of type SHT_RELA).  */
545
546struct Elf32_Rela
547{
548  Elf32_Addr    r_offset;       //< Address
549  Elf32_Word    r_info; //< Relocation type and symbol index
550  Elf32_Sword   r_addend;       //< Addend
551};
552
553struct Elf64_Rela
554{
555  Elf64_Addr    r_offset;       //< Address
556  Elf64_Xword   r_info; //< Relocation type and symbol index
557  Elf64_Sxword  r_addend;       //< Addend
558};
559
560/** @multiple @showcontent How to extract and insert information held in the @tt r_info field.  */
561
562#define ELF32_R_SYM(val)                ((val) >> 8)
563#define ELF32_R_TYPE(val)               ((val) & 0xff)
564#define ELF32_R_INFO(sym, type)         (((sym) << 8) + ((type) & 0xff))
565
566#define ELF64_R_SYM(i)                  ((i) >> 32)
567#define ELF64_R_TYPE(i)                 ((i) & 0xffffffff)
568#define ELF64_R_INFO(sym,type)          ((((Elf64_Xword) (sym)) << 32) + (type))
569
570/** @multiple Program segment header.  */
571
572struct Elf32_Phdr
573{
574  Elf32_Word    p_type; //< Segment type
575  Elf32_Off     p_offset;       //< Segment file offset
576  Elf32_Addr    p_vaddr;        //< Segment virtual address
577  Elf32_Addr    p_paddr;        //< Segment physical address
578  Elf32_Word    p_filesz;       //< Segment size in file
579  Elf32_Word    p_memsz;        //< Segment size in memory
580  Elf32_Word    p_flags;        //< Segment flags
581  Elf32_Word    p_align;        //< Segment alignment
582};
583
584struct Elf64_Phdr
585{
586  Elf64_Word    p_type; //< Segment type
587  Elf64_Word    p_flags;        //< Segment flags
588  Elf64_Off     p_offset;       //< Segment file offset
589  Elf64_Addr    p_vaddr;        //< Segment virtual address
590  Elf64_Addr    p_paddr;        //< Segment physical address
591  Elf64_Xword   p_filesz;       //< Segment size in file
592  Elf64_Xword   p_memsz;        //< Segment size in memory
593  Elf64_Xword   p_align;        //< Segment alignment
594};
595
596/** Legal values for p_type (segment type).  */
597
598enum p_type_e
599  {
600    PT_NULL =         0,        //< Program header table entry unused
601    PT_LOAD =         1,        //< Loadable program segment
602    PT_DYNAMIC =      2,        //< Dynamic linking information
603    PT_INTERP =       3,        //< Program interpreter
604    PT_NOTE =         4,        //< Auxiliary information
605    PT_SHLIB =        5,        //< Reserved
606    PT_PHDR =         6,        //< Entry for header table itself
607    PT_TLS =          7,        //< Thread-local storage segment
608    PT_NUM =          8,        //< Number of defined types
609    PT_LOOS =         0x60000000,       //< Start of OS-specific
610    PT_GNU_EH_FRAME = 0x6474e550,       //< GCC .eh_frame_hdr segment
611    PT_GNU_STACK =    0x6474e551,       //< Indicates stack executability
612    PT_GNU_RELRO =    0x6474e552,       //< Read-only after relocation
613    PT_LOSUNW =       0x6ffffffa,
614    PT_SUNWBSS =      0x6ffffffa,       //< Sun Specific segment
615    PT_SUNWSTACK =    0x6ffffffb,       //< Stack segment
616    PT_HISUNW =       0x6fffffff,
617    PT_HIOS =         0x6fffffff,       //< End of OS-specific
618    PT_LOPROC =       0x70000000,       //< Start of processor-specific
619    PT_HIPROC =       0x7fffffff,       //< End of processor-specific
620  };
621
622/** Legal values for p_flags (segment flags).  */
623
624enum p_flags_e
625  {
626    PF_X =            (1 << 0), //< Segment is executable
627    PF_W =            (1 << 1), //< Segment is writable
628    PF_R =            (1 << 2), //< Segment is readable
629    PF_MASKOS =       0x0ff00000,       //< OS-specific
630    PF_MASKPROC =     0xf0000000,       //< Processor-specific
631  };
632
633/** Legal values for note segment descriptor types for core files. */
634
635enum note_desc_type_e
636  {
637    NT_PRSTATUS =     1,        //< Contains copy of prstatus struct
638    NT_FPREGSET =     2,        //< Contains copy of fpregset struct
639    NT_PRPSINFO =     3,        //< Contains copy of prpsinfo struct
640    NT_PRXREG =       4,        //< Contains copy of prxregset struct
641    NT_TASKSTRUCT =   4,        //< Contains copy of task structure
642    NT_PLATFORM =     5,        //< String from sysinfo(SI_PLATFORM)
643    NT_AUXV =         6,        //< Contains copy of auxv array
644    NT_GWINDOWS =     7,        //< Contains copy of gwindows struct
645    NT_ASRS =         8,        //< Contains copy of asrset struct
646    NT_PSTATUS =      10,       //< Contains copy of pstatus struct
647    NT_PSINFO =       13,       //< Contains copy of psinfo struct
648    NT_PRCRED =       14,       //< Contains copy of prcred struct
649    NT_UTSNAME =      15,       //< Contains copy of utsname struct
650    NT_LWPSTATUS =    16,       //< Contains copy of lwpstatus struct
651    NT_LWPSINFO =     17,       //< Contains copy of lwpinfo struct
652    NT_PRFPXREG =     20,       //< Contains copy of fprxregset struct
653    NT_PRXFPREG =     0x46e62b7f,       //< Contains copy of user_fxsr_struct
654
655    NT_VERSION =      1,        //< Contains a version string. 
656  };
657
658/** Version definition sections.  */
659
660struct Elf32_Verdef
661{
662  Elf32_Half    vd_version;     //< Version revision
663  Elf32_Half    vd_flags;       //< Version information
664  Elf32_Half    vd_ndx; //< Version Index
665  Elf32_Half    vd_cnt; //< Number of associated aux entries
666  Elf32_Word    vd_hash;        //< Version name hash value
667  Elf32_Word    vd_aux; //< Offset in bytes to verdaux array
668  Elf32_Word    vd_next;        //< Offset in bytes to next verdef entry
669};
670
671struct Elf64_Verdef
672{
673  Elf64_Half    vd_version;     //< Version revision
674  Elf64_Half    vd_flags;       //< Version information
675  Elf64_Half    vd_ndx; //< Version Index
676  Elf64_Half    vd_cnt; //< Number of associated aux entries
677  Elf64_Word    vd_hash;        //< Version name hash value
678  Elf64_Word    vd_aux; //< Offset in bytes to verdaux array
679  Elf64_Word    vd_next;        //< Offset in bytes to next verdef entry
680};
681
682
683/** Legal values for vd_version (version revision).  */
684enum vd_version_e
685  {
686    VER_DEF_NONE =    0,        //< No version
687    VER_DEF_CURRENT = 1,        //< Current version
688    VER_DEF_NUM =     2,        //< Given version number
689  };
690
691/** Legal values for vd_flags (version information flags).  */
692enum vd_flags
693  {
694    VER_FLG_BASE =    0x1,      //< Version definition of file itself
695    VER_FLG_WEAK =    0x2,      //< Weak version identifier
696  };
697
698/** Versym symbol index values.  */
699enum ver_ndx_e
700  {
701    VER_NDX_LOCAL =           0,        //< Symbol is local. 
702    VER_NDX_GLOBAL =          1,        //< Symbol is global. 
703    VER_NDX_LORESERVE =       0xff00,   //< Beginning of reserved entries. 
704    VER_NDX_ELIMINATE =       0xff01,   //< Symbol is to be eliminated. 
705  };
706
707/** Auxialiary version information.  */
708
709struct Elf32_Verdaux
710{
711  Elf32_Word    vda_name;       //< Version or dependency names
712  Elf32_Word    vda_next;       //< Offset in bytes to next verdaux entry
713};
714
715struct Elf64_Verdaux
716{
717  Elf64_Word    vda_name;       //< Version or dependency names
718  Elf64_Word    vda_next;       //< Offset in bytes to next verdaux entry
719};
720
721
722/** Version dependency section.  */
723
724struct Elf32_Verneed
725{
726  Elf32_Half    vn_version;     //< Version of structure
727  Elf32_Half    vn_cnt; //< Number of associated aux entries
728  Elf32_Word    vn_file;        //< Offset of filename for this dependency
729  Elf32_Word    vn_aux; //< Offset in bytes to vernaux array
730  Elf32_Word    vn_next;        //< Offset in bytes to next verneed entry
731};
732
733struct Elf64_Verneed
734{
735  Elf64_Half    vn_version;     //< Version of structure
736  Elf64_Half    vn_cnt; //< Number of associated aux entries
737  Elf64_Word    vn_file;        //< Offset of filename for this dependency
738  Elf64_Word    vn_aux; //< Offset in bytes to vernaux array
739  Elf64_Word    vn_next;        //< Offset in bytes to next verneed entry
740};
741
742
743/** Legal values for vn_version (version revision).  */
744enum vn_version_e
745  {
746    VER_NEED_NONE =    0,       //< No version
747    VER_NEED_CURRENT = 1,       //< Current version
748    VER_NEED_NUM =     2,       //< Given version number
749  };
750
751/** Auxiliary needed version information.  */
752
753struct Elf32_Vernaux
754{
755  Elf32_Word    vna_hash;       //< Hash value of dependency name
756  Elf32_Half    vna_flags;      //< Dependency specific information
757  Elf32_Half    vna_other;      //< Unused
758  Elf32_Word    vna_name;       //< Dependency name string offset
759  Elf32_Word    vna_next;       //< Offset in bytes to next vernaux entry
760};
761
762struct Elf64_Vernaux
763{
764  Elf64_Word    vna_hash;       //< Hash value of dependency name
765  Elf64_Half    vna_flags;      //< Dependency specific information
766  Elf64_Half    vna_other;      //< Unused
767  Elf64_Word    vna_name;       //< Dependency name string offset
768  Elf64_Word    vna_next;       //< Offset in bytes to next vernaux entry
769};
770
771/* Auxiliary vector.  */
772
773/** @multiple This vector is normally only used by the program interpreter.  The
774   usual definition in an ABI supplement uses the name auxv_t.  The
775   vector is not usually defined in a standard <elf.h> file, but it
776   can't hurt.  We rename it to avoid conflicts.  The sizes of these
777   types are an arrangement between the exec server and the program
778   interpreter, so we don't fully specify them here.  */
779
780struct Elf32_auxv_t
781{
782  uint32_t a_type;      //< Entry type
783  union
784    {
785      uint32_t a_val;   //< Integer value
786      /** We use to have pointer elements added here.  We cannot do that,
787         though, since it does not work when using 32-bit definitions
788         on 64-bit platforms and vice versa.  */
789    } a_un;
790};
791
792struct Elf64_auxv_t
793{
794  uint64_t a_type;      //< Entry type
795  union
796    {
797      uint64_t a_val;   //< Integer value
798      /** We use to have pointer elements added here.  We cannot do that,
799         though, since it does not work when using 32-bit definitions
800         on 64-bit platforms and vice versa.  */
801    } a_un;
802};
803
804/** Legal values for a_type (entry type).  */
805
806enum a_type_e
807  {
808    AT_NULL =         0,        //< End of vector
809    AT_IGNORE =       1,        //< Entry should be ignored
810    AT_EXECFD =       2,        //< File descriptor of program
811    AT_PHDR =         3,        //< Program headers for program
812    AT_PHENT =        4,        //< Size of program header entry
813    AT_PHNUM =        5,        //< Number of program headers
814    AT_PAGESZ =       6,        //< System page size
815    AT_BASE =         7,        //< Base address of interpreter
816    AT_FLAGS =        8,        //< Flags
817    AT_ENTRY =        9,        //< Entry point of program
818    AT_NOTELF =       10,       //< Program is not ELF
819    AT_UID =          11,       //< Real uid
820    AT_EUID =         12,       //< Effective uid
821    AT_GID =          13,       //< Real gid
822    AT_EGID =         14,       //< Effective gid
823    AT_CLKTCK =       17,       //< Frequency of times()
824
825    /** Some more special a_type values describing the hardware.  */
826    AT_PLATFORM =     15,       //< String identifying platform. 
827    AT_HWCAP =        16,       //< Machine dependent hints about processor capabilities. 
828  };
829
830/** This entry gives some information about the FPU initialization
831   performed by the kernel.  */
832#define AT_FPUCW        18              /** Used FPU control word.  */
833
834/* Cache block sizes.  */
835#define AT_DCACHEBSIZE  19             
836              //< Data cache block size
837#define AT_ICACHEBSIZE  20
838              //< Instruction cache block size.
839#define AT_UCACHEBSIZE  21             
840             //< Unified cache block size.
841
842/* A special ignored value for PPC, used by the kernel to control the
843   interpretation of the AUXV. Must be > 16.  */
844
845#define AT_IGNOREPPC    22
846            //< Entry should be ignored.
847#define AT_SECURE       23             
848            //< Boolean, was exec setuid-like?
849
850/** @multiple Pointer to the global system page used for system calls and other nice things.  */
851#define AT_SYSINFO      32
852#define AT_SYSINFO_EHDR 33
853
854/** @multiple Shapes of the caches.  Bits 0-3 contains associativity; bits 4-7 contains
855   log2 of line size; mask those to get cache size.  */
856#define AT_L1I_CACHESHAPE       34
857#define AT_L1D_CACHESHAPE       35
858#define AT_L2_CACHESHAPE        36
859#define AT_L3_CACHESHAPE        37
860
861/** @multiple  Note section contents.  Each entry in the note section begins with
862   a header of a fixed form.  */
863
864struct Elf32_Nhdr
865{
866  Elf32_Word n_namesz;  //< Length of the note's name. 
867  Elf32_Word n_descsz;  //< Length of the note's descriptor. 
868  Elf32_Word n_type;    //< Type of the note. 
869};
870
871struct Elf64_Nhdr
872{
873  Elf64_Word n_namesz;  //< Length of the note's name. 
874  Elf64_Word n_descsz;  //< Length of the note's descriptor. 
875  Elf64_Word n_type;    //< Type of the note. 
876};
877
878/* Known names of notes.  */
879
880/** Solaris entries in the note section have this name.  */
881#define ELF_NOTE_SOLARIS        "SUNW Solaris"
882
883/** Note entries for GNU systems have this name.  */
884#define ELF_NOTE_GNU            "GNU"
885
886
887/* Defined types of notes for Solaris.  */
888
889/** Value of descriptor (one word) is desired pagesize for the binary.  */
890#define ELF_NOTE_PAGESIZE_HINT  1
891
892
893/* Defined note types for GNU systems.  */
894
895/** ABI information.  The descriptor consists of words:
896   word 0: OS descriptor
897   word 1: major version of the ABI
898   word 2: minor version of the ABI
899   word 3: subminor version of the ABI
900*/
901#define ELF_NOTE_ABI            1
902
903/** Known OSes.  These value can appear in word 0 of an ELF_NOTE_ABI
904   note section entry.  */
905#define ELF_NOTE_OS_LINUX       0
906#define ELF_NOTE_OS_GNU         1
907#define ELF_NOTE_OS_SOLARIS2    2
908#define ELF_NOTE_OS_FREEBSD     3
909
910
911/** @multiple Move records.  */
912struct Elf32_Move
913{
914  Elf32_Xword m_value;  //< Symbol value. 
915  Elf32_Word m_info;    //< Size and index. 
916  Elf32_Word m_poffset; //< Symbol offset. 
917  Elf32_Half m_repeat;  //< Repeat count. 
918  Elf32_Half m_stride;  //< Stride info. 
919};
920
921struct Elf64_Move
922{
923  Elf64_Xword m_value;  //< Symbol value. 
924  Elf64_Xword m_info;   //< Size and index. 
925  Elf64_Xword m_poffset;//< Symbol offset. 
926  Elf64_Half m_repeat;  //< Repeat count. 
927  Elf64_Half m_stride;  //< Stride info. 
928};
929
930/** @multiple Macro to construct move records.  */
931#define ELF32_M_SYM(info)       ((info) >> 8)
932#define ELF32_M_SIZE(info)      ((unsigned char) (info))
933#define ELF32_M_INFO(sym, size) (((sym) << 8) + (unsigned char) (size))
934
935#define ELF64_M_SYM(info)       ELF32_M_SYM (info)
936#define ELF64_M_SIZE(info)      ELF32_M_SIZE (info)
937#define ELF64_M_INFO(sym, size) ELF32_M_INFO (sym, size)
938
939/** Motorola 68k specific definitions.  */
940
941/** Values for Elf32_Ehdr.e_flags.  */
942#define EF_CPU32        0x00810000
943
944/** Relocation ids */
945
946enum reloc_e
947  {
948    R_NONE =      0,    //< No reloc
949
950    /* m68k relocs.  */
951    R_68K_NONE =      0,        //< No reloc
952    R_68K_32 =        1,        //< Direct 32 bit 
953    R_68K_16 =        2,        //< Direct 16 bit 
954    R_68K_8 =         3,        //< Direct 8 bit 
955    R_68K_PC32 =      4,        //< PC relative 32 bit
956    R_68K_PC16 =      5,        //< PC relative 16 bit
957    R_68K_PC8 =       6,        //< PC relative 8 bit
958    R_68K_GOT32 =     7,        //< 32 bit PC relative GOT entry
959    R_68K_GOT16 =     8,        //< 16 bit PC relative GOT entry
960    R_68K_GOT8 =      9,        //< 8 bit PC relative GOT entry
961    R_68K_GOT32O =    10,       //< 32 bit GOT offset
962    R_68K_GOT16O =    11,       //< 16 bit GOT offset
963    R_68K_GOT8O =     12,       //< 8 bit GOT offset
964    R_68K_PLT32 =     13,       //< 32 bit PC relative PLT address
965    R_68K_PLT16 =     14,       //< 16 bit PC relative PLT address
966    R_68K_PLT8 =      15,       //< 8 bit PC relative PLT address
967    R_68K_PLT32O =    16,       //< 32 bit PLT offset
968    R_68K_PLT16O =    17,       //< 16 bit PLT offset
969    R_68K_PLT8O =     18,       //< 8 bit PLT offset
970    R_68K_COPY =      19,       //< Copy symbol at runtime
971    R_68K_GLOB_DAT =  20,       //< Create GOT entry
972    R_68K_JMP_SLOT =  21,       //< Create PLT entry
973    R_68K_RELATIVE =  22,       //< Adjust by program base
974/* Keep this the last entry.  */
975    R_68K_NUM =       23,
976
977    /* i386 relocs.  */
978    R_386_NONE =         0,     //< No reloc
979    R_386_32 =           1,     //< Direct 32 bit 
980    R_386_PC32 =         2,     //< PC relative 32 bit
981    R_386_GOT32 =        3,     //< 32 bit GOT entry
982    R_386_PLT32 =        4,     //< 32 bit PLT address
983    R_386_COPY =         5,     //< Copy symbol at runtime
984    R_386_GLOB_DAT =     6,     //< Create GOT entry
985    R_386_JMP_SLOT =     7,     //< Create PLT entry
986    R_386_RELATIVE =     8,     //< Adjust by program base
987    R_386_GOTOFF =       9,     //< 32 bit offset to GOT
988    R_386_GOTPC =        10,    //< 32 bit PC relative offset to GOT
989    R_386_32PLT =        11,
990    R_386_TLS_TPOFF =    14,    //< Offset in static TLS block
991    R_386_TLS_IE =       15,    //< Address of GOT entry for static TLS block offset
992    R_386_TLS_GOTIE =    16,    //< GOT entry for static TLS block offset
993    R_386_TLS_LE =       17,    //< Offset relative to static TLS block
994    R_386_TLS_GD =       18,    //< Direct 32 bit for GNU version of general dynamic thread local data
995    R_386_TLS_LDM =      19,    //< Direct 32 bit for GNU version of local dynamic thread local data in LE code
996    R_386_16 =           20,
997    R_386_PC16 =         21,
998    R_386_8 =            22,
999    R_386_PC8 =          23,
1000    R_386_TLS_GD_32 =    24,    //< Direct 32 bit for general dynamic thread local data
1001    R_386_TLS_GD_PUSH =  25,    //< Tag for pushl in GD TLS code
1002    R_386_TLS_GD_CALL =  26,    //< Relocation for call to __tls_get_addr()
1003    R_386_TLS_GD_POP =   27,    //< Tag for popl in GD TLS code
1004    R_386_TLS_LDM_32 =   28,    //< Direct 32 bit for local dynamic thread local data in LE code
1005    R_386_TLS_LDM_PUSH = 29,    //< Tag for pushl in LDM TLS code
1006    R_386_TLS_LDM_CALL = 30,    //< Relocation for call to __tls_get_addr() in LDM code
1007    R_386_TLS_LDM_POP =  31,    //< Tag for popl in LDM TLS code
1008    R_386_TLS_LDO_32 =   32,    //< Offset relative to TLS block
1009    R_386_TLS_IE_32 =    33,    //< GOT entry for negated static TLS block offset
1010    R_386_TLS_LE_32 =    34,    //< Negated offset relative to static TLS block
1011    R_386_TLS_DTPMOD32 = 35,    //< ID of module containing symbol
1012    R_386_TLS_DTPOFF32 = 36,    //< Offset in TLS block
1013    R_386_TLS_TPOFF32 =  37,    //< Negated offset in static TLS block
1014/* Keep this the last entry.  */
1015    R_386_NUM =          38,
1016
1017    /* SPARC relocs.  */
1018    R_SPARC_NONE =            0,        //< No reloc
1019    R_SPARC_8 =               1,        //< Direct 8 bit
1020    R_SPARC_16 =              2,        //< Direct 16 bit
1021    R_SPARC_32 =              3,        //< Direct 32 bit
1022    R_SPARC_DISP8 =           4,        //< PC relative 8 bit
1023    R_SPARC_DISP16 =          5,        //< PC relative 16 bit
1024    R_SPARC_DISP32 =          6,        //< PC relative 32 bit
1025    R_SPARC_WDISP30 =         7,        //< PC relative 30 bit shifted
1026    R_SPARC_WDISP22 =         8,        //< PC relative 22 bit shifted
1027    R_SPARC_HI22 =            9,        //< High 22 bit
1028    R_SPARC_22 =              10,       //< Direct 22 bit
1029    R_SPARC_13 =              11,       //< Direct 13 bit
1030    R_SPARC_LO10 =            12,       //< Truncated 10 bit
1031    R_SPARC_GOT10 =           13,       //< Truncated 10 bit GOT entry
1032    R_SPARC_GOT13 =           14,       //< 13 bit GOT entry
1033    R_SPARC_GOT22 =           15,       //< 22 bit GOT entry shifted
1034    R_SPARC_PC10 =            16,       //< PC relative 10 bit truncated
1035    R_SPARC_PC22 =            17,       //< PC relative 22 bit shifted
1036    R_SPARC_WPLT30 =          18,       //< 30 bit PC relative PLT address
1037    R_SPARC_COPY =            19,       //< Copy symbol at runtime
1038    R_SPARC_GLOB_DAT =        20,       //< Create GOT entry
1039    R_SPARC_JMP_SLOT =        21,       //< Create PLT entry
1040    R_SPARC_RELATIVE =        22,       //< Adjust by program base
1041    R_SPARC_UA32 =            23,       //< Direct 32 bit unaligned
1042
1043    /* Additional Sparc64 relocs.  */
1044    R_SPARC_PLT32 =           24,       //< Direct 32 bit ref to PLT entry
1045    R_SPARC_HIPLT22 =         25,       //< High 22 bit PLT entry
1046    R_SPARC_LOPLT10 =         26,       //< Truncated 10 bit PLT entry
1047    R_SPARC_PCPLT32 =         27,       //< PC rel 32 bit ref to PLT entry
1048    R_SPARC_PCPLT22 =         28,       //< PC rel high 22 bit PLT entry
1049    R_SPARC_PCPLT10 =         29,       //< PC rel trunc 10 bit PLT entry
1050    R_SPARC_10 =              30,       //< Direct 10 bit
1051    R_SPARC_11 =              31,       //< Direct 11 bit
1052    R_SPARC_64 =              32,       //< Direct 64 bit
1053    R_SPARC_OLO10 =           33,       //< 10bit with secondary 13bit addend
1054    R_SPARC_HH22 =            34,       //< Top 22 bits of direct 64 bit
1055    R_SPARC_HM10 =            35,       //< High middle 10 bits of ...
1056    R_SPARC_LM22 =            36,       //< Low middle 22 bits of ...
1057    R_SPARC_PC_HH22 =         37,       //< Top 22 bits of pc rel 64 bit
1058    R_SPARC_PC_HM10 =         38,       //< High middle 10 bit of ...
1059    R_SPARC_PC_LM22 =         39,       //< Low miggle 22 bits of ...
1060    R_SPARC_WDISP16 =         40,       //< PC relative 16 bit shifted
1061    R_SPARC_WDISP19 =         41,       //< PC relative 19 bit shifted
1062    R_SPARC_7 =               43,       //< Direct 7 bit
1063    R_SPARC_5 =               44,       //< Direct 5 bit
1064    R_SPARC_6 =               45,       //< Direct 6 bit
1065    R_SPARC_DISP64 =          46,       //< PC relative 64 bit
1066    R_SPARC_PLT64 =           47,       //< Direct 64 bit ref to PLT entry
1067    R_SPARC_HIX22 =           48,       //< High 22 bit complemented
1068    R_SPARC_LOX10 =           49,       //< Truncated 11 bit complemented
1069    R_SPARC_H44 =             50,       //< Direct high 12 of 44 bit
1070    R_SPARC_M44 =             51,       //< Direct mid 22 of 44 bit
1071    R_SPARC_L44 =             52,       //< Direct low 10 of 44 bit
1072    R_SPARC_REGISTER =        53,       //< Global register usage
1073    R_SPARC_UA64 =            54,       //< Direct 64 bit unaligned
1074    R_SPARC_UA16 =            55,       //< Direct 16 bit unaligned
1075    R_SPARC_TLS_GD_HI22 =     56,
1076    R_SPARC_TLS_GD_LO10 =     57,
1077    R_SPARC_TLS_GD_ADD =      58,
1078    R_SPARC_TLS_GD_CALL =     59,
1079    R_SPARC_TLS_LDM_HI22 =    60,
1080    R_SPARC_TLS_LDM_LO10 =    61,
1081    R_SPARC_TLS_LDM_ADD =     62,
1082    R_SPARC_TLS_LDM_CALL =    63,
1083    R_SPARC_TLS_LDO_HIX22 =   64,
1084    R_SPARC_TLS_LDO_LOX10 =   65,
1085    R_SPARC_TLS_LDO_ADD =     66,
1086    R_SPARC_TLS_IE_HI22 =     67,
1087    R_SPARC_TLS_IE_LO10 =     68,
1088    R_SPARC_TLS_IE_LD =       69,
1089    R_SPARC_TLS_IE_LDX =      70,
1090    R_SPARC_TLS_IE_ADD =      71,
1091    R_SPARC_TLS_LE_HIX22 =    72,
1092    R_SPARC_TLS_LE_LOX10 =    73,
1093    R_SPARC_TLS_DTPMOD32 =    74,
1094    R_SPARC_TLS_DTPMOD64 =    75,
1095    R_SPARC_TLS_DTPOFF32 =    76,
1096    R_SPARC_TLS_DTPOFF64 =    77,
1097    R_SPARC_TLS_TPOFF32 =     78,
1098    R_SPARC_TLS_TPOFF64 =     79,
1099/* Keep this the last entry.  */
1100    R_SPARC_NUM =             80,
1101
1102    /* MIPS relocs.  */
1103    R_MIPS_NONE =             0,        //< No reloc
1104    R_MIPS_16 =               1,        //< Direct 16 bit
1105    R_MIPS_32 =               2,        //< Direct 32 bit
1106    R_MIPS_REL32 =            3,        //< PC relative 32 bit
1107    R_MIPS_26 =               4,        //< Direct 26 bit shifted
1108    R_MIPS_HI16 =             5,        //< High 16 bit
1109    R_MIPS_LO16 =             6,        //< Low 16 bit
1110    R_MIPS_GPREL16 =          7,        //< GP relative 16 bit
1111    R_MIPS_LITERAL =          8,        //< 16 bit literal entry
1112    R_MIPS_GOT16 =            9,        //< 16 bit GOT entry
1113    R_MIPS_PC16 =             10,       //< PC relative 16 bit
1114    R_MIPS_CALL16 =           11,       //< 16 bit GOT entry for function
1115    R_MIPS_GPREL32 =          12,       //< GP relative 32 bit
1116    R_MIPS_SHIFT5 =           16,
1117    R_MIPS_SHIFT6 =           17,
1118    R_MIPS_64 =               18,
1119    R_MIPS_GOT_DISP =         19,
1120    R_MIPS_GOT_PAGE =         20,
1121    R_MIPS_GOT_OFST =         21,
1122    R_MIPS_GOT_HI16 =         22,
1123    R_MIPS_GOT_LO16 =         23,
1124    R_MIPS_SUB =              24,
1125    R_MIPS_INSERT_A =         25,
1126    R_MIPS_INSERT_B =         26,
1127    R_MIPS_DELETE =           27,
1128    R_MIPS_HIGHER =           28,
1129    R_MIPS_HIGHEST =          29,
1130    R_MIPS_CALL_HI16 =        30,
1131    R_MIPS_CALL_LO16 =        31,
1132    R_MIPS_SCN_DISP =         32,
1133    R_MIPS_REL16 =            33,
1134    R_MIPS_ADD_IMMEDIATE =    34,
1135    R_MIPS_PJUMP =            35,
1136    R_MIPS_RELGOT =           36,
1137    R_MIPS_JALR =             37,
1138    R_MIPS_TLS_DTPMOD32 =     38,       //< Module number 32 bit
1139    R_MIPS_TLS_DTPREL32 =     39,       //< Module-relative offset 32 bit
1140    R_MIPS_TLS_DTPMOD64 =     40,       //< Module number 64 bit
1141    R_MIPS_TLS_DTPREL64 =     41,       //< Module-relative offset 64 bit
1142    R_MIPS_TLS_GD =           42,       //< 16 bit GOT offset for GD
1143    R_MIPS_TLS_LDM =          43,       //< 16 bit GOT offset for LDM
1144    R_MIPS_TLS_DTPREL_HI16 =  44,       //< Module-relative offset, high 16 bits
1145    R_MIPS_TLS_DTPREL_LO16 =  45,       //< Module-relative offset, low 16 bits
1146    R_MIPS_TLS_GOTTPREL =     46,       //< 16 bit GOT offset for IE
1147    R_MIPS_TLS_TPREL32 =      47,       //< TP-relative offset, 32 bit
1148    R_MIPS_TLS_TPREL64 =      48,       //< TP-relative offset, 64 bit
1149    R_MIPS_TLS_TPREL_HI16 =   49,       //< TP-relative offset, high 16 bits
1150    R_MIPS_TLS_TPREL_LO16 =   50,       //< TP-relative offset, low 16 bits
1151    R_MIPS_GLOB_DAT =         51,
1152    /* Keep this the last entry.  */
1153    R_MIPS_NUM =              52,
1154
1155/* HPPA relocs.  */
1156
1157    R_PARISC_NONE =           0,        //< No reloc. 
1158    R_PARISC_DIR32 =          1,        //< Direct 32-bit reference. 
1159    R_PARISC_DIR21L =         2,        //< Left 21 bits of eff. address. 
1160    R_PARISC_DIR17R =         3,        //< Right 17 bits of eff. address. 
1161    R_PARISC_DIR17F =         4,        //< 17 bits of eff. address. 
1162    R_PARISC_DIR14R =         6,        //< Right 14 bits of eff. address. 
1163    R_PARISC_PCREL32 =        9,        //< 32-bit rel. address. 
1164    R_PARISC_PCREL21L =       10,       //< Left 21 bits of rel. address. 
1165    R_PARISC_PCREL17R =       11,       //< Right 17 bits of rel. address. 
1166    R_PARISC_PCREL17F =       12,       //< 17 bits of rel. address. 
1167    R_PARISC_PCREL14R =       14,       //< Right 14 bits of rel. address. 
1168    R_PARISC_DPREL21L =       18,       //< Left 21 bits of rel. address. 
1169    R_PARISC_DPREL14R =       22,       //< Right 14 bits of rel. address. 
1170    R_PARISC_GPREL21L =       26,       //< GP-relative, left 21 bits. 
1171    R_PARISC_GPREL14R =       30,       //< GP-relative, right 14 bits. 
1172    R_PARISC_LTOFF21L =       34,       //< LT-relative, left 21 bits. 
1173    R_PARISC_LTOFF14R =       38,       //< LT-relative, right 14 bits. 
1174    R_PARISC_SECREL32 =       41,       //< 32 bits section rel. address. 
1175    R_PARISC_SEGBASE =        48,       //< No relocation, set segment base. 
1176    R_PARISC_SEGREL32 =       49,       //< 32 bits segment rel. address. 
1177    R_PARISC_PLTOFF21L =      50,       //< PLT rel. address, left 21 bits. 
1178    R_PARISC_PLTOFF14R =      54,       //< PLT rel. address, right 14 bits. 
1179    R_PARISC_LTOFF_FPTR32 =   57,       //< 32 bits LT-rel. function pointer.
1180    R_PARISC_LTOFF_FPTR21L =  58,       //< LT-rel. fct ptr, left 21 bits.
1181    R_PARISC_LTOFF_FPTR14R =  62,       //< LT-rel. fct ptr, right 14 bits.
1182    R_PARISC_FPTR64 =         64,       //< 64 bits function address. 
1183    R_PARISC_PLABEL32 =       65,       //< 32 bits function address. 
1184    R_PARISC_PLABEL21L =      66,       //< Left 21 bits of fdesc address
1185    R_PARISC_PLABEL14R =      70,       //< Right 14 bits of fdesc address
1186    R_PARISC_PCREL64 =        72,       //< 64 bits PC-rel. address. 
1187    R_PARISC_PCREL22F =       74,       //< 22 bits PC-rel. address. 
1188    R_PARISC_PCREL14WR =      75,       //< PC-rel. address, right 14 bits. 
1189    R_PARISC_PCREL14DR =      76,       //< PC rel. address, right 14 bits. 
1190    R_PARISC_PCREL16F =       77,       //< 16 bits PC-rel. address. 
1191    R_PARISC_PCREL16WF =      78,       //< 16 bits PC-rel. address. 
1192    R_PARISC_PCREL16DF =      79,       //< 16 bits PC-rel. address. 
1193    R_PARISC_DIR64 =          80,       //< 64 bits of eff. address. 
1194    R_PARISC_DIR14WR =        83,       //< 14 bits of eff. address. 
1195    R_PARISC_DIR14DR =        84,       //< 14 bits of eff. address. 
1196    R_PARISC_DIR16F =         85,       //< 16 bits of eff. address. 
1197    R_PARISC_DIR16WF =        86,       //< 16 bits of eff. address. 
1198    R_PARISC_DIR16DF =        87,       //< 16 bits of eff. address. 
1199    R_PARISC_GPREL64 =        88,       //< 64 bits of GP-rel. address. 
1200    R_PARISC_GPREL14WR =      91,       //< GP-rel. address, right 14 bits. 
1201    R_PARISC_GPREL14DR =      92,       //< GP-rel. address, right 14 bits. 
1202    R_PARISC_GPREL16F =       93,       //< 16 bits GP-rel. address. 
1203    R_PARISC_GPREL16WF =      94,       //< 16 bits GP-rel. address. 
1204    R_PARISC_GPREL16DF =      95,       //< 16 bits GP-rel. address. 
1205    R_PARISC_LTOFF64 =        96,       //< 64 bits LT-rel. address. 
1206    R_PARISC_LTOFF14WR =      99,       //< LT-rel. address, right 14 bits. 
1207    R_PARISC_LTOFF14DR =      100,      //< LT-rel. address, right 14 bits. 
1208    R_PARISC_LTOFF16F =       101,      //< 16 bits LT-rel. address. 
1209    R_PARISC_LTOFF16WF =      102,      //< 16 bits LT-rel. address. 
1210    R_PARISC_LTOFF16DF =      103,      //< 16 bits LT-rel. address. 
1211    R_PARISC_SECREL64 =       104,      //< 64 bits section rel. address. 
1212    R_PARISC_SEGREL64 =       112,      //< 64 bits segment rel. address. 
1213    R_PARISC_PLTOFF14WR =     115,      //< PLT-rel. address, right 14 bits. 
1214    R_PARISC_PLTOFF14DR =     116,      //< PLT-rel. address, right 14 bits. 
1215    R_PARISC_PLTOFF16F =      117,      //< 16 bits LT-rel. address. 
1216    R_PARISC_PLTOFF16WF =     118,      //< 16 bits PLT-rel. address. 
1217    R_PARISC_PLTOFF16DF =     119,      //< 16 bits PLT-rel. address. 
1218    R_PARISC_LTOFF_FPTR64 =   120,      //< 64 bits LT-rel. function ptr. 
1219    R_PARISC_LTOFF_FPTR14WR = 123,      //< LT-rel. fct. ptr., right 14 bits.
1220    R_PARISC_LTOFF_FPTR14DR = 124,      //< LT-rel. fct. ptr., right 14 bits.
1221    R_PARISC_LTOFF_FPTR16F =  125,      //< 16 bits LT-rel. function ptr. 
1222    R_PARISC_LTOFF_FPTR16WF = 126,      //< 16 bits LT-rel. function ptr. 
1223    R_PARISC_LTOFF_FPTR16DF = 127,      //< 16 bits LT-rel. function ptr. 
1224    R_PARISC_LORESERVE =      128,
1225    R_PARISC_COPY =           128,      //< Copy relocation. 
1226    R_PARISC_IPLT =           129,      //< Dynamic reloc, imported PLT
1227    R_PARISC_EPLT =           130,      //< Dynamic reloc, exported PLT
1228    R_PARISC_TPREL32 =        153,      //< 32 bits TP-rel. address. 
1229    R_PARISC_TPREL21L =       154,      //< TP-rel. address, left 21 bits. 
1230    R_PARISC_TPREL14R =       158,      //< TP-rel. address, right 14 bits. 
1231    R_PARISC_LTOFF_TP21L =    162,      //< LT-TP-rel. address, left 21 bits.
1232    R_PARISC_LTOFF_TP14R =    166,      //< LT-TP-rel. address, right 14 bits.
1233    R_PARISC_LTOFF_TP14F =    167,      //< 14 bits LT-TP-rel. address. 
1234    R_PARISC_TPREL64 =        216,      //< 64 bits TP-rel. address. 
1235    R_PARISC_TPREL14WR =      219,      //< TP-rel. address, right 14 bits. 
1236    R_PARISC_TPREL14DR =      220,      //< TP-rel. address, right 14 bits. 
1237    R_PARISC_TPREL16F =       221,      //< 16 bits TP-rel. address. 
1238    R_PARISC_TPREL16WF =      222,      //< 16 bits TP-rel. address. 
1239    R_PARISC_TPREL16DF =      223,      //< 16 bits TP-rel. address. 
1240    R_PARISC_LTOFF_TP64 =     224,      //< 64 bits LT-TP-rel. address. 
1241    R_PARISC_LTOFF_TP14WR =   227,      //< LT-TP-rel. address, right 14 bits.
1242    R_PARISC_LTOFF_TP14DR =   228,      //< LT-TP-rel. address, right 14 bits.
1243    R_PARISC_LTOFF_TP16F =    229,      //< 16 bits LT-TP-rel. address. 
1244    R_PARISC_LTOFF_TP16WF =   230,      //< 16 bits LT-TP-rel. address. 
1245    R_PARISC_LTOFF_TP16DF =   231,      //< 16 bits LT-TP-rel. address. 
1246    R_PARISC_GNU_VTENTRY =    232,
1247    R_PARISC_GNU_VTINHERIT =  233,
1248    R_PARISC_TLS_GD21L =      234,      //< GD 21-bit left
1249    R_PARISC_TLS_GD14R =      235,      //< GD 14-bit right
1250    R_PARISC_TLS_GDCALL =     236,      //< GD call to __t_g_a
1251    R_PARISC_TLS_LDM21L =     237,      //< LD module 21-bit left
1252    R_PARISC_TLS_LDM14R =     238,      //< LD module 14-bit right
1253    R_PARISC_TLS_LDMCALL =    239,      //< LD module call to __t_g_a
1254    R_PARISC_TLS_LDO21L =     240,      //< LD offset 21-bit left
1255    R_PARISC_TLS_LDO14R =     241,      //< LD offset 14-bit right
1256    R_PARISC_TLS_DTPMOD32 =   242,      //< DTP module 32-bit
1257    R_PARISC_TLS_DTPMOD64 =   243,      //< DTP module 64-bit
1258    R_PARISC_TLS_DTPOFF32 =   244,      //< DTP offset 32-bit
1259    R_PARISC_TLS_DTPOFF64 =   245,      //< DTP offset 32-bit
1260    R_PARISC_TLS_LE21L =      R_PARISC_TPREL21L,
1261    R_PARISC_TLS_LE14R =      R_PARISC_TPREL14R,
1262    R_PARISC_TLS_IE21L =      R_PARISC_LTOFF_TP21L,
1263    R_PARISC_TLS_IE14R =      R_PARISC_LTOFF_TP14R,
1264    R_PARISC_TLS_TPREL32 =    R_PARISC_TPREL32,
1265    R_PARISC_TLS_TPREL64 =    R_PARISC_TPREL64,
1266    R_PARISC_HIRESERVE =      255,
1267
1268    /* Alpha relocs.  */
1269    R_ALPHA_NONE =            0,        //< No reloc
1270    R_ALPHA_REFLONG =         1,        //< Direct 32 bit
1271    R_ALPHA_REFQUAD =         2,        //< Direct 64 bit
1272    R_ALPHA_GPREL32 =         3,        //< GP relative 32 bit
1273    R_ALPHA_LITERAL =         4,        //< GP relative 16 bit w/optimization
1274    R_ALPHA_LITUSE =          5,        //< Optimization hint for LITERAL
1275    R_ALPHA_GPDISP =          6,        //< Add displacement to GP
1276    R_ALPHA_BRADDR =          7,        //< PC+4 relative 23 bit shifted
1277    R_ALPHA_HINT =            8,        //< PC+4 relative 16 bit shifted
1278    R_ALPHA_SREL16 =          9,        //< PC relative 16 bit
1279    R_ALPHA_SREL32 =          10,       //< PC relative 32 bit
1280    R_ALPHA_SREL64 =          11,       //< PC relative 64 bit
1281    R_ALPHA_GPRELHIGH =       17,       //< GP relative 32 bit, high 16 bits
1282    R_ALPHA_GPRELLOW =        18,       //< GP relative 32 bit, low 16 bits
1283    R_ALPHA_GPREL16 =         19,       //< GP relative 16 bit
1284    R_ALPHA_COPY =            24,       //< Copy symbol at runtime
1285    R_ALPHA_GLOB_DAT =        25,       //< Create GOT entry
1286    R_ALPHA_JMP_SLOT =        26,       //< Create PLT entry
1287    R_ALPHA_RELATIVE =        27,       //< Adjust by program base
1288    R_ALPHA_TLS_GD_HI =       28,
1289    R_ALPHA_TLSGD =           29,
1290    R_ALPHA_TLS_LDM =         30,
1291    R_ALPHA_DTPMOD64 =        31,
1292    R_ALPHA_GOTDTPREL =       32,
1293    R_ALPHA_DTPREL64 =        33,
1294    R_ALPHA_DTPRELHI =        34,
1295    R_ALPHA_DTPRELLO =        35,
1296    R_ALPHA_DTPREL16 =        36,
1297    R_ALPHA_GOTTPREL =        37,
1298    R_ALPHA_TPREL64 =         38,
1299    R_ALPHA_TPRELHI =         39,
1300    R_ALPHA_TPRELLO =         40,
1301    R_ALPHA_TPREL16 =         41,
1302    /* Keep this the last entry.  */
1303    R_ALPHA_NUM =             46,
1304
1305/* PowerPC relocations defined by the ABIs */
1306    R_PPC_NONE =              0,
1307    R_PPC_ADDR32 =            1,        //< 32bit absolute address
1308    R_PPC_ADDR24 =            2,        //< 26bit address, 2 bits ignored. 
1309    R_PPC_ADDR16 =            3,        //< 16bit absolute address
1310    R_PPC_ADDR16_LO =         4,        //< lower 16bit of absolute address
1311    R_PPC_ADDR16_HI =         5,        //< high 16bit of absolute address
1312    R_PPC_ADDR16_HA =         6,        //< adjusted high 16bit
1313    R_PPC_ADDR14 =            7,        //< 16bit address, 2 bits ignored
1314    R_PPC_ADDR14_BRTAKEN =    8,
1315    R_PPC_ADDR14_BRNTAKEN =   9,
1316    R_PPC_REL24 =             10,       //< PC relative 26 bit
1317    R_PPC_REL14 =             11,       //< PC relative 16 bit
1318    R_PPC_REL14_BRTAKEN =     12,
1319    R_PPC_REL14_BRNTAKEN =    13,
1320    R_PPC_GOT16 =             14,
1321    R_PPC_GOT16_LO =          15,
1322    R_PPC_GOT16_HI =          16,
1323    R_PPC_GOT16_HA =          17,
1324    R_PPC_PLTREL24 =          18,
1325    R_PPC_COPY =              19,
1326    R_PPC_GLOB_DAT =          20,
1327    R_PPC_JMP_SLOT =          21,
1328    R_PPC_RELATIVE =          22,
1329    R_PPC_LOCAL24PC =         23,
1330    R_PPC_UADDR32 =           24,
1331    R_PPC_UADDR16 =           25,
1332    R_PPC_REL32 =             26,
1333    R_PPC_PLT32 =             27,
1334    R_PPC_PLTREL32 =          28,
1335    R_PPC_PLT16_LO =          29,
1336    R_PPC_PLT16_HI =          30,
1337    R_PPC_PLT16_HA =          31,
1338    R_PPC_SDAREL16 =          32,
1339    R_PPC_SECTOFF =           33,
1340    R_PPC_SECTOFF_LO =        34,
1341    R_PPC_SECTOFF_HI =        35,
1342    R_PPC_SECTOFF_HA =        36,
1343
1344/* PowerPC relocations defined for the TLS access ABI.  */
1345    R_PPC_TLS =               67,       //< none      (sym+add)@@tls
1346    R_PPC_DTPMOD32 =          68,       //< word32    (sym+add)@@dtpmod
1347    R_PPC_TPREL16 =           69,       //< half16*   (sym+add)@@tprel
1348    R_PPC_TPREL16_LO =        70,       //< half16    (sym+add)@@tprel@@l
1349    R_PPC_TPREL16_HI =        71,       //< half16    (sym+add)@@tprel@@h
1350    R_PPC_TPREL16_HA =        72,       //< half16    (sym+add)@@tprel@@ha
1351    R_PPC_TPREL32 =           73,       //< word32    (sym+add)@@tprel
1352    R_PPC_DTPREL16 =          74,       //< half16*   (sym+add)@@dtprel
1353    R_PPC_DTPREL16_LO =       75,       //< half16    (sym+add)@@dtprel@@l
1354    R_PPC_DTPREL16_HI =       76,       //< half16    (sym+add)@@dtprel@@h
1355    R_PPC_DTPREL16_HA =       77,       //< half16    (sym+add)@@dtprel@@ha
1356    R_PPC_DTPREL32 =          78,       //< word32    (sym+add)@@dtprel
1357    R_PPC_GOT_TLSGD16 =       79,       //< half16*   (sym+add)@@got@@tlsgd
1358    R_PPC_GOT_TLSGD16_LO =    80,       //< half16    (sym+add)@@got@@tlsgd@@l
1359    R_PPC_GOT_TLSGD16_HI =    81,       //< half16    (sym+add)@@got@@tlsgd@@h
1360    R_PPC_GOT_TLSGD16_HA =    82,       //< half16    (sym+add)@@got@@tlsgd@@ha
1361    R_PPC_GOT_TLSLD16 =       83,       //< half16*   (sym+add)@@got@@tlsld
1362    R_PPC_GOT_TLSLD16_LO =    84,       //< half16    (sym+add)@@got@@tlsld@@l
1363    R_PPC_GOT_TLSLD16_HI =    85,       //< half16    (sym+add)@@got@@tlsld@@h
1364    R_PPC_GOT_TLSLD16_HA =    86,       //< half16    (sym+add)@@got@@tlsld@@ha
1365    R_PPC_GOT_TPREL16 =       87,       //< half16*   (sym+add)@@got@@tprel
1366    R_PPC_GOT_TPREL16_LO =    88,       //< half16    (sym+add)@@got@@tprel@@l
1367    R_PPC_GOT_TPREL16_HI =    89,       //< half16    (sym+add)@@got@@tprel@@h
1368    R_PPC_GOT_TPREL16_HA =    90,       //< half16    (sym+add)@@got@@tprel@@ha
1369    R_PPC_GOT_DTPREL16 =      91,       //< half16*   (sym+add)@@got@@dtprel
1370    R_PPC_GOT_DTPREL16_LO =   92,       //< half16*   (sym+add)@@got@@dtprel@@l
1371    R_PPC_GOT_DTPREL16_HI =   93,       //< half16*   (sym+add)@@got@@dtprel@@h
1372    R_PPC_GOT_DTPREL16_HA =   94,       //< half16*   (sym+add)@@got@@dtprel@@ha
1373
1374/* Keep this the last entry.  */
1375    R_PPC_NUM =               95,
1376
1377/* The remaining relocs are from the Embedded ELF ABI, and are not
1378   in the SVR4 ELF ABI.  */
1379    R_PPC_EMB_NADDR32 =       101,
1380    R_PPC_EMB_NADDR16 =       102,
1381    R_PPC_EMB_NADDR16_LO =    103,
1382    R_PPC_EMB_NADDR16_HI =    104,
1383    R_PPC_EMB_NADDR16_HA =    105,
1384    R_PPC_EMB_SDAI16 =        106,
1385    R_PPC_EMB_SDA2I16 =       107,
1386    R_PPC_EMB_SDA2REL =       108,
1387    R_PPC_EMB_SDA21 =         109,      //< 16 bit offset in SDA
1388    R_PPC_EMB_MRKREF =        110,
1389    R_PPC_EMB_RELSEC16 =      111,
1390    R_PPC_EMB_RELST_LO =      112,
1391    R_PPC_EMB_RELST_HI =      113,
1392    R_PPC_EMB_RELST_HA =      114,
1393    R_PPC_EMB_BIT_FLD =       115,
1394    R_PPC_EMB_RELSDA =        116,      //< 16 bit relative offset in SDA
1395
1396/* Diab tool relocations.  */
1397    R_PPC_DIAB_SDA21_LO =     180,      //< like EMB_SDA21, but lower 16 bit
1398    R_PPC_DIAB_SDA21_HI =     181,      //< like EMB_SDA21, but high 16 bit
1399    R_PPC_DIAB_SDA21_HA =     182,      //< like EMB_SDA21, adjusted high 16
1400    R_PPC_DIAB_RELSDA_LO =    183,      //< like EMB_RELSDA, but lower 16 bit
1401    R_PPC_DIAB_RELSDA_HI =    184,      //< like EMB_RELSDA, but high 16 bit
1402    R_PPC_DIAB_RELSDA_HA =    185,      //< like EMB_RELSDA, adjusted high 16
1403
1404/* GNU relocs used in PIC code sequences.  */
1405    R_PPC_REL16 =             249,      //< word32   (sym-.)
1406    R_PPC_REL16_LO =          250,      //< half16   (sym-.)@@l
1407    R_PPC_REL16_HI =          251,      //< half16   (sym-.)@@h
1408    R_PPC_REL16_HA =          252,      //< half16   (sym-.)@@ha
1409
1410/* This is a phony reloc to handle any old fashioned TOC16 references
1411   that may still be in object files.  */
1412    R_PPC_TOC16 =             255,
1413
1414/* PowerPC64 relocations defined by the ABIs */
1415    R_PPC64_NONE =            R_PPC_NONE,
1416    R_PPC64_ADDR32 =          R_PPC_ADDR32,     //< 32bit absolute address
1417    R_PPC64_ADDR24 =          R_PPC_ADDR24,     //< 26bit address, word aligned
1418    R_PPC64_ADDR16 =          R_PPC_ADDR16,     //< 16bit absolute address
1419    R_PPC64_ADDR16_LO =       R_PPC_ADDR16_LO,  //< lower 16bits of address
1420    R_PPC64_ADDR16_HI =       R_PPC_ADDR16_HI,  //< high 16bits of address.
1421    R_PPC64_ADDR16_HA =       R_PPC_ADDR16_HA,  //< adjusted high 16bits. 
1422    R_PPC64_ADDR14 =          R_PPC_ADDR14,     //< 16bit address, word aligned
1423    R_PPC64_ADDR14_BRTAKEN =  R_PPC_ADDR14_BRTAKEN,
1424    R_PPC64_ADDR14_BRNTAKEN = R_PPC_ADDR14_BRNTAKEN,
1425    R_PPC64_REL24 =           R_PPC_REL24,      //< PC-rel. 26 bit, word aligned
1426    R_PPC64_REL14 =           R_PPC_REL14,      //< PC relative 16 bit
1427    R_PPC64_REL14_BRTAKEN =   R_PPC_REL14_BRTAKEN,
1428    R_PPC64_REL14_BRNTAKEN =  R_PPC_REL14_BRNTAKEN,
1429    R_PPC64_GOT16 =           R_PPC_GOT16,
1430    R_PPC64_GOT16_LO =        R_PPC_GOT16_LO,
1431    R_PPC64_GOT16_HI =        R_PPC_GOT16_HI,
1432    R_PPC64_GOT16_HA =        R_PPC_GOT16_HA,
1433    R_PPC64_COPY =            R_PPC_COPY,
1434    R_PPC64_GLOB_DAT =        R_PPC_GLOB_DAT,
1435    R_PPC64_JMP_SLOT =        R_PPC_JMP_SLOT,
1436    R_PPC64_RELATIVE =        R_PPC_RELATIVE,
1437    R_PPC64_UADDR32 =         R_PPC_UADDR32,
1438    R_PPC64_UADDR16 =         R_PPC_UADDR16,
1439    R_PPC64_REL32 =           R_PPC_REL32,
1440    R_PPC64_PLT32 =           R_PPC_PLT32,
1441    R_PPC64_PLTREL32 =        R_PPC_PLTREL32,
1442    R_PPC64_PLT16_LO =        R_PPC_PLT16_LO,
1443    R_PPC64_PLT16_HI =        R_PPC_PLT16_HI,
1444    R_PPC64_PLT16_HA =        R_PPC_PLT16_HA,
1445    R_PPC64_SECTOFF =         R_PPC_SECTOFF,
1446    R_PPC64_SECTOFF_LO =      R_PPC_SECTOFF_LO,
1447    R_PPC64_SECTOFF_HI =      R_PPC_SECTOFF_HI,
1448    R_PPC64_SECTOFF_HA =      R_PPC_SECTOFF_HA,
1449    R_PPC64_ADDR30 =          37,       //< word30 (S + A - P) >> 2
1450    R_PPC64_ADDR64 =          38,       //< doubleword64 S + A
1451    R_PPC64_ADDR16_HIGHER =   39,       //< half16 #higher(S + A)
1452    R_PPC64_ADDR16_HIGHERA =  40,       //< half16 #highera(S + A)
1453    R_PPC64_ADDR16_HIGHEST =  41,       //< half16 #highest(S + A)
1454    R_PPC64_ADDR16_HIGHESTA = 42,       //< half16 #highesta(S + A)
1455    R_PPC64_UADDR64 =         43,       //< doubleword64 S + A
1456    R_PPC64_REL64 =           44,       //< doubleword64 S + A - P
1457    R_PPC64_PLT64 =           45,       //< doubleword64 L + A
1458    R_PPC64_PLTREL64 =        46,       //< doubleword64 L + A - P
1459    R_PPC64_TOC16 =           47,       //< half16* S + A - .TOC
1460    R_PPC64_TOC16_LO =        48,       //< half16 #lo(S + A - .TOC.)
1461    R_PPC64_TOC16_HI =        49,       //< half16 #hi(S + A - .TOC.)
1462    R_PPC64_TOC16_HA =        50,       //< half16 #ha(S + A - .TOC.)
1463    R_PPC64_TOC =             51,       //< doubleword64 .TOC
1464    R_PPC64_PLTGOT16 =        52,       //< half16* M + A
1465    R_PPC64_PLTGOT16_LO =     53,       //< half16 #lo(M + A)
1466    R_PPC64_PLTGOT16_HI =     54,       //< half16 #hi(M + A)
1467    R_PPC64_PLTGOT16_HA =     55,       //< half16 #ha(M + A)
1468    R_PPC64_ADDR16_DS =       56,       //< half16ds* (S + A) >> 2
1469    R_PPC64_ADDR16_LO_DS =    57,       //< half16ds  #lo(S + A) >> 2
1470    R_PPC64_GOT16_DS =        58,       //< half16ds* (G + A) >> 2
1471    R_PPC64_GOT16_LO_DS =     59,       //< half16ds  #lo(G + A) >> 2
1472    R_PPC64_PLT16_LO_DS =     60,       //< half16ds  #lo(L + A) >> 2
1473    R_PPC64_SECTOFF_DS =      61,       //< half16ds* (R + A) >> 2
1474    R_PPC64_SECTOFF_LO_DS =   62,       //< half16ds  #lo(R + A) >> 2
1475    R_PPC64_TOC16_DS =        63,       //< half16ds* (S + A - .TOC.) >> 2
1476    R_PPC64_TOC16_LO_DS =     64,       //< half16ds  #lo(S + A - .TOC.) >> 2
1477    R_PPC64_PLTGOT16_DS =     65,       //< half16ds* (M + A) >> 2
1478    R_PPC64_PLTGOT16_LO_DS =  66,       //< half16ds  #lo(M + A) >> 2
1479    /* PowerPC64 relocations defined for the TLS access ABI.  */
1480    R_PPC64_TLS =             67,       //< none      (sym+add)@@tls
1481    R_PPC64_DTPMOD64 =        68,       //< doubleword64 (sym+add)@@dtpmod
1482    R_PPC64_TPREL16 =         69,       //< half16*   (sym+add)@@tprel
1483    R_PPC64_TPREL16_LO =      70,       //< half16    (sym+add)@@tprel@@l
1484    R_PPC64_TPREL16_HI =      71,       //< half16    (sym+add)@@tprel@@h
1485    R_PPC64_TPREL16_HA =      72,       //< half16    (sym+add)@@tprel@@ha
1486    R_PPC64_TPREL64 =         73,       //< doubleword64 (sym+add)@@tprel
1487    R_PPC64_DTPREL16 =        74,       //< half16*   (sym+add)@@dtprel
1488    R_PPC64_DTPREL16_LO =     75,       //< half16    (sym+add)@@dtprel@@l
1489    R_PPC64_DTPREL16_HI =     76,       //< half16    (sym+add)@@dtprel@@h
1490    R_PPC64_DTPREL16_HA =     77,       //< half16    (sym+add)@@dtprel@@ha
1491    R_PPC64_DTPREL64 =        78,       //< doubleword64 (sym+add)@@dtprel
1492    R_PPC64_GOT_TLSGD16 =     79,       //< half16*   (sym+add)@@got@@tlsgd
1493    R_PPC64_GOT_TLSGD16_LO =  80,       //< half16    (sym+add)@@got@@tlsgd@@l
1494    R_PPC64_GOT_TLSGD16_HI =  81,       //< half16    (sym+add)@@got@@tlsgd@@h
1495    R_PPC64_GOT_TLSGD16_HA =  82,       //< half16    (sym+add)@@got@@tlsgd@@ha
1496    R_PPC64_GOT_TLSLD16 =     83,       //< half16*   (sym+add)@@got@@tlsld
1497    R_PPC64_GOT_TLSLD16_LO =  84,       //< half16    (sym+add)@@got@@tlsld@@l
1498    R_PPC64_GOT_TLSLD16_HI =  85,       //< half16    (sym+add)@@got@@tlsld@@h
1499    R_PPC64_GOT_TLSLD16_HA =  86,       //< half16    (sym+add)@@got@@tlsld@@ha
1500    R_PPC64_GOT_TPREL16_DS =  87,       //< half16ds* (sym+add)@@got@@tprel
1501    R_PPC64_GOT_TPREL16_LO_DS = 88,     //< half16ds (sym+add)@@got@@tprel@@l
1502    R_PPC64_GOT_TPREL16_HI =  89,       //< half16    (sym+add)@@got@@tprel@@h
1503    R_PPC64_GOT_TPREL16_HA =  90,       //< half16    (sym+add)@@got@@tprel@@ha
1504    R_PPC64_GOT_DTPREL16_DS = 91,       //< half16ds* (sym+add)@@got@@dtprel
1505    R_PPC64_GOT_DTPREL16_LO_DS = 92,    //< half16ds (sym+add)@@got@@dtprel@@l
1506    R_PPC64_GOT_DTPREL16_HI = 93,       //< half16    (sym+add)@@got@@dtprel@@h
1507    R_PPC64_GOT_DTPREL16_HA = 94,       //< half16    (sym+add)@@got@@dtprel@@ha
1508    R_PPC64_TPREL16_DS =      95,       //< half16ds* (sym+add)@@tprel
1509    R_PPC64_TPREL16_LO_DS =   96,       //< half16ds  (sym+add)@@tprel@@l
1510    R_PPC64_TPREL16_HIGHER =  97,       //< half16    (sym+add)@@tprel@@higher
1511    R_PPC64_TPREL16_HIGHERA = 98,       //< half16    (sym+add)@@tprel@@highera
1512    R_PPC64_TPREL16_HIGHEST = 99,       //< half16    (sym+add)@@tprel@@highest
1513    R_PPC64_TPREL16_HIGHESTA = 100,     //< half16  (sym+add)@@tprel@@highesta
1514    R_PPC64_DTPREL16_DS =     101,      //< half16ds* (sym+add)@@dtprel
1515    R_PPC64_DTPREL16_LO_DS =  102,      //< half16ds (sym+add)@@dtprel@@l
1516    R_PPC64_DTPREL16_HIGHER = 103,      //< half16   (sym+add)@@dtprel@@higher
1517    R_PPC64_DTPREL16_HIGHERA = 104,     //< half16  (sym+add)@@dtprel@@highera
1518    R_PPC64_DTPREL16_HIGHEST = 105,     //< half16  (sym+add)@@dtprel@@highest
1519    R_PPC64_DTPREL16_HIGHESTA = 106,    //< half16 (sym+add)@@dtprel@@highesta
1520
1521    /* Keep this the last entry.  */
1522    R_PPC64_NUM =             107,
1523
1524    /* ARM relocs.  */
1525    R_ARM_NONE =              0,        //< No reloc
1526    R_ARM_PC24 =              1,        //< PC relative 26 bit branch
1527    R_ARM_ABS32 =             2,        //< Direct 32 bit 
1528    R_ARM_REL32 =             3,        //< PC relative 32 bit
1529    R_ARM_PC13 =              4,
1530    R_ARM_ABS16 =             5,        //< Direct 16 bit
1531    R_ARM_ABS12 =             6,        //< Direct 12 bit
1532    R_ARM_THM_ABS5 =          7,
1533    R_ARM_ABS8 =              8,        //< Direct 8 bit
1534    R_ARM_SBREL32 =           9,
1535    R_ARM_THM_PC22 =          10,
1536    R_ARM_THM_PC8 =           11,
1537    R_ARM_AMP_VCALL9 =        12,
1538    R_ARM_SWI24 =             13,
1539    R_ARM_THM_SWI8 =          14,
1540    R_ARM_XPC25 =             15,
1541    R_ARM_THM_XPC22 =         16,
1542    R_ARM_TLS_DTPMOD32 =      17,       //< ID of module containing symbol
1543    R_ARM_TLS_DTPOFF32 =      18,       //< Offset in TLS block
1544    R_ARM_TLS_TPOFF32 =       19,       //< Offset in static TLS block
1545    R_ARM_COPY =              20,       //< Copy symbol at runtime
1546    R_ARM_GLOB_DAT =          21,       //< Create GOT entry
1547    R_ARM_JUMP_SLOT =         22,       //< Create PLT entry
1548    R_ARM_RELATIVE =          23,       //< Adjust by program base
1549    R_ARM_GOTOFF =            24,       //< 32 bit offset to GOT
1550    R_ARM_GOTPC =             25,       //< 32 bit PC relative offset to GOT
1551    R_ARM_GOT32 =             26,       //< 32 bit GOT entry
1552    R_ARM_PLT32 =             27,       //< 32 bit PLT address
1553    R_ARM_ALU_PCREL_7_0 =     32,
1554    R_ARM_ALU_PCREL_15_8 =    33,
1555    R_ARM_ALU_PCREL_23_15 =   34,
1556    R_ARM_LDR_SBREL_11_0 =    35,
1557    R_ARM_ALU_SBREL_19_12 =   36,
1558    R_ARM_ALU_SBREL_27_20 =   37,
1559    R_ARM_GNU_VTENTRY =       100,
1560    R_ARM_GNU_VTINHERIT =     101,
1561    R_ARM_THM_PC11 =          102,      //< thumb unconditional branch
1562    R_ARM_THM_PC9 =           103,      //< thumb conditional branch
1563    R_ARM_TLS_GD32 =          104,      //< PC-rel 32 bit for global dynamic thread local data
1564    R_ARM_TLS_LDM32 =         105,      //< PC-rel 32 bit for local dynamic thread local data
1565    R_ARM_TLS_LDO32 =         106,      //< 32 bit offset relative to TLS block
1566    R_ARM_TLS_IE32 =          107,      //< PC-rel 32 bit for GOT entry of static TLS block offset
1567    R_ARM_TLS_LE32 =          108,      //< 32 bit offset relative to static TLS block
1568    R_ARM_RXPC25 =            249,
1569    R_ARM_RSBREL32 =          250,
1570    R_ARM_THM_RPC22 =         251,
1571    R_ARM_RREL32 =            252,
1572    R_ARM_RABS22 =            253,
1573    R_ARM_RPC24 =             254,
1574    R_ARM_RBASE =             255,
1575    /* Keep this the last entry.  */
1576    R_ARM_NUM =               256,
1577
1578/* IA-64 relocations.  */
1579    R_IA64_NONE =             0x00,     //< none
1580    R_IA64_IMM14 =            0x21,     //< symbol + addend, add imm14
1581    R_IA64_IMM22 =            0x22,     //< symbol + addend, add imm22
1582    R_IA64_IMM64 =            0x23,     //< symbol + addend, mov imm64
1583    R_IA64_DIR32MSB =         0x24,     //< symbol + addend, data4 MSB
1584    R_IA64_DIR32LSB =         0x25,     //< symbol + addend, data4 LSB
1585    R_IA64_DIR64MSB =         0x26,     //< symbol + addend, data8 MSB
1586    R_IA64_DIR64LSB =         0x27,     //< symbol + addend, data8 LSB
1587    R_IA64_GPREL22 =          0x2a,     //< @@gprel(sym + add), add imm22
1588    R_IA64_GPREL64I =         0x2b,     //< @@gprel(sym + add), mov imm64
1589    R_IA64_GPREL32MSB =       0x2c,     //< @@gprel(sym + add), data4 MSB
1590    R_IA64_GPREL32LSB =       0x2d,     //< @@gprel(sym + add), data4 LSB
1591    R_IA64_GPREL64MSB =       0x2e,     //< @@gprel(sym + add), data8 MSB
1592    R_IA64_GPREL64LSB =       0x2f,     //< @@gprel(sym + add), data8 LSB
1593    R_IA64_LTOFF22 =          0x32,     //< @@ltoff(sym + add), add imm22
1594    R_IA64_LTOFF64I =         0x33,     //< @@ltoff(sym + add), mov imm64
1595    R_IA64_PLTOFF22 =         0x3a,     //< @@pltoff(sym + add), add imm22
1596    R_IA64_PLTOFF64I =        0x3b,     //< @@pltoff(sym + add), mov imm64
1597    R_IA64_PLTOFF64MSB =      0x3e,     //< @@pltoff(sym + add), data8 MSB
1598    R_IA64_PLTOFF64LSB =      0x3f,     //< @@pltoff(sym + add), data8 LSB
1599    R_IA64_FPTR64I =          0x43,     //< @@fptr(sym + add), mov imm64
1600    R_IA64_FPTR32MSB =        0x44,     //< @@fptr(sym + add), data4 MSB
1601    R_IA64_FPTR32LSB =        0x45,     //< @@fptr(sym + add), data4 LSB
1602    R_IA64_FPTR64MSB =        0x46,     //< @@fptr(sym + add), data8 MSB
1603    R_IA64_FPTR64LSB =        0x47,     //< @@fptr(sym + add), data8 LSB
1604    R_IA64_PCREL60B =         0x48,     //< @@pcrel(sym + add), brl
1605    R_IA64_PCREL21B =         0x49,     //< @@pcrel(sym + add), ptb, call
1606    R_IA64_PCREL21M =         0x4a,     //< @@pcrel(sym + add), chk.s
1607    R_IA64_PCREL21F =         0x4b,     //< @@pcrel(sym + add), fchkf
1608    R_IA64_PCREL32MSB =       0x4c,     //< @@pcrel(sym + add), data4 MSB
1609    R_IA64_PCREL32LSB =       0x4d,     //< @@pcrel(sym + add), data4 LSB
1610    R_IA64_PCREL64MSB =       0x4e,     //< @@pcrel(sym + add), data8 MSB
1611    R_IA64_PCREL64LSB =       0x4f,     //< @@pcrel(sym + add), data8 LSB
1612    R_IA64_LTOFF_FPTR22 =     0x52,     //< @@ltoff(@@fptr(s+a)), imm22
1613    R_IA64_LTOFF_FPTR64I =    0x53,     //< @@ltoff(@@fptr(s+a)), imm64
1614    R_IA64_LTOFF_FPTR32MSB =  0x54,     //< @@ltoff(@@fptr(s+a)), data4 MSB
1615    R_IA64_LTOFF_FPTR32LSB =  0x55,     //< @@ltoff(@@fptr(s+a)), data4 LSB
1616    R_IA64_LTOFF_FPTR64MSB =  0x56,     //< @@ltoff(@@fptr(s+a)), data8 MSB
1617    R_IA64_LTOFF_FPTR64LSB =  0x57,     //< @@ltoff(@@fptr(s+a)), data8 LSB
1618    R_IA64_SEGREL32MSB =      0x5c,     //< @@segrel(sym + add), data4 MSB
1619    R_IA64_SEGREL32LSB =      0x5d,     //< @@segrel(sym + add), data4 LSB
1620    R_IA64_SEGREL64MSB =      0x5e,     //< @@segrel(sym + add), data8 MSB
1621    R_IA64_SEGREL64LSB =      0x5f,     //< @@segrel(sym + add), data8 LSB
1622    R_IA64_SECREL32MSB =      0x64,     //< @@secrel(sym + add), data4 MSB
1623    R_IA64_SECREL32LSB =      0x65,     //< @@secrel(sym + add), data4 LSB
1624    R_IA64_SECREL64MSB =      0x66,     //< @@secrel(sym + add), data8 MSB
1625    R_IA64_SECREL64LSB =      0x67,     //< @@secrel(sym + add), data8 LSB
1626    R_IA64_REL32MSB =         0x6c,     //< data 4 + REL
1627    R_IA64_REL32LSB =         0x6d,     //< data 4 + REL
1628    R_IA64_REL64MSB =         0x6e,     //< data 8 + REL
1629    R_IA64_REL64LSB =         0x6f,     //< data 8 + REL
1630    R_IA64_LTV32MSB =         0x74,     //< symbol + addend, data4 MSB
1631    R_IA64_LTV32LSB =         0x75,     //< symbol + addend, data4 LSB
1632    R_IA64_LTV64MSB =         0x76,     //< symbol + addend, data8 MSB
1633    R_IA64_LTV64LSB =         0x77,     //< symbol + addend, data8 LSB
1634    R_IA64_PCREL21BI =        0x79,     //< @@pcrel(sym + add), 21bit inst
1635    R_IA64_PCREL22 =          0x7a,     //< @@pcrel(sym + add), 22bit inst
1636    R_IA64_PCREL64I =         0x7b,     //< @@pcrel(sym + add), 64bit inst
1637    R_IA64_IPLTMSB =          0x80,     //< dynamic reloc, imported PLT, MSB
1638    R_IA64_IPLTLSB =          0x81,     //< dynamic reloc, imported PLT, LSB
1639    R_IA64_COPY =             0x84,     //< copy relocation
1640    R_IA64_SUB =              0x85,     //< Addend and symbol difference
1641    R_IA64_LTOFF22X =         0x86,     //< LTOFF22, relaxable. 
1642    R_IA64_LDXMOV =           0x87,     //< Use of LTOFF22X. 
1643    R_IA64_TPREL14 =          0x91,     //< @@tprel(sym + add), imm14
1644    R_IA64_TPREL22 =          0x92,     //< @@tprel(sym + add), imm22
1645    R_IA64_TPREL64I =         0x93,     //< @@tprel(sym + add), imm64
1646    R_IA64_TPREL64MSB =       0x96,     //< @@tprel(sym + add), data8 MSB
1647    R_IA64_TPREL64LSB =       0x97,     //< @@tprel(sym + add), data8 LSB
1648    R_IA64_LTOFF_TPREL22 =    0x9a,     //< @@ltoff(@@tprel(s+a)), imm2
1649    R_IA64_DTPMOD64MSB =      0xa6,     //< @@dtpmod(sym + add), data8 MSB
1650    R_IA64_DTPMOD64LSB =      0xa7,     //< @@dtpmod(sym + add), data8 LSB
1651    R_IA64_LTOFF_DTPMOD22 =   0xaa,     //< @@ltoff(@@dtpmod(sym + add)), imm22
1652    R_IA64_DTPREL14 =         0xb1,     //< @@dtprel(sym + add), imm14
1653    R_IA64_DTPREL22 =         0xb2,     //< @@dtprel(sym + add), imm22
1654    R_IA64_DTPREL64I =        0xb3,     //< @@dtprel(sym + add), imm64
1655    R_IA64_DTPREL32MSB =      0xb4,     //< @@dtprel(sym + add), data4 MSB
1656    R_IA64_DTPREL32LSB =      0xb5,     //< @@dtprel(sym + add), data4 LSB
1657    R_IA64_DTPREL64MSB =      0xb6,     //< @@dtprel(sym + add), data8 MSB
1658    R_IA64_DTPREL64LSB =      0xb7,     //< @@dtprel(sym + add), data8 LSB
1659    R_IA64_LTOFF_DTPREL22 =   0xba,     //< @@ltoff(@@dtprel(s+a)), imm22
1660
1661    /* SH relocs.  */
1662    R_SH_NONE =               0,
1663    R_SH_DIR32 =              1,
1664    R_SH_REL32 =              2,
1665    R_SH_DIR8WPN =            3,
1666    R_SH_IND12W =             4,
1667    R_SH_DIR8WPL =            5,
1668    R_SH_DIR8WPZ =            6,
1669    R_SH_DIR8BP =             7,
1670    R_SH_DIR8W =              8,
1671    R_SH_DIR8L =              9,
1672    R_SH_SWITCH16 =           25,
1673    R_SH_SWITCH32 =           26,
1674    R_SH_USES =               27,
1675    R_SH_COUNT =              28,
1676    R_SH_ALIGN =              29,
1677    R_SH_CODE =               30,
1678    R_SH_DATA =               31,
1679    R_SH_LABEL =              32,
1680    R_SH_SWITCH8 =            33,
1681    R_SH_GNU_VTINHERIT =      34,
1682    R_SH_GNU_VTENTRY =        35,
1683    R_SH_TLS_GD_32 =          144,
1684    R_SH_TLS_LD_32 =          145,
1685    R_SH_TLS_LDO_32 =         146,
1686    R_SH_TLS_IE_32 =          147,
1687    R_SH_TLS_LE_32 =          148,
1688    R_SH_TLS_DTPMOD32 =       149,
1689    R_SH_TLS_DTPOFF32 =       150,
1690    R_SH_TLS_TPOFF32 =        151,
1691    R_SH_GOT32 =              160,
1692    R_SH_PLT32 =              161,
1693    R_SH_COPY =               162,
1694    R_SH_GLOB_DAT =           163,
1695    R_SH_JMP_SLOT =           164,
1696    R_SH_RELATIVE =           165,
1697    R_SH_GOTOFF =             166,
1698    R_SH_GOTPC =              167,
1699    /* Keep this the last entry.  */
1700    R_SH_NUM =                256,
1701
1702/* Additional s390 relocs */
1703    R_390_NONE =              0,        //< No reloc. 
1704    R_390_8 =                 1,        //< Direct 8 bit. 
1705    R_390_12 =                2,        //< Direct 12 bit. 
1706    R_390_16 =                3,        //< Direct 16 bit. 
1707    R_390_32 =                4,        //< Direct 32 bit. 
1708    R_390_PC32 =              5,        //< PC relative 32 bit. 
1709    R_390_GOT12 =             6,        //< 12 bit GOT offset. 
1710    R_390_GOT32 =             7,        //< 32 bit GOT offset. 
1711    R_390_PLT32 =             8,        //< 32 bit PC relative PLT address. 
1712    R_390_COPY =              9,        //< Copy symbol at runtime. 
1713    R_390_GLOB_DAT =          10,       //< Create GOT entry. 
1714    R_390_JMP_SLOT =          11,       //< Create PLT entry. 
1715    R_390_RELATIVE =          12,       //< Adjust by program base. 
1716    R_390_GOTOFF32 =          13,       //< 32 bit offset to GOT.         
1717    R_390_GOTPC =             14,       //< 32 bit PC relative offset to GOT. 
1718    R_390_GOT16 =             15,       //< 16 bit GOT offset. 
1719    R_390_PC16 =              16,       //< PC relative 16 bit. 
1720    R_390_PC16DBL =           17,       //< PC relative 16 bit shifted by 1. 
1721    R_390_PLT16DBL =          18,       //< 16 bit PC rel. PLT shifted by 1. 
1722    R_390_PC32DBL =           19,       //< PC relative 32 bit shifted by 1. 
1723    R_390_PLT32DBL =          20,       //< 32 bit PC rel. PLT shifted by 1. 
1724    R_390_GOTPCDBL =          21,       //< 32 bit PC rel. GOT shifted by 1. 
1725    R_390_64 =                22,       //< Direct 64 bit. 
1726    R_390_PC64 =              23,       //< PC relative 64 bit. 
1727    R_390_GOT64 =             24,       //< 64 bit GOT offset. 
1728    R_390_PLT64 =             25,       //< 64 bit PC relative PLT address. 
1729    R_390_GOTENT =            26,       //< 32 bit PC rel. to GOT entry >> 1.
1730    R_390_GOTOFF16 =          27,       //< 16 bit offset to GOT.
1731    R_390_GOTOFF64 =          28,       //< 64 bit offset to GOT.
1732    R_390_GOTPLT12 =          29,       //< 12 bit offset to jump slot. 
1733    R_390_GOTPLT16 =          30,       //< 16 bit offset to jump slot. 
1734    R_390_GOTPLT32 =          31,       //< 32 bit offset to jump slot. 
1735    R_390_GOTPLT64 =          32,       //< 64 bit offset to jump slot. 
1736    R_390_GOTPLTENT =         33,       //< 32 bit rel. offset to jump slot. 
1737    R_390_PLTOFF16 =          34,       //< 16 bit offset from GOT to PLT.
1738    R_390_PLTOFF32 =          35,       //< 32 bit offset from GOT to PLT.
1739    R_390_PLTOFF64 =          36,       //< 16 bit offset from GOT to PLT.
1740    R_390_TLS_LOAD =          37,       //< Tag for load insn in TLS code. 
1741    R_390_TLS_GDCALL =        38,       //< Tag for function call in general dynamic TLS code.
1742    R_390_TLS_LDCALL =        39,       //< Tag for function call in local dynamic TLS code.
1743    R_390_TLS_GD32 =          40,       //< Direct 32 bit for general dynamic  thread local data. 
1744    R_390_TLS_GD64 =          41,       //< Direct 64 bit for general dynamic thread local data. 
1745    R_390_TLS_GOTIE12 =       42,       //< 12 bit GOT offset for static TLS  block offset. 
1746    R_390_TLS_GOTIE32 =       43,       //< 32 bit GOT offset for static TLS  block offset. 
1747    R_390_TLS_GOTIE64 =       44,       //< 64 bit GOT offset for static TLS   block offset.
1748    R_390_TLS_LDM32 =         45,       //< Direct 32 bit for local dynamic   thread local data in LE code. 
1749    R_390_TLS_LDM64 =         46,       //< Direct 64 bit for local dynamic   thread local data in LE code. 
1750    R_390_TLS_IE32 =          47,       //< 32 bit address of GOT entry for   negated static TLS block offset. 
1751    R_390_TLS_IE64 =          48,       //< 64 bit address of GOT entry for   negated static TLS block offset. 
1752    R_390_TLS_IEENT =         49,       //< 32 bit rel. offset to GOT entry for negated static TLS block offset. 
1753    R_390_TLS_LE32 =          50,       //< 32 bit negated offset relative to static TLS block. 
1754    R_390_TLS_LE64 =          51,       //< 64 bit negated offset relative to static TLS block. 
1755    R_390_TLS_LDO32 =         52,       //< 32 bit offset relative to TLS block. 
1756    R_390_TLS_LDO64 =         53,       //< 64 bit offset relative to TLS block. 
1757    R_390_TLS_DTPMOD =        54,       //< ID of module containing symbol. 
1758    R_390_TLS_DTPOFF =        55,       //< Offset in TLS block. 
1759    R_390_TLS_TPOFF =         56,       //< Negated offset in static TLS  block. 
1760    R_390_20 =                57,       //< Direct 20 bit. 
1761    R_390_GOT20 =             58,       //< 20 bit GOT offset. 
1762    R_390_GOTPLT20 =          59,       //< 20 bit offset to jump slot. 
1763    R_390_TLS_GOTIE20 =       60,       //< 20 bit GOT offset for static TLS block offset. 
1764    /* Keep this the last entry.  */
1765    R_390_NUM =               61,
1766
1767/* CRIS relocations.  */
1768    R_CRIS_NONE =             0,
1769    R_CRIS_8 =                1,
1770    R_CRIS_16 =               2,
1771    R_CRIS_32 =               3,
1772    R_CRIS_8_PCREL =          4,
1773    R_CRIS_16_PCREL =         5,
1774    R_CRIS_32_PCREL =         6,
1775    R_CRIS_GNU_VTINHERIT =    7,
1776    R_CRIS_GNU_VTENTRY =      8,
1777    R_CRIS_COPY =             9,
1778    R_CRIS_GLOB_DAT =         10,
1779    R_CRIS_JUMP_SLOT =        11,
1780    R_CRIS_RELATIVE =         12,
1781    R_CRIS_16_GOT =           13,
1782    R_CRIS_32_GOT =           14,
1783    R_CRIS_16_GOTPLT =        15,
1784    R_CRIS_32_GOTPLT =        16,
1785    R_CRIS_32_GOTREL =        17,
1786    R_CRIS_32_PLT_GOTREL =    18,
1787    R_CRIS_32_PLT_PCREL =     19,
1788    R_CRIS_NUM =              20,
1789
1790/* AM33 relocations.  */
1791    R_MN10300_NONE =          0,        //< No reloc. 
1792    R_MN10300_32 =            1,        //< Direct 32 bit. 
1793    R_MN10300_16 =            2,        //< Direct 16 bit. 
1794    R_MN10300_8 =             3,        //< Direct 8 bit. 
1795    R_MN10300_PCREL32 =       4,        //< PC-relative 32-bit. 
1796    R_MN10300_PCREL16 =       5,        //< PC-relative 16-bit signed. 
1797    R_MN10300_PCREL8 =        6,        //< PC-relative 8-bit signed. 
1798    R_MN10300_GNU_VTINHERIT = 7,        //< Ancient C++ vtable garbage...
1799    R_MN10300_GNU_VTENTRY =   8,        //< ... collection annotation. 
1800    R_MN10300_24 =            9,        //< Direct 24 bit. 
1801    R_MN10300_GOTPC32 =       10,       //< 32-bit PCrel offset to GOT. 
1802    R_MN10300_GOTPC16 =       11,       //< 16-bit PCrel offset to GOT. 
1803    R_MN10300_GOTOFF32 =      12,       //< 32-bit offset from GOT. 
1804    R_MN10300_GOTOFF24 =      13,       //< 24-bit offset from GOT. 
1805    R_MN10300_GOTOFF16 =      14,       //< 16-bit offset from GOT. 
1806    R_MN10300_PLT32 =         15,       //< 32-bit PCrel to PLT entry. 
1807    R_MN10300_PLT16 =         16,       //< 16-bit PCrel to PLT entry. 
1808    R_MN10300_GOT32 =         17,       //< 32-bit offset to GOT entry. 
1809    R_MN10300_GOT24 =         18,       //< 24-bit offset to GOT entry. 
1810    R_MN10300_GOT16 =         19,       //< 16-bit offset to GOT entry. 
1811    R_MN10300_COPY =          20,       //< Copy symbol at runtime. 
1812    R_MN10300_GLOB_DAT =      21,       //< Create GOT entry. 
1813    R_MN10300_JMP_SLOT =      22,       //< Create PLT entry. 
1814    R_MN10300_RELATIVE =      23,       //< Adjust by program base. 
1815    R_MN10300_NUM =           24,
1816
1817/* AMD x86-64 relocations.  */
1818    R_X86_64_NONE =           0,        //< No reloc
1819    R_X86_64_64 =             1,        //< Direct 64 bit 
1820    R_X86_64_PC32 =           2,        //< PC relative 32 bit signed
1821    R_X86_64_GOT32 =          3,        //< 32 bit GOT entry
1822    R_X86_64_PLT32 =          4,        //< 32 bit PLT address
1823    R_X86_64_COPY =           5,        //< Copy symbol at runtime
1824    R_X86_64_GLOB_DAT =       6,        //< Create GOT entry
1825    R_X86_64_JUMP_SLOT =      7,        //< Create PLT entry
1826    R_X86_64_RELATIVE =       8,        //< Adjust by program base
1827    R_X86_64_GOTPCREL =       9,        //< 32 bit signed PC relative offset to GOT
1828    R_X86_64_32 =             10,       //< Direct 32 bit zero extended
1829    R_X86_64_32S =            11,       //< Direct 32 bit sign extended
1830    R_X86_64_16 =             12,       //< Direct 16 bit zero extended
1831    R_X86_64_PC16 =           13,       //< 16 bit sign extended pc relative
1832    R_X86_64_8 =              14,       //< Direct 8 bit sign extended 
1833    R_X86_64_PC8 =            15,       //< 8 bit sign extended pc relative
1834    R_X86_64_DTPMOD64 =       16,       //< ID of module containing symbol
1835    R_X86_64_DTPOFF64 =       17,       //< Offset in module's TLS block
1836    R_X86_64_TPOFF64 =        18,       //< Offset in initial TLS block
1837    R_X86_64_TLSGD =          19,       //< 32 bit signed PC relative offset to two GOT entries for GD symbol
1838    R_X86_64_TLSLD =          20,       //< 32 bit signed PC relative offset to two GOT entries for LD symbol
1839    R_X86_64_DTPOFF32 =       21,       //< Offset in TLS block
1840    R_X86_64_GOTTPOFF =       22,       //< 32 bit signed PC relative offset to GOT entry for IE symbol
1841    R_X86_64_TPOFF32 =        23,       //< Offset in initial TLS block
1842    R_X86_64_NUM =            24,
1843
1844/* M32R relocs.  */
1845    R_M32R_NONE =             0,        //< No reloc.
1846    R_M32R_16 =               1,        //< Direct 16 bit.
1847    R_M32R_32 =               2,        //< Direct 32 bit.
1848    R_M32R_24 =               3,        //< Direct 24 bit.
1849    R_M32R_10_PCREL =         4,        //< PC relative 10 bit shifted.
1850    R_M32R_18_PCREL =         5,        //< PC relative 18 bit shifted.
1851    R_M32R_26_PCREL =         6,        //< PC relative 26 bit shifted.
1852    R_M32R_HI16_ULO =         7,        //< High 16 bit with unsigned low.
1853    R_M32R_HI16_SLO =         8,        //< High 16 bit with signed low.
1854    R_M32R_LO16 =             9,        //< Low 16 bit.
1855    R_M32R_SDA16 =            10,       //< 16 bit offset in SDA.
1856    R_M32R_GNU_VTINHERIT =    11,
1857    R_M32R_GNU_VTENTRY =      12,
1858/* M32R relocs use SHT_RELA.  */
1859    R_M32R_16_RELA =          33,       //< Direct 16 bit.
1860    R_M32R_32_RELA =          34,       //< Direct 32 bit.
1861    R_M32R_24_RELA =          35,       //< Direct 24 bit.
1862    R_M32R_10_PCREL_RELA =    36,       //< PC relative 10 bit shifted.
1863    R_M32R_18_PCREL_RELA =    37,       //< PC relative 18 bit shifted.
1864    R_M32R_26_PCREL_RELA =    38,       //< PC relative 26 bit shifted.
1865    R_M32R_HI16_ULO_RELA =    39,       //< High 16 bit with unsigned low
1866    R_M32R_HI16_SLO_RELA =    40,       //< High 16 bit with signed low
1867    R_M32R_LO16_RELA =        41,       //< Low 16 bit
1868    R_M32R_SDA16_RELA =       42,       //< 16 bit offset in SDA
1869    R_M32R_RELA_GNU_VTINHERIT = 43,
1870    R_M32R_RELA_GNU_VTENTRY = 44,
1871    R_M32R_REL32 =            45,       //< PC relative 32 bit. 
1872    R_M32R_GOT24 =            48,       //< 24 bit GOT entry
1873    R_M32R_26_PLTREL =        49,       //< 26 bit PC relative to PLT shifted
1874    R_M32R_COPY =             50,       //< Copy symbol at runtime
1875    R_M32R_GLOB_DAT =         51,       //< Create GOT entry
1876    R_M32R_JMP_SLOT =         52,       //< Create PLT entry
1877    R_M32R_RELATIVE =         53,       //< Adjust by program base
1878    R_M32R_GOTOFF =           54,       //< 24 bit offset to GOT
1879    R_M32R_GOTPC24 =          55,       //< 24 bit PC relative offset to GOT
1880    R_M32R_GOT16_HI_ULO =     56,       //< High 16 bit GOT entry with unsigned low
1881    R_M32R_GOT16_HI_SLO =     57,       //< High 16 bit GOT entry with signed low
1882    R_M32R_GOT16_LO =         58,       //< Low 16 bit GOT entry
1883    R_M32R_GOTPC_HI_ULO =     59,       //< High 16 bit PC relative offset to GOT with unsigned low
1884    R_M32R_GOTPC_HI_SLO =     60,       //< High 16 bit PC relative offset to GOT with signed low
1885    R_M32R_GOTPC_LO =         61,       //< Low 16 bit PC relative offset to GOT
1886    R_M32R_GOTOFF_HI_ULO =    62,       //< High 16 bit offset to GOT with unsigned low
1887    R_M32R_GOTOFF_HI_SLO =    63,       //< High 16 bit offset to GOT with signed low
1888    R_M32R_GOTOFF_LO =        64,       //< Low 16 bit offset to GOT
1889    R_M32R_NUM =              256,      //< Keep this the last entry.
1890
1891  };
1892
1893}
1894
1895#endif
1896
Note: See TracBrowser for help on using the repository browser.