You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2994 lines
111 KiB

  1. /*
  2. * ELF constants and data structures
  3. *
  4. * Derived from:
  5. * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.1 2005/12/30 22:13:58 marcel Exp $
  6. * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.1 2005/12/30 22:13:58 marcel Exp $
  7. * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.1 2005/12/30 22:13:58 marcel Exp $
  8. * $FreeBSD: src/sys/alpha/include/elf.h,v 1.14 2003/09/25 01:10:22 peter Exp $
  9. * $FreeBSD: src/sys/amd64/include/elf.h,v 1.18 2004/08/03 08:21:48 dfr Exp $
  10. * $FreeBSD: src/sys/arm/include/elf.h,v 1.5.2.1 2006/06/30 21:42:52 cognet Exp $
  11. * $FreeBSD: src/sys/i386/include/elf.h,v 1.16 2004/08/02 19:12:17 dfr Exp $
  12. * $FreeBSD: src/sys/powerpc/include/elf.h,v 1.7 2004/11/02 09:47:01 ssouhlal Exp $
  13. * $FreeBSD: src/sys/sparc64/include/elf.h,v 1.12 2003/09/25 01:10:26 peter Exp $
  14. * "System V ABI" (http://www.sco.com/developers/gabi/latest/ch4.eheader.html)
  15. * "ELF for the ARM® 64-bit Architecture (AArch64)" (ARM IHI 0056B)
  16. * "RISC-V ELF psABI specification" (https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md)
  17. * llvm/BinaryFormat/ELF.h - ELF constants and structures
  18. *
  19. * Copyright (c) 1996-1998 John D. Polstra. All rights reserved.
  20. * Copyright (c) 2001 David E. O'Brien
  21. * Portions Copyright 2018 Google LLC.
  22. * Redistribution and use in source and binary forms, with or without
  23. * modification, are permitted provided that the following conditions
  24. * are met:
  25. * 1. Redistributions of source code must retain the above copyright
  26. * notice, this list of conditions and the following disclaimer.
  27. * 2. Redistributions in binary form must reproduce the above copyright
  28. * notice, this list of conditions and the following disclaimer in the
  29. * documentation and/or other materials provided with the distribution.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  32. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  34. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  35. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  39. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  40. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  41. * SUCH DAMAGE.
  42. */
  43. package elf
  44. import "strconv"
  45. /*
  46. * Constants
  47. */
  48. // Indexes into the Header.Ident array.
  49. const (
  50. EI_CLASS = 4 /* Class of machine. */
  51. EI_DATA = 5 /* Data format. */
  52. EI_VERSION = 6 /* ELF format version. */
  53. EI_OSABI = 7 /* Operating system / ABI identification */
  54. EI_ABIVERSION = 8 /* ABI version */
  55. EI_PAD = 9 /* Start of padding (per SVR4 ABI). */
  56. EI_NIDENT = 16 /* Size of e_ident array. */
  57. )
  58. // Initial magic number for ELF files.
  59. const ELFMAG = "\177ELF"
  60. // Version is found in Header.Ident[EI_VERSION] and Header.Version.
  61. type Version byte
  62. const (
  63. EV_NONE Version = 0
  64. EV_CURRENT Version = 1
  65. )
  66. var versionStrings = []intName{
  67. {0, "EV_NONE"},
  68. {1, "EV_CURRENT"},
  69. }
  70. func (i Version) String() string { return stringName(uint32(i), versionStrings, false) }
  71. func (i Version) GoString() string { return stringName(uint32(i), versionStrings, true) }
  72. // Class is found in Header.Ident[EI_CLASS] and Header.Class.
  73. type Class byte
  74. const (
  75. ELFCLASSNONE Class = 0 /* Unknown class. */
  76. ELFCLASS32 Class = 1 /* 32-bit architecture. */
  77. ELFCLASS64 Class = 2 /* 64-bit architecture. */
  78. )
  79. var classStrings = []intName{
  80. {0, "ELFCLASSNONE"},
  81. {1, "ELFCLASS32"},
  82. {2, "ELFCLASS64"},
  83. }
  84. func (i Class) String() string { return stringName(uint32(i), classStrings, false) }
  85. func (i Class) GoString() string { return stringName(uint32(i), classStrings, true) }
  86. // Data is found in Header.Ident[EI_DATA] and Header.Data.
  87. type Data byte
  88. const (
  89. ELFDATANONE Data = 0 /* Unknown data format. */
  90. ELFDATA2LSB Data = 1 /* 2's complement little-endian. */
  91. ELFDATA2MSB Data = 2 /* 2's complement big-endian. */
  92. )
  93. var dataStrings = []intName{
  94. {0, "ELFDATANONE"},
  95. {1, "ELFDATA2LSB"},
  96. {2, "ELFDATA2MSB"},
  97. }
  98. func (i Data) String() string { return stringName(uint32(i), dataStrings, false) }
  99. func (i Data) GoString() string { return stringName(uint32(i), dataStrings, true) }
  100. // OSABI is found in Header.Ident[EI_OSABI] and Header.OSABI.
  101. type OSABI byte
  102. const (
  103. ELFOSABI_NONE OSABI = 0 /* UNIX System V ABI */
  104. ELFOSABI_HPUX OSABI = 1 /* HP-UX operating system */
  105. ELFOSABI_NETBSD OSABI = 2 /* NetBSD */
  106. ELFOSABI_LINUX OSABI = 3 /* GNU/Linux */
  107. ELFOSABI_HURD OSABI = 4 /* GNU/Hurd */
  108. ELFOSABI_86OPEN OSABI = 5 /* 86Open common IA32 ABI */
  109. ELFOSABI_SOLARIS OSABI = 6 /* Solaris */
  110. ELFOSABI_AIX OSABI = 7 /* AIX */
  111. ELFOSABI_IRIX OSABI = 8 /* IRIX */
  112. ELFOSABI_FREEBSD OSABI = 9 /* FreeBSD */
  113. ELFOSABI_TRU64 OSABI = 10 /* TRU64 UNIX */
  114. ELFOSABI_MODESTO OSABI = 11 /* Novell Modesto */
  115. ELFOSABI_OPENBSD OSABI = 12 /* OpenBSD */
  116. ELFOSABI_OPENVMS OSABI = 13 /* Open VMS */
  117. ELFOSABI_NSK OSABI = 14 /* HP Non-Stop Kernel */
  118. ELFOSABI_AROS OSABI = 15 /* Amiga Research OS */
  119. ELFOSABI_FENIXOS OSABI = 16 /* The FenixOS highly scalable multi-core OS */
  120. ELFOSABI_CLOUDABI OSABI = 17 /* Nuxi CloudABI */
  121. ELFOSABI_ARM OSABI = 97 /* ARM */
  122. ELFOSABI_STANDALONE OSABI = 255 /* Standalone (embedded) application */
  123. )
  124. var osabiStrings = []intName{
  125. {0, "ELFOSABI_NONE"},
  126. {1, "ELFOSABI_HPUX"},
  127. {2, "ELFOSABI_NETBSD"},
  128. {3, "ELFOSABI_LINUX"},
  129. {4, "ELFOSABI_HURD"},
  130. {5, "ELFOSABI_86OPEN"},
  131. {6, "ELFOSABI_SOLARIS"},
  132. {7, "ELFOSABI_AIX"},
  133. {8, "ELFOSABI_IRIX"},
  134. {9, "ELFOSABI_FREEBSD"},
  135. {10, "ELFOSABI_TRU64"},
  136. {11, "ELFOSABI_MODESTO"},
  137. {12, "ELFOSABI_OPENBSD"},
  138. {13, "ELFOSABI_OPENVMS"},
  139. {14, "ELFOSABI_NSK"},
  140. {15, "ELFOSABI_AROS"},
  141. {16, "ELFOSABI_FENIXOS"},
  142. {17, "ELFOSABI_CLOUDABI"},
  143. {97, "ELFOSABI_ARM"},
  144. {255, "ELFOSABI_STANDALONE"},
  145. }
  146. func (i OSABI) String() string { return stringName(uint32(i), osabiStrings, false) }
  147. func (i OSABI) GoString() string { return stringName(uint32(i), osabiStrings, true) }
  148. // Type is found in Header.Type.
  149. type Type uint16
  150. const (
  151. ET_NONE Type = 0 /* Unknown type. */
  152. ET_REL Type = 1 /* Relocatable. */
  153. ET_EXEC Type = 2 /* Executable. */
  154. ET_DYN Type = 3 /* Shared object. */
  155. ET_CORE Type = 4 /* Core file. */
  156. ET_LOOS Type = 0xfe00 /* First operating system specific. */
  157. ET_HIOS Type = 0xfeff /* Last operating system-specific. */
  158. ET_LOPROC Type = 0xff00 /* First processor-specific. */
  159. ET_HIPROC Type = 0xffff /* Last processor-specific. */
  160. )
  161. var typeStrings = []intName{
  162. {0, "ET_NONE"},
  163. {1, "ET_REL"},
  164. {2, "ET_EXEC"},
  165. {3, "ET_DYN"},
  166. {4, "ET_CORE"},
  167. {0xfe00, "ET_LOOS"},
  168. {0xfeff, "ET_HIOS"},
  169. {0xff00, "ET_LOPROC"},
  170. {0xffff, "ET_HIPROC"},
  171. }
  172. func (i Type) String() string { return stringName(uint32(i), typeStrings, false) }
  173. func (i Type) GoString() string { return stringName(uint32(i), typeStrings, true) }
  174. // Machine is found in Header.Machine.
  175. type Machine uint16
  176. const (
  177. EM_NONE Machine = 0 /* Unknown machine. */
  178. EM_M32 Machine = 1 /* AT&T WE32100. */
  179. EM_SPARC Machine = 2 /* Sun SPARC. */
  180. EM_386 Machine = 3 /* Intel i386. */
  181. EM_68K Machine = 4 /* Motorola 68000. */
  182. EM_88K Machine = 5 /* Motorola 88000. */
  183. EM_860 Machine = 7 /* Intel i860. */
  184. EM_MIPS Machine = 8 /* MIPS R3000 Big-Endian only. */
  185. EM_S370 Machine = 9 /* IBM System/370. */
  186. EM_MIPS_RS3_LE Machine = 10 /* MIPS R3000 Little-Endian. */
  187. EM_PARISC Machine = 15 /* HP PA-RISC. */
  188. EM_VPP500 Machine = 17 /* Fujitsu VPP500. */
  189. EM_SPARC32PLUS Machine = 18 /* SPARC v8plus. */
  190. EM_960 Machine = 19 /* Intel 80960. */
  191. EM_PPC Machine = 20 /* PowerPC 32-bit. */
  192. EM_PPC64 Machine = 21 /* PowerPC 64-bit. */
  193. EM_S390 Machine = 22 /* IBM System/390. */
  194. EM_V800 Machine = 36 /* NEC V800. */
  195. EM_FR20 Machine = 37 /* Fujitsu FR20. */
  196. EM_RH32 Machine = 38 /* TRW RH-32. */
  197. EM_RCE Machine = 39 /* Motorola RCE. */
  198. EM_ARM Machine = 40 /* ARM. */
  199. EM_SH Machine = 42 /* Hitachi SH. */
  200. EM_SPARCV9 Machine = 43 /* SPARC v9 64-bit. */
  201. EM_TRICORE Machine = 44 /* Siemens TriCore embedded processor. */
  202. EM_ARC Machine = 45 /* Argonaut RISC Core. */
  203. EM_H8_300 Machine = 46 /* Hitachi H8/300. */
  204. EM_H8_300H Machine = 47 /* Hitachi H8/300H. */
  205. EM_H8S Machine = 48 /* Hitachi H8S. */
  206. EM_H8_500 Machine = 49 /* Hitachi H8/500. */
  207. EM_IA_64 Machine = 50 /* Intel IA-64 Processor. */
  208. EM_MIPS_X Machine = 51 /* Stanford MIPS-X. */
  209. EM_COLDFIRE Machine = 52 /* Motorola ColdFire. */
  210. EM_68HC12 Machine = 53 /* Motorola M68HC12. */
  211. EM_MMA Machine = 54 /* Fujitsu MMA. */
  212. EM_PCP Machine = 55 /* Siemens PCP. */
  213. EM_NCPU Machine = 56 /* Sony nCPU. */
  214. EM_NDR1 Machine = 57 /* Denso NDR1 microprocessor. */
  215. EM_STARCORE Machine = 58 /* Motorola Star*Core processor. */
  216. EM_ME16 Machine = 59 /* Toyota ME16 processor. */
  217. EM_ST100 Machine = 60 /* STMicroelectronics ST100 processor. */
  218. EM_TINYJ Machine = 61 /* Advanced Logic Corp. TinyJ processor. */
  219. EM_X86_64 Machine = 62 /* Advanced Micro Devices x86-64 */
  220. EM_PDSP Machine = 63 /* Sony DSP Processor */
  221. EM_PDP10 Machine = 64 /* Digital Equipment Corp. PDP-10 */
  222. EM_PDP11 Machine = 65 /* Digital Equipment Corp. PDP-11 */
  223. EM_FX66 Machine = 66 /* Siemens FX66 microcontroller */
  224. EM_ST9PLUS Machine = 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
  225. EM_ST7 Machine = 68 /* STMicroelectronics ST7 8-bit microcontroller */
  226. EM_68HC16 Machine = 69 /* Motorola MC68HC16 Microcontroller */
  227. EM_68HC11 Machine = 70 /* Motorola MC68HC11 Microcontroller */
  228. EM_68HC08 Machine = 71 /* Motorola MC68HC08 Microcontroller */
  229. EM_68HC05 Machine = 72 /* Motorola MC68HC05 Microcontroller */
  230. EM_SVX Machine = 73 /* Silicon Graphics SVx */
  231. EM_ST19 Machine = 74 /* STMicroelectronics ST19 8-bit microcontroller */
  232. EM_VAX Machine = 75 /* Digital VAX */
  233. EM_CRIS Machine = 76 /* Axis Communications 32-bit embedded processor */
  234. EM_JAVELIN Machine = 77 /* Infineon Technologies 32-bit embedded processor */
  235. EM_FIREPATH Machine = 78 /* Element 14 64-bit DSP Processor */
  236. EM_ZSP Machine = 79 /* LSI Logic 16-bit DSP Processor */
  237. EM_MMIX Machine = 80 /* Donald Knuth's educational 64-bit processor */
  238. EM_HUANY Machine = 81 /* Harvard University machine-independent object files */
  239. EM_PRISM Machine = 82 /* SiTera Prism */
  240. EM_AVR Machine = 83 /* Atmel AVR 8-bit microcontroller */
  241. EM_FR30 Machine = 84 /* Fujitsu FR30 */
  242. EM_D10V Machine = 85 /* Mitsubishi D10V */
  243. EM_D30V Machine = 86 /* Mitsubishi D30V */
  244. EM_V850 Machine = 87 /* NEC v850 */
  245. EM_M32R Machine = 88 /* Mitsubishi M32R */
  246. EM_MN10300 Machine = 89 /* Matsushita MN10300 */
  247. EM_MN10200 Machine = 90 /* Matsushita MN10200 */
  248. EM_PJ Machine = 91 /* picoJava */
  249. EM_OPENRISC Machine = 92 /* OpenRISC 32-bit embedded processor */
  250. EM_ARC_COMPACT Machine = 93 /* ARC International ARCompact processor (old spelling/synonym: EM_ARC_A5) */
  251. EM_XTENSA Machine = 94 /* Tensilica Xtensa Architecture */
  252. EM_VIDEOCORE Machine = 95 /* Alphamosaic VideoCore processor */
  253. EM_TMM_GPP Machine = 96 /* Thompson Multimedia General Purpose Processor */
  254. EM_NS32K Machine = 97 /* National Semiconductor 32000 series */
  255. EM_TPC Machine = 98 /* Tenor Network TPC processor */
  256. EM_SNP1K Machine = 99 /* Trebia SNP 1000 processor */
  257. EM_ST200 Machine = 100 /* STMicroelectronics (www.st.com) ST200 microcontroller */
  258. EM_IP2K Machine = 101 /* Ubicom IP2xxx microcontroller family */
  259. EM_MAX Machine = 102 /* MAX Processor */
  260. EM_CR Machine = 103 /* National Semiconductor CompactRISC microprocessor */
  261. EM_F2MC16 Machine = 104 /* Fujitsu F2MC16 */
  262. EM_MSP430 Machine = 105 /* Texas Instruments embedded microcontroller msp430 */
  263. EM_BLACKFIN Machine = 106 /* Analog Devices Blackfin (DSP) processor */
  264. EM_SE_C33 Machine = 107 /* S1C33 Family of Seiko Epson processors */
  265. EM_SEP Machine = 108 /* Sharp embedded microprocessor */
  266. EM_ARCA Machine = 109 /* Arca RISC Microprocessor */
  267. EM_UNICORE Machine = 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
  268. EM_EXCESS Machine = 111 /* eXcess: 16/32/64-bit configurable embedded CPU */
  269. EM_DXP Machine = 112 /* Icera Semiconductor Inc. Deep Execution Processor */
  270. EM_ALTERA_NIOS2 Machine = 113 /* Altera Nios II soft-core processor */
  271. EM_CRX Machine = 114 /* National Semiconductor CompactRISC CRX microprocessor */
  272. EM_XGATE Machine = 115 /* Motorola XGATE embedded processor */
  273. EM_C166 Machine = 116 /* Infineon C16x/XC16x processor */
  274. EM_M16C Machine = 117 /* Renesas M16C series microprocessors */
  275. EM_DSPIC30F Machine = 118 /* Microchip Technology dsPIC30F Digital Signal Controller */
  276. EM_CE Machine = 119 /* Freescale Communication Engine RISC core */
  277. EM_M32C Machine = 120 /* Renesas M32C series microprocessors */
  278. EM_TSK3000 Machine = 131 /* Altium TSK3000 core */
  279. EM_RS08 Machine = 132 /* Freescale RS08 embedded processor */
  280. EM_SHARC Machine = 133 /* Analog Devices SHARC family of 32-bit DSP processors */
  281. EM_ECOG2 Machine = 134 /* Cyan Technology eCOG2 microprocessor */
  282. EM_SCORE7 Machine = 135 /* Sunplus S+core7 RISC processor */
  283. EM_DSP24 Machine = 136 /* New Japan Radio (NJR) 24-bit DSP Processor */
  284. EM_VIDEOCORE3 Machine = 137 /* Broadcom VideoCore III processor */
  285. EM_LATTICEMICO32 Machine = 138 /* RISC processor for Lattice FPGA architecture */
  286. EM_SE_C17 Machine = 139 /* Seiko Epson C17 family */
  287. EM_TI_C6000 Machine = 140 /* The Texas Instruments TMS320C6000 DSP family */
  288. EM_TI_C2000 Machine = 141 /* The Texas Instruments TMS320C2000 DSP family */
  289. EM_TI_C5500 Machine = 142 /* The Texas Instruments TMS320C55x DSP family */
  290. EM_TI_ARP32 Machine = 143 /* Texas Instruments Application Specific RISC Processor, 32bit fetch */
  291. EM_TI_PRU Machine = 144 /* Texas Instruments Programmable Realtime Unit */
  292. EM_MMDSP_PLUS Machine = 160 /* STMicroelectronics 64bit VLIW Data Signal Processor */
  293. EM_CYPRESS_M8C Machine = 161 /* Cypress M8C microprocessor */
  294. EM_R32C Machine = 162 /* Renesas R32C series microprocessors */
  295. EM_TRIMEDIA Machine = 163 /* NXP Semiconductors TriMedia architecture family */
  296. EM_QDSP6 Machine = 164 /* QUALCOMM DSP6 Processor */
  297. EM_8051 Machine = 165 /* Intel 8051 and variants */
  298. EM_STXP7X Machine = 166 /* STMicroelectronics STxP7x family of configurable and extensible RISC processors */
  299. EM_NDS32 Machine = 167 /* Andes Technology compact code size embedded RISC processor family */
  300. EM_ECOG1 Machine = 168 /* Cyan Technology eCOG1X family */
  301. EM_ECOG1X Machine = 168 /* Cyan Technology eCOG1X family */
  302. EM_MAXQ30 Machine = 169 /* Dallas Semiconductor MAXQ30 Core Micro-controllers */
  303. EM_XIMO16 Machine = 170 /* New Japan Radio (NJR) 16-bit DSP Processor */
  304. EM_MANIK Machine = 171 /* M2000 Reconfigurable RISC Microprocessor */
  305. EM_CRAYNV2 Machine = 172 /* Cray Inc. NV2 vector architecture */
  306. EM_RX Machine = 173 /* Renesas RX family */
  307. EM_METAG Machine = 174 /* Imagination Technologies META processor architecture */
  308. EM_MCST_ELBRUS Machine = 175 /* MCST Elbrus general purpose hardware architecture */
  309. EM_ECOG16 Machine = 176 /* Cyan Technology eCOG16 family */
  310. EM_CR16 Machine = 177 /* National Semiconductor CompactRISC CR16 16-bit microprocessor */
  311. EM_ETPU Machine = 178 /* Freescale Extended Time Processing Unit */
  312. EM_SLE9X Machine = 179 /* Infineon Technologies SLE9X core */
  313. EM_L10M Machine = 180 /* Intel L10M */
  314. EM_K10M Machine = 181 /* Intel K10M */
  315. EM_AARCH64 Machine = 183 /* ARM 64-bit Architecture (AArch64) */
  316. EM_AVR32 Machine = 185 /* Atmel Corporation 32-bit microprocessor family */
  317. EM_STM8 Machine = 186 /* STMicroeletronics STM8 8-bit microcontroller */
  318. EM_TILE64 Machine = 187 /* Tilera TILE64 multicore architecture family */
  319. EM_TILEPRO Machine = 188 /* Tilera TILEPro multicore architecture family */
  320. EM_MICROBLAZE Machine = 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
  321. EM_CUDA Machine = 190 /* NVIDIA CUDA architecture */
  322. EM_TILEGX Machine = 191 /* Tilera TILE-Gx multicore architecture family */
  323. EM_CLOUDSHIELD Machine = 192 /* CloudShield architecture family */
  324. EM_COREA_1ST Machine = 193 /* KIPO-KAIST Core-A 1st generation processor family */
  325. EM_COREA_2ND Machine = 194 /* KIPO-KAIST Core-A 2nd generation processor family */
  326. EM_ARC_COMPACT2 Machine = 195 /* Synopsys ARCompact V2 */
  327. EM_OPEN8 Machine = 196 /* Open8 8-bit RISC soft processor core */
  328. EM_RL78 Machine = 197 /* Renesas RL78 family */
  329. EM_VIDEOCORE5 Machine = 198 /* Broadcom VideoCore V processor */
  330. EM_78KOR Machine = 199 /* Renesas 78KOR family */
  331. EM_56800EX Machine = 200 /* Freescale 56800EX Digital Signal Controller (DSC) */
  332. EM_BA1 Machine = 201 /* Beyond BA1 CPU architecture */
  333. EM_BA2 Machine = 202 /* Beyond BA2 CPU architecture */
  334. EM_XCORE Machine = 203 /* XMOS xCORE processor family */
  335. EM_MCHP_PIC Machine = 204 /* Microchip 8-bit PIC(r) family */
  336. EM_INTEL205 Machine = 205 /* Reserved by Intel */
  337. EM_INTEL206 Machine = 206 /* Reserved by Intel */
  338. EM_INTEL207 Machine = 207 /* Reserved by Intel */
  339. EM_INTEL208 Machine = 208 /* Reserved by Intel */
  340. EM_INTEL209 Machine = 209 /* Reserved by Intel */
  341. EM_KM32 Machine = 210 /* KM211 KM32 32-bit processor */
  342. EM_KMX32 Machine = 211 /* KM211 KMX32 32-bit processor */
  343. EM_KMX16 Machine = 212 /* KM211 KMX16 16-bit processor */
  344. EM_KMX8 Machine = 213 /* KM211 KMX8 8-bit processor */
  345. EM_KVARC Machine = 214 /* KM211 KVARC processor */
  346. EM_CDP Machine = 215 /* Paneve CDP architecture family */
  347. EM_COGE Machine = 216 /* Cognitive Smart Memory Processor */
  348. EM_COOL Machine = 217 /* Bluechip Systems CoolEngine */
  349. EM_NORC Machine = 218 /* Nanoradio Optimized RISC */
  350. EM_CSR_KALIMBA Machine = 219 /* CSR Kalimba architecture family */
  351. EM_Z80 Machine = 220 /* Zilog Z80 */
  352. EM_VISIUM Machine = 221 /* Controls and Data Services VISIUMcore processor */
  353. EM_FT32 Machine = 222 /* FTDI Chip FT32 high performance 32-bit RISC architecture */
  354. EM_MOXIE Machine = 223 /* Moxie processor family */
  355. EM_AMDGPU Machine = 224 /* AMD GPU architecture */
  356. EM_RISCV Machine = 243 /* RISC-V */
  357. EM_LANAI Machine = 244 /* Lanai 32-bit processor */
  358. EM_BPF Machine = 247 /* Linux BPF – in-kernel virtual machine */
  359. /* Non-standard or deprecated. */
  360. EM_486 Machine = 6 /* Intel i486. */
  361. EM_MIPS_RS4_BE Machine = 10 /* MIPS R4000 Big-Endian */
  362. EM_ALPHA_STD Machine = 41 /* Digital Alpha (standard value). */
  363. EM_ALPHA Machine = 0x9026 /* Alpha (written in the absence of an ABI) */
  364. )
  365. var machineStrings = []intName{
  366. {0, "EM_NONE"},
  367. {1, "EM_M32"},
  368. {2, "EM_SPARC"},
  369. {3, "EM_386"},
  370. {4, "EM_68K"},
  371. {5, "EM_88K"},
  372. {7, "EM_860"},
  373. {8, "EM_MIPS"},
  374. {9, "EM_S370"},
  375. {10, "EM_MIPS_RS3_LE"},
  376. {15, "EM_PARISC"},
  377. {17, "EM_VPP500"},
  378. {18, "EM_SPARC32PLUS"},
  379. {19, "EM_960"},
  380. {20, "EM_PPC"},
  381. {21, "EM_PPC64"},
  382. {22, "EM_S390"},
  383. {36, "EM_V800"},
  384. {37, "EM_FR20"},
  385. {38, "EM_RH32"},
  386. {39, "EM_RCE"},
  387. {40, "EM_ARM"},
  388. {42, "EM_SH"},
  389. {43, "EM_SPARCV9"},
  390. {44, "EM_TRICORE"},
  391. {45, "EM_ARC"},
  392. {46, "EM_H8_300"},
  393. {47, "EM_H8_300H"},
  394. {48, "EM_H8S"},
  395. {49, "EM_H8_500"},
  396. {50, "EM_IA_64"},
  397. {51, "EM_MIPS_X"},
  398. {52, "EM_COLDFIRE"},
  399. {53, "EM_68HC12"},
  400. {54, "EM_MMA"},
  401. {55, "EM_PCP"},
  402. {56, "EM_NCPU"},
  403. {57, "EM_NDR1"},
  404. {58, "EM_STARCORE"},
  405. {59, "EM_ME16"},
  406. {60, "EM_ST100"},
  407. {61, "EM_TINYJ"},
  408. {62, "EM_X86_64"},
  409. {63, "EM_PDSP"},
  410. {64, "EM_PDP10"},
  411. {65, "EM_PDP11"},
  412. {66, "EM_FX66"},
  413. {67, "EM_ST9PLUS"},
  414. {68, "EM_ST7"},
  415. {69, "EM_68HC16"},
  416. {70, "EM_68HC11"},
  417. {71, "EM_68HC08"},
  418. {72, "EM_68HC05"},
  419. {73, "EM_SVX"},
  420. {74, "EM_ST19"},
  421. {75, "EM_VAX"},
  422. {76, "EM_CRIS"},
  423. {77, "EM_JAVELIN"},
  424. {78, "EM_FIREPATH"},
  425. {79, "EM_ZSP"},
  426. {80, "EM_MMIX"},
  427. {81, "EM_HUANY"},
  428. {82, "EM_PRISM"},
  429. {83, "EM_AVR"},
  430. {84, "EM_FR30"},
  431. {85, "EM_D10V"},
  432. {86, "EM_D30V"},
  433. {87, "EM_V850"},
  434. {88, "EM_M32R"},
  435. {89, "EM_MN10300"},
  436. {90, "EM_MN10200"},
  437. {91, "EM_PJ"},
  438. {92, "EM_OPENRISC"},
  439. {93, "EM_ARC_COMPACT"},
  440. {94, "EM_XTENSA"},
  441. {95, "EM_VIDEOCORE"},
  442. {96, "EM_TMM_GPP"},
  443. {97, "EM_NS32K"},
  444. {98, "EM_TPC"},
  445. {99, "EM_SNP1K"},
  446. {100, "EM_ST200"},
  447. {101, "EM_IP2K"},
  448. {102, "EM_MAX"},
  449. {103, "EM_CR"},
  450. {104, "EM_F2MC16"},
  451. {105, "EM_MSP430"},
  452. {106, "EM_BLACKFIN"},
  453. {107, "EM_SE_C33"},
  454. {108, "EM_SEP"},
  455. {109, "EM_ARCA"},
  456. {110, "EM_UNICORE"},
  457. {111, "EM_EXCESS"},
  458. {112, "EM_DXP"},
  459. {113, "EM_ALTERA_NIOS2"},
  460. {114, "EM_CRX"},
  461. {115, "EM_XGATE"},
  462. {116, "EM_C166"},
  463. {117, "EM_M16C"},
  464. {118, "EM_DSPIC30F"},
  465. {119, "EM_CE"},
  466. {120, "EM_M32C"},
  467. {131, "EM_TSK3000"},
  468. {132, "EM_RS08"},
  469. {133, "EM_SHARC"},
  470. {134, "EM_ECOG2"},
  471. {135, "EM_SCORE7"},
  472. {136, "EM_DSP24"},
  473. {137, "EM_VIDEOCORE3"},
  474. {138, "EM_LATTICEMICO32"},
  475. {139, "EM_SE_C17"},
  476. {140, "EM_TI_C6000"},
  477. {141, "EM_TI_C2000"},
  478. {142, "EM_TI_C5500"},
  479. {143, "EM_TI_ARP32"},
  480. {144, "EM_TI_PRU"},
  481. {160, "EM_MMDSP_PLUS"},
  482. {161, "EM_CYPRESS_M8C"},
  483. {162, "EM_R32C"},
  484. {163, "EM_TRIMEDIA"},
  485. {164, "EM_QDSP6"},
  486. {165, "EM_8051"},
  487. {166, "EM_STXP7X"},
  488. {167, "EM_NDS32"},
  489. {168, "EM_ECOG1"},
  490. {168, "EM_ECOG1X"},
  491. {169, "EM_MAXQ30"},
  492. {170, "EM_XIMO16"},
  493. {171, "EM_MANIK"},
  494. {172, "EM_CRAYNV2"},
  495. {173, "EM_RX"},
  496. {174, "EM_METAG"},
  497. {175, "EM_MCST_ELBRUS"},
  498. {176, "EM_ECOG16"},
  499. {177, "EM_CR16"},
  500. {178, "EM_ETPU"},
  501. {179, "EM_SLE9X"},
  502. {180, "EM_L10M"},
  503. {181, "EM_K10M"},
  504. {183, "EM_AARCH64"},
  505. {185, "EM_AVR32"},
  506. {186, "EM_STM8"},
  507. {187, "EM_TILE64"},
  508. {188, "EM_TILEPRO"},
  509. {189, "EM_MICROBLAZE"},
  510. {190, "EM_CUDA"},
  511. {191, "EM_TILEGX"},
  512. {192, "EM_CLOUDSHIELD"},
  513. {193, "EM_COREA_1ST"},
  514. {194, "EM_COREA_2ND"},
  515. {195, "EM_ARC_COMPACT2"},
  516. {196, "EM_OPEN8"},
  517. {197, "EM_RL78"},
  518. {198, "EM_VIDEOCORE5"},
  519. {199, "EM_78KOR"},
  520. {200, "EM_56800EX"},
  521. {201, "EM_BA1"},
  522. {202, "EM_BA2"},
  523. {203, "EM_XCORE"},
  524. {204, "EM_MCHP_PIC"},
  525. {205, "EM_INTEL205"},
  526. {206, "EM_INTEL206"},
  527. {207, "EM_INTEL207"},
  528. {208, "EM_INTEL208"},
  529. {209, "EM_INTEL209"},
  530. {210, "EM_KM32"},
  531. {211, "EM_KMX32"},
  532. {212, "EM_KMX16"},
  533. {213, "EM_KMX8"},
  534. {214, "EM_KVARC"},
  535. {215, "EM_CDP"},
  536. {216, "EM_COGE"},
  537. {217, "EM_COOL"},
  538. {218, "EM_NORC"},
  539. {219, "EM_CSR_KALIMBA "},
  540. {220, "EM_Z80 "},
  541. {221, "EM_VISIUM "},
  542. {222, "EM_FT32 "},
  543. {223, "EM_MOXIE"},
  544. {224, "EM_AMDGPU"},
  545. {243, "EM_RISCV"},
  546. {244, "EM_LANAI"},
  547. {247, "EM_BPF"},
  548. /* Non-standard or deprecated. */
  549. {6, "EM_486"},
  550. {10, "EM_MIPS_RS4_BE"},
  551. {41, "EM_ALPHA_STD"},
  552. {0x9026, "EM_ALPHA"},
  553. }
  554. func (i Machine) String() string { return stringName(uint32(i), machineStrings, false) }
  555. func (i Machine) GoString() string { return stringName(uint32(i), machineStrings, true) }
  556. // Special section indices.
  557. type SectionIndex int
  558. const (
  559. SHN_UNDEF SectionIndex = 0 /* Undefined, missing, irrelevant. */
  560. SHN_LORESERVE SectionIndex = 0xff00 /* First of reserved range. */
  561. SHN_LOPROC SectionIndex = 0xff00 /* First processor-specific. */
  562. SHN_HIPROC SectionIndex = 0xff1f /* Last processor-specific. */
  563. SHN_LOOS SectionIndex = 0xff20 /* First operating system-specific. */
  564. SHN_HIOS SectionIndex = 0xff3f /* Last operating system-specific. */
  565. SHN_ABS SectionIndex = 0xfff1 /* Absolute values. */
  566. SHN_COMMON SectionIndex = 0xfff2 /* Common data. */
  567. SHN_XINDEX SectionIndex = 0xffff /* Escape; index stored elsewhere. */
  568. SHN_HIRESERVE SectionIndex = 0xffff /* Last of reserved range. */
  569. )
  570. var shnStrings = []intName{
  571. {0, "SHN_UNDEF"},
  572. {0xff00, "SHN_LOPROC"},
  573. {0xff20, "SHN_LOOS"},
  574. {0xfff1, "SHN_ABS"},
  575. {0xfff2, "SHN_COMMON"},
  576. {0xffff, "SHN_XINDEX"},
  577. }
  578. func (i SectionIndex) String() string { return stringName(uint32(i), shnStrings, false) }
  579. func (i SectionIndex) GoString() string { return stringName(uint32(i), shnStrings, true) }
  580. // Section type.
  581. type SectionType uint32
  582. const (
  583. SHT_NULL SectionType = 0 /* inactive */
  584. SHT_PROGBITS SectionType = 1 /* program defined information */
  585. SHT_SYMTAB SectionType = 2 /* symbol table section */
  586. SHT_STRTAB SectionType = 3 /* string table section */
  587. SHT_RELA SectionType = 4 /* relocation section with addends */
  588. SHT_HASH SectionType = 5 /* symbol hash table section */
  589. SHT_DYNAMIC SectionType = 6 /* dynamic section */
  590. SHT_NOTE SectionType = 7 /* note section */
  591. SHT_NOBITS SectionType = 8 /* no space section */
  592. SHT_REL SectionType = 9 /* relocation section - no addends */
  593. SHT_SHLIB SectionType = 10 /* reserved - purpose unknown */
  594. SHT_DYNSYM SectionType = 11 /* dynamic symbol table section */
  595. SHT_INIT_ARRAY SectionType = 14 /* Initialization function pointers. */
  596. SHT_FINI_ARRAY SectionType = 15 /* Termination function pointers. */
  597. SHT_PREINIT_ARRAY SectionType = 16 /* Pre-initialization function ptrs. */
  598. SHT_GROUP SectionType = 17 /* Section group. */
  599. SHT_SYMTAB_SHNDX SectionType = 18 /* Section indexes (see SHN_XINDEX). */
  600. SHT_LOOS SectionType = 0x60000000 /* First of OS specific semantics */
  601. SHT_GNU_ATTRIBUTES SectionType = 0x6ffffff5 /* GNU object attributes */
  602. SHT_GNU_HASH SectionType = 0x6ffffff6 /* GNU hash table */
  603. SHT_GNU_LIBLIST SectionType = 0x6ffffff7 /* GNU prelink library list */
  604. SHT_GNU_VERDEF SectionType = 0x6ffffffd /* GNU version definition section */
  605. SHT_GNU_VERNEED SectionType = 0x6ffffffe /* GNU version needs section */
  606. SHT_GNU_VERSYM SectionType = 0x6fffffff /* GNU version symbol table */
  607. SHT_HIOS SectionType = 0x6fffffff /* Last of OS specific semantics */
  608. SHT_LOPROC SectionType = 0x70000000 /* reserved range for processor */
  609. SHT_HIPROC SectionType = 0x7fffffff /* specific section header types */
  610. SHT_LOUSER SectionType = 0x80000000 /* reserved range for application */
  611. SHT_HIUSER SectionType = 0xffffffff /* specific indexes */
  612. )
  613. var shtStrings = []intName{
  614. {0, "SHT_NULL"},
  615. {1, "SHT_PROGBITS"},
  616. {2, "SHT_SYMTAB"},
  617. {3, "SHT_STRTAB"},
  618. {4, "SHT_RELA"},
  619. {5, "SHT_HASH"},
  620. {6, "SHT_DYNAMIC"},
  621. {7, "SHT_NOTE"},
  622. {8, "SHT_NOBITS"},
  623. {9, "SHT_REL"},
  624. {10, "SHT_SHLIB"},
  625. {11, "SHT_DYNSYM"},
  626. {14, "SHT_INIT_ARRAY"},
  627. {15, "SHT_FINI_ARRAY"},
  628. {16, "SHT_PREINIT_ARRAY"},
  629. {17, "SHT_GROUP"},
  630. {18, "SHT_SYMTAB_SHNDX"},
  631. {0x60000000, "SHT_LOOS"},
  632. {0x6ffffff5, "SHT_GNU_ATTRIBUTES"},
  633. {0x6ffffff6, "SHT_GNU_HASH"},
  634. {0x6ffffff7, "SHT_GNU_LIBLIST"},
  635. {0x6ffffffd, "SHT_GNU_VERDEF"},
  636. {0x6ffffffe, "SHT_GNU_VERNEED"},
  637. {0x6fffffff, "SHT_GNU_VERSYM"},
  638. {0x70000000, "SHT_LOPROC"},
  639. {0x7fffffff, "SHT_HIPROC"},
  640. {0x80000000, "SHT_LOUSER"},
  641. {0xffffffff, "SHT_HIUSER"},
  642. }
  643. func (i SectionType) String() string { return stringName(uint32(i), shtStrings, false) }
  644. func (i SectionType) GoString() string { return stringName(uint32(i), shtStrings, true) }
  645. // Section flags.
  646. type SectionFlag uint32
  647. const (
  648. SHF_WRITE SectionFlag = 0x1 /* Section contains writable data. */
  649. SHF_ALLOC SectionFlag = 0x2 /* Section occupies memory. */
  650. SHF_EXECINSTR SectionFlag = 0x4 /* Section contains instructions. */
  651. SHF_MERGE SectionFlag = 0x10 /* Section may be merged. */
  652. SHF_STRINGS SectionFlag = 0x20 /* Section contains strings. */
  653. SHF_INFO_LINK SectionFlag = 0x40 /* sh_info holds section index. */
  654. SHF_LINK_ORDER SectionFlag = 0x80 /* Special ordering requirements. */
  655. SHF_OS_NONCONFORMING SectionFlag = 0x100 /* OS-specific processing required. */
  656. SHF_GROUP SectionFlag = 0x200 /* Member of section group. */
  657. SHF_TLS SectionFlag = 0x400 /* Section contains TLS data. */
  658. SHF_COMPRESSED SectionFlag = 0x800 /* Section is compressed. */
  659. SHF_MASKOS SectionFlag = 0x0ff00000 /* OS-specific semantics. */
  660. SHF_MASKPROC SectionFlag = 0xf0000000 /* Processor-specific semantics. */
  661. )
  662. var shfStrings = []intName{
  663. {0x1, "SHF_WRITE"},
  664. {0x2, "SHF_ALLOC"},
  665. {0x4, "SHF_EXECINSTR"},
  666. {0x10, "SHF_MERGE"},
  667. {0x20, "SHF_STRINGS"},
  668. {0x40, "SHF_INFO_LINK"},
  669. {0x80, "SHF_LINK_ORDER"},
  670. {0x100, "SHF_OS_NONCONFORMING"},
  671. {0x200, "SHF_GROUP"},
  672. {0x400, "SHF_TLS"},
  673. {0x800, "SHF_COMPRESSED"},
  674. }
  675. func (i SectionFlag) String() string { return flagName(uint32(i), shfStrings, false) }
  676. func (i SectionFlag) GoString() string { return flagName(uint32(i), shfStrings, true) }
  677. // Section compression type.
  678. type CompressionType int
  679. const (
  680. COMPRESS_ZLIB CompressionType = 1 /* ZLIB compression. */
  681. COMPRESS_LOOS CompressionType = 0x60000000 /* First OS-specific. */
  682. COMPRESS_HIOS CompressionType = 0x6fffffff /* Last OS-specific. */
  683. COMPRESS_LOPROC CompressionType = 0x70000000 /* First processor-specific type. */
  684. COMPRESS_HIPROC CompressionType = 0x7fffffff /* Last processor-specific type. */
  685. )
  686. var compressionStrings = []intName{
  687. {0, "COMPRESS_ZLIB"},
  688. {0x60000000, "COMPRESS_LOOS"},
  689. {0x6fffffff, "COMPRESS_HIOS"},
  690. {0x70000000, "COMPRESS_LOPROC"},
  691. {0x7fffffff, "COMPRESS_HIPROC"},
  692. }
  693. func (i CompressionType) String() string { return stringName(uint32(i), compressionStrings, false) }
  694. func (i CompressionType) GoString() string { return stringName(uint32(i), compressionStrings, true) }
  695. // Prog.Type
  696. type ProgType int
  697. const (
  698. PT_NULL ProgType = 0 /* Unused entry. */
  699. PT_LOAD ProgType = 1 /* Loadable segment. */
  700. PT_DYNAMIC ProgType = 2 /* Dynamic linking information segment. */
  701. PT_INTERP ProgType = 3 /* Pathname of interpreter. */
  702. PT_NOTE ProgType = 4 /* Auxiliary information. */
  703. PT_SHLIB ProgType = 5 /* Reserved (not used). */
  704. PT_PHDR ProgType = 6 /* Location of program header itself. */
  705. PT_TLS ProgType = 7 /* Thread local storage segment */
  706. PT_LOOS ProgType = 0x60000000 /* First OS-specific. */
  707. PT_HIOS ProgType = 0x6fffffff /* Last OS-specific. */
  708. PT_LOPROC ProgType = 0x70000000 /* First processor-specific type. */
  709. PT_HIPROC ProgType = 0x7fffffff /* Last processor-specific type. */
  710. )
  711. var ptStrings = []intName{
  712. {0, "PT_NULL"},
  713. {1, "PT_LOAD"},
  714. {2, "PT_DYNAMIC"},
  715. {3, "PT_INTERP"},
  716. {4, "PT_NOTE"},
  717. {5, "PT_SHLIB"},
  718. {6, "PT_PHDR"},
  719. {7, "PT_TLS"},
  720. {0x60000000, "PT_LOOS"},
  721. {0x6fffffff, "PT_HIOS"},
  722. {0x70000000, "PT_LOPROC"},
  723. {0x7fffffff, "PT_HIPROC"},
  724. }
  725. func (i ProgType) String() string { return stringName(uint32(i), ptStrings, false) }
  726. func (i ProgType) GoString() string { return stringName(uint32(i), ptStrings, true) }
  727. // Prog.Flag
  728. type ProgFlag uint32
  729. const (
  730. PF_X ProgFlag = 0x1 /* Executable. */
  731. PF_W ProgFlag = 0x2 /* Writable. */
  732. PF_R ProgFlag = 0x4 /* Readable. */
  733. PF_MASKOS ProgFlag = 0x0ff00000 /* Operating system-specific. */
  734. PF_MASKPROC ProgFlag = 0xf0000000 /* Processor-specific. */
  735. )
  736. var pfStrings = []intName{
  737. {0x1, "PF_X"},
  738. {0x2, "PF_W"},
  739. {0x4, "PF_R"},
  740. }
  741. func (i ProgFlag) String() string { return flagName(uint32(i), pfStrings, false) }
  742. func (i ProgFlag) GoString() string { return flagName(uint32(i), pfStrings, true) }
  743. // Dyn.Tag
  744. type DynTag int
  745. const (
  746. DT_NULL DynTag = 0 /* Terminating entry. */
  747. DT_NEEDED DynTag = 1 /* String table offset of a needed shared library. */
  748. DT_PLTRELSZ DynTag = 2 /* Total size in bytes of PLT relocations. */
  749. DT_PLTGOT DynTag = 3 /* Processor-dependent address. */
  750. DT_HASH DynTag = 4 /* Address of symbol hash table. */
  751. DT_STRTAB DynTag = 5 /* Address of string table. */
  752. DT_SYMTAB DynTag = 6 /* Address of symbol table. */
  753. DT_RELA DynTag = 7 /* Address of ElfNN_Rela relocations. */
  754. DT_RELASZ DynTag = 8 /* Total size of ElfNN_Rela relocations. */
  755. DT_RELAENT DynTag = 9 /* Size of each ElfNN_Rela relocation entry. */
  756. DT_STRSZ DynTag = 10 /* Size of string table. */
  757. DT_SYMENT DynTag = 11 /* Size of each symbol table entry. */
  758. DT_INIT DynTag = 12 /* Address of initialization function. */
  759. DT_FINI DynTag = 13 /* Address of finalization function. */
  760. DT_SONAME DynTag = 14 /* String table offset of shared object name. */
  761. DT_RPATH DynTag = 15 /* String table offset of library path. [sup] */
  762. DT_SYMBOLIC DynTag = 16 /* Indicates "symbolic" linking. [sup] */
  763. DT_REL DynTag = 17 /* Address of ElfNN_Rel relocations. */
  764. DT_RELSZ DynTag = 18 /* Total size of ElfNN_Rel relocations. */
  765. DT_RELENT DynTag = 19 /* Size of each ElfNN_Rel relocation. */
  766. DT_PLTREL DynTag = 20 /* Type of relocation used for PLT. */
  767. DT_DEBUG DynTag = 21 /* Reserved (not used). */
  768. DT_TEXTREL DynTag = 22 /* Indicates there may be relocations in non-writable segments. [sup] */
  769. DT_JMPREL DynTag = 23 /* Address of PLT relocations. */
  770. DT_BIND_NOW DynTag = 24 /* [sup] */
  771. DT_INIT_ARRAY DynTag = 25 /* Address of the array of pointers to initialization functions */
  772. DT_FINI_ARRAY DynTag = 26 /* Address of the array of pointers to termination functions */
  773. DT_INIT_ARRAYSZ DynTag = 27 /* Size in bytes of the array of initialization functions. */
  774. DT_FINI_ARRAYSZ DynTag = 28 /* Size in bytes of the array of termination functions. */
  775. DT_RUNPATH DynTag = 29 /* String table offset of a null-terminated library search path string. */
  776. DT_FLAGS DynTag = 30 /* Object specific flag values. */
  777. DT_ENCODING DynTag = 32 /* Values greater than or equal to DT_ENCODING
  778. and less than DT_LOOS follow the rules for
  779. the interpretation of the d_un union
  780. as follows: even == 'd_ptr', even == 'd_val'
  781. or none */
  782. DT_PREINIT_ARRAY DynTag = 32 /* Address of the array of pointers to pre-initialization functions. */
  783. DT_PREINIT_ARRAYSZ DynTag = 33 /* Size in bytes of the array of pre-initialization functions. */
  784. DT_LOOS DynTag = 0x6000000d /* First OS-specific */
  785. DT_HIOS DynTag = 0x6ffff000 /* Last OS-specific */
  786. DT_VERSYM DynTag = 0x6ffffff0
  787. DT_VERNEED DynTag = 0x6ffffffe
  788. DT_VERNEEDNUM DynTag = 0x6fffffff
  789. DT_LOPROC DynTag = 0x70000000 /* First processor-specific type. */
  790. DT_HIPROC DynTag = 0x7fffffff /* Last processor-specific type. */
  791. )
  792. var dtStrings = []intName{
  793. {0, "DT_NULL"},
  794. {1, "DT_NEEDED"},
  795. {2, "DT_PLTRELSZ"},
  796. {3, "DT_PLTGOT"},
  797. {4, "DT_HASH"},
  798. {5, "DT_STRTAB"},
  799. {6, "DT_SYMTAB"},
  800. {7, "DT_RELA"},
  801. {8, "DT_RELASZ"},
  802. {9, "DT_RELAENT"},
  803. {10, "DT_STRSZ"},
  804. {11, "DT_SYMENT"},
  805. {12, "DT_INIT"},
  806. {13, "DT_FINI"},
  807. {14, "DT_SONAME"},
  808. {15, "DT_RPATH"},
  809. {16, "DT_SYMBOLIC"},
  810. {17, "DT_REL"},
  811. {18, "DT_RELSZ"},
  812. {19, "DT_RELENT"},
  813. {20, "DT_PLTREL"},
  814. {21, "DT_DEBUG"},
  815. {22, "DT_TEXTREL"},
  816. {23, "DT_JMPREL"},
  817. {24, "DT_BIND_NOW"},
  818. {25, "DT_INIT_ARRAY"},
  819. {26, "DT_FINI_ARRAY"},
  820. {27, "DT_INIT_ARRAYSZ"},
  821. {28, "DT_FINI_ARRAYSZ"},
  822. {29, "DT_RUNPATH"},
  823. {30, "DT_FLAGS"},
  824. {32, "DT_ENCODING"},
  825. {32, "DT_PREINIT_ARRAY"},
  826. {33, "DT_PREINIT_ARRAYSZ"},
  827. {0x6000000d, "DT_LOOS"},
  828. {0x6ffff000, "DT_HIOS"},
  829. {0x6ffffff0, "DT_VERSYM"},
  830. {0x6ffffffe, "DT_VERNEED"},
  831. {0x6fffffff, "DT_VERNEEDNUM"},
  832. {0x70000000, "DT_LOPROC"},
  833. {0x7fffffff, "DT_HIPROC"},
  834. }
  835. func (i DynTag) String() string { return stringName(uint32(i), dtStrings, false) }
  836. func (i DynTag) GoString() string { return stringName(uint32(i), dtStrings, true) }
  837. // DT_FLAGS values.
  838. type DynFlag int
  839. const (
  840. DF_ORIGIN DynFlag = 0x0001 /* Indicates that the object being loaded may
  841. make reference to the
  842. $ORIGIN substitution string */
  843. DF_SYMBOLIC DynFlag = 0x0002 /* Indicates "symbolic" linking. */
  844. DF_TEXTREL DynFlag = 0x0004 /* Indicates there may be relocations in non-writable segments. */
  845. DF_BIND_NOW DynFlag = 0x0008 /* Indicates that the dynamic linker should
  846. process all relocations for the object
  847. containing this entry before transferring
  848. control to the program. */
  849. DF_STATIC_TLS DynFlag = 0x0010 /* Indicates that the shared object or
  850. executable contains code using a static
  851. thread-local storage scheme. */
  852. )
  853. var dflagStrings = []intName{
  854. {0x0001, "DF_ORIGIN"},
  855. {0x0002, "DF_SYMBOLIC"},
  856. {0x0004, "DF_TEXTREL"},
  857. {0x0008, "DF_BIND_NOW"},
  858. {0x0010, "DF_STATIC_TLS"},
  859. }
  860. func (i DynFlag) String() string { return flagName(uint32(i), dflagStrings, false) }
  861. func (i DynFlag) GoString() string { return flagName(uint32(i), dflagStrings, true) }
  862. // NType values; used in core files.
  863. type NType int
  864. const (
  865. NT_PRSTATUS NType = 1 /* Process status. */
  866. NT_FPREGSET NType = 2 /* Floating point registers. */
  867. NT_PRPSINFO NType = 3 /* Process state info. */
  868. )
  869. var ntypeStrings = []intName{
  870. {1, "NT_PRSTATUS"},
  871. {2, "NT_FPREGSET"},
  872. {3, "NT_PRPSINFO"},
  873. }
  874. func (i NType) String() string { return stringName(uint32(i), ntypeStrings, false) }
  875. func (i NType) GoString() string { return stringName(uint32(i), ntypeStrings, true) }
  876. /* Symbol Binding - ELFNN_ST_BIND - st_info */
  877. type SymBind int
  878. const (
  879. STB_LOCAL SymBind = 0 /* Local symbol */
  880. STB_GLOBAL SymBind = 1 /* Global symbol */
  881. STB_WEAK SymBind = 2 /* like global - lower precedence */
  882. STB_LOOS SymBind = 10 /* Reserved range for operating system */
  883. STB_HIOS SymBind = 12 /* specific semantics. */
  884. STB_LOPROC SymBind = 13 /* reserved range for processor */
  885. STB_HIPROC SymBind = 15 /* specific semantics. */
  886. )
  887. var stbStrings = []intName{
  888. {0, "STB_LOCAL"},
  889. {1, "STB_GLOBAL"},
  890. {2, "STB_WEAK"},
  891. {10, "STB_LOOS"},
  892. {12, "STB_HIOS"},
  893. {13, "STB_LOPROC"},
  894. {15, "STB_HIPROC"},
  895. }
  896. func (i SymBind) String() string { return stringName(uint32(i), stbStrings, false) }
  897. func (i SymBind) GoString() string { return stringName(uint32(i), stbStrings, true) }
  898. /* Symbol type - ELFNN_ST_TYPE - st_info */
  899. type SymType int
  900. const (
  901. STT_NOTYPE SymType = 0 /* Unspecified type. */
  902. STT_OBJECT SymType = 1 /* Data object. */
  903. STT_FUNC SymType = 2 /* Function. */
  904. STT_SECTION SymType = 3 /* Section. */
  905. STT_FILE SymType = 4 /* Source file. */
  906. STT_COMMON SymType = 5 /* Uninitialized common block. */
  907. STT_TLS SymType = 6 /* TLS object. */
  908. STT_LOOS SymType = 10 /* Reserved range for operating system */
  909. STT_HIOS SymType = 12 /* specific semantics. */
  910. STT_LOPROC SymType = 13 /* reserved range for processor */
  911. STT_HIPROC SymType = 15 /* specific semantics. */
  912. )
  913. var sttStrings = []intName{
  914. {0, "STT_NOTYPE"},
  915. {1, "STT_OBJECT"},
  916. {2, "STT_FUNC"},
  917. {3, "STT_SECTION"},
  918. {4, "STT_FILE"},
  919. {5, "STT_COMMON"},
  920. {6, "STT_TLS"},
  921. {10, "STT_LOOS"},
  922. {12, "STT_HIOS"},
  923. {13, "STT_LOPROC"},
  924. {15, "STT_HIPROC"},
  925. }
  926. func (i SymType) String() string { return stringName(uint32(i), sttStrings, false) }
  927. func (i SymType) GoString() string { return stringName(uint32(i), sttStrings, true) }
  928. /* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
  929. type SymVis int
  930. const (
  931. STV_DEFAULT SymVis = 0x0 /* Default visibility (see binding). */
  932. STV_INTERNAL SymVis = 0x1 /* Special meaning in relocatable objects. */
  933. STV_HIDDEN SymVis = 0x2 /* Not visible. */
  934. STV_PROTECTED SymVis = 0x3 /* Visible but not preemptible. */
  935. )
  936. var stvStrings = []intName{
  937. {0x0, "STV_DEFAULT"},
  938. {0x1, "STV_INTERNAL"},
  939. {0x2, "STV_HIDDEN"},
  940. {0x3, "STV_PROTECTED"},
  941. }
  942. func (i SymVis) String() string { return stringName(uint32(i), stvStrings, false) }
  943. func (i SymVis) GoString() string { return stringName(uint32(i), stvStrings, true) }
  944. /*
  945. * Relocation types.
  946. */
  947. // Relocation types for x86-64.
  948. type R_X86_64 int
  949. const (
  950. R_X86_64_NONE R_X86_64 = 0 /* No relocation. */
  951. R_X86_64_64 R_X86_64 = 1 /* Add 64 bit symbol value. */
  952. R_X86_64_PC32 R_X86_64 = 2 /* PC-relative 32 bit signed sym value. */
  953. R_X86_64_GOT32 R_X86_64 = 3 /* PC-relative 32 bit GOT offset. */
  954. R_X86_64_PLT32 R_X86_64 = 4 /* PC-relative 32 bit PLT offset. */
  955. R_X86_64_COPY R_X86_64 = 5 /* Copy data from shared object. */
  956. R_X86_64_GLOB_DAT R_X86_64 = 6 /* Set GOT entry to data address. */
  957. R_X86_64_JMP_SLOT R_X86_64 = 7 /* Set GOT entry to code address. */
  958. R_X86_64_RELATIVE R_X86_64 = 8 /* Add load address of shared object. */
  959. R_X86_64_GOTPCREL R_X86_64 = 9 /* Add 32 bit signed pcrel offset to GOT. */
  960. R_X86_64_32 R_X86_64 = 10 /* Add 32 bit zero extended symbol value */
  961. R_X86_64_32S R_X86_64 = 11 /* Add 32 bit sign extended symbol value */
  962. R_X86_64_16 R_X86_64 = 12 /* Add 16 bit zero extended symbol value */
  963. R_X86_64_PC16 R_X86_64 = 13 /* Add 16 bit signed extended pc relative symbol value */
  964. R_X86_64_8 R_X86_64 = 14 /* Add 8 bit zero extended symbol value */
  965. R_X86_64_PC8 R_X86_64 = 15 /* Add 8 bit signed extended pc relative symbol value */
  966. R_X86_64_DTPMOD64 R_X86_64 = 16 /* ID of module containing symbol */
  967. R_X86_64_DTPOFF64 R_X86_64 = 17 /* Offset in TLS block */
  968. R_X86_64_TPOFF64 R_X86_64 = 18 /* Offset in static TLS block */
  969. R_X86_64_TLSGD R_X86_64 = 19 /* PC relative offset to GD GOT entry */
  970. R_X86_64_TLSLD R_X86_64 = 20 /* PC relative offset to LD GOT entry */
  971. R_X86_64_DTPOFF32 R_X86_64 = 21 /* Offset in TLS block */
  972. R_X86_64_GOTTPOFF R_X86_64 = 22 /* PC relative offset to IE GOT entry */
  973. R_X86_64_TPOFF32 R_X86_64 = 23 /* Offset in static TLS block */
  974. R_X86_64_PC64 R_X86_64 = 24 /* PC relative 64-bit sign extended symbol value. */
  975. R_X86_64_GOTOFF64 R_X86_64 = 25
  976. R_X86_64_GOTPC32 R_X86_64 = 26
  977. R_X86_64_GOT64 R_X86_64 = 27
  978. R_X86_64_GOTPCREL64 R_X86_64 = 28
  979. R_X86_64_GOTPC64 R_X86_64 = 29
  980. R_X86_64_GOTPLT64 R_X86_64 = 30
  981. R_X86_64_PLTOFF64 R_X86_64 = 31
  982. R_X86_64_SIZE32 R_X86_64 = 32
  983. R_X86_64_SIZE64 R_X86_64 = 33
  984. R_X86_64_GOTPC32_TLSDESC R_X86_64 = 34
  985. R_X86_64_TLSDESC_CALL R_X86_64 = 35
  986. R_X86_64_TLSDESC R_X86_64 = 36
  987. R_X86_64_IRELATIVE R_X86_64 = 37
  988. R_X86_64_RELATIVE64 R_X86_64 = 38
  989. R_X86_64_PC32_BND R_X86_64 = 39
  990. R_X86_64_PLT32_BND R_X86_64 = 40
  991. R_X86_64_GOTPCRELX R_X86_64 = 41
  992. R_X86_64_REX_GOTPCRELX R_X86_64 = 42
  993. )
  994. var rx86_64Strings = []intName{
  995. {0, "R_X86_64_NONE"},
  996. {1, "R_X86_64_64"},
  997. {2, "R_X86_64_PC32"},
  998. {3, "R_X86_64_GOT32"},
  999. {4, "R_X86_64_PLT32"},
  1000. {5, "R_X86_64_COPY"},
  1001. {6, "R_X86_64_GLOB_DAT"},
  1002. {7, "R_X86_64_JMP_SLOT"},
  1003. {8, "R_X86_64_RELATIVE"},
  1004. {9, "R_X86_64_GOTPCREL"},
  1005. {10, "R_X86_64_32"},
  1006. {11, "R_X86_64_32S"},
  1007. {12, "R_X86_64_16"},
  1008. {13, "R_X86_64_PC16"},
  1009. {14, "R_X86_64_8"},
  1010. {15, "R_X86_64_PC8"},
  1011. {16, "R_X86_64_DTPMOD64"},
  1012. {17, "R_X86_64_DTPOFF64"},
  1013. {18, "R_X86_64_TPOFF64"},
  1014. {19, "R_X86_64_TLSGD"},
  1015. {20, "R_X86_64_TLSLD"},
  1016. {21, "R_X86_64_DTPOFF32"},
  1017. {22, "R_X86_64_GOTTPOFF"},
  1018. {23, "R_X86_64_TPOFF32"},
  1019. {24, "R_X86_64_PC64"},
  1020. {25, "R_X86_64_GOTOFF64"},
  1021. {26, "R_X86_64_GOTPC32"},
  1022. {27, "R_X86_64_GOT64"},
  1023. {28, "R_X86_64_GOTPCREL64"},
  1024. {29, "R_X86_64_GOTPC64"},
  1025. {30, "R_X86_64_GOTPLT64"},
  1026. {31, "R_X86_64_PLTOFF64"},
  1027. {32, "R_X86_64_SIZE32"},
  1028. {33, "R_X86_64_SIZE64"},
  1029. {34, "R_X86_64_GOTPC32_TLSDESC"},
  1030. {35, "R_X86_64_TLSDESC_CALL"},
  1031. {36, "R_X86_64_TLSDESC"},
  1032. {37, "R_X86_64_IRELATIVE"},
  1033. {38, "R_X86_64_RELATIVE64"},
  1034. {39, "R_X86_64_PC32_BND"},
  1035. {40, "R_X86_64_PLT32_BND"},
  1036. {41, "R_X86_64_GOTPCRELX"},
  1037. {42, "R_X86_64_REX_GOTPCRELX"},
  1038. }
  1039. func (i R_X86_64) String() string { return stringName(uint32(i), rx86_64Strings, false) }
  1040. func (i R_X86_64) GoString() string { return stringName(uint32(i), rx86_64Strings, true) }
  1041. // Relocation types for AArch64 (aka arm64)
  1042. type R_AARCH64 int
  1043. const (
  1044. R_AARCH64_NONE R_AARCH64 = 0
  1045. R_AARCH64_P32_ABS32 R_AARCH64 = 1
  1046. R_AARCH64_P32_ABS16 R_AARCH64 = 2
  1047. R_AARCH64_P32_PREL32 R_AARCH64 = 3
  1048. R_AARCH64_P32_PREL16 R_AARCH64 = 4
  1049. R_AARCH64_P32_MOVW_UABS_G0 R_AARCH64 = 5
  1050. R_AARCH64_P32_MOVW_UABS_G0_NC R_AARCH64 = 6
  1051. R_AARCH64_P32_MOVW_UABS_G1 R_AARCH64 = 7
  1052. R_AARCH64_P32_MOVW_SABS_G0 R_AARCH64 = 8
  1053. R_AARCH64_P32_LD_PREL_LO19 R_AARCH64 = 9
  1054. R_AARCH64_P32_ADR_PREL_LO21 R_AARCH64 = 10
  1055. R_AARCH64_P32_ADR_PREL_PG_HI21 R_AARCH64 = 11
  1056. R_AARCH64_P32_ADD_ABS_LO12_NC R_AARCH64 = 12
  1057. R_AARCH64_P32_LDST8_ABS_LO12_NC R_AARCH64 = 13
  1058. R_AARCH64_P32_LDST16_ABS_LO12_NC R_AARCH64 = 14
  1059. R_AARCH64_P32_LDST32_ABS_LO12_NC R_AARCH64 = 15
  1060. R_AARCH64_P32_LDST64_ABS_LO12_NC R_AARCH64 = 16
  1061. R_AARCH64_P32_LDST128_ABS_LO12_NC R_AARCH64 = 17
  1062. R_AARCH64_P32_TSTBR14 R_AARCH64 = 18
  1063. R_AARCH64_P32_CONDBR19 R_AARCH64 = 19
  1064. R_AARCH64_P32_JUMP26 R_AARCH64 = 20
  1065. R_AARCH64_P32_CALL26 R_AARCH64 = 21
  1066. R_AARCH64_P32_GOT_LD_PREL19 R_AARCH64 = 25
  1067. R_AARCH64_P32_ADR_GOT_PAGE R_AARCH64 = 26
  1068. R_AARCH64_P32_LD32_GOT_LO12_NC R_AARCH64 = 27
  1069. R_AARCH64_P32_TLSGD_ADR_PAGE21 R_AARCH64 = 81
  1070. R_AARCH64_P32_TLSGD_ADD_LO12_NC R_AARCH64 = 82
  1071. R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 103
  1072. R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC R_AARCH64 = 104
  1073. R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 105
  1074. R_AARCH64_P32_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 106
  1075. R_AARCH64_P32_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 107
  1076. R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 108
  1077. R_AARCH64_P32_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 109
  1078. R_AARCH64_P32_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 110
  1079. R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 111
  1080. R_AARCH64_P32_TLSDESC_LD_PREL19 R_AARCH64 = 122
  1081. R_AARCH64_P32_TLSDESC_ADR_PREL21 R_AARCH64 = 123
  1082. R_AARCH64_P32_TLSDESC_ADR_PAGE21 R_AARCH64 = 124
  1083. R_AARCH64_P32_TLSDESC_LD32_LO12_NC R_AARCH64 = 125
  1084. R_AARCH64_P32_TLSDESC_ADD_LO12_NC R_AARCH64 = 126
  1085. R_AARCH64_P32_TLSDESC_CALL R_AARCH64 = 127
  1086. R_AARCH64_P32_COPY R_AARCH64 = 180
  1087. R_AARCH64_P32_GLOB_DAT R_AARCH64 = 181
  1088. R_AARCH64_P32_JUMP_SLOT R_AARCH64 = 182
  1089. R_AARCH64_P32_RELATIVE R_AARCH64 = 183
  1090. R_AARCH64_P32_TLS_DTPMOD R_AARCH64 = 184
  1091. R_AARCH64_P32_TLS_DTPREL R_AARCH64 = 185
  1092. R_AARCH64_P32_TLS_TPREL R_AARCH64 = 186
  1093. R_AARCH64_P32_TLSDESC R_AARCH64 = 187
  1094. R_AARCH64_P32_IRELATIVE R_AARCH64 = 188
  1095. R_AARCH64_NULL R_AARCH64 = 256
  1096. R_AARCH64_ABS64 R_AARCH64 = 257
  1097. R_AARCH64_ABS32 R_AARCH64 = 258
  1098. R_AARCH64_ABS16 R_AARCH64 = 259
  1099. R_AARCH64_PREL64 R_AARCH64 = 260
  1100. R_AARCH64_PREL32 R_AARCH64 = 261
  1101. R_AARCH64_PREL16 R_AARCH64 = 262
  1102. R_AARCH64_MOVW_UABS_G0 R_AARCH64 = 263
  1103. R_AARCH64_MOVW_UABS_G0_NC R_AARCH64 = 264
  1104. R_AARCH64_MOVW_UABS_G1 R_AARCH64 = 265
  1105. R_AARCH64_MOVW_UABS_G1_NC R_AARCH64 = 266
  1106. R_AARCH64_MOVW_UABS_G2 R_AARCH64 = 267
  1107. R_AARCH64_MOVW_UABS_G2_NC R_AARCH64 = 268
  1108. R_AARCH64_MOVW_UABS_G3 R_AARCH64 = 269
  1109. R_AARCH64_MOVW_SABS_G0 R_AARCH64 = 270
  1110. R_AARCH64_MOVW_SABS_G1 R_AARCH64 = 271
  1111. R_AARCH64_MOVW_SABS_G2 R_AARCH64 = 272
  1112. R_AARCH64_LD_PREL_LO19 R_AARCH64 = 273
  1113. R_AARCH64_ADR_PREL_LO21 R_AARCH64 = 274
  1114. R_AARCH64_ADR_PREL_PG_HI21 R_AARCH64 = 275
  1115. R_AARCH64_ADR_PREL_PG_HI21_NC R_AARCH64 = 276
  1116. R_AARCH64_ADD_ABS_LO12_NC R_AARCH64 = 277
  1117. R_AARCH64_LDST8_ABS_LO12_NC R_AARCH64 = 278
  1118. R_AARCH64_TSTBR14 R_AARCH64 = 279
  1119. R_AARCH64_CONDBR19 R_AARCH64 = 280
  1120. R_AARCH64_JUMP26 R_AARCH64 = 282
  1121. R_AARCH64_CALL26 R_AARCH64 = 283
  1122. R_AARCH64_LDST16_ABS_LO12_NC R_AARCH64 = 284
  1123. R_AARCH64_LDST32_ABS_LO12_NC R_AARCH64 = 285
  1124. R_AARCH64_LDST64_ABS_LO12_NC R_AARCH64 = 286
  1125. R_AARCH64_LDST128_ABS_LO12_NC R_AARCH64 = 299
  1126. R_AARCH64_GOT_LD_PREL19 R_AARCH64 = 309
  1127. R_AARCH64_LD64_GOTOFF_LO15 R_AARCH64 = 310
  1128. R_AARCH64_ADR_GOT_PAGE R_AARCH64 = 311
  1129. R_AARCH64_LD64_GOT_LO12_NC R_AARCH64 = 312
  1130. R_AARCH64_LD64_GOTPAGE_LO15 R_AARCH64 = 313
  1131. R_AARCH64_TLSGD_ADR_PREL21 R_AARCH64 = 512
  1132. R_AARCH64_TLSGD_ADR_PAGE21 R_AARCH64 = 513
  1133. R_AARCH64_TLSGD_ADD_LO12_NC R_AARCH64 = 514
  1134. R_AARCH64_TLSGD_MOVW_G1 R_AARCH64 = 515
  1135. R_AARCH64_TLSGD_MOVW_G0_NC R_AARCH64 = 516
  1136. R_AARCH64_TLSLD_ADR_PREL21 R_AARCH64 = 517
  1137. R_AARCH64_TLSLD_ADR_PAGE21 R_AARCH64 = 518
  1138. R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 R_AARCH64 = 539
  1139. R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC R_AARCH64 = 540
  1140. R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 541
  1141. R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC R_AARCH64 = 542
  1142. R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 543
  1143. R_AARCH64_TLSLE_MOVW_TPREL_G2 R_AARCH64 = 544
  1144. R_AARCH64_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 545
  1145. R_AARCH64_TLSLE_MOVW_TPREL_G1_NC R_AARCH64 = 546
  1146. R_AARCH64_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 547
  1147. R_AARCH64_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 548
  1148. R_AARCH64_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 549
  1149. R_AARCH64_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 550
  1150. R_AARCH64_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 551
  1151. R_AARCH64_TLSDESC_LD_PREL19 R_AARCH64 = 560
  1152. R_AARCH64_TLSDESC_ADR_PREL21 R_AARCH64 = 561
  1153. R_AARCH64_TLSDESC_ADR_PAGE21 R_AARCH64 = 562
  1154. R_AARCH64_TLSDESC_LD64_LO12_NC R_AARCH64 = 563
  1155. R_AARCH64_TLSDESC_ADD_LO12_NC R_AARCH64 = 564
  1156. R_AARCH64_TLSDESC_OFF_G1 R_AARCH64 = 565
  1157. R_AARCH64_TLSDESC_OFF_G0_NC R_AARCH64 = 566
  1158. R_AARCH64_TLSDESC_LDR R_AARCH64 = 567
  1159. R_AARCH64_TLSDESC_ADD R_AARCH64 = 568
  1160. R_AARCH64_TLSDESC_CALL R_AARCH64 = 569
  1161. R_AARCH64_TLSLE_LDST128_TPREL_LO12 R_AARCH64 = 570
  1162. R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC R_AARCH64 = 571
  1163. R_AARCH64_TLSLD_LDST128_DTPREL_LO12 R_AARCH64 = 572
  1164. R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC R_AARCH64 = 573
  1165. R_AARCH64_COPY R_AARCH64 = 1024
  1166. R_AARCH64_GLOB_DAT R_AARCH64 = 1025
  1167. R_AARCH64_JUMP_SLOT R_AARCH64 = 1026
  1168. R_AARCH64_RELATIVE R_AARCH64 = 1027
  1169. R_AARCH64_TLS_DTPMOD64 R_AARCH64 = 1028
  1170. R_AARCH64_TLS_DTPREL64 R_AARCH64 = 1029
  1171. R_AARCH64_TLS_TPREL64 R_AARCH64 = 1030
  1172. R_AARCH64_TLSDESC R_AARCH64 = 1031
  1173. R_AARCH64_IRELATIVE R_AARCH64 = 1032
  1174. )
  1175. var raarch64Strings = []intName{
  1176. {0, "R_AARCH64_NONE"},
  1177. {1, "R_AARCH64_P32_ABS32"},
  1178. {2, "R_AARCH64_P32_ABS16"},
  1179. {3, "R_AARCH64_P32_PREL32"},
  1180. {4, "R_AARCH64_P32_PREL16"},
  1181. {5, "R_AARCH64_P32_MOVW_UABS_G0"},
  1182. {6, "R_AARCH64_P32_MOVW_UABS_G0_NC"},
  1183. {7, "R_AARCH64_P32_MOVW_UABS_G1"},
  1184. {8, "R_AARCH64_P32_MOVW_SABS_G0"},
  1185. {9, "R_AARCH64_P32_LD_PREL_LO19"},
  1186. {10, "R_AARCH64_P32_ADR_PREL_LO21"},
  1187. {11, "R_AARCH64_P32_ADR_PREL_PG_HI21"},
  1188. {12, "R_AARCH64_P32_ADD_ABS_LO12_NC"},
  1189. {13, "R_AARCH64_P32_LDST8_ABS_LO12_NC"},
  1190. {14, "R_AARCH64_P32_LDST16_ABS_LO12_NC"},
  1191. {15, "R_AARCH64_P32_LDST32_ABS_LO12_NC"},
  1192. {16, "R_AARCH64_P32_LDST64_ABS_LO12_NC"},
  1193. {17, "R_AARCH64_P32_LDST128_ABS_LO12_NC"},
  1194. {18, "R_AARCH64_P32_TSTBR14"},
  1195. {19, "R_AARCH64_P32_CONDBR19"},
  1196. {20, "R_AARCH64_P32_JUMP26"},
  1197. {21, "R_AARCH64_P32_CALL26"},
  1198. {25, "R_AARCH64_P32_GOT_LD_PREL19"},
  1199. {26, "R_AARCH64_P32_ADR_GOT_PAGE"},
  1200. {27, "R_AARCH64_P32_LD32_GOT_LO12_NC"},
  1201. {81, "R_AARCH64_P32_TLSGD_ADR_PAGE21"},
  1202. {82, "R_AARCH64_P32_TLSGD_ADD_LO12_NC"},
  1203. {103, "R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21"},
  1204. {104, "R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC"},
  1205. {105, "R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19"},
  1206. {106, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G1"},
  1207. {107, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0"},
  1208. {108, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC"},
  1209. {109, "R_AARCH64_P32_TLSLE_ADD_TPREL_HI12"},
  1210. {110, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12"},
  1211. {111, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC"},
  1212. {122, "R_AARCH64_P32_TLSDESC_LD_PREL19"},
  1213. {123, "R_AARCH64_P32_TLSDESC_ADR_PREL21"},
  1214. {124, "R_AARCH64_P32_TLSDESC_ADR_PAGE21"},
  1215. {125, "R_AARCH64_P32_TLSDESC_LD32_LO12_NC"},
  1216. {126, "R_AARCH64_P32_TLSDESC_ADD_LO12_NC"},
  1217. {127, "R_AARCH64_P32_TLSDESC_CALL"},
  1218. {180, "R_AARCH64_P32_COPY"},
  1219. {181, "R_AARCH64_P32_GLOB_DAT"},
  1220. {182, "R_AARCH64_P32_JUMP_SLOT"},
  1221. {183, "R_AARCH64_P32_RELATIVE"},
  1222. {184, "R_AARCH64_P32_TLS_DTPMOD"},
  1223. {185, "R_AARCH64_P32_TLS_DTPREL"},
  1224. {186, "R_AARCH64_P32_TLS_TPREL"},
  1225. {187, "R_AARCH64_P32_TLSDESC"},
  1226. {188, "R_AARCH64_P32_IRELATIVE"},
  1227. {256, "R_AARCH64_NULL"},
  1228. {257, "R_AARCH64_ABS64"},
  1229. {258, "R_AARCH64_ABS32"},
  1230. {259, "R_AARCH64_ABS16"},
  1231. {260, "R_AARCH64_PREL64"},
  1232. {261, "R_AARCH64_PREL32"},
  1233. {262, "R_AARCH64_PREL16"},
  1234. {263, "R_AARCH64_MOVW_UABS_G0"},
  1235. {264, "R_AARCH64_MOVW_UABS_G0_NC"},
  1236. {265, "R_AARCH64_MOVW_UABS_G1"},
  1237. {266, "R_AARCH64_MOVW_UABS_G1_NC"},
  1238. {267, "R_AARCH64_MOVW_UABS_G2"},
  1239. {268, "R_AARCH64_MOVW_UABS_G2_NC"},
  1240. {269, "R_AARCH64_MOVW_UABS_G3"},
  1241. {270, "R_AARCH64_MOVW_SABS_G0"},
  1242. {271, "R_AARCH64_MOVW_SABS_G1"},
  1243. {272, "R_AARCH64_MOVW_SABS_G2"},
  1244. {273, "R_AARCH64_LD_PREL_LO19"},
  1245. {274, "R_AARCH64_ADR_PREL_LO21"},
  1246. {275, "R_AARCH64_ADR_PREL_PG_HI21"},
  1247. {276, "R_AARCH64_ADR_PREL_PG_HI21_NC"},
  1248. {277, "R_AARCH64_ADD_ABS_LO12_NC"},
  1249. {278, "R_AARCH64_LDST8_ABS_LO12_NC"},
  1250. {279, "R_AARCH64_TSTBR14"},
  1251. {280, "R_AARCH64_CONDBR19"},
  1252. {282, "R_AARCH64_JUMP26"},
  1253. {283, "R_AARCH64_CALL26"},
  1254. {284, "R_AARCH64_LDST16_ABS_LO12_NC"},
  1255. {285, "R_AARCH64_LDST32_ABS_LO12_NC"},
  1256. {286, "R_AARCH64_LDST64_ABS_LO12_NC"},
  1257. {299, "R_AARCH64_LDST128_ABS_LO12_NC"},
  1258. {309, "R_AARCH64_GOT_LD_PREL19"},
  1259. {310, "R_AARCH64_LD64_GOTOFF_LO15"},
  1260. {311, "R_AARCH64_ADR_GOT_PAGE"},
  1261. {312, "R_AARCH64_LD64_GOT_LO12_NC"},
  1262. {313, "R_AARCH64_LD64_GOTPAGE_LO15"},
  1263. {512, "R_AARCH64_TLSGD_ADR_PREL21"},
  1264. {513, "R_AARCH64_TLSGD_ADR_PAGE21"},
  1265. {514, "R_AARCH64_TLSGD_ADD_LO12_NC"},
  1266. {515, "R_AARCH64_TLSGD_MOVW_G1"},
  1267. {516, "R_AARCH64_TLSGD_MOVW_G0_NC"},
  1268. {517, "R_AARCH64_TLSLD_ADR_PREL21"},
  1269. {518, "R_AARCH64_TLSLD_ADR_PAGE21"},
  1270. {539, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G1"},
  1271. {540, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC"},
  1272. {541, "R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21"},
  1273. {542, "R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC"},
  1274. {543, "R_AARCH64_TLSIE_LD_GOTTPREL_PREL19"},
  1275. {544, "R_AARCH64_TLSLE_MOVW_TPREL_G2"},
  1276. {545, "R_AARCH64_TLSLE_MOVW_TPREL_G1"},
  1277. {546, "R_AARCH64_TLSLE_MOVW_TPREL_G1_NC"},
  1278. {547, "R_AARCH64_TLSLE_MOVW_TPREL_G0"},
  1279. {548, "R_AARCH64_TLSLE_MOVW_TPREL_G0_NC"},
  1280. {549, "R_AARCH64_TLSLE_ADD_TPREL_HI12"},
  1281. {550, "R_AARCH64_TLSLE_ADD_TPREL_LO12"},
  1282. {551, "R_AARCH64_TLSLE_ADD_TPREL_LO12_NC"},
  1283. {560, "R_AARCH64_TLSDESC_LD_PREL19"},
  1284. {561, "R_AARCH64_TLSDESC_ADR_PREL21"},
  1285. {562, "R_AARCH64_TLSDESC_ADR_PAGE21"},
  1286. {563, "R_AARCH64_TLSDESC_LD64_LO12_NC"},
  1287. {564, "R_AARCH64_TLSDESC_ADD_LO12_NC"},
  1288. {565, "R_AARCH64_TLSDESC_OFF_G1"},
  1289. {566, "R_AARCH64_TLSDESC_OFF_G0_NC"},
  1290. {567, "R_AARCH64_TLSDESC_LDR"},
  1291. {568, "R_AARCH64_TLSDESC_ADD"},
  1292. {569, "R_AARCH64_TLSDESC_CALL"},
  1293. {570, "R_AARCH64_TLSLE_LDST128_TPREL_LO12"},
  1294. {571, "R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC"},
  1295. {572, "R_AARCH64_TLSLD_LDST128_DTPREL_LO12"},
  1296. {573, "R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC"},
  1297. {1024, "R_AARCH64_COPY"},
  1298. {1025, "R_AARCH64_GLOB_DAT"},
  1299. {1026, "R_AARCH64_JUMP_SLOT"},
  1300. {1027, "R_AARCH64_RELATIVE"},
  1301. {1028, "R_AARCH64_TLS_DTPMOD64"},
  1302. {1029, "R_AARCH64_TLS_DTPREL64"},
  1303. {1030, "R_AARCH64_TLS_TPREL64"},
  1304. {1031, "R_AARCH64_TLSDESC"},
  1305. {1032, "R_AARCH64_IRELATIVE"},
  1306. }
  1307. func (i R_AARCH64) String() string { return stringName(uint32(i), raarch64Strings, false) }
  1308. func (i R_AARCH64) GoString() string { return stringName(uint32(i), raarch64Strings, true) }
  1309. // Relocation types for Alpha.
  1310. type R_ALPHA int
  1311. const (
  1312. R_ALPHA_NONE R_ALPHA = 0 /* No reloc */
  1313. R_ALPHA_REFLONG R_ALPHA = 1 /* Direct 32 bit */
  1314. R_ALPHA_REFQUAD R_ALPHA = 2 /* Direct 64 bit */
  1315. R_ALPHA_GPREL32 R_ALPHA = 3 /* GP relative 32 bit */
  1316. R_ALPHA_LITERAL R_ALPHA = 4 /* GP relative 16 bit w/optimization */
  1317. R_ALPHA_LITUSE R_ALPHA = 5 /* Optimization hint for LITERAL */
  1318. R_ALPHA_GPDISP R_ALPHA = 6 /* Add displacement to GP */
  1319. R_ALPHA_BRADDR R_ALPHA = 7 /* PC+4 relative 23 bit shifted */
  1320. R_ALPHA_HINT R_ALPHA = 8 /* PC+4 relative 16 bit shifted */
  1321. R_ALPHA_SREL16 R_ALPHA = 9 /* PC relative 16 bit */
  1322. R_ALPHA_SREL32 R_ALPHA = 10 /* PC relative 32 bit */
  1323. R_ALPHA_SREL64 R_ALPHA = 11 /* PC relative 64 bit */
  1324. R_ALPHA_OP_PUSH R_ALPHA = 12 /* OP stack push */
  1325. R_ALPHA_OP_STORE R_ALPHA = 13 /* OP stack pop and store */
  1326. R_ALPHA_OP_PSUB R_ALPHA = 14 /* OP stack subtract */
  1327. R_ALPHA_OP_PRSHIFT R_ALPHA = 15 /* OP stack right shift */
  1328. R_ALPHA_GPVALUE R_ALPHA = 16
  1329. R_ALPHA_GPRELHIGH R_ALPHA = 17
  1330. R_ALPHA_GPRELLOW R_ALPHA = 18
  1331. R_ALPHA_IMMED_GP_16 R_ALPHA = 19
  1332. R_ALPHA_IMMED_GP_HI32 R_ALPHA = 20
  1333. R_ALPHA_IMMED_SCN_HI32 R_ALPHA = 21
  1334. R_ALPHA_IMMED_BR_HI32 R_ALPHA = 22
  1335. R_ALPHA_IMMED_LO32 R_ALPHA = 23
  1336. R_ALPHA_COPY R_ALPHA = 24 /* Copy symbol at runtime */
  1337. R_ALPHA_GLOB_DAT R_ALPHA = 25 /* Create GOT entry */
  1338. R_ALPHA_JMP_SLOT R_ALPHA = 26 /* Create PLT entry */
  1339. R_ALPHA_RELATIVE R_ALPHA = 27 /* Adjust by program base */
  1340. )
  1341. var ralphaStrings = []intName{
  1342. {0, "R_ALPHA_NONE"},
  1343. {1, "R_ALPHA_REFLONG"},
  1344. {2, "R_ALPHA_REFQUAD"},
  1345. {3, "R_ALPHA_GPREL32"},
  1346. {4, "R_ALPHA_LITERAL"},
  1347. {5, "R_ALPHA_LITUSE"},
  1348. {6, "R_ALPHA_GPDISP"},
  1349. {7, "R_ALPHA_BRADDR"},
  1350. {8, "R_ALPHA_HINT"},
  1351. {9, "R_ALPHA_SREL16"},
  1352. {10, "R_ALPHA_SREL32"},
  1353. {11, "R_ALPHA_SREL64"},
  1354. {12, "R_ALPHA_OP_PUSH"},
  1355. {13, "R_ALPHA_OP_STORE"},
  1356. {14, "R_ALPHA_OP_PSUB"},
  1357. {15, "R_ALPHA_OP_PRSHIFT"},
  1358. {16, "R_ALPHA_GPVALUE"},
  1359. {17, "R_ALPHA_GPRELHIGH"},
  1360. {18, "R_ALPHA_GPRELLOW"},
  1361. {19, "R_ALPHA_IMMED_GP_16"},
  1362. {20, "R_ALPHA_IMMED_GP_HI32"},
  1363. {21, "R_ALPHA_IMMED_SCN_HI32"},
  1364. {22, "R_ALPHA_IMMED_BR_HI32"},
  1365. {23, "R_ALPHA_IMMED_LO32"},
  1366. {24, "R_ALPHA_COPY"},
  1367. {25, "R_ALPHA_GLOB_DAT"},
  1368. {26, "R_ALPHA_JMP_SLOT"},
  1369. {27, "R_ALPHA_RELATIVE"},
  1370. }
  1371. func (i R_ALPHA) String() string { return stringName(uint32(i), ralphaStrings, false) }
  1372. func (i R_ALPHA) GoString() string { return stringName(uint32(i), ralphaStrings, true) }
  1373. // Relocation types for ARM.
  1374. type R_ARM int
  1375. const (
  1376. R_ARM_NONE R_ARM = 0 /* No relocation. */
  1377. R_ARM_PC24 R_ARM = 1
  1378. R_ARM_ABS32 R_ARM = 2
  1379. R_ARM_REL32 R_ARM = 3
  1380. R_ARM_PC13 R_ARM = 4
  1381. R_ARM_ABS16 R_ARM = 5
  1382. R_ARM_ABS12 R_ARM = 6
  1383. R_ARM_THM_ABS5 R_ARM = 7
  1384. R_ARM_ABS8 R_ARM = 8
  1385. R_ARM_SBREL32 R_ARM = 9
  1386. R_ARM_THM_PC22 R_ARM = 10
  1387. R_ARM_THM_PC8 R_ARM = 11
  1388. R_ARM_AMP_VCALL9 R_ARM = 12
  1389. R_ARM_SWI24 R_ARM = 13
  1390. R_ARM_THM_SWI8 R_ARM = 14
  1391. R_ARM_XPC25 R_ARM = 15
  1392. R_ARM_THM_XPC22 R_ARM = 16
  1393. R_ARM_TLS_DTPMOD32 R_ARM = 17
  1394. R_ARM_TLS_DTPOFF32 R_ARM = 18
  1395. R_ARM_TLS_TPOFF32 R_ARM = 19
  1396. R_ARM_COPY R_ARM = 20 /* Copy data from shared object. */
  1397. R_ARM_GLOB_DAT R_ARM = 21 /* Set GOT entry to data address. */
  1398. R_ARM_JUMP_SLOT R_ARM = 22 /* Set GOT entry to code address. */
  1399. R_ARM_RELATIVE R_ARM = 23 /* Add load address of shared object. */
  1400. R_ARM_GOTOFF R_ARM = 24 /* Add GOT-relative symbol address. */
  1401. R_ARM_GOTPC R_ARM = 25 /* Add PC-relative GOT table address. */
  1402. R_ARM_GOT32 R_ARM = 26 /* Add PC-relative GOT offset. */
  1403. R_ARM_PLT32 R_ARM = 27 /* Add PC-relative PLT offset. */
  1404. R_ARM_CALL R_ARM = 28
  1405. R_ARM_JUMP24 R_ARM = 29
  1406. R_ARM_THM_JUMP24 R_ARM = 30
  1407. R_ARM_BASE_ABS R_ARM = 31
  1408. R_ARM_ALU_PCREL_7_0 R_ARM = 32
  1409. R_ARM_ALU_PCREL_15_8 R_ARM = 33
  1410. R_ARM_ALU_PCREL_23_15 R_ARM = 34
  1411. R_ARM_LDR_SBREL_11_10_NC R_ARM = 35
  1412. R_ARM_ALU_SBREL_19_12_NC R_ARM = 36
  1413. R_ARM_ALU_SBREL_27_20_CK R_ARM = 37
  1414. R_ARM_TARGET1 R_ARM = 38
  1415. R_ARM_SBREL31 R_ARM = 39
  1416. R_ARM_V4BX R_ARM = 40
  1417. R_ARM_TARGET2 R_ARM = 41
  1418. R_ARM_PREL31 R_ARM = 42
  1419. R_ARM_MOVW_ABS_NC R_ARM = 43
  1420. R_ARM_MOVT_ABS R_ARM = 44
  1421. R_ARM_MOVW_PREL_NC R_ARM = 45
  1422. R_ARM_MOVT_PREL R_ARM = 46
  1423. R_ARM_THM_MOVW_ABS_NC R_ARM = 47
  1424. R_ARM_THM_MOVT_ABS R_ARM = 48
  1425. R_ARM_THM_MOVW_PREL_NC R_ARM = 49
  1426. R_ARM_THM_MOVT_PREL R_ARM = 50
  1427. R_ARM_THM_JUMP19 R_ARM = 51
  1428. R_ARM_THM_JUMP6 R_ARM = 52
  1429. R_ARM_THM_ALU_PREL_11_0 R_ARM = 53
  1430. R_ARM_THM_PC12 R_ARM = 54
  1431. R_ARM_ABS32_NOI R_ARM = 55
  1432. R_ARM_REL32_NOI R_ARM = 56
  1433. R_ARM_ALU_PC_G0_NC R_ARM = 57
  1434. R_ARM_ALU_PC_G0 R_ARM = 58
  1435. R_ARM_ALU_PC_G1_NC R_ARM = 59
  1436. R_ARM_ALU_PC_G1 R_ARM = 60
  1437. R_ARM_ALU_PC_G2 R_ARM = 61
  1438. R_ARM_LDR_PC_G1 R_ARM = 62
  1439. R_ARM_LDR_PC_G2 R_ARM = 63
  1440. R_ARM_LDRS_PC_G0 R_ARM = 64
  1441. R_ARM_LDRS_PC_G1 R_ARM = 65
  1442. R_ARM_LDRS_PC_G2 R_ARM = 66
  1443. R_ARM_LDC_PC_G0 R_ARM = 67
  1444. R_ARM_LDC_PC_G1 R_ARM = 68
  1445. R_ARM_LDC_PC_G2 R_ARM = 69
  1446. R_ARM_ALU_SB_G0_NC R_ARM = 70
  1447. R_ARM_ALU_SB_G0 R_ARM = 71
  1448. R_ARM_ALU_SB_G1_NC R_ARM = 72
  1449. R_ARM_ALU_SB_G1 R_ARM = 73
  1450. R_ARM_ALU_SB_G2 R_ARM = 74
  1451. R_ARM_LDR_SB_G0 R_ARM = 75
  1452. R_ARM_LDR_SB_G1 R_ARM = 76
  1453. R_ARM_LDR_SB_G2 R_ARM = 77
  1454. R_ARM_LDRS_SB_G0 R_ARM = 78
  1455. R_ARM_LDRS_SB_G1 R_ARM = 79
  1456. R_ARM_LDRS_SB_G2 R_ARM = 80
  1457. R_ARM_LDC_SB_G0 R_ARM = 81
  1458. R_ARM_LDC_SB_G1 R_ARM = 82
  1459. R_ARM_LDC_SB_G2 R_ARM = 83
  1460. R_ARM_MOVW_BREL_NC R_ARM = 84
  1461. R_ARM_MOVT_BREL R_ARM = 85
  1462. R_ARM_MOVW_BREL R_ARM = 86
  1463. R_ARM_THM_MOVW_BREL_NC R_ARM = 87
  1464. R_ARM_THM_MOVT_BREL R_ARM = 88
  1465. R_ARM_THM_MOVW_BREL R_ARM = 89
  1466. R_ARM_TLS_GOTDESC R_ARM = 90
  1467. R_ARM_TLS_CALL R_ARM = 91
  1468. R_ARM_TLS_DESCSEQ R_ARM = 92
  1469. R_ARM_THM_TLS_CALL R_ARM = 93
  1470. R_ARM_PLT32_ABS R_ARM = 94
  1471. R_ARM_GOT_ABS R_ARM = 95
  1472. R_ARM_GOT_PREL R_ARM = 96
  1473. R_ARM_GOT_BREL12 R_ARM = 97
  1474. R_ARM_GOTOFF12 R_ARM = 98
  1475. R_ARM_GOTRELAX R_ARM = 99
  1476. R_ARM_GNU_VTENTRY R_ARM = 100
  1477. R_ARM_GNU_VTINHERIT R_ARM = 101
  1478. R_ARM_THM_JUMP11 R_ARM = 102
  1479. R_ARM_THM_JUMP8 R_ARM = 103
  1480. R_ARM_TLS_GD32 R_ARM = 104
  1481. R_ARM_TLS_LDM32 R_ARM = 105
  1482. R_ARM_TLS_LDO32 R_ARM = 106
  1483. R_ARM_TLS_IE32 R_ARM = 107
  1484. R_ARM_TLS_LE32 R_ARM = 108
  1485. R_ARM_TLS_LDO12 R_ARM = 109
  1486. R_ARM_TLS_LE12 R_ARM = 110
  1487. R_ARM_TLS_IE12GP R_ARM = 111
  1488. R_ARM_PRIVATE_0 R_ARM = 112
  1489. R_ARM_PRIVATE_1 R_ARM = 113
  1490. R_ARM_PRIVATE_2 R_ARM = 114
  1491. R_ARM_PRIVATE_3 R_ARM = 115
  1492. R_ARM_PRIVATE_4 R_ARM = 116
  1493. R_ARM_PRIVATE_5 R_ARM = 117
  1494. R_ARM_PRIVATE_6 R_ARM = 118
  1495. R_ARM_PRIVATE_7 R_ARM = 119
  1496. R_ARM_PRIVATE_8 R_ARM = 120
  1497. R_ARM_PRIVATE_9 R_ARM = 121
  1498. R_ARM_PRIVATE_10 R_ARM = 122
  1499. R_ARM_PRIVATE_11 R_ARM = 123
  1500. R_ARM_PRIVATE_12 R_ARM = 124
  1501. R_ARM_PRIVATE_13 R_ARM = 125
  1502. R_ARM_PRIVATE_14 R_ARM = 126
  1503. R_ARM_PRIVATE_15 R_ARM = 127
  1504. R_ARM_ME_TOO R_ARM = 128
  1505. R_ARM_THM_TLS_DESCSEQ16 R_ARM = 129
  1506. R_ARM_THM_TLS_DESCSEQ32 R_ARM = 130
  1507. R_ARM_THM_GOT_BREL12 R_ARM = 131
  1508. R_ARM_THM_ALU_ABS_G0_NC R_ARM = 132
  1509. R_ARM_THM_ALU_ABS_G1_NC R_ARM = 133
  1510. R_ARM_THM_ALU_ABS_G2_NC R_ARM = 134
  1511. R_ARM_THM_ALU_ABS_G3 R_ARM = 135
  1512. R_ARM_IRELATIVE R_ARM = 160
  1513. R_ARM_RXPC25 R_ARM = 249
  1514. R_ARM_RSBREL32 R_ARM = 250
  1515. R_ARM_THM_RPC22 R_ARM = 251
  1516. R_ARM_RREL32 R_ARM = 252
  1517. R_ARM_RABS32 R_ARM = 253
  1518. R_ARM_RPC24 R_ARM = 254
  1519. R_ARM_RBASE R_ARM = 255
  1520. )
  1521. var rarmStrings = []intName{
  1522. {0, "R_ARM_NONE"},
  1523. {1, "R_ARM_PC24"},
  1524. {2, "R_ARM_ABS32"},
  1525. {3, "R_ARM_REL32"},
  1526. {4, "R_ARM_PC13"},
  1527. {5, "R_ARM_ABS16"},
  1528. {6, "R_ARM_ABS12"},
  1529. {7, "R_ARM_THM_ABS5"},
  1530. {8, "R_ARM_ABS8"},
  1531. {9, "R_ARM_SBREL32"},
  1532. {10, "R_ARM_THM_PC22"},
  1533. {11, "R_ARM_THM_PC8"},
  1534. {12, "R_ARM_AMP_VCALL9"},
  1535. {13, "R_ARM_SWI24"},
  1536. {14, "R_ARM_THM_SWI8"},
  1537. {15, "R_ARM_XPC25"},
  1538. {16, "R_ARM_THM_XPC22"},
  1539. {17, "R_ARM_TLS_DTPMOD32"},
  1540. {18, "R_ARM_TLS_DTPOFF32"},
  1541. {19, "R_ARM_TLS_TPOFF32"},
  1542. {20, "R_ARM_COPY"},
  1543. {21, "R_ARM_GLOB_DAT"},
  1544. {22, "R_ARM_JUMP_SLOT"},
  1545. {23, "R_ARM_RELATIVE"},
  1546. {24, "R_ARM_GOTOFF"},
  1547. {25, "R_ARM_GOTPC"},
  1548. {26, "R_ARM_GOT32"},
  1549. {27, "R_ARM_PLT32"},
  1550. {28, "R_ARM_CALL"},
  1551. {29, "R_ARM_JUMP24"},
  1552. {30, "R_ARM_THM_JUMP24"},
  1553. {31, "R_ARM_BASE_ABS"},
  1554. {32, "R_ARM_ALU_PCREL_7_0"},
  1555. {33, "R_ARM_ALU_PCREL_15_8"},
  1556. {34, "R_ARM_ALU_PCREL_23_15"},
  1557. {35, "R_ARM_LDR_SBREL_11_10_NC"},
  1558. {36, "R_ARM_ALU_SBREL_19_12_NC"},
  1559. {37, "R_ARM_ALU_SBREL_27_20_CK"},
  1560. {38, "R_ARM_TARGET1"},
  1561. {39, "R_ARM_SBREL31"},
  1562. {40, "R_ARM_V4BX"},
  1563. {41, "R_ARM_TARGET2"},
  1564. {42, "R_ARM_PREL31"},
  1565. {43, "R_ARM_MOVW_ABS_NC"},
  1566. {44, "R_ARM_MOVT_ABS"},
  1567. {45, "R_ARM_MOVW_PREL_NC"},
  1568. {46, "R_ARM_MOVT_PREL"},
  1569. {47, "R_ARM_THM_MOVW_ABS_NC"},
  1570. {48, "R_ARM_THM_MOVT_ABS"},
  1571. {49, "R_ARM_THM_MOVW_PREL_NC"},
  1572. {50, "R_ARM_THM_MOVT_PREL"},
  1573. {51, "R_ARM_THM_JUMP19"},
  1574. {52, "R_ARM_THM_JUMP6"},
  1575. {53, "R_ARM_THM_ALU_PREL_11_0"},
  1576. {54, "R_ARM_THM_PC12"},
  1577. {55, "R_ARM_ABS32_NOI"},
  1578. {56, "R_ARM_REL32_NOI"},
  1579. {57, "R_ARM_ALU_PC_G0_NC"},
  1580. {58, "R_ARM_ALU_PC_G0"},
  1581. {59, "R_ARM_ALU_PC_G1_NC"},
  1582. {60, "R_ARM_ALU_PC_G1"},
  1583. {61, "R_ARM_ALU_PC_G2"},
  1584. {62, "R_ARM_LDR_PC_G1"},
  1585. {63, "R_ARM_LDR_PC_G2"},
  1586. {64, "R_ARM_LDRS_PC_G0"},
  1587. {65, "R_ARM_LDRS_PC_G1"},
  1588. {66, "R_ARM_LDRS_PC_G2"},
  1589. {67, "R_ARM_LDC_PC_G0"},
  1590. {68, "R_ARM_LDC_PC_G1"},
  1591. {69, "R_ARM_LDC_PC_G2"},
  1592. {70, "R_ARM_ALU_SB_G0_NC"},
  1593. {71, "R_ARM_ALU_SB_G0"},
  1594. {72, "R_ARM_ALU_SB_G1_NC"},
  1595. {73, "R_ARM_ALU_SB_G1"},
  1596. {74, "R_ARM_ALU_SB_G2"},
  1597. {75, "R_ARM_LDR_SB_G0"},
  1598. {76, "R_ARM_LDR_SB_G1"},
  1599. {77, "R_ARM_LDR_SB_G2"},
  1600. {78, "R_ARM_LDRS_SB_G0"},
  1601. {79, "R_ARM_LDRS_SB_G1"},
  1602. {80, "R_ARM_LDRS_SB_G2"},
  1603. {81, "R_ARM_LDC_SB_G0"},
  1604. {82, "R_ARM_LDC_SB_G1"},
  1605. {83, "R_ARM_LDC_SB_G2"},
  1606. {84, "R_ARM_MOVW_BREL_NC"},
  1607. {85, "R_ARM_MOVT_BREL"},
  1608. {86, "R_ARM_MOVW_BREL"},
  1609. {87, "R_ARM_THM_MOVW_BREL_NC"},
  1610. {88, "R_ARM_THM_MOVT_BREL"},
  1611. {89, "R_ARM_THM_MOVW_BREL"},
  1612. {90, "R_ARM_TLS_GOTDESC"},
  1613. {91, "R_ARM_TLS_CALL"},
  1614. {92, "R_ARM_TLS_DESCSEQ"},
  1615. {93, "R_ARM_THM_TLS_CALL"},
  1616. {94, "R_ARM_PLT32_ABS"},
  1617. {95, "R_ARM_GOT_ABS"},
  1618. {96, "R_ARM_GOT_PREL"},
  1619. {97, "R_ARM_GOT_BREL12"},
  1620. {98, "R_ARM_GOTOFF12"},
  1621. {99, "R_ARM_GOTRELAX"},
  1622. {100, "R_ARM_GNU_VTENTRY"},
  1623. {101, "R_ARM_GNU_VTINHERIT"},
  1624. {102, "R_ARM_THM_JUMP11"},
  1625. {103, "R_ARM_THM_JUMP8"},
  1626. {104, "R_ARM_TLS_GD32"},
  1627. {105, "R_ARM_TLS_LDM32"},
  1628. {106, "R_ARM_TLS_LDO32"},
  1629. {107, "R_ARM_TLS_IE32"},
  1630. {108, "R_ARM_TLS_LE32"},
  1631. {109, "R_ARM_TLS_LDO12"},
  1632. {110, "R_ARM_TLS_LE12"},
  1633. {111, "R_ARM_TLS_IE12GP"},
  1634. {112, "R_ARM_PRIVATE_0"},
  1635. {113, "R_ARM_PRIVATE_1"},
  1636. {114, "R_ARM_PRIVATE_2"},
  1637. {115, "R_ARM_PRIVATE_3"},
  1638. {116, "R_ARM_PRIVATE_4"},
  1639. {117, "R_ARM_PRIVATE_5"},
  1640. {118, "R_ARM_PRIVATE_6"},
  1641. {119, "R_ARM_PRIVATE_7"},
  1642. {120, "R_ARM_PRIVATE_8"},
  1643. {121, "R_ARM_PRIVATE_9"},
  1644. {122, "R_ARM_PRIVATE_10"},
  1645. {123, "R_ARM_PRIVATE_11"},
  1646. {124, "R_ARM_PRIVATE_12"},
  1647. {125, "R_ARM_PRIVATE_13"},
  1648. {126, "R_ARM_PRIVATE_14"},
  1649. {127, "R_ARM_PRIVATE_15"},
  1650. {128, "R_ARM_ME_TOO"},
  1651. {129, "R_ARM_THM_TLS_DESCSEQ16"},
  1652. {130, "R_ARM_THM_TLS_DESCSEQ32"},
  1653. {131, "R_ARM_THM_GOT_BREL12"},
  1654. {132, "R_ARM_THM_ALU_ABS_G0_NC"},
  1655. {133, "R_ARM_THM_ALU_ABS_G1_NC"},
  1656. {134, "R_ARM_THM_ALU_ABS_G2_NC"},
  1657. {135, "R_ARM_THM_ALU_ABS_G3"},
  1658. {160, "R_ARM_IRELATIVE"},
  1659. {249, "R_ARM_RXPC25"},
  1660. {250, "R_ARM_RSBREL32"},
  1661. {251, "R_ARM_THM_RPC22"},
  1662. {252, "R_ARM_RREL32"},
  1663. {253, "R_ARM_RABS32"},
  1664. {254, "R_ARM_RPC24"},
  1665. {255, "R_ARM_RBASE"},
  1666. }
  1667. func (i R_ARM) String() string { return stringName(uint32(i), rarmStrings, false) }
  1668. func (i R_ARM) GoString() string { return stringName(uint32(i), rarmStrings, true) }
  1669. // Relocation types for 386.
  1670. type R_386 int
  1671. const (
  1672. R_386_NONE R_386 = 0 /* No relocation. */
  1673. R_386_32 R_386 = 1 /* Add symbol value. */
  1674. R_386_PC32 R_386 = 2 /* Add PC-relative symbol value. */
  1675. R_386_GOT32 R_386 = 3 /* Add PC-relative GOT offset. */
  1676. R_386_PLT32 R_386 = 4 /* Add PC-relative PLT offset. */
  1677. R_386_COPY R_386 = 5 /* Copy data from shared object. */
  1678. R_386_GLOB_DAT R_386 = 6 /* Set GOT entry to data address. */
  1679. R_386_JMP_SLOT R_386 = 7 /* Set GOT entry to code address. */
  1680. R_386_RELATIVE R_386 = 8 /* Add load address of shared object. */
  1681. R_386_GOTOFF R_386 = 9 /* Add GOT-relative symbol address. */
  1682. R_386_GOTPC R_386 = 10 /* Add PC-relative GOT table address. */
  1683. R_386_32PLT R_386 = 11
  1684. R_386_TLS_TPOFF R_386 = 14 /* Negative offset in static TLS block */
  1685. R_386_TLS_IE R_386 = 15 /* Absolute address of GOT for -ve static TLS */
  1686. R_386_TLS_GOTIE R_386 = 16 /* GOT entry for negative static TLS block */
  1687. R_386_TLS_LE R_386 = 17 /* Negative offset relative to static TLS */
  1688. R_386_TLS_GD R_386 = 18 /* 32 bit offset to GOT (index,off) pair */
  1689. R_386_TLS_LDM R_386 = 19 /* 32 bit offset to GOT (index,zero) pair */
  1690. R_386_16 R_386 = 20
  1691. R_386_PC16 R_386 = 21
  1692. R_386_8 R_386 = 22
  1693. R_386_PC8 R_386 = 23
  1694. R_386_TLS_GD_32 R_386 = 24 /* 32 bit offset to GOT (index,off) pair */
  1695. R_386_TLS_GD_PUSH R_386 = 25 /* pushl instruction for Sun ABI GD sequence */
  1696. R_386_TLS_GD_CALL R_386 = 26 /* call instruction for Sun ABI GD sequence */
  1697. R_386_TLS_GD_POP R_386 = 27 /* popl instruction for Sun ABI GD sequence */
  1698. R_386_TLS_LDM_32 R_386 = 28 /* 32 bit offset to GOT (index,zero) pair */
  1699. R_386_TLS_LDM_PUSH R_386 = 29 /* pushl instruction for Sun ABI LD sequence */
  1700. R_386_TLS_LDM_CALL R_386 = 30 /* call instruction for Sun ABI LD sequence */
  1701. R_386_TLS_LDM_POP R_386 = 31 /* popl instruction for Sun ABI LD sequence */
  1702. R_386_TLS_LDO_32 R_386 = 32 /* 32 bit offset from start of TLS block */
  1703. R_386_TLS_IE_32 R_386 = 33 /* 32 bit offset to GOT static TLS offset entry */
  1704. R_386_TLS_LE_32 R_386 = 34 /* 32 bit offset within static TLS block */
  1705. R_386_TLS_DTPMOD32 R_386 = 35 /* GOT entry containing TLS index */
  1706. R_386_TLS_DTPOFF32 R_386 = 36 /* GOT entry containing TLS offset */
  1707. R_386_TLS_TPOFF32 R_386 = 37 /* GOT entry of -ve static TLS offset */
  1708. R_386_SIZE32 R_386 = 38
  1709. R_386_TLS_GOTDESC R_386 = 39
  1710. R_386_TLS_DESC_CALL R_386 = 40
  1711. R_386_TLS_DESC R_386 = 41
  1712. R_386_IRELATIVE R_386 = 42
  1713. R_386_GOT32X R_386 = 43
  1714. )
  1715. var r386Strings = []intName{
  1716. {0, "R_386_NONE"},
  1717. {1, "R_386_32"},
  1718. {2, "R_386_PC32"},
  1719. {3, "R_386_GOT32"},
  1720. {4, "R_386_PLT32"},
  1721. {5, "R_386_COPY"},
  1722. {6, "R_386_GLOB_DAT"},
  1723. {7, "R_386_JMP_SLOT"},
  1724. {8, "R_386_RELATIVE"},
  1725. {9, "R_386_GOTOFF"},
  1726. {10, "R_386_GOTPC"},
  1727. {11, "R_386_32PLT"},
  1728. {14, "R_386_TLS_TPOFF"},
  1729. {15, "R_386_TLS_IE"},
  1730. {16, "R_386_TLS_GOTIE"},
  1731. {17, "R_386_TLS_LE"},
  1732. {18, "R_386_TLS_GD"},
  1733. {19, "R_386_TLS_LDM"},
  1734. {20, "R_386_16"},
  1735. {21, "R_386_PC16"},
  1736. {22, "R_386_8"},
  1737. {23, "R_386_PC8"},
  1738. {24, "R_386_TLS_GD_32"},
  1739. {25, "R_386_TLS_GD_PUSH"},
  1740. {26, "R_386_TLS_GD_CALL"},
  1741. {27, "R_386_TLS_GD_POP"},
  1742. {28, "R_386_TLS_LDM_32"},
  1743. {29, "R_386_TLS_LDM_PUSH"},
  1744. {30, "R_386_TLS_LDM_CALL"},
  1745. {31, "R_386_TLS_LDM_POP"},
  1746. {32, "R_386_TLS_LDO_32"},
  1747. {33, "R_386_TLS_IE_32"},
  1748. {34, "R_386_TLS_LE_32"},
  1749. {35, "R_386_TLS_DTPMOD32"},
  1750. {36, "R_386_TLS_DTPOFF32"},
  1751. {37, "R_386_TLS_TPOFF32"},
  1752. {38, "R_386_SIZE32"},
  1753. {39, "R_386_TLS_GOTDESC"},
  1754. {40, "R_386_TLS_DESC_CALL"},
  1755. {41, "R_386_TLS_DESC"},
  1756. {42, "R_386_IRELATIVE"},
  1757. {43, "R_386_GOT32X"},
  1758. }
  1759. func (i R_386) String() string { return stringName(uint32(i), r386Strings, false) }
  1760. func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) }
  1761. // Relocation types for MIPS.
  1762. type R_MIPS int
  1763. const (
  1764. R_MIPS_NONE R_MIPS = 0
  1765. R_MIPS_16 R_MIPS = 1
  1766. R_MIPS_32 R_MIPS = 2
  1767. R_MIPS_REL32 R_MIPS = 3
  1768. R_MIPS_26 R_MIPS = 4
  1769. R_MIPS_HI16 R_MIPS = 5 /* high 16 bits of symbol value */
  1770. R_MIPS_LO16 R_MIPS = 6 /* low 16 bits of symbol value */
  1771. R_MIPS_GPREL16 R_MIPS = 7 /* GP-relative reference */
  1772. R_MIPS_LITERAL R_MIPS = 8 /* Reference to literal section */
  1773. R_MIPS_GOT16 R_MIPS = 9 /* Reference to global offset table */
  1774. R_MIPS_PC16 R_MIPS = 10 /* 16 bit PC relative reference */
  1775. R_MIPS_CALL16 R_MIPS = 11 /* 16 bit call through glbl offset tbl */
  1776. R_MIPS_GPREL32 R_MIPS = 12
  1777. R_MIPS_SHIFT5 R_MIPS = 16
  1778. R_MIPS_SHIFT6 R_MIPS = 17
  1779. R_MIPS_64 R_MIPS = 18
  1780. R_MIPS_GOT_DISP R_MIPS = 19
  1781. R_MIPS_GOT_PAGE R_MIPS = 20
  1782. R_MIPS_GOT_OFST R_MIPS = 21
  1783. R_MIPS_GOT_HI16 R_MIPS = 22
  1784. R_MIPS_GOT_LO16 R_MIPS = 23
  1785. R_MIPS_SUB R_MIPS = 24
  1786. R_MIPS_INSERT_A R_MIPS = 25
  1787. R_MIPS_INSERT_B R_MIPS = 26
  1788. R_MIPS_DELETE R_MIPS = 27
  1789. R_MIPS_HIGHER R_MIPS = 28
  1790. R_MIPS_HIGHEST R_MIPS = 29
  1791. R_MIPS_CALL_HI16 R_MIPS = 30
  1792. R_MIPS_CALL_LO16 R_MIPS = 31
  1793. R_MIPS_SCN_DISP R_MIPS = 32
  1794. R_MIPS_REL16 R_MIPS = 33
  1795. R_MIPS_ADD_IMMEDIATE R_MIPS = 34
  1796. R_MIPS_PJUMP R_MIPS = 35
  1797. R_MIPS_RELGOT R_MIPS = 36
  1798. R_MIPS_JALR R_MIPS = 37
  1799. R_MIPS_TLS_DTPMOD32 R_MIPS = 38 /* Module number 32 bit */
  1800. R_MIPS_TLS_DTPREL32 R_MIPS = 39 /* Module-relative offset 32 bit */
  1801. R_MIPS_TLS_DTPMOD64 R_MIPS = 40 /* Module number 64 bit */
  1802. R_MIPS_TLS_DTPREL64 R_MIPS = 41 /* Module-relative offset 64 bit */
  1803. R_MIPS_TLS_GD R_MIPS = 42 /* 16 bit GOT offset for GD */
  1804. R_MIPS_TLS_LDM R_MIPS = 43 /* 16 bit GOT offset for LDM */
  1805. R_MIPS_TLS_DTPREL_HI16 R_MIPS = 44 /* Module-relative offset, high 16 bits */
  1806. R_MIPS_TLS_DTPREL_LO16 R_MIPS = 45 /* Module-relative offset, low 16 bits */
  1807. R_MIPS_TLS_GOTTPREL R_MIPS = 46 /* 16 bit GOT offset for IE */
  1808. R_MIPS_TLS_TPREL32 R_MIPS = 47 /* TP-relative offset, 32 bit */
  1809. R_MIPS_TLS_TPREL64 R_MIPS = 48 /* TP-relative offset, 64 bit */
  1810. R_MIPS_TLS_TPREL_HI16 R_MIPS = 49 /* TP-relative offset, high 16 bits */
  1811. R_MIPS_TLS_TPREL_LO16 R_MIPS = 50 /* TP-relative offset, low 16 bits */
  1812. )
  1813. var rmipsStrings = []intName{
  1814. {0, "R_MIPS_NONE"},
  1815. {1, "R_MIPS_16"},
  1816. {2, "R_MIPS_32"},
  1817. {3, "R_MIPS_REL32"},
  1818. {4, "R_MIPS_26"},
  1819. {5, "R_MIPS_HI16"},
  1820. {6, "R_MIPS_LO16"},
  1821. {7, "R_MIPS_GPREL16"},
  1822. {8, "R_MIPS_LITERAL"},
  1823. {9, "R_MIPS_GOT16"},
  1824. {10, "R_MIPS_PC16"},
  1825. {11, "R_MIPS_CALL16"},
  1826. {12, "R_MIPS_GPREL32"},
  1827. {16, "R_MIPS_SHIFT5"},
  1828. {17, "R_MIPS_SHIFT6"},
  1829. {18, "R_MIPS_64"},
  1830. {19, "R_MIPS_GOT_DISP"},
  1831. {20, "R_MIPS_GOT_PAGE"},
  1832. {21, "R_MIPS_GOT_OFST"},
  1833. {22, "R_MIPS_GOT_HI16"},
  1834. {23, "R_MIPS_GOT_LO16"},
  1835. {24, "R_MIPS_SUB"},
  1836. {25, "R_MIPS_INSERT_A"},
  1837. {26, "R_MIPS_INSERT_B"},
  1838. {27, "R_MIPS_DELETE"},
  1839. {28, "R_MIPS_HIGHER"},
  1840. {29, "R_MIPS_HIGHEST"},
  1841. {30, "R_MIPS_CALL_HI16"},
  1842. {31, "R_MIPS_CALL_LO16"},
  1843. {32, "R_MIPS_SCN_DISP"},
  1844. {33, "R_MIPS_REL16"},
  1845. {34, "R_MIPS_ADD_IMMEDIATE"},
  1846. {35, "R_MIPS_PJUMP"},
  1847. {36, "R_MIPS_RELGOT"},
  1848. {37, "R_MIPS_JALR"},
  1849. {38, "R_MIPS_TLS_DTPMOD32"},
  1850. {39, "R_MIPS_TLS_DTPREL32"},
  1851. {40, "R_MIPS_TLS_DTPMOD64"},
  1852. {41, "R_MIPS_TLS_DTPREL64"},
  1853. {42, "R_MIPS_TLS_GD"},
  1854. {43, "R_MIPS_TLS_LDM"},
  1855. {44, "R_MIPS_TLS_DTPREL_HI16"},
  1856. {45, "R_MIPS_TLS_DTPREL_LO16"},
  1857. {46, "R_MIPS_TLS_GOTTPREL"},
  1858. {47, "R_MIPS_TLS_TPREL32"},
  1859. {48, "R_MIPS_TLS_TPREL64"},
  1860. {49, "R_MIPS_TLS_TPREL_HI16"},
  1861. {50, "R_MIPS_TLS_TPREL_LO16"},
  1862. }
  1863. func (i R_MIPS) String() string { return stringName(uint32(i), rmipsStrings, false) }
  1864. func (i R_MIPS) GoString() string { return stringName(uint32(i), rmipsStrings, true) }
  1865. // Relocation types for PowerPC.
  1866. //
  1867. // Values that are shared by both R_PPC and R_PPC64 are prefixed with
  1868. // R_POWERPC_ in the ELF standard. For the R_PPC type, the relevant
  1869. // shared relocations have been renamed with the prefix R_PPC_.
  1870. // The original name follows the value in a comment.
  1871. type R_PPC int
  1872. const (
  1873. R_PPC_NONE R_PPC = 0 // R_POWERPC_NONE
  1874. R_PPC_ADDR32 R_PPC = 1 // R_POWERPC_ADDR32
  1875. R_PPC_ADDR24 R_PPC = 2 // R_POWERPC_ADDR24
  1876. R_PPC_ADDR16 R_PPC = 3 // R_POWERPC_ADDR16
  1877. R_PPC_ADDR16_LO R_PPC = 4 // R_POWERPC_ADDR16_LO
  1878. R_PPC_ADDR16_HI R_PPC = 5 // R_POWERPC_ADDR16_HI
  1879. R_PPC_ADDR16_HA R_PPC = 6 // R_POWERPC_ADDR16_HA
  1880. R_PPC_ADDR14 R_PPC = 7 // R_POWERPC_ADDR14
  1881. R_PPC_ADDR14_BRTAKEN R_PPC = 8 // R_POWERPC_ADDR14_BRTAKEN
  1882. R_PPC_ADDR14_BRNTAKEN R_PPC = 9 // R_POWERPC_ADDR14_BRNTAKEN
  1883. R_PPC_REL24 R_PPC = 10 // R_POWERPC_REL24
  1884. R_PPC_REL14 R_PPC = 11 // R_POWERPC_REL14
  1885. R_PPC_REL14_BRTAKEN R_PPC = 12 // R_POWERPC_REL14_BRTAKEN
  1886. R_PPC_REL14_BRNTAKEN R_PPC = 13 // R_POWERPC_REL14_BRNTAKEN
  1887. R_PPC_GOT16 R_PPC = 14 // R_POWERPC_GOT16
  1888. R_PPC_GOT16_LO R_PPC = 15 // R_POWERPC_GOT16_LO
  1889. R_PPC_GOT16_HI R_PPC = 16 // R_POWERPC_GOT16_HI
  1890. R_PPC_GOT16_HA R_PPC = 17 // R_POWERPC_GOT16_HA
  1891. R_PPC_PLTREL24 R_PPC = 18
  1892. R_PPC_COPY R_PPC = 19 // R_POWERPC_COPY
  1893. R_PPC_GLOB_DAT R_PPC = 20 // R_POWERPC_GLOB_DAT
  1894. R_PPC_JMP_SLOT R_PPC = 21 // R_POWERPC_JMP_SLOT
  1895. R_PPC_RELATIVE R_PPC = 22 // R_POWERPC_RELATIVE
  1896. R_PPC_LOCAL24PC R_PPC = 23
  1897. R_PPC_UADDR32 R_PPC = 24 // R_POWERPC_UADDR32
  1898. R_PPC_UADDR16 R_PPC = 25 // R_POWERPC_UADDR16
  1899. R_PPC_REL32 R_PPC = 26 // R_POWERPC_REL32
  1900. R_PPC_PLT32 R_PPC = 27 // R_POWERPC_PLT32
  1901. R_PPC_PLTREL32 R_PPC = 28 // R_POWERPC_PLTREL32
  1902. R_PPC_PLT16_LO R_PPC = 29 // R_POWERPC_PLT16_LO
  1903. R_PPC_PLT16_HI R_PPC = 30 // R_POWERPC_PLT16_HI
  1904. R_PPC_PLT16_HA R_PPC = 31 // R_POWERPC_PLT16_HA
  1905. R_PPC_SDAREL16 R_PPC = 32
  1906. R_PPC_SECTOFF R_PPC = 33 // R_POWERPC_SECTOFF
  1907. R_PPC_SECTOFF_LO R_PPC = 34 // R_POWERPC_SECTOFF_LO
  1908. R_PPC_SECTOFF_HI R_PPC = 35 // R_POWERPC_SECTOFF_HI
  1909. R_PPC_SECTOFF_HA R_PPC = 36 // R_POWERPC_SECTOFF_HA
  1910. R_PPC_TLS R_PPC = 67 // R_POWERPC_TLS
  1911. R_PPC_DTPMOD32 R_PPC = 68 // R_POWERPC_DTPMOD32
  1912. R_PPC_TPREL16 R_PPC = 69 // R_POWERPC_TPREL16
  1913. R_PPC_TPREL16_LO R_PPC = 70 // R_POWERPC_TPREL16_LO
  1914. R_PPC_TPREL16_HI R_PPC = 71 // R_POWERPC_TPREL16_HI
  1915. R_PPC_TPREL16_HA R_PPC = 72 // R_POWERPC_TPREL16_HA
  1916. R_PPC_TPREL32 R_PPC = 73 // R_POWERPC_TPREL32
  1917. R_PPC_DTPREL16 R_PPC = 74 // R_POWERPC_DTPREL16
  1918. R_PPC_DTPREL16_LO R_PPC = 75 // R_POWERPC_DTPREL16_LO
  1919. R_PPC_DTPREL16_HI R_PPC = 76 // R_POWERPC_DTPREL16_HI
  1920. R_PPC_DTPREL16_HA R_PPC = 77 // R_POWERPC_DTPREL16_HA
  1921. R_PPC_DTPREL32 R_PPC = 78 // R_POWERPC_DTPREL32
  1922. R_PPC_GOT_TLSGD16 R_PPC = 79 // R_POWERPC_GOT_TLSGD16
  1923. R_PPC_GOT_TLSGD16_LO R_PPC = 80 // R_POWERPC_GOT_TLSGD16_LO
  1924. R_PPC_GOT_TLSGD16_HI R_PPC = 81 // R_POWERPC_GOT_TLSGD16_HI
  1925. R_PPC_GOT_TLSGD16_HA R_PPC = 82 // R_POWERPC_GOT_TLSGD16_HA
  1926. R_PPC_GOT_TLSLD16 R_PPC = 83 // R_POWERPC_GOT_TLSLD16
  1927. R_PPC_GOT_TLSLD16_LO R_PPC = 84 // R_POWERPC_GOT_TLSLD16_LO
  1928. R_PPC_GOT_TLSLD16_HI R_PPC = 85 // R_POWERPC_GOT_TLSLD16_HI
  1929. R_PPC_GOT_TLSLD16_HA R_PPC = 86 // R_POWERPC_GOT_TLSLD16_HA
  1930. R_PPC_GOT_TPREL16 R_PPC = 87 // R_POWERPC_GOT_TPREL16
  1931. R_PPC_GOT_TPREL16_LO R_PPC = 88 // R_POWERPC_GOT_TPREL16_LO
  1932. R_PPC_GOT_TPREL16_HI R_PPC = 89 // R_POWERPC_GOT_TPREL16_HI
  1933. R_PPC_GOT_TPREL16_HA R_PPC = 90 // R_POWERPC_GOT_TPREL16_HA
  1934. R_PPC_EMB_NADDR32 R_PPC = 101
  1935. R_PPC_EMB_NADDR16 R_PPC = 102
  1936. R_PPC_EMB_NADDR16_LO R_PPC = 103
  1937. R_PPC_EMB_NADDR16_HI R_PPC = 104
  1938. R_PPC_EMB_NADDR16_HA R_PPC = 105
  1939. R_PPC_EMB_SDAI16 R_PPC = 106
  1940. R_PPC_EMB_SDA2I16 R_PPC = 107
  1941. R_PPC_EMB_SDA2REL R_PPC = 108
  1942. R_PPC_EMB_SDA21 R_PPC = 109
  1943. R_PPC_EMB_MRKREF R_PPC = 110
  1944. R_PPC_EMB_RELSEC16 R_PPC = 111
  1945. R_PPC_EMB_RELST_LO R_PPC = 112
  1946. R_PPC_EMB_RELST_HI R_PPC = 113
  1947. R_PPC_EMB_RELST_HA R_PPC = 114
  1948. R_PPC_EMB_BIT_FLD R_PPC = 115
  1949. R_PPC_EMB_RELSDA R_PPC = 116
  1950. )
  1951. var rppcStrings = []intName{
  1952. {0, "R_PPC_NONE"},
  1953. {1, "R_PPC_ADDR32"},
  1954. {2, "R_PPC_ADDR24"},
  1955. {3, "R_PPC_ADDR16"},
  1956. {4, "R_PPC_ADDR16_LO"},
  1957. {5, "R_PPC_ADDR16_HI"},
  1958. {6, "R_PPC_ADDR16_HA"},
  1959. {7, "R_PPC_ADDR14"},
  1960. {8, "R_PPC_ADDR14_BRTAKEN"},
  1961. {9, "R_PPC_ADDR14_BRNTAKEN"},
  1962. {10, "R_PPC_REL24"},
  1963. {11, "R_PPC_REL14"},
  1964. {12, "R_PPC_REL14_BRTAKEN"},
  1965. {13, "R_PPC_REL14_BRNTAKEN"},
  1966. {14, "R_PPC_GOT16"},
  1967. {15, "R_PPC_GOT16_LO"},
  1968. {16, "R_PPC_GOT16_HI"},
  1969. {17, "R_PPC_GOT16_HA"},
  1970. {18, "R_PPC_PLTREL24"},
  1971. {19, "R_PPC_COPY"},
  1972. {20, "R_PPC_GLOB_DAT"},
  1973. {21, "R_PPC_JMP_SLOT"},
  1974. {22, "R_PPC_RELATIVE"},
  1975. {23, "R_PPC_LOCAL24PC"},
  1976. {24, "R_PPC_UADDR32"},
  1977. {25, "R_PPC_UADDR16"},
  1978. {26, "R_PPC_REL32"},
  1979. {27, "R_PPC_PLT32"},
  1980. {28, "R_PPC_PLTREL32"},
  1981. {29, "R_PPC_PLT16_LO"},
  1982. {30, "R_PPC_PLT16_HI"},
  1983. {31, "R_PPC_PLT16_HA"},
  1984. {32, "R_PPC_SDAREL16"},
  1985. {33, "R_PPC_SECTOFF"},
  1986. {34, "R_PPC_SECTOFF_LO"},
  1987. {35, "R_PPC_SECTOFF_HI"},
  1988. {36, "R_PPC_SECTOFF_HA"},
  1989. {67, "R_PPC_TLS"},
  1990. {68, "R_PPC_DTPMOD32"},
  1991. {69, "R_PPC_TPREL16"},
  1992. {70, "R_PPC_TPREL16_LO"},
  1993. {71, "R_PPC_TPREL16_HI"},
  1994. {72, "R_PPC_TPREL16_HA"},
  1995. {73, "R_PPC_TPREL32"},
  1996. {74, "R_PPC_DTPREL16"},
  1997. {75, "R_PPC_DTPREL16_LO"},
  1998. {76, "R_PPC_DTPREL16_HI"},
  1999. {77, "R_PPC_DTPREL16_HA"},
  2000. {78, "R_PPC_DTPREL32"},
  2001. {79, "R_PPC_GOT_TLSGD16"},
  2002. {80, "R_PPC_GOT_TLSGD16_LO"},
  2003. {81, "R_PPC_GOT_TLSGD16_HI"},
  2004. {82, "R_PPC_GOT_TLSGD16_HA"},
  2005. {83, "R_PPC_GOT_TLSLD16"},
  2006. {84, "R_PPC_GOT_TLSLD16_LO"},
  2007. {85, "R_PPC_GOT_TLSLD16_HI"},
  2008. {86, "R_PPC_GOT_TLSLD16_HA"},
  2009. {87, "R_PPC_GOT_TPREL16"},
  2010. {88, "R_PPC_GOT_TPREL16_LO"},
  2011. {89, "R_PPC_GOT_TPREL16_HI"},
  2012. {90, "R_PPC_GOT_TPREL16_HA"},
  2013. {101, "R_PPC_EMB_NADDR32"},
  2014. {102, "R_PPC_EMB_NADDR16"},
  2015. {103, "R_PPC_EMB_NADDR16_LO"},
  2016. {104, "R_PPC_EMB_NADDR16_HI"},
  2017. {105, "R_PPC_EMB_NADDR16_HA"},
  2018. {106, "R_PPC_EMB_SDAI16"},
  2019. {107, "R_PPC_EMB_SDA2I16"},
  2020. {108, "R_PPC_EMB_SDA2REL"},
  2021. {109, "R_PPC_EMB_SDA21"},
  2022. {110, "R_PPC_EMB_MRKREF"},
  2023. {111, "R_PPC_EMB_RELSEC16"},
  2024. {112, "R_PPC_EMB_RELST_LO"},
  2025. {113, "R_PPC_EMB_RELST_HI"},
  2026. {114, "R_PPC_EMB_RELST_HA"},
  2027. {115, "R_PPC_EMB_BIT_FLD"},
  2028. {116, "R_PPC_EMB_RELSDA"},
  2029. }
  2030. func (i R_PPC) String() string { return stringName(uint32(i), rppcStrings, false) }
  2031. func (i R_PPC) GoString() string { return stringName(uint32(i), rppcStrings, true) }
  2032. // Relocation types for 64-bit PowerPC or Power Architecture processors.
  2033. //
  2034. // Values that are shared by both R_PPC and R_PPC64 are prefixed with
  2035. // R_POWERPC_ in the ELF standard. For the R_PPC64 type, the relevant
  2036. // shared relocations have been renamed with the prefix R_PPC64_.
  2037. // The original name follows the value in a comment.
  2038. type R_PPC64 int
  2039. const (
  2040. R_PPC64_NONE R_PPC64 = 0 // R_POWERPC_NONE
  2041. R_PPC64_ADDR32 R_PPC64 = 1 // R_POWERPC_ADDR32
  2042. R_PPC64_ADDR24 R_PPC64 = 2 // R_POWERPC_ADDR24
  2043. R_PPC64_ADDR16 R_PPC64 = 3 // R_POWERPC_ADDR16
  2044. R_PPC64_ADDR16_LO R_PPC64 = 4 // R_POWERPC_ADDR16_LO
  2045. R_PPC64_ADDR16_HI R_PPC64 = 5 // R_POWERPC_ADDR16_HI
  2046. R_PPC64_ADDR16_HA R_PPC64 = 6 // R_POWERPC_ADDR16_HA
  2047. R_PPC64_ADDR14 R_PPC64 = 7 // R_POWERPC_ADDR14
  2048. R_PPC64_ADDR14_BRTAKEN R_PPC64 = 8 // R_POWERPC_ADDR14_BRTAKEN
  2049. R_PPC64_ADDR14_BRNTAKEN R_PPC64 = 9 // R_POWERPC_ADDR14_BRNTAKEN
  2050. R_PPC64_REL24 R_PPC64 = 10 // R_POWERPC_REL24
  2051. R_PPC64_REL14 R_PPC64 = 11 // R_POWERPC_REL14
  2052. R_PPC64_REL14_BRTAKEN R_PPC64 = 12 // R_POWERPC_REL14_BRTAKEN
  2053. R_PPC64_REL14_BRNTAKEN R_PPC64 = 13 // R_POWERPC_REL14_BRNTAKEN
  2054. R_PPC64_GOT16 R_PPC64 = 14 // R_POWERPC_GOT16
  2055. R_PPC64_GOT16_LO R_PPC64 = 15 // R_POWERPC_GOT16_LO
  2056. R_PPC64_GOT16_HI R_PPC64 = 16 // R_POWERPC_GOT16_HI
  2057. R_PPC64_GOT16_HA R_PPC64 = 17 // R_POWERPC_GOT16_HA
  2058. R_PPC64_JMP_SLOT R_PPC64 = 21 // R_POWERPC_JMP_SLOT
  2059. R_PPC64_REL32 R_PPC64 = 26 // R_POWERPC_REL32
  2060. R_PPC64_ADDR64 R_PPC64 = 38
  2061. R_PPC64_ADDR16_HIGHER R_PPC64 = 39
  2062. R_PPC64_ADDR16_HIGHERA R_PPC64 = 40
  2063. R_PPC64_ADDR16_HIGHEST R_PPC64 = 41
  2064. R_PPC64_ADDR16_HIGHESTA R_PPC64 = 42
  2065. R_PPC64_REL64 R_PPC64 = 44
  2066. R_PPC64_TOC16 R_PPC64 = 47
  2067. R_PPC64_TOC16_LO R_PPC64 = 48
  2068. R_PPC64_TOC16_HI R_PPC64 = 49
  2069. R_PPC64_TOC16_HA R_PPC64 = 50
  2070. R_PPC64_TOC R_PPC64 = 51
  2071. R_PPC64_PLTGOT16 R_PPC64 = 52
  2072. R_PPC64_PLTGOT16_LO R_PPC64 = 53
  2073. R_PPC64_PLTGOT16_HI R_PPC64 = 54
  2074. R_PPC64_PLTGOT16_HA R_PPC64 = 55
  2075. R_PPC64_ADDR16_DS R_PPC64 = 56
  2076. R_PPC64_ADDR16_LO_DS R_PPC64 = 57
  2077. R_PPC64_GOT16_DS R_PPC64 = 58
  2078. R_PPC64_GOT16_LO_DS R_PPC64 = 59
  2079. R_PPC64_PLT16_LO_DS R_PPC64 = 60
  2080. R_PPC64_SECTOFF_DS R_PPC64 = 61
  2081. R_PPC64_SECTOFF_LO_DS R_PPC64 = 61
  2082. R_PPC64_TOC16_DS R_PPC64 = 63
  2083. R_PPC64_TOC16_LO_DS R_PPC64 = 64
  2084. R_PPC64_PLTGOT16_DS R_PPC64 = 65
  2085. R_PPC64_PLTGOT_LO_DS R_PPC64 = 66
  2086. R_PPC64_TLS R_PPC64 = 67 // R_POWERPC_TLS
  2087. R_PPC64_DTPMOD64 R_PPC64 = 68 // R_POWERPC_DTPMOD64
  2088. R_PPC64_TPREL16 R_PPC64 = 69 // R_POWERPC_TPREL16
  2089. R_PPC64_TPREL16_LO R_PPC64 = 70 // R_POWERPC_TPREL16_LO
  2090. R_PPC64_TPREL16_HI R_PPC64 = 71 // R_POWERPC_TPREL16_HI
  2091. R_PPC64_TPREL16_HA R_PPC64 = 72 // R_POWERPC_TPREL16_HA
  2092. R_PPC64_TPREL64 R_PPC64 = 73 // R_POWERPC_TPREL64
  2093. R_PPC64_DTPREL16 R_PPC64 = 74 // R_POWERPC_DTPREL16
  2094. R_PPC64_DTPREL16_LO R_PPC64 = 75 // R_POWERPC_DTPREL16_LO
  2095. R_PPC64_DTPREL16_HI R_PPC64 = 76 // R_POWERPC_DTPREL16_HI
  2096. R_PPC64_DTPREL16_HA R_PPC64 = 77 // R_POWERPC_DTPREL16_HA
  2097. R_PPC64_DTPREL64 R_PPC64 = 78 // R_POWERPC_DTPREL64
  2098. R_PPC64_GOT_TLSGD16 R_PPC64 = 79 // R_POWERPC_GOT_TLSGD16
  2099. R_PPC64_GOT_TLSGD16_LO R_PPC64 = 80 // R_POWERPC_GOT_TLSGD16_LO
  2100. R_PPC64_GOT_TLSGD16_HI R_PPC64 = 81 // R_POWERPC_GOT_TLSGD16_HI
  2101. R_PPC64_GOT_TLSGD16_HA R_PPC64 = 82 // R_POWERPC_GOT_TLSGD16_HA
  2102. R_PPC64_GOT_TLSLD16 R_PPC64 = 83 // R_POWERPC_GOT_TLSLD16
  2103. R_PPC64_GOT_TLSLD16_LO R_PPC64 = 84 // R_POWERPC_GOT_TLSLD16_LO
  2104. R_PPC64_GOT_TLSLD16_HI R_PPC64 = 85 // R_POWERPC_GOT_TLSLD16_HI
  2105. R_PPC64_GOT_TLSLD16_HA R_PPC64 = 86 // R_POWERPC_GOT_TLSLD16_HA
  2106. R_PPC64_GOT_TPREL16_DS R_PPC64 = 87 // R_POWERPC_GOT_TPREL16_DS
  2107. R_PPC64_GOT_TPREL16_LO_DS R_PPC64 = 88 // R_POWERPC_GOT_TPREL16_LO_DS
  2108. R_PPC64_GOT_TPREL16_HI R_PPC64 = 89 // R_POWERPC_GOT_TPREL16_HI
  2109. R_PPC64_GOT_TPREL16_HA R_PPC64 = 90 // R_POWERPC_GOT_TPREL16_HA
  2110. R_PPC64_GOT_DTPREL16_DS R_PPC64 = 91 // R_POWERPC_GOT_DTPREL16_DS
  2111. R_PPC64_GOT_DTPREL16_LO_DS R_PPC64 = 92 // R_POWERPC_GOT_DTPREL16_LO_DS
  2112. R_PPC64_GOT_DTPREL16_HI R_PPC64 = 93 // R_POWERPC_GOT_DTPREL16_HI
  2113. R_PPC64_GOT_DTPREL16_HA R_PPC64 = 94 // R_POWERPC_GOT_DTPREL16_HA
  2114. R_PPC64_TPREL16_DS R_PPC64 = 95
  2115. R_PPC64_TPREL16_LO_DS R_PPC64 = 96
  2116. R_PPC64_TPREL16_HIGHER R_PPC64 = 97
  2117. R_PPC64_TPREL16_HIGHERA R_PPC64 = 98
  2118. R_PPC64_TPREL16_HIGHEST R_PPC64 = 99
  2119. R_PPC64_TPREL16_HIGHESTA R_PPC64 = 100
  2120. R_PPC64_DTPREL16_DS R_PPC64 = 101
  2121. R_PPC64_DTPREL16_LO_DS R_PPC64 = 102
  2122. R_PPC64_DTPREL16_HIGHER R_PPC64 = 103
  2123. R_PPC64_DTPREL16_HIGHERA R_PPC64 = 104
  2124. R_PPC64_DTPREL16_HIGHEST R_PPC64 = 105
  2125. R_PPC64_DTPREL16_HIGHESTA R_PPC64 = 106
  2126. R_PPC64_TLSGD R_PPC64 = 107
  2127. R_PPC64_TLSLD R_PPC64 = 108
  2128. R_PPC64_TOCSAVE R_PPC64 = 109
  2129. R_PPC64_ADDR16_HIGH R_PPC64 = 110
  2130. R_PPC64_ADDR16_HIGHA R_PPC64 = 111
  2131. R_PPC64_TPREL16_HIGH R_PPC64 = 112
  2132. R_PPC64_TPREL16_HIGHA R_PPC64 = 113
  2133. R_PPC64_DTPREL16_HIGH R_PPC64 = 114
  2134. R_PPC64_DTPREL16_HIGHA R_PPC64 = 115
  2135. R_PPC64_REL24_NOTOC R_PPC64 = 116
  2136. R_PPC64_ADDR64_LOCAL R_PPC64 = 117
  2137. R_PPC64_ENTRY R_PPC64 = 118
  2138. R_PPC64_REL16DX_HA R_PPC64 = 246 // R_POWERPC_REL16DX_HA
  2139. R_PPC64_JMP_IREL R_PPC64 = 247
  2140. R_PPC64_IRELATIVE R_PPC64 = 248 // R_POWERPC_IRELATIVE
  2141. R_PPC64_REL16 R_PPC64 = 249 // R_POWERPC_REL16
  2142. R_PPC64_REL16_LO R_PPC64 = 250 // R_POWERPC_REL16_LO
  2143. R_PPC64_REL16_HI R_PPC64 = 251 // R_POWERPC_REL16_HI
  2144. R_PPC64_REL16_HA R_PPC64 = 252 // R_POWERPC_REL16_HA
  2145. )
  2146. var rppc64Strings = []intName{
  2147. {0, "R_PPC64_NONE"},
  2148. {1, "R_PPC64_ADDR32"},
  2149. {2, "R_PPC64_ADDR24"},
  2150. {3, "R_PPC64_ADDR16"},
  2151. {4, "R_PPC64_ADDR16_LO"},
  2152. {5, "R_PPC64_ADDR16_HI"},
  2153. {6, "R_PPC64_ADDR16_HA"},
  2154. {7, "R_PPC64_ADDR14"},
  2155. {8, "R_PPC64_ADDR14_BRTAKEN"},
  2156. {9, "R_PPC64_ADDR14_BRNTAKEN"},
  2157. {10, "R_PPC64_REL24"},
  2158. {11, "R_PPC64_REL14"},
  2159. {12, "R_PPC64_REL14_BRTAKEN"},
  2160. {13, "R_PPC64_REL14_BRNTAKEN"},
  2161. {14, "R_PPC64_GOT16"},
  2162. {15, "R_PPC64_GOT16_LO"},
  2163. {16, "R_PPC64_GOT16_HI"},
  2164. {17, "R_PPC64_GOT16_HA"},
  2165. {21, "R_PPC64_JMP_SLOT"},
  2166. {26, "R_PPC64_REL32"},
  2167. {38, "R_PPC64_ADDR64"},
  2168. {39, "R_PPC64_ADDR16_HIGHER"},
  2169. {40, "R_PPC64_ADDR16_HIGHERA"},
  2170. {41, "R_PPC64_ADDR16_HIGHEST"},
  2171. {42, "R_PPC64_ADDR16_HIGHESTA"},
  2172. {44, "R_PPC64_REL64"},
  2173. {47, "R_PPC64_TOC16"},
  2174. {48, "R_PPC64_TOC16_LO"},
  2175. {49, "R_PPC64_TOC16_HI"},
  2176. {50, "R_PPC64_TOC16_HA"},
  2177. {51, "R_PPC64_TOC"},
  2178. {52, "R_PPC64_PLTGOT16"},
  2179. {53, "R_PPC64_PLTGOT16_LO"},
  2180. {54, "R_PPC64_PLTGOT16_HI"},
  2181. {55, "R_PPC64_PLTGOT16_HA"},
  2182. {56, "R_PPC64_ADDR16_DS"},
  2183. {57, "R_PPC64_ADDR16_LO_DS"},
  2184. {58, "R_PPC64_GOT16_DS"},
  2185. {59, "R_PPC64_GOT16_LO_DS"},
  2186. {60, "R_PPC64_PLT16_LO_DS"},
  2187. {61, "R_PPC64_SECTOFF_DS"},
  2188. {61, "R_PPC64_SECTOFF_LO_DS"},
  2189. {63, "R_PPC64_TOC16_DS"},
  2190. {64, "R_PPC64_TOC16_LO_DS"},
  2191. {65, "R_PPC64_PLTGOT16_DS"},
  2192. {66, "R_PPC64_PLTGOT_LO_DS"},
  2193. {67, "R_PPC64_TLS"},
  2194. {68, "R_PPC64_DTPMOD64"},
  2195. {69, "R_PPC64_TPREL16"},
  2196. {70, "R_PPC64_TPREL16_LO"},
  2197. {71, "R_PPC64_TPREL16_HI"},
  2198. {72, "R_PPC64_TPREL16_HA"},
  2199. {73, "R_PPC64_TPREL64"},
  2200. {74, "R_PPC64_DTPREL16"},
  2201. {75, "R_PPC64_DTPREL16_LO"},
  2202. {76, "R_PPC64_DTPREL16_HI"},
  2203. {77, "R_PPC64_DTPREL16_HA"},
  2204. {78, "R_PPC64_DTPREL64"},
  2205. {79, "R_PPC64_GOT_TLSGD16"},
  2206. {80, "R_PPC64_GOT_TLSGD16_LO"},
  2207. {81, "R_PPC64_GOT_TLSGD16_HI"},
  2208. {82, "R_PPC64_GOT_TLSGD16_HA"},
  2209. {83, "R_PPC64_GOT_TLSLD16"},
  2210. {84, "R_PPC64_GOT_TLSLD16_LO"},
  2211. {85, "R_PPC64_GOT_TLSLD16_HI"},
  2212. {86, "R_PPC64_GOT_TLSLD16_HA"},
  2213. {87, "R_PPC64_GOT_TPREL16_DS"},
  2214. {88, "R_PPC64_GOT_TPREL16_LO_DS"},
  2215. {89, "R_PPC64_GOT_TPREL16_HI"},
  2216. {90, "R_PPC64_GOT_TPREL16_HA"},
  2217. {91, "R_PPC64_GOT_DTPREL16_DS"},
  2218. {92, "R_PPC64_GOT_DTPREL16_LO_DS"},
  2219. {93, "R_PPC64_GOT_DTPREL16_HI"},
  2220. {94, "R_PPC64_GOT_DTPREL16_HA"},
  2221. {95, "R_PPC64_TPREL16_DS"},
  2222. {96, "R_PPC64_TPREL16_LO_DS"},
  2223. {97, "R_PPC64_TPREL16_HIGHER"},
  2224. {98, "R_PPC64_TPREL16_HIGHERA"},
  2225. {99, "R_PPC64_TPREL16_HIGHEST"},
  2226. {100, "R_PPC64_TPREL16_HIGHESTA"},
  2227. {101, "R_PPC64_DTPREL16_DS"},
  2228. {102, "R_PPC64_DTPREL16_LO_DS"},
  2229. {103, "R_PPC64_DTPREL16_HIGHER"},
  2230. {104, "R_PPC64_DTPREL16_HIGHERA"},
  2231. {105, "R_PPC64_DTPREL16_HIGHEST"},
  2232. {106, "R_PPC64_DTPREL16_HIGHESTA"},
  2233. {107, "R_PPC64_TLSGD"},
  2234. {108, "R_PPC64_TLSLD"},
  2235. {109, "R_PPC64_TOCSAVE"},
  2236. {110, "R_PPC64_ADDR16_HIGH"},
  2237. {111, "R_PPC64_ADDR16_HIGHA"},
  2238. {112, "R_PPC64_TPREL16_HIGH"},
  2239. {113, "R_PPC64_TPREL16_HIGHA"},
  2240. {114, "R_PPC64_DTPREL16_HIGH"},
  2241. {115, "R_PPC64_DTPREL16_HIGHA"},
  2242. {116, "R_PPC64_REL24_NOTOC"},
  2243. {117, "R_PPC64_ADDR64_LOCAL"},
  2244. {118, "R_PPC64_ENTRY"},
  2245. {246, "R_PPC64_REL16DX_HA"},
  2246. {247, "R_PPC64_JMP_IREL"},
  2247. {248, "R_PPC64_IRELATIVE"},
  2248. {249, "R_PPC64_REL16"},
  2249. {250, "R_PPC64_REL16_LO"},
  2250. {251, "R_PPC64_REL16_HI"},
  2251. {252, "R_PPC64_REL16_HA"},
  2252. }
  2253. func (i R_PPC64) String() string { return stringName(uint32(i), rppc64Strings, false) }
  2254. func (i R_PPC64) GoString() string { return stringName(uint32(i), rppc64Strings, true) }
  2255. // Relocation types for RISC-V processors.
  2256. type R_RISCV int
  2257. const (
  2258. R_RISCV_NONE R_RISCV = 0 /* No relocation. */
  2259. R_RISCV_32 R_RISCV = 1 /* Add 32 bit zero extended symbol value */
  2260. R_RISCV_64 R_RISCV = 2 /* Add 64 bit symbol value. */
  2261. R_RISCV_RELATIVE R_RISCV = 3 /* Add load address of shared object. */
  2262. R_RISCV_COPY R_RISCV = 4 /* Copy data from shared object. */
  2263. R_RISCV_JUMP_SLOT R_RISCV = 5 /* Set GOT entry to code address. */
  2264. R_RISCV_TLS_DTPMOD32 R_RISCV = 6 /* 32 bit ID of module containing symbol */
  2265. R_RISCV_TLS_DTPMOD64 R_RISCV = 7 /* ID of module containing symbol */
  2266. R_RISCV_TLS_DTPREL32 R_RISCV = 8 /* 32 bit relative offset in TLS block */
  2267. R_RISCV_TLS_DTPREL64 R_RISCV = 9 /* Relative offset in TLS block */
  2268. R_RISCV_TLS_TPREL32 R_RISCV = 10 /* 32 bit relative offset in static TLS block */
  2269. R_RISCV_TLS_TPREL64 R_RISCV = 11 /* Relative offset in static TLS block */
  2270. R_RISCV_BRANCH R_RISCV = 16 /* PC-relative branch */
  2271. R_RISCV_JAL R_RISCV = 17 /* PC-relative jump */
  2272. R_RISCV_CALL R_RISCV = 18 /* PC-relative call */
  2273. R_RISCV_CALL_PLT R_RISCV = 19 /* PC-relative call (PLT) */
  2274. R_RISCV_GOT_HI20 R_RISCV = 20 /* PC-relative GOT reference */
  2275. R_RISCV_TLS_GOT_HI20 R_RISCV = 21 /* PC-relative TLS IE GOT offset */
  2276. R_RISCV_TLS_GD_HI20 R_RISCV = 22 /* PC-relative TLS GD reference */
  2277. R_RISCV_PCREL_HI20 R_RISCV = 23 /* PC-relative reference */
  2278. R_RISCV_PCREL_LO12_I R_RISCV = 24 /* PC-relative reference */
  2279. R_RISCV_PCREL_LO12_S R_RISCV = 25 /* PC-relative reference */
  2280. R_RISCV_HI20 R_RISCV = 26 /* Absolute address */
  2281. R_RISCV_LO12_I R_RISCV = 27 /* Absolute address */
  2282. R_RISCV_LO12_S R_RISCV = 28 /* Absolute address */
  2283. R_RISCV_TPREL_HI20 R_RISCV = 29 /* TLS LE thread offset */
  2284. R_RISCV_TPREL_LO12_I R_RISCV = 30 /* TLS LE thread offset */
  2285. R_RISCV_TPREL_LO12_S R_RISCV = 31 /* TLS LE thread offset */
  2286. R_RISCV_TPREL_ADD R_RISCV = 32 /* TLS LE thread usage */
  2287. R_RISCV_ADD8 R_RISCV = 33 /* 8-bit label addition */
  2288. R_RISCV_ADD16 R_RISCV = 34 /* 16-bit label addition */
  2289. R_RISCV_ADD32 R_RISCV = 35 /* 32-bit label addition */
  2290. R_RISCV_ADD64 R_RISCV = 36 /* 64-bit label addition */
  2291. R_RISCV_SUB8 R_RISCV = 37 /* 8-bit label subtraction */
  2292. R_RISCV_SUB16 R_RISCV = 38 /* 16-bit label subtraction */
  2293. R_RISCV_SUB32 R_RISCV = 39 /* 32-bit label subtraction */
  2294. R_RISCV_SUB64 R_RISCV = 40 /* 64-bit label subtraction */
  2295. R_RISCV_GNU_VTINHERIT R_RISCV = 41 /* GNU C++ vtable hierarchy */
  2296. R_RISCV_GNU_VTENTRY R_RISCV = 42 /* GNU C++ vtable member usage */
  2297. R_RISCV_ALIGN R_RISCV = 43 /* Alignment statement */
  2298. R_RISCV_RVC_BRANCH R_RISCV = 44 /* PC-relative branch offset */
  2299. R_RISCV_RVC_JUMP R_RISCV = 45 /* PC-relative jump offset */
  2300. R_RISCV_RVC_LUI R_RISCV = 46 /* Absolute address */
  2301. R_RISCV_GPREL_I R_RISCV = 47 /* GP-relative reference */
  2302. R_RISCV_GPREL_S R_RISCV = 48 /* GP-relative reference */
  2303. R_RISCV_TPREL_I R_RISCV = 49 /* TP-relative TLS LE load */
  2304. R_RISCV_TPREL_S R_RISCV = 50 /* TP-relative TLS LE store */
  2305. R_RISCV_RELAX R_RISCV = 51 /* Instruction pair can be relaxed */
  2306. R_RISCV_SUB6 R_RISCV = 52 /* Local label subtraction */
  2307. R_RISCV_SET6 R_RISCV = 53 /* Local label subtraction */
  2308. R_RISCV_SET8 R_RISCV = 54 /* Local label subtraction */
  2309. R_RISCV_SET16 R_RISCV = 55 /* Local label subtraction */
  2310. R_RISCV_SET32 R_RISCV = 56 /* Local label subtraction */
  2311. )
  2312. var rriscvStrings = []intName{
  2313. {0, "R_RISCV_NONE"},
  2314. {1, "R_RISCV_32"},
  2315. {2, "R_RISCV_64"},
  2316. {3, "R_RISCV_RELATIVE"},
  2317. {4, "R_RISCV_COPY"},
  2318. {5, "R_RISCV_JUMP_SLOT"},
  2319. {6, "R_RISCV_TLS_DTPMOD32"},
  2320. {7, "R_RISCV_TLS_DTPMOD64"},
  2321. {8, "R_RISCV_TLS_DTPREL32"},
  2322. {9, "R_RISCV_TLS_DTPREL64"},
  2323. {10, "R_RISCV_TLS_TPREL32"},
  2324. {11, "R_RISCV_TLS_TPREL64"},
  2325. {16, "R_RISCV_BRANCH"},
  2326. {17, "R_RISCV_JAL"},
  2327. {18, "R_RISCV_CALL"},
  2328. {19, "R_RISCV_CALL_PLT"},
  2329. {20, "R_RISCV_GOT_HI20"},
  2330. {21, "R_RISCV_TLS_GOT_HI20"},
  2331. {22, "R_RISCV_TLS_GD_HI20"},
  2332. {23, "R_RISCV_PCREL_HI20"},
  2333. {24, "R_RISCV_PCREL_LO12_I"},
  2334. {25, "R_RISCV_PCREL_LO12_S"},
  2335. {26, "R_RISCV_HI20"},
  2336. {27, "R_RISCV_LO12_I"},
  2337. {28, "R_RISCV_LO12_S"},
  2338. {29, "R_RISCV_TPREL_HI20"},
  2339. {30, "R_RISCV_TPREL_LO12_I"},
  2340. {31, "R_RISCV_TPREL_LO12_S"},
  2341. {32, "R_RISCV_TPREL_ADD"},
  2342. {33, "R_RISCV_ADD8"},
  2343. {34, "R_RISCV_ADD16"},
  2344. {35, "R_RISCV_ADD32"},
  2345. {36, "R_RISCV_ADD64"},
  2346. {37, "R_RISCV_SUB8"},
  2347. {38, "R_RISCV_SUB16"},
  2348. {39, "R_RISCV_SUB32"},
  2349. {40, "R_RISCV_SUB64"},
  2350. {41, "R_RISCV_GNU_VTINHERIT"},
  2351. {42, "R_RISCV_GNU_VTENTRY"},
  2352. {43, "R_RISCV_ALIGN"},
  2353. {44, "R_RISCV_RVC_BRANCH"},
  2354. {45, "R_RISCV_RVC_JUMP"},
  2355. {46, "R_RISCV_RVC_LUI"},
  2356. {47, "R_RISCV_GPREL_I"},
  2357. {48, "R_RISCV_GPREL_S"},
  2358. {49, "R_RISCV_TPREL_I"},
  2359. {50, "R_RISCV_TPREL_S"},
  2360. {51, "R_RISCV_RELAX"},
  2361. {52, "R_RISCV_SUB6"},
  2362. {53, "R_RISCV_SET6"},
  2363. {54, "R_RISCV_SET8"},
  2364. {55, "R_RISCV_SET16"},
  2365. {56, "R_RISCV_SET32"},
  2366. }
  2367. func (i R_RISCV) String() string { return stringName(uint32(i), rriscvStrings, false) }
  2368. func (i R_RISCV) GoString() string { return stringName(uint32(i), rriscvStrings, true) }
  2369. // Relocation types for s390x processors.
  2370. type R_390 int
  2371. const (
  2372. R_390_NONE R_390 = 0
  2373. R_390_8 R_390 = 1
  2374. R_390_12 R_390 = 2
  2375. R_390_16 R_390 = 3
  2376. R_390_32 R_390 = 4
  2377. R_390_PC32 R_390 = 5
  2378. R_390_GOT12 R_390 = 6
  2379. R_390_GOT32 R_390 = 7
  2380. R_390_PLT32 R_390 = 8
  2381. R_390_COPY R_390 = 9
  2382. R_390_GLOB_DAT R_390 = 10
  2383. R_390_JMP_SLOT R_390 = 11
  2384. R_390_RELATIVE R_390 = 12
  2385. R_390_GOTOFF R_390 = 13
  2386. R_390_GOTPC R_390 = 14
  2387. R_390_GOT16 R_390 = 15
  2388. R_390_PC16 R_390 = 16
  2389. R_390_PC16DBL R_390 = 17
  2390. R_390_PLT16DBL R_390 = 18
  2391. R_390_PC32DBL R_390 = 19
  2392. R_390_PLT32DBL R_390 = 20
  2393. R_390_GOTPCDBL R_390 = 21
  2394. R_390_64 R_390 = 22
  2395. R_390_PC64 R_390 = 23
  2396. R_390_GOT64 R_390 = 24
  2397. R_390_PLT64 R_390 = 25
  2398. R_390_GOTENT R_390 = 26
  2399. R_390_GOTOFF16 R_390 = 27
  2400. R_390_GOTOFF64 R_390 = 28
  2401. R_390_GOTPLT12 R_390 = 29
  2402. R_390_GOTPLT16 R_390 = 30
  2403. R_390_GOTPLT32 R_390 = 31
  2404. R_390_GOTPLT64 R_390 = 32
  2405. R_390_GOTPLTENT R_390 = 33
  2406. R_390_GOTPLTOFF16 R_390 = 34
  2407. R_390_GOTPLTOFF32 R_390 = 35
  2408. R_390_GOTPLTOFF64 R_390 = 36
  2409. R_390_TLS_LOAD R_390 = 37
  2410. R_390_TLS_GDCALL R_390 = 38
  2411. R_390_TLS_LDCALL R_390 = 39
  2412. R_390_TLS_GD32 R_390 = 40
  2413. R_390_TLS_GD64 R_390 = 41
  2414. R_390_TLS_GOTIE12 R_390 = 42
  2415. R_390_TLS_GOTIE32 R_390 = 43
  2416. R_390_TLS_GOTIE64 R_390 = 44
  2417. R_390_TLS_LDM32 R_390 = 45
  2418. R_390_TLS_LDM64 R_390 = 46
  2419. R_390_TLS_IE32 R_390 = 47
  2420. R_390_TLS_IE64 R_390 = 48
  2421. R_390_TLS_IEENT R_390 = 49
  2422. R_390_TLS_LE32 R_390 = 50
  2423. R_390_TLS_LE64 R_390 = 51
  2424. R_390_TLS_LDO32 R_390 = 52
  2425. R_390_TLS_LDO64 R_390 = 53
  2426. R_390_TLS_DTPMOD R_390 = 54
  2427. R_390_TLS_DTPOFF R_390 = 55
  2428. R_390_TLS_TPOFF R_390 = 56
  2429. R_390_20 R_390 = 57
  2430. R_390_GOT20 R_390 = 58
  2431. R_390_GOTPLT20 R_390 = 59
  2432. R_390_TLS_GOTIE20 R_390 = 60
  2433. )
  2434. var r390Strings = []intName{
  2435. {0, "R_390_NONE"},
  2436. {1, "R_390_8"},
  2437. {2, "R_390_12"},
  2438. {3, "R_390_16"},
  2439. {4, "R_390_32"},
  2440. {5, "R_390_PC32"},
  2441. {6, "R_390_GOT12"},
  2442. {7, "R_390_GOT32"},
  2443. {8, "R_390_PLT32"},
  2444. {9, "R_390_COPY"},
  2445. {10, "R_390_GLOB_DAT"},
  2446. {11, "R_390_JMP_SLOT"},
  2447. {12, "R_390_RELATIVE"},
  2448. {13, "R_390_GOTOFF"},
  2449. {14, "R_390_GOTPC"},
  2450. {15, "R_390_GOT16"},
  2451. {16, "R_390_PC16"},
  2452. {17, "R_390_PC16DBL"},
  2453. {18, "R_390_PLT16DBL"},
  2454. {19, "R_390_PC32DBL"},
  2455. {20, "R_390_PLT32DBL"},
  2456. {21, "R_390_GOTPCDBL"},
  2457. {22, "R_390_64"},
  2458. {23, "R_390_PC64"},
  2459. {24, "R_390_GOT64"},
  2460. {25, "R_390_PLT64"},
  2461. {26, "R_390_GOTENT"},
  2462. {27, "R_390_GOTOFF16"},
  2463. {28, "R_390_GOTOFF64"},
  2464. {29, "R_390_GOTPLT12"},
  2465. {30, "R_390_GOTPLT16"},
  2466. {31, "R_390_GOTPLT32"},
  2467. {32, "R_390_GOTPLT64"},
  2468. {33, "R_390_GOTPLTENT"},
  2469. {34, "R_390_GOTPLTOFF16"},
  2470. {35, "R_390_GOTPLTOFF32"},
  2471. {36, "R_390_GOTPLTOFF64"},
  2472. {37, "R_390_TLS_LOAD"},
  2473. {38, "R_390_TLS_GDCALL"},
  2474. {39, "R_390_TLS_LDCALL"},
  2475. {40, "R_390_TLS_GD32"},
  2476. {41, "R_390_TLS_GD64"},
  2477. {42, "R_390_TLS_GOTIE12"},
  2478. {43, "R_390_TLS_GOTIE32"},
  2479. {44, "R_390_TLS_GOTIE64"},
  2480. {45, "R_390_TLS_LDM32"},
  2481. {46, "R_390_TLS_LDM64"},
  2482. {47, "R_390_TLS_IE32"},
  2483. {48, "R_390_TLS_IE64"},
  2484. {49, "R_390_TLS_IEENT"},
  2485. {50, "R_390_TLS_LE32"},
  2486. {51, "R_390_TLS_LE64"},
  2487. {52, "R_390_TLS_LDO32"},
  2488. {53, "R_390_TLS_LDO64"},
  2489. {54, "R_390_TLS_DTPMOD"},
  2490. {55, "R_390_TLS_DTPOFF"},
  2491. {56, "R_390_TLS_TPOFF"},
  2492. {57, "R_390_20"},
  2493. {58, "R_390_GOT20"},
  2494. {59, "R_390_GOTPLT20"},
  2495. {60, "R_390_TLS_GOTIE20"},
  2496. }
  2497. func (i R_390) String() string { return stringName(uint32(i), r390Strings, false) }
  2498. func (i R_390) GoString() string { return stringName(uint32(i), r390Strings, true) }
  2499. // Relocation types for SPARC.
  2500. type R_SPARC int
  2501. const (
  2502. R_SPARC_NONE R_SPARC = 0
  2503. R_SPARC_8 R_SPARC = 1
  2504. R_SPARC_16 R_SPARC = 2
  2505. R_SPARC_32 R_SPARC = 3
  2506. R_SPARC_DISP8 R_SPARC = 4
  2507. R_SPARC_DISP16 R_SPARC = 5
  2508. R_SPARC_DISP32 R_SPARC = 6
  2509. R_SPARC_WDISP30 R_SPARC = 7
  2510. R_SPARC_WDISP22 R_SPARC = 8
  2511. R_SPARC_HI22 R_SPARC = 9
  2512. R_SPARC_22 R_SPARC = 10
  2513. R_SPARC_13 R_SPARC = 11
  2514. R_SPARC_LO10 R_SPARC = 12
  2515. R_SPARC_GOT10 R_SPARC = 13
  2516. R_SPARC_GOT13 R_SPARC = 14
  2517. R_SPARC_GOT22 R_SPARC = 15
  2518. R_SPARC_PC10 R_SPARC = 16
  2519. R_SPARC_PC22 R_SPARC = 17
  2520. R_SPARC_WPLT30 R_SPARC = 18
  2521. R_SPARC_COPY R_SPARC = 19
  2522. R_SPARC_GLOB_DAT R_SPARC = 20
  2523. R_SPARC_JMP_SLOT R_SPARC = 21
  2524. R_SPARC_RELATIVE R_SPARC = 22
  2525. R_SPARC_UA32 R_SPARC = 23
  2526. R_SPARC_PLT32 R_SPARC = 24
  2527. R_SPARC_HIPLT22 R_SPARC = 25
  2528. R_SPARC_LOPLT10 R_SPARC = 26
  2529. R_SPARC_PCPLT32 R_SPARC = 27
  2530. R_SPARC_PCPLT22 R_SPARC = 28
  2531. R_SPARC_PCPLT10 R_SPARC = 29
  2532. R_SPARC_10 R_SPARC = 30
  2533. R_SPARC_11 R_SPARC = 31
  2534. R_SPARC_64 R_SPARC = 32
  2535. R_SPARC_OLO10 R_SPARC = 33
  2536. R_SPARC_HH22 R_SPARC = 34
  2537. R_SPARC_HM10 R_SPARC = 35
  2538. R_SPARC_LM22 R_SPARC = 36
  2539. R_SPARC_PC_HH22 R_SPARC = 37
  2540. R_SPARC_PC_HM10 R_SPARC = 38
  2541. R_SPARC_PC_LM22 R_SPARC = 39
  2542. R_SPARC_WDISP16 R_SPARC = 40
  2543. R_SPARC_WDISP19 R_SPARC = 41
  2544. R_SPARC_GLOB_JMP R_SPARC = 42
  2545. R_SPARC_7 R_SPARC = 43
  2546. R_SPARC_5 R_SPARC = 44
  2547. R_SPARC_6 R_SPARC = 45
  2548. R_SPARC_DISP64 R_SPARC = 46
  2549. R_SPARC_PLT64 R_SPARC = 47
  2550. R_SPARC_HIX22 R_SPARC = 48
  2551. R_SPARC_LOX10 R_SPARC = 49
  2552. R_SPARC_H44 R_SPARC = 50
  2553. R_SPARC_M44 R_SPARC = 51
  2554. R_SPARC_L44 R_SPARC = 52
  2555. R_SPARC_REGISTER R_SPARC = 53
  2556. R_SPARC_UA64 R_SPARC = 54
  2557. R_SPARC_UA16 R_SPARC = 55
  2558. )
  2559. var rsparcStrings = []intName{
  2560. {0, "R_SPARC_NONE"},
  2561. {1, "R_SPARC_8"},
  2562. {2, "R_SPARC_16"},
  2563. {3, "R_SPARC_32"},
  2564. {4, "R_SPARC_DISP8"},
  2565. {5, "R_SPARC_DISP16"},
  2566. {6, "R_SPARC_DISP32"},
  2567. {7, "R_SPARC_WDISP30"},
  2568. {8, "R_SPARC_WDISP22"},
  2569. {9, "R_SPARC_HI22"},
  2570. {10, "R_SPARC_22"},
  2571. {11, "R_SPARC_13"},
  2572. {12, "R_SPARC_LO10"},
  2573. {13, "R_SPARC_GOT10"},
  2574. {14, "R_SPARC_GOT13"},
  2575. {15, "R_SPARC_GOT22"},
  2576. {16, "R_SPARC_PC10"},
  2577. {17, "R_SPARC_PC22"},
  2578. {18, "R_SPARC_WPLT30"},
  2579. {19, "R_SPARC_COPY"},
  2580. {20, "R_SPARC_GLOB_DAT"},
  2581. {21, "R_SPARC_JMP_SLOT"},
  2582. {22, "R_SPARC_RELATIVE"},
  2583. {23, "R_SPARC_UA32"},
  2584. {24, "R_SPARC_PLT32"},
  2585. {25, "R_SPARC_HIPLT22"},
  2586. {26, "R_SPARC_LOPLT10"},
  2587. {27, "R_SPARC_PCPLT32"},
  2588. {28, "R_SPARC_PCPLT22"},
  2589. {29, "R_SPARC_PCPLT10"},
  2590. {30, "R_SPARC_10"},
  2591. {31, "R_SPARC_11"},
  2592. {32, "R_SPARC_64"},
  2593. {33, "R_SPARC_OLO10"},
  2594. {34, "R_SPARC_HH22"},
  2595. {35, "R_SPARC_HM10"},
  2596. {36, "R_SPARC_LM22"},
  2597. {37, "R_SPARC_PC_HH22"},
  2598. {38, "R_SPARC_PC_HM10"},
  2599. {39, "R_SPARC_PC_LM22"},
  2600. {40, "R_SPARC_WDISP16"},
  2601. {41, "R_SPARC_WDISP19"},
  2602. {42, "R_SPARC_GLOB_JMP"},
  2603. {43, "R_SPARC_7"},
  2604. {44, "R_SPARC_5"},
  2605. {45, "R_SPARC_6"},
  2606. {46, "R_SPARC_DISP64"},
  2607. {47, "R_SPARC_PLT64"},
  2608. {48, "R_SPARC_HIX22"},
  2609. {49, "R_SPARC_LOX10"},
  2610. {50, "R_SPARC_H44"},
  2611. {51, "R_SPARC_M44"},
  2612. {52, "R_SPARC_L44"},
  2613. {53, "R_SPARC_REGISTER"},
  2614. {54, "R_SPARC_UA64"},
  2615. {55, "R_SPARC_UA16"},
  2616. }
  2617. func (i R_SPARC) String() string { return stringName(uint32(i), rsparcStrings, false) }
  2618. func (i R_SPARC) GoString() string { return stringName(uint32(i), rsparcStrings, true) }
  2619. // Magic number for the elf trampoline, chosen wisely to be an immediate value.
  2620. const ARM_MAGIC_TRAMP_NUMBER = 0x5c000003
  2621. // ELF32 File header.
  2622. type Header32 struct {
  2623. Ident [EI_NIDENT]byte /* File identification. */
  2624. Type uint16 /* File type. */
  2625. Machine uint16 /* Machine architecture. */
  2626. Version uint32 /* ELF format version. */
  2627. Entry uint32 /* Entry point. */
  2628. Phoff uint32 /* Program header file offset. */
  2629. Shoff uint32 /* Section header file offset. */
  2630. Flags uint32 /* Architecture-specific flags. */
  2631. Ehsize uint16 /* Size of ELF header in bytes. */
  2632. Phentsize uint16 /* Size of program header entry. */
  2633. Phnum uint16 /* Number of program header entries. */
  2634. Shentsize uint16 /* Size of section header entry. */
  2635. Shnum uint16 /* Number of section header entries. */
  2636. Shstrndx uint16 /* Section name strings section. */
  2637. }
  2638. // ELF32 Section header.
  2639. type Section32 struct {
  2640. Name uint32 /* Section name (index into the section header string table). */
  2641. Type uint32 /* Section type. */
  2642. Flags uint32 /* Section flags. */
  2643. Addr uint32 /* Address in memory image. */
  2644. Off uint32 /* Offset in file. */
  2645. Size uint32 /* Size in bytes. */
  2646. Link uint32 /* Index of a related section. */
  2647. Info uint32 /* Depends on section type. */
  2648. Addralign uint32 /* Alignment in bytes. */
  2649. Entsize uint32 /* Size of each entry in section. */
  2650. }
  2651. // ELF32 Program header.
  2652. type Prog32 struct {
  2653. Type uint32 /* Entry type. */
  2654. Off uint32 /* File offset of contents. */
  2655. Vaddr uint32 /* Virtual address in memory image. */
  2656. Paddr uint32 /* Physical address (not used). */
  2657. Filesz uint32 /* Size of contents in file. */
  2658. Memsz uint32 /* Size of contents in memory. */
  2659. Flags uint32 /* Access permission flags. */
  2660. Align uint32 /* Alignment in memory and file. */
  2661. }
  2662. // ELF32 Dynamic structure. The ".dynamic" section contains an array of them.
  2663. type Dyn32 struct {
  2664. Tag int32 /* Entry type. */
  2665. Val uint32 /* Integer/Address value. */
  2666. }
  2667. // ELF32 Compression header.
  2668. type Chdr32 struct {
  2669. Type uint32
  2670. Size uint32
  2671. Addralign uint32
  2672. }
  2673. /*
  2674. * Relocation entries.
  2675. */
  2676. // ELF32 Relocations that don't need an addend field.
  2677. type Rel32 struct {
  2678. Off uint32 /* Location to be relocated. */
  2679. Info uint32 /* Relocation type and symbol index. */
  2680. }
  2681. // ELF32 Relocations that need an addend field.
  2682. type Rela32 struct {
  2683. Off uint32 /* Location to be relocated. */
  2684. Info uint32 /* Relocation type and symbol index. */
  2685. Addend int32 /* Addend. */
  2686. }
  2687. func R_SYM32(info uint32) uint32 { return info >> 8 }
  2688. func R_TYPE32(info uint32) uint32 { return info & 0xff }
  2689. func R_INFO32(sym, typ uint32) uint32 { return sym<<8 | typ }
  2690. // ELF32 Symbol.
  2691. type Sym32 struct {
  2692. Name uint32
  2693. Value uint32
  2694. Size uint32
  2695. Info uint8
  2696. Other uint8
  2697. Shndx uint16
  2698. }
  2699. const Sym32Size = 16
  2700. func ST_BIND(info uint8) SymBind { return SymBind(info >> 4) }
  2701. func ST_TYPE(info uint8) SymType { return SymType(info & 0xF) }
  2702. func ST_INFO(bind SymBind, typ SymType) uint8 {
  2703. return uint8(bind)<<4 | uint8(typ)&0xf
  2704. }
  2705. func ST_VISIBILITY(other uint8) SymVis { return SymVis(other & 3) }
  2706. /*
  2707. * ELF64
  2708. */
  2709. // ELF64 file header.
  2710. type Header64 struct {
  2711. Ident [EI_NIDENT]byte /* File identification. */
  2712. Type uint16 /* File type. */
  2713. Machine uint16 /* Machine architecture. */
  2714. Version uint32 /* ELF format version. */
  2715. Entry uint64 /* Entry point. */
  2716. Phoff uint64 /* Program header file offset. */
  2717. Shoff uint64 /* Section header file offset. */
  2718. Flags uint32 /* Architecture-specific flags. */
  2719. Ehsize uint16 /* Size of ELF header in bytes. */
  2720. Phentsize uint16 /* Size of program header entry. */
  2721. Phnum uint16 /* Number of program header entries. */
  2722. Shentsize uint16 /* Size of section header entry. */
  2723. Shnum uint16 /* Number of section header entries. */
  2724. Shstrndx uint16 /* Section name strings section. */
  2725. }
  2726. // ELF64 Section header.
  2727. type Section64 struct {
  2728. Name uint32 /* Section name (index into the section header string table). */
  2729. Type uint32 /* Section type. */
  2730. Flags uint64 /* Section flags. */
  2731. Addr uint64 /* Address in memory image. */
  2732. Off uint64 /* Offset in file. */
  2733. Size uint64 /* Size in bytes. */
  2734. Link uint32 /* Index of a related section. */
  2735. Info uint32 /* Depends on section type. */
  2736. Addralign uint64 /* Alignment in bytes. */
  2737. Entsize uint64 /* Size of each entry in section. */
  2738. }
  2739. // ELF64 Program header.
  2740. type Prog64 struct {
  2741. Type uint32 /* Entry type. */
  2742. Flags uint32 /* Access permission flags. */
  2743. Off uint64 /* File offset of contents. */
  2744. Vaddr uint64 /* Virtual address in memory image. */
  2745. Paddr uint64 /* Physical address (not used). */
  2746. Filesz uint64 /* Size of contents in file. */
  2747. Memsz uint64 /* Size of contents in memory. */
  2748. Align uint64 /* Alignment in memory and file. */
  2749. }
  2750. // ELF64 Dynamic structure. The ".dynamic" section contains an array of them.
  2751. type Dyn64 struct {
  2752. Tag int64 /* Entry type. */
  2753. Val uint64 /* Integer/address value */
  2754. }
  2755. // ELF64 Compression header.
  2756. type Chdr64 struct {
  2757. Type uint32
  2758. _ uint32 /* Reserved. */
  2759. Size uint64
  2760. Addralign uint64
  2761. }
  2762. /*
  2763. * Relocation entries.
  2764. */
  2765. /* ELF64 relocations that don't need an addend field. */
  2766. type Rel64 struct {
  2767. Off uint64 /* Location to be relocated. */
  2768. Info uint64 /* Relocation type and symbol index. */
  2769. }
  2770. /* ELF64 relocations that need an addend field. */
  2771. type Rela64 struct {
  2772. Off uint64 /* Location to be relocated. */
  2773. Info uint64 /* Relocation type and symbol index. */
  2774. Addend int64 /* Addend. */
  2775. }
  2776. func R_SYM64(info uint64) uint32 { return uint32(info >> 32) }
  2777. func R_TYPE64(info uint64) uint32 { return uint32(info) }
  2778. func R_INFO(sym, typ uint32) uint64 { return uint64(sym)<<32 | uint64(typ) }
  2779. // ELF64 symbol table entries.
  2780. type Sym64 struct {
  2781. Name uint32 /* String table index of name. */
  2782. Info uint8 /* Type and binding information. */
  2783. Other uint8 /* Reserved (not used). */
  2784. Shndx uint16 /* Section index of symbol. */
  2785. Value uint64 /* Symbol value. */
  2786. Size uint64 /* Size of associated object. */
  2787. }
  2788. const Sym64Size = 24
  2789. type intName struct {
  2790. i uint32
  2791. s string
  2792. }
  2793. func stringName(i uint32, names []intName, goSyntax bool) string {
  2794. for _, n := range names {
  2795. if n.i == i {
  2796. if goSyntax {
  2797. return "elf." + n.s
  2798. }
  2799. return n.s
  2800. }
  2801. }
  2802. // second pass - look for smaller to add with.
  2803. // assume sorted already
  2804. for j := len(names) - 1; j >= 0; j-- {
  2805. n := names[j]
  2806. if n.i < i {
  2807. s := n.s
  2808. if goSyntax {
  2809. s = "elf." + s
  2810. }
  2811. return s + "+" + strconv.FormatUint(uint64(i-n.i), 10)
  2812. }
  2813. }
  2814. return strconv.FormatUint(uint64(i), 10)
  2815. }
  2816. func flagName(i uint32, names []intName, goSyntax bool) string {
  2817. s := ""
  2818. for _, n := range names {
  2819. if n.i&i == n.i {
  2820. if len(s) > 0 {
  2821. s += "+"
  2822. }
  2823. if goSyntax {
  2824. s += "elf."
  2825. }
  2826. s += n.s
  2827. i -= n.i
  2828. }
  2829. }
  2830. if len(s) == 0 {
  2831. return "0x" + strconv.FormatUint(uint64(i), 16)
  2832. }
  2833. if i != 0 {
  2834. s += "+0x" + strconv.FormatUint(uint64(i), 16)
  2835. }
  2836. return s
  2837. }