github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/src/debug/elf/elf.go (about)

     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   * "ELF for the ARMĀ® 64-bit Architecture (AArch64)" (ARM IHI 0056B)
    15   *
    16   * Copyright (c) 1996-1998 John D. Polstra.  All rights reserved.
    17   * Copyright (c) 2001 David E. O'Brien
    18   * Portions Copyright 2009 The Go Authors. All rights reserved.
    19   *
    20   * Redistribution and use in source and binary forms, with or without
    21   * modification, are permitted provided that the following conditions
    22   * are met:
    23   * 1. Redistributions of source code must retain the above copyright
    24   *    notice, this list of conditions and the following disclaimer.
    25   * 2. Redistributions in binary form must reproduce the above copyright
    26   *    notice, this list of conditions and the following disclaimer in the
    27   *    documentation and/or other materials provided with the distribution.
    28   *
    29   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
    30   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    31   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    32   * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
    33   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    34   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    35   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    36   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    37   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    38   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    39   * SUCH DAMAGE.
    40   */
    41  
    42  package elf
    43  
    44  import "strconv"
    45  
    46  /*
    47   * Constants
    48   */
    49  
    50  // Indexes into the Header.Ident array.
    51  const (
    52  	EI_CLASS      = 4  /* Class of machine. */
    53  	EI_DATA       = 5  /* Data format. */
    54  	EI_VERSION    = 6  /* ELF format version. */
    55  	EI_OSABI      = 7  /* Operating system / ABI identification */
    56  	EI_ABIVERSION = 8  /* ABI version */
    57  	EI_PAD        = 9  /* Start of padding (per SVR4 ABI). */
    58  	EI_NIDENT     = 16 /* Size of e_ident array. */
    59  )
    60  
    61  // Initial magic number for ELF files.
    62  const ELFMAG = "\177ELF"
    63  
    64  // Version is found in Header.Ident[EI_VERSION] and Header.Version.
    65  type Version byte
    66  
    67  const (
    68  	EV_NONE    Version = 0
    69  	EV_CURRENT Version = 1
    70  )
    71  
    72  var versionStrings = []intName{
    73  	{0, "EV_NONE"},
    74  	{1, "EV_CURRENT"},
    75  }
    76  
    77  func (i Version) String() string   { return stringName(uint32(i), versionStrings, false) }
    78  func (i Version) GoString() string { return stringName(uint32(i), versionStrings, true) }
    79  
    80  // Class is found in Header.Ident[EI_CLASS] and Header.Class.
    81  type Class byte
    82  
    83  const (
    84  	ELFCLASSNONE Class = 0 /* Unknown class. */
    85  	ELFCLASS32   Class = 1 /* 32-bit architecture. */
    86  	ELFCLASS64   Class = 2 /* 64-bit architecture. */
    87  )
    88  
    89  var classStrings = []intName{
    90  	{0, "ELFCLASSNONE"},
    91  	{1, "ELFCLASS32"},
    92  	{2, "ELFCLASS64"},
    93  }
    94  
    95  func (i Class) String() string   { return stringName(uint32(i), classStrings, false) }
    96  func (i Class) GoString() string { return stringName(uint32(i), classStrings, true) }
    97  
    98  // Data is found in Header.Ident[EI_DATA] and Header.Data.
    99  type Data byte
   100  
   101  const (
   102  	ELFDATANONE Data = 0 /* Unknown data format. */
   103  	ELFDATA2LSB Data = 1 /* 2's complement little-endian. */
   104  	ELFDATA2MSB Data = 2 /* 2's complement big-endian. */
   105  )
   106  
   107  var dataStrings = []intName{
   108  	{0, "ELFDATANONE"},
   109  	{1, "ELFDATA2LSB"},
   110  	{2, "ELFDATA2MSB"},
   111  }
   112  
   113  func (i Data) String() string   { return stringName(uint32(i), dataStrings, false) }
   114  func (i Data) GoString() string { return stringName(uint32(i), dataStrings, true) }
   115  
   116  // OSABI is found in Header.Ident[EI_OSABI] and Header.OSABI.
   117  type OSABI byte
   118  
   119  const (
   120  	ELFOSABI_NONE       OSABI = 0   /* UNIX System V ABI */
   121  	ELFOSABI_HPUX       OSABI = 1   /* HP-UX operating system */
   122  	ELFOSABI_NETBSD     OSABI = 2   /* NetBSD */
   123  	ELFOSABI_LINUX      OSABI = 3   /* GNU/Linux */
   124  	ELFOSABI_HURD       OSABI = 4   /* GNU/Hurd */
   125  	ELFOSABI_86OPEN     OSABI = 5   /* 86Open common IA32 ABI */
   126  	ELFOSABI_SOLARIS    OSABI = 6   /* Solaris */
   127  	ELFOSABI_AIX        OSABI = 7   /* AIX */
   128  	ELFOSABI_IRIX       OSABI = 8   /* IRIX */
   129  	ELFOSABI_FREEBSD    OSABI = 9   /* FreeBSD */
   130  	ELFOSABI_TRU64      OSABI = 10  /* TRU64 UNIX */
   131  	ELFOSABI_MODESTO    OSABI = 11  /* Novell Modesto */
   132  	ELFOSABI_OPENBSD    OSABI = 12  /* OpenBSD */
   133  	ELFOSABI_OPENVMS    OSABI = 13  /* Open VMS */
   134  	ELFOSABI_NSK        OSABI = 14  /* HP Non-Stop Kernel */
   135  	ELFOSABI_ARM        OSABI = 97  /* ARM */
   136  	ELFOSABI_STANDALONE OSABI = 255 /* Standalone (embedded) application */
   137  )
   138  
   139  var osabiStrings = []intName{
   140  	{0, "ELFOSABI_NONE"},
   141  	{1, "ELFOSABI_HPUX"},
   142  	{2, "ELFOSABI_NETBSD"},
   143  	{3, "ELFOSABI_LINUX"},
   144  	{4, "ELFOSABI_HURD"},
   145  	{5, "ELFOSABI_86OPEN"},
   146  	{6, "ELFOSABI_SOLARIS"},
   147  	{7, "ELFOSABI_AIX"},
   148  	{8, "ELFOSABI_IRIX"},
   149  	{9, "ELFOSABI_FREEBSD"},
   150  	{10, "ELFOSABI_TRU64"},
   151  	{11, "ELFOSABI_MODESTO"},
   152  	{12, "ELFOSABI_OPENBSD"},
   153  	{13, "ELFOSABI_OPENVMS"},
   154  	{14, "ELFOSABI_NSK"},
   155  	{97, "ELFOSABI_ARM"},
   156  	{255, "ELFOSABI_STANDALONE"},
   157  }
   158  
   159  func (i OSABI) String() string   { return stringName(uint32(i), osabiStrings, false) }
   160  func (i OSABI) GoString() string { return stringName(uint32(i), osabiStrings, true) }
   161  
   162  // Type is found in Header.Type.
   163  type Type uint16
   164  
   165  const (
   166  	ET_NONE   Type = 0      /* Unknown type. */
   167  	ET_REL    Type = 1      /* Relocatable. */
   168  	ET_EXEC   Type = 2      /* Executable. */
   169  	ET_DYN    Type = 3      /* Shared object. */
   170  	ET_CORE   Type = 4      /* Core file. */
   171  	ET_LOOS   Type = 0xfe00 /* First operating system specific. */
   172  	ET_HIOS   Type = 0xfeff /* Last operating system-specific. */
   173  	ET_LOPROC Type = 0xff00 /* First processor-specific. */
   174  	ET_HIPROC Type = 0xffff /* Last processor-specific. */
   175  )
   176  
   177  var typeStrings = []intName{
   178  	{0, "ET_NONE"},
   179  	{1, "ET_REL"},
   180  	{2, "ET_EXEC"},
   181  	{3, "ET_DYN"},
   182  	{4, "ET_CORE"},
   183  	{0xfe00, "ET_LOOS"},
   184  	{0xfeff, "ET_HIOS"},
   185  	{0xff00, "ET_LOPROC"},
   186  	{0xffff, "ET_HIPROC"},
   187  }
   188  
   189  func (i Type) String() string   { return stringName(uint32(i), typeStrings, false) }
   190  func (i Type) GoString() string { return stringName(uint32(i), typeStrings, true) }
   191  
   192  // Machine is found in Header.Machine.
   193  type Machine uint16
   194  
   195  const (
   196  	EM_NONE        Machine = 0   /* Unknown machine. */
   197  	EM_M32         Machine = 1   /* AT&T WE32100. */
   198  	EM_SPARC       Machine = 2   /* Sun SPARC. */
   199  	EM_386         Machine = 3   /* Intel i386. */
   200  	EM_68K         Machine = 4   /* Motorola 68000. */
   201  	EM_88K         Machine = 5   /* Motorola 88000. */
   202  	EM_860         Machine = 7   /* Intel i860. */
   203  	EM_MIPS        Machine = 8   /* MIPS R3000 Big-Endian only. */
   204  	EM_S370        Machine = 9   /* IBM System/370. */
   205  	EM_MIPS_RS3_LE Machine = 10  /* MIPS R3000 Little-Endian. */
   206  	EM_PARISC      Machine = 15  /* HP PA-RISC. */
   207  	EM_VPP500      Machine = 17  /* Fujitsu VPP500. */
   208  	EM_SPARC32PLUS Machine = 18  /* SPARC v8plus. */
   209  	EM_960         Machine = 19  /* Intel 80960. */
   210  	EM_PPC         Machine = 20  /* PowerPC 32-bit. */
   211  	EM_PPC64       Machine = 21  /* PowerPC 64-bit. */
   212  	EM_S390        Machine = 22  /* IBM System/390. */
   213  	EM_V800        Machine = 36  /* NEC V800. */
   214  	EM_FR20        Machine = 37  /* Fujitsu FR20. */
   215  	EM_RH32        Machine = 38  /* TRW RH-32. */
   216  	EM_RCE         Machine = 39  /* Motorola RCE. */
   217  	EM_ARM         Machine = 40  /* ARM. */
   218  	EM_SH          Machine = 42  /* Hitachi SH. */
   219  	EM_SPARCV9     Machine = 43  /* SPARC v9 64-bit. */
   220  	EM_TRICORE     Machine = 44  /* Siemens TriCore embedded processor. */
   221  	EM_ARC         Machine = 45  /* Argonaut RISC Core. */
   222  	EM_H8_300      Machine = 46  /* Hitachi H8/300. */
   223  	EM_H8_300H     Machine = 47  /* Hitachi H8/300H. */
   224  	EM_H8S         Machine = 48  /* Hitachi H8S. */
   225  	EM_H8_500      Machine = 49  /* Hitachi H8/500. */
   226  	EM_IA_64       Machine = 50  /* Intel IA-64 Processor. */
   227  	EM_MIPS_X      Machine = 51  /* Stanford MIPS-X. */
   228  	EM_COLDFIRE    Machine = 52  /* Motorola ColdFire. */
   229  	EM_68HC12      Machine = 53  /* Motorola M68HC12. */
   230  	EM_MMA         Machine = 54  /* Fujitsu MMA. */
   231  	EM_PCP         Machine = 55  /* Siemens PCP. */
   232  	EM_NCPU        Machine = 56  /* Sony nCPU. */
   233  	EM_NDR1        Machine = 57  /* Denso NDR1 microprocessor. */
   234  	EM_STARCORE    Machine = 58  /* Motorola Star*Core processor. */
   235  	EM_ME16        Machine = 59  /* Toyota ME16 processor. */
   236  	EM_ST100       Machine = 60  /* STMicroelectronics ST100 processor. */
   237  	EM_TINYJ       Machine = 61  /* Advanced Logic Corp. TinyJ processor. */
   238  	EM_X86_64      Machine = 62  /* Advanced Micro Devices x86-64 */
   239  	EM_AARCH64     Machine = 183 /* ARM 64-bit Architecture (AArch64) */
   240  	EM_RISCV       Machine = 243 /* RISC-V */
   241  
   242  	/* Non-standard or deprecated. */
   243  	EM_486         Machine = 6      /* Intel i486. */
   244  	EM_MIPS_RS4_BE Machine = 10     /* MIPS R4000 Big-Endian */
   245  	EM_ALPHA_STD   Machine = 41     /* Digital Alpha (standard value). */
   246  	EM_ALPHA       Machine = 0x9026 /* Alpha (written in the absence of an ABI) */
   247  )
   248  
   249  var machineStrings = []intName{
   250  	{0, "EM_NONE"},
   251  	{1, "EM_M32"},
   252  	{2, "EM_SPARC"},
   253  	{3, "EM_386"},
   254  	{4, "EM_68K"},
   255  	{5, "EM_88K"},
   256  	{7, "EM_860"},
   257  	{8, "EM_MIPS"},
   258  	{9, "EM_S370"},
   259  	{10, "EM_MIPS_RS3_LE"},
   260  	{15, "EM_PARISC"},
   261  	{17, "EM_VPP500"},
   262  	{18, "EM_SPARC32PLUS"},
   263  	{19, "EM_960"},
   264  	{20, "EM_PPC"},
   265  	{21, "EM_PPC64"},
   266  	{22, "EM_S390"},
   267  	{36, "EM_V800"},
   268  	{37, "EM_FR20"},
   269  	{38, "EM_RH32"},
   270  	{39, "EM_RCE"},
   271  	{40, "EM_ARM"},
   272  	{42, "EM_SH"},
   273  	{43, "EM_SPARCV9"},
   274  	{44, "EM_TRICORE"},
   275  	{45, "EM_ARC"},
   276  	{46, "EM_H8_300"},
   277  	{47, "EM_H8_300H"},
   278  	{48, "EM_H8S"},
   279  	{49, "EM_H8_500"},
   280  	{50, "EM_IA_64"},
   281  	{51, "EM_MIPS_X"},
   282  	{52, "EM_COLDFIRE"},
   283  	{53, "EM_68HC12"},
   284  	{54, "EM_MMA"},
   285  	{55, "EM_PCP"},
   286  	{56, "EM_NCPU"},
   287  	{57, "EM_NDR1"},
   288  	{58, "EM_STARCORE"},
   289  	{59, "EM_ME16"},
   290  	{60, "EM_ST100"},
   291  	{61, "EM_TINYJ"},
   292  	{62, "EM_X86_64"},
   293  	{243, "EM_RISCV"},
   294  
   295  	/* Non-standard or deprecated. */
   296  	{6, "EM_486"},
   297  	{10, "EM_MIPS_RS4_BE"},
   298  	{41, "EM_ALPHA_STD"},
   299  	{0x9026, "EM_ALPHA"},
   300  }
   301  
   302  func (i Machine) String() string   { return stringName(uint32(i), machineStrings, false) }
   303  func (i Machine) GoString() string { return stringName(uint32(i), machineStrings, true) }
   304  
   305  // Special section indices.
   306  type SectionIndex int
   307  
   308  const (
   309  	SHN_UNDEF     SectionIndex = 0      /* Undefined, missing, irrelevant. */
   310  	SHN_LORESERVE SectionIndex = 0xff00 /* First of reserved range. */
   311  	SHN_LOPROC    SectionIndex = 0xff00 /* First processor-specific. */
   312  	SHN_HIPROC    SectionIndex = 0xff1f /* Last processor-specific. */
   313  	SHN_LOOS      SectionIndex = 0xff20 /* First operating system-specific. */
   314  	SHN_HIOS      SectionIndex = 0xff3f /* Last operating system-specific. */
   315  	SHN_ABS       SectionIndex = 0xfff1 /* Absolute values. */
   316  	SHN_COMMON    SectionIndex = 0xfff2 /* Common data. */
   317  	SHN_XINDEX    SectionIndex = 0xffff /* Escape; index stored elsewhere. */
   318  	SHN_HIRESERVE SectionIndex = 0xffff /* Last of reserved range. */
   319  )
   320  
   321  var shnStrings = []intName{
   322  	{0, "SHN_UNDEF"},
   323  	{0xff00, "SHN_LOPROC"},
   324  	{0xff20, "SHN_LOOS"},
   325  	{0xfff1, "SHN_ABS"},
   326  	{0xfff2, "SHN_COMMON"},
   327  	{0xffff, "SHN_XINDEX"},
   328  }
   329  
   330  func (i SectionIndex) String() string   { return stringName(uint32(i), shnStrings, false) }
   331  func (i SectionIndex) GoString() string { return stringName(uint32(i), shnStrings, true) }
   332  
   333  // Section type.
   334  type SectionType uint32
   335  
   336  const (
   337  	SHT_NULL           SectionType = 0          /* inactive */
   338  	SHT_PROGBITS       SectionType = 1          /* program defined information */
   339  	SHT_SYMTAB         SectionType = 2          /* symbol table section */
   340  	SHT_STRTAB         SectionType = 3          /* string table section */
   341  	SHT_RELA           SectionType = 4          /* relocation section with addends */
   342  	SHT_HASH           SectionType = 5          /* symbol hash table section */
   343  	SHT_DYNAMIC        SectionType = 6          /* dynamic section */
   344  	SHT_NOTE           SectionType = 7          /* note section */
   345  	SHT_NOBITS         SectionType = 8          /* no space section */
   346  	SHT_REL            SectionType = 9          /* relocation section - no addends */
   347  	SHT_SHLIB          SectionType = 10         /* reserved - purpose unknown */
   348  	SHT_DYNSYM         SectionType = 11         /* dynamic symbol table section */
   349  	SHT_INIT_ARRAY     SectionType = 14         /* Initialization function pointers. */
   350  	SHT_FINI_ARRAY     SectionType = 15         /* Termination function pointers. */
   351  	SHT_PREINIT_ARRAY  SectionType = 16         /* Pre-initialization function ptrs. */
   352  	SHT_GROUP          SectionType = 17         /* Section group. */
   353  	SHT_SYMTAB_SHNDX   SectionType = 18         /* Section indexes (see SHN_XINDEX). */
   354  	SHT_LOOS           SectionType = 0x60000000 /* First of OS specific semantics */
   355  	SHT_GNU_ATTRIBUTES SectionType = 0x6ffffff5 /* GNU object attributes */
   356  	SHT_GNU_HASH       SectionType = 0x6ffffff6 /* GNU hash table */
   357  	SHT_GNU_LIBLIST    SectionType = 0x6ffffff7 /* GNU prelink library list */
   358  	SHT_GNU_VERDEF     SectionType = 0x6ffffffd /* GNU version definition section */
   359  	SHT_GNU_VERNEED    SectionType = 0x6ffffffe /* GNU version needs section */
   360  	SHT_GNU_VERSYM     SectionType = 0x6fffffff /* GNU version symbol table */
   361  	SHT_HIOS           SectionType = 0x6fffffff /* Last of OS specific semantics */
   362  	SHT_LOPROC         SectionType = 0x70000000 /* reserved range for processor */
   363  	SHT_HIPROC         SectionType = 0x7fffffff /* specific section header types */
   364  	SHT_LOUSER         SectionType = 0x80000000 /* reserved range for application */
   365  	SHT_HIUSER         SectionType = 0xffffffff /* specific indexes */
   366  )
   367  
   368  var shtStrings = []intName{
   369  	{0, "SHT_NULL"},
   370  	{1, "SHT_PROGBITS"},
   371  	{2, "SHT_SYMTAB"},
   372  	{3, "SHT_STRTAB"},
   373  	{4, "SHT_RELA"},
   374  	{5, "SHT_HASH"},
   375  	{6, "SHT_DYNAMIC"},
   376  	{7, "SHT_NOTE"},
   377  	{8, "SHT_NOBITS"},
   378  	{9, "SHT_REL"},
   379  	{10, "SHT_SHLIB"},
   380  	{11, "SHT_DYNSYM"},
   381  	{14, "SHT_INIT_ARRAY"},
   382  	{15, "SHT_FINI_ARRAY"},
   383  	{16, "SHT_PREINIT_ARRAY"},
   384  	{17, "SHT_GROUP"},
   385  	{18, "SHT_SYMTAB_SHNDX"},
   386  	{0x60000000, "SHT_LOOS"},
   387  	{0x6ffffff5, "SHT_GNU_ATTRIBUTES"},
   388  	{0x6ffffff6, "SHT_GNU_HASH"},
   389  	{0x6ffffff7, "SHT_GNU_LIBLIST"},
   390  	{0x6ffffffd, "SHT_GNU_VERDEF"},
   391  	{0x6ffffffe, "SHT_GNU_VERNEED"},
   392  	{0x6fffffff, "SHT_GNU_VERSYM"},
   393  	{0x70000000, "SHT_LOPROC"},
   394  	{0x7fffffff, "SHT_HIPROC"},
   395  	{0x80000000, "SHT_LOUSER"},
   396  	{0xffffffff, "SHT_HIUSER"},
   397  }
   398  
   399  func (i SectionType) String() string   { return stringName(uint32(i), shtStrings, false) }
   400  func (i SectionType) GoString() string { return stringName(uint32(i), shtStrings, true) }
   401  
   402  // Section flags.
   403  type SectionFlag uint32
   404  
   405  const (
   406  	SHF_WRITE            SectionFlag = 0x1        /* Section contains writable data. */
   407  	SHF_ALLOC            SectionFlag = 0x2        /* Section occupies memory. */
   408  	SHF_EXECINSTR        SectionFlag = 0x4        /* Section contains instructions. */
   409  	SHF_MERGE            SectionFlag = 0x10       /* Section may be merged. */
   410  	SHF_STRINGS          SectionFlag = 0x20       /* Section contains strings. */
   411  	SHF_INFO_LINK        SectionFlag = 0x40       /* sh_info holds section index. */
   412  	SHF_LINK_ORDER       SectionFlag = 0x80       /* Special ordering requirements. */
   413  	SHF_OS_NONCONFORMING SectionFlag = 0x100      /* OS-specific processing required. */
   414  	SHF_GROUP            SectionFlag = 0x200      /* Member of section group. */
   415  	SHF_TLS              SectionFlag = 0x400      /* Section contains TLS data. */
   416  	SHF_COMPRESSED       SectionFlag = 0x800      /* Section is compressed. */
   417  	SHF_MASKOS           SectionFlag = 0x0ff00000 /* OS-specific semantics. */
   418  	SHF_MASKPROC         SectionFlag = 0xf0000000 /* Processor-specific semantics. */
   419  )
   420  
   421  var shfStrings = []intName{
   422  	{0x1, "SHF_WRITE"},
   423  	{0x2, "SHF_ALLOC"},
   424  	{0x4, "SHF_EXECINSTR"},
   425  	{0x10, "SHF_MERGE"},
   426  	{0x20, "SHF_STRINGS"},
   427  	{0x40, "SHF_INFO_LINK"},
   428  	{0x80, "SHF_LINK_ORDER"},
   429  	{0x100, "SHF_OS_NONCONFORMING"},
   430  	{0x200, "SHF_GROUP"},
   431  	{0x400, "SHF_TLS"},
   432  	{0x800, "SHF_COMPRESSED"},
   433  }
   434  
   435  func (i SectionFlag) String() string   { return flagName(uint32(i), shfStrings, false) }
   436  func (i SectionFlag) GoString() string { return flagName(uint32(i), shfStrings, true) }
   437  
   438  // Section compression type.
   439  type CompressionType int
   440  
   441  const (
   442  	COMPRESS_ZLIB   CompressionType = 1          /* ZLIB compression. */
   443  	COMPRESS_LOOS   CompressionType = 0x60000000 /* First OS-specific. */
   444  	COMPRESS_HIOS   CompressionType = 0x6fffffff /* Last OS-specific. */
   445  	COMPRESS_LOPROC CompressionType = 0x70000000 /* First processor-specific type. */
   446  	COMPRESS_HIPROC CompressionType = 0x7fffffff /* Last processor-specific type. */
   447  )
   448  
   449  var compressionStrings = []intName{
   450  	{0, "COMPRESS_ZLIB"},
   451  	{0x60000000, "COMPRESS_LOOS"},
   452  	{0x6fffffff, "COMPRESS_HIOS"},
   453  	{0x70000000, "COMPRESS_LOPROC"},
   454  	{0x7fffffff, "COMPRESS_HIPROC"},
   455  }
   456  
   457  func (i CompressionType) String() string   { return stringName(uint32(i), compressionStrings, false) }
   458  func (i CompressionType) GoString() string { return stringName(uint32(i), compressionStrings, true) }
   459  
   460  // Prog.Type
   461  type ProgType int
   462  
   463  const (
   464  	PT_NULL    ProgType = 0          /* Unused entry. */
   465  	PT_LOAD    ProgType = 1          /* Loadable segment. */
   466  	PT_DYNAMIC ProgType = 2          /* Dynamic linking information segment. */
   467  	PT_INTERP  ProgType = 3          /* Pathname of interpreter. */
   468  	PT_NOTE    ProgType = 4          /* Auxiliary information. */
   469  	PT_SHLIB   ProgType = 5          /* Reserved (not used). */
   470  	PT_PHDR    ProgType = 6          /* Location of program header itself. */
   471  	PT_TLS     ProgType = 7          /* Thread local storage segment */
   472  	PT_LOOS    ProgType = 0x60000000 /* First OS-specific. */
   473  	PT_HIOS    ProgType = 0x6fffffff /* Last OS-specific. */
   474  	PT_LOPROC  ProgType = 0x70000000 /* First processor-specific type. */
   475  	PT_HIPROC  ProgType = 0x7fffffff /* Last processor-specific type. */
   476  )
   477  
   478  var ptStrings = []intName{
   479  	{0, "PT_NULL"},
   480  	{1, "PT_LOAD"},
   481  	{2, "PT_DYNAMIC"},
   482  	{3, "PT_INTERP"},
   483  	{4, "PT_NOTE"},
   484  	{5, "PT_SHLIB"},
   485  	{6, "PT_PHDR"},
   486  	{7, "PT_TLS"},
   487  	{0x60000000, "PT_LOOS"},
   488  	{0x6fffffff, "PT_HIOS"},
   489  	{0x70000000, "PT_LOPROC"},
   490  	{0x7fffffff, "PT_HIPROC"},
   491  }
   492  
   493  func (i ProgType) String() string   { return stringName(uint32(i), ptStrings, false) }
   494  func (i ProgType) GoString() string { return stringName(uint32(i), ptStrings, true) }
   495  
   496  // Prog.Flag
   497  type ProgFlag uint32
   498  
   499  const (
   500  	PF_X        ProgFlag = 0x1        /* Executable. */
   501  	PF_W        ProgFlag = 0x2        /* Writable. */
   502  	PF_R        ProgFlag = 0x4        /* Readable. */
   503  	PF_MASKOS   ProgFlag = 0x0ff00000 /* Operating system-specific. */
   504  	PF_MASKPROC ProgFlag = 0xf0000000 /* Processor-specific. */
   505  )
   506  
   507  var pfStrings = []intName{
   508  	{0x1, "PF_X"},
   509  	{0x2, "PF_W"},
   510  	{0x4, "PF_R"},
   511  }
   512  
   513  func (i ProgFlag) String() string   { return flagName(uint32(i), pfStrings, false) }
   514  func (i ProgFlag) GoString() string { return flagName(uint32(i), pfStrings, true) }
   515  
   516  // Dyn.Tag
   517  type DynTag int
   518  
   519  const (
   520  	DT_NULL         DynTag = 0  /* Terminating entry. */
   521  	DT_NEEDED       DynTag = 1  /* String table offset of a needed shared library. */
   522  	DT_PLTRELSZ     DynTag = 2  /* Total size in bytes of PLT relocations. */
   523  	DT_PLTGOT       DynTag = 3  /* Processor-dependent address. */
   524  	DT_HASH         DynTag = 4  /* Address of symbol hash table. */
   525  	DT_STRTAB       DynTag = 5  /* Address of string table. */
   526  	DT_SYMTAB       DynTag = 6  /* Address of symbol table. */
   527  	DT_RELA         DynTag = 7  /* Address of ElfNN_Rela relocations. */
   528  	DT_RELASZ       DynTag = 8  /* Total size of ElfNN_Rela relocations. */
   529  	DT_RELAENT      DynTag = 9  /* Size of each ElfNN_Rela relocation entry. */
   530  	DT_STRSZ        DynTag = 10 /* Size of string table. */
   531  	DT_SYMENT       DynTag = 11 /* Size of each symbol table entry. */
   532  	DT_INIT         DynTag = 12 /* Address of initialization function. */
   533  	DT_FINI         DynTag = 13 /* Address of finalization function. */
   534  	DT_SONAME       DynTag = 14 /* String table offset of shared object name. */
   535  	DT_RPATH        DynTag = 15 /* String table offset of library path. [sup] */
   536  	DT_SYMBOLIC     DynTag = 16 /* Indicates "symbolic" linking. [sup] */
   537  	DT_REL          DynTag = 17 /* Address of ElfNN_Rel relocations. */
   538  	DT_RELSZ        DynTag = 18 /* Total size of ElfNN_Rel relocations. */
   539  	DT_RELENT       DynTag = 19 /* Size of each ElfNN_Rel relocation. */
   540  	DT_PLTREL       DynTag = 20 /* Type of relocation used for PLT. */
   541  	DT_DEBUG        DynTag = 21 /* Reserved (not used). */
   542  	DT_TEXTREL      DynTag = 22 /* Indicates there may be relocations in non-writable segments. [sup] */
   543  	DT_JMPREL       DynTag = 23 /* Address of PLT relocations. */
   544  	DT_BIND_NOW     DynTag = 24 /* [sup] */
   545  	DT_INIT_ARRAY   DynTag = 25 /* Address of the array of pointers to initialization functions */
   546  	DT_FINI_ARRAY   DynTag = 26 /* Address of the array of pointers to termination functions */
   547  	DT_INIT_ARRAYSZ DynTag = 27 /* Size in bytes of the array of initialization functions. */
   548  	DT_FINI_ARRAYSZ DynTag = 28 /* Size in bytes of the array of termination functions. */
   549  	DT_RUNPATH      DynTag = 29 /* String table offset of a null-terminated library search path string. */
   550  	DT_FLAGS        DynTag = 30 /* Object specific flag values. */
   551  	DT_ENCODING     DynTag = 32 /* Values greater than or equal to DT_ENCODING
   552  	   and less than DT_LOOS follow the rules for
   553  	   the interpretation of the d_un union
   554  	   as follows: even == 'd_ptr', even == 'd_val'
   555  	   or none */
   556  	DT_PREINIT_ARRAY   DynTag = 32         /* Address of the array of pointers to pre-initialization functions. */
   557  	DT_PREINIT_ARRAYSZ DynTag = 33         /* Size in bytes of the array of pre-initialization functions. */
   558  	DT_LOOS            DynTag = 0x6000000d /* First OS-specific */
   559  	DT_HIOS            DynTag = 0x6ffff000 /* Last OS-specific */
   560  	DT_VERSYM          DynTag = 0x6ffffff0
   561  	DT_VERNEED         DynTag = 0x6ffffffe
   562  	DT_VERNEEDNUM      DynTag = 0x6fffffff
   563  	DT_LOPROC          DynTag = 0x70000000 /* First processor-specific type. */
   564  	DT_HIPROC          DynTag = 0x7fffffff /* Last processor-specific type. */
   565  )
   566  
   567  var dtStrings = []intName{
   568  	{0, "DT_NULL"},
   569  	{1, "DT_NEEDED"},
   570  	{2, "DT_PLTRELSZ"},
   571  	{3, "DT_PLTGOT"},
   572  	{4, "DT_HASH"},
   573  	{5, "DT_STRTAB"},
   574  	{6, "DT_SYMTAB"},
   575  	{7, "DT_RELA"},
   576  	{8, "DT_RELASZ"},
   577  	{9, "DT_RELAENT"},
   578  	{10, "DT_STRSZ"},
   579  	{11, "DT_SYMENT"},
   580  	{12, "DT_INIT"},
   581  	{13, "DT_FINI"},
   582  	{14, "DT_SONAME"},
   583  	{15, "DT_RPATH"},
   584  	{16, "DT_SYMBOLIC"},
   585  	{17, "DT_REL"},
   586  	{18, "DT_RELSZ"},
   587  	{19, "DT_RELENT"},
   588  	{20, "DT_PLTREL"},
   589  	{21, "DT_DEBUG"},
   590  	{22, "DT_TEXTREL"},
   591  	{23, "DT_JMPREL"},
   592  	{24, "DT_BIND_NOW"},
   593  	{25, "DT_INIT_ARRAY"},
   594  	{26, "DT_FINI_ARRAY"},
   595  	{27, "DT_INIT_ARRAYSZ"},
   596  	{28, "DT_FINI_ARRAYSZ"},
   597  	{29, "DT_RUNPATH"},
   598  	{30, "DT_FLAGS"},
   599  	{32, "DT_ENCODING"},
   600  	{32, "DT_PREINIT_ARRAY"},
   601  	{33, "DT_PREINIT_ARRAYSZ"},
   602  	{0x6000000d, "DT_LOOS"},
   603  	{0x6ffff000, "DT_HIOS"},
   604  	{0x6ffffff0, "DT_VERSYM"},
   605  	{0x6ffffffe, "DT_VERNEED"},
   606  	{0x6fffffff, "DT_VERNEEDNUM"},
   607  	{0x70000000, "DT_LOPROC"},
   608  	{0x7fffffff, "DT_HIPROC"},
   609  }
   610  
   611  func (i DynTag) String() string   { return stringName(uint32(i), dtStrings, false) }
   612  func (i DynTag) GoString() string { return stringName(uint32(i), dtStrings, true) }
   613  
   614  // DT_FLAGS values.
   615  type DynFlag int
   616  
   617  const (
   618  	DF_ORIGIN DynFlag = 0x0001 /* Indicates that the object being loaded may
   619  	   make reference to the
   620  	   $ORIGIN substitution string */
   621  	DF_SYMBOLIC DynFlag = 0x0002 /* Indicates "symbolic" linking. */
   622  	DF_TEXTREL  DynFlag = 0x0004 /* Indicates there may be relocations in non-writable segments. */
   623  	DF_BIND_NOW DynFlag = 0x0008 /* Indicates that the dynamic linker should
   624  	   process all relocations for the object
   625  	   containing this entry before transferring
   626  	   control to the program. */
   627  	DF_STATIC_TLS DynFlag = 0x0010 /* Indicates that the shared object or
   628  	   executable contains code using a static
   629  	   thread-local storage scheme. */
   630  )
   631  
   632  var dflagStrings = []intName{
   633  	{0x0001, "DF_ORIGIN"},
   634  	{0x0002, "DF_SYMBOLIC"},
   635  	{0x0004, "DF_TEXTREL"},
   636  	{0x0008, "DF_BIND_NOW"},
   637  	{0x0010, "DF_STATIC_TLS"},
   638  }
   639  
   640  func (i DynFlag) String() string   { return flagName(uint32(i), dflagStrings, false) }
   641  func (i DynFlag) GoString() string { return flagName(uint32(i), dflagStrings, true) }
   642  
   643  // NType values; used in core files.
   644  type NType int
   645  
   646  const (
   647  	NT_PRSTATUS NType = 1 /* Process status. */
   648  	NT_FPREGSET NType = 2 /* Floating point registers. */
   649  	NT_PRPSINFO NType = 3 /* Process state info. */
   650  )
   651  
   652  var ntypeStrings = []intName{
   653  	{1, "NT_PRSTATUS"},
   654  	{2, "NT_FPREGSET"},
   655  	{3, "NT_PRPSINFO"},
   656  }
   657  
   658  func (i NType) String() string   { return stringName(uint32(i), ntypeStrings, false) }
   659  func (i NType) GoString() string { return stringName(uint32(i), ntypeStrings, true) }
   660  
   661  /* Symbol Binding - ELFNN_ST_BIND - st_info */
   662  type SymBind int
   663  
   664  const (
   665  	STB_LOCAL  SymBind = 0  /* Local symbol */
   666  	STB_GLOBAL SymBind = 1  /* Global symbol */
   667  	STB_WEAK   SymBind = 2  /* like global - lower precedence */
   668  	STB_LOOS   SymBind = 10 /* Reserved range for operating system */
   669  	STB_HIOS   SymBind = 12 /*   specific semantics. */
   670  	STB_LOPROC SymBind = 13 /* reserved range for processor */
   671  	STB_HIPROC SymBind = 15 /*   specific semantics. */
   672  )
   673  
   674  var stbStrings = []intName{
   675  	{0, "STB_LOCAL"},
   676  	{1, "STB_GLOBAL"},
   677  	{2, "STB_WEAK"},
   678  	{10, "STB_LOOS"},
   679  	{12, "STB_HIOS"},
   680  	{13, "STB_LOPROC"},
   681  	{15, "STB_HIPROC"},
   682  }
   683  
   684  func (i SymBind) String() string   { return stringName(uint32(i), stbStrings, false) }
   685  func (i SymBind) GoString() string { return stringName(uint32(i), stbStrings, true) }
   686  
   687  /* Symbol type - ELFNN_ST_TYPE - st_info */
   688  type SymType int
   689  
   690  const (
   691  	STT_NOTYPE  SymType = 0  /* Unspecified type. */
   692  	STT_OBJECT  SymType = 1  /* Data object. */
   693  	STT_FUNC    SymType = 2  /* Function. */
   694  	STT_SECTION SymType = 3  /* Section. */
   695  	STT_FILE    SymType = 4  /* Source file. */
   696  	STT_COMMON  SymType = 5  /* Uninitialized common block. */
   697  	STT_TLS     SymType = 6  /* TLS object. */
   698  	STT_LOOS    SymType = 10 /* Reserved range for operating system */
   699  	STT_HIOS    SymType = 12 /*   specific semantics. */
   700  	STT_LOPROC  SymType = 13 /* reserved range for processor */
   701  	STT_HIPROC  SymType = 15 /*   specific semantics. */
   702  )
   703  
   704  var sttStrings = []intName{
   705  	{0, "STT_NOTYPE"},
   706  	{1, "STT_OBJECT"},
   707  	{2, "STT_FUNC"},
   708  	{3, "STT_SECTION"},
   709  	{4, "STT_FILE"},
   710  	{5, "STT_COMMON"},
   711  	{6, "STT_TLS"},
   712  	{10, "STT_LOOS"},
   713  	{12, "STT_HIOS"},
   714  	{13, "STT_LOPROC"},
   715  	{15, "STT_HIPROC"},
   716  }
   717  
   718  func (i SymType) String() string   { return stringName(uint32(i), sttStrings, false) }
   719  func (i SymType) GoString() string { return stringName(uint32(i), sttStrings, true) }
   720  
   721  /* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */
   722  type SymVis int
   723  
   724  const (
   725  	STV_DEFAULT   SymVis = 0x0 /* Default visibility (see binding). */
   726  	STV_INTERNAL  SymVis = 0x1 /* Special meaning in relocatable objects. */
   727  	STV_HIDDEN    SymVis = 0x2 /* Not visible. */
   728  	STV_PROTECTED SymVis = 0x3 /* Visible but not preemptible. */
   729  )
   730  
   731  var stvStrings = []intName{
   732  	{0x0, "STV_DEFAULT"},
   733  	{0x1, "STV_INTERNAL"},
   734  	{0x2, "STV_HIDDEN"},
   735  	{0x3, "STV_PROTECTED"},
   736  }
   737  
   738  func (i SymVis) String() string   { return stringName(uint32(i), stvStrings, false) }
   739  func (i SymVis) GoString() string { return stringName(uint32(i), stvStrings, true) }
   740  
   741  /*
   742   * Relocation types.
   743   */
   744  
   745  // Relocation types for x86-64.
   746  type R_X86_64 int
   747  
   748  const (
   749  	R_X86_64_NONE     R_X86_64 = 0  /* No relocation. */
   750  	R_X86_64_64       R_X86_64 = 1  /* Add 64 bit symbol value. */
   751  	R_X86_64_PC32     R_X86_64 = 2  /* PC-relative 32 bit signed sym value. */
   752  	R_X86_64_GOT32    R_X86_64 = 3  /* PC-relative 32 bit GOT offset. */
   753  	R_X86_64_PLT32    R_X86_64 = 4  /* PC-relative 32 bit PLT offset. */
   754  	R_X86_64_COPY     R_X86_64 = 5  /* Copy data from shared object. */
   755  	R_X86_64_GLOB_DAT R_X86_64 = 6  /* Set GOT entry to data address. */
   756  	R_X86_64_JMP_SLOT R_X86_64 = 7  /* Set GOT entry to code address. */
   757  	R_X86_64_RELATIVE R_X86_64 = 8  /* Add load address of shared object. */
   758  	R_X86_64_GOTPCREL R_X86_64 = 9  /* Add 32 bit signed pcrel offset to GOT. */
   759  	R_X86_64_32       R_X86_64 = 10 /* Add 32 bit zero extended symbol value */
   760  	R_X86_64_32S      R_X86_64 = 11 /* Add 32 bit sign extended symbol value */
   761  	R_X86_64_16       R_X86_64 = 12 /* Add 16 bit zero extended symbol value */
   762  	R_X86_64_PC16     R_X86_64 = 13 /* Add 16 bit signed extended pc relative symbol value */
   763  	R_X86_64_8        R_X86_64 = 14 /* Add 8 bit zero extended symbol value */
   764  	R_X86_64_PC8      R_X86_64 = 15 /* Add 8 bit signed extended pc relative symbol value */
   765  	R_X86_64_DTPMOD64 R_X86_64 = 16 /* ID of module containing symbol */
   766  	R_X86_64_DTPOFF64 R_X86_64 = 17 /* Offset in TLS block */
   767  	R_X86_64_TPOFF64  R_X86_64 = 18 /* Offset in static TLS block */
   768  	R_X86_64_TLSGD    R_X86_64 = 19 /* PC relative offset to GD GOT entry */
   769  	R_X86_64_TLSLD    R_X86_64 = 20 /* PC relative offset to LD GOT entry */
   770  	R_X86_64_DTPOFF32 R_X86_64 = 21 /* Offset in TLS block */
   771  	R_X86_64_GOTTPOFF R_X86_64 = 22 /* PC relative offset to IE GOT entry */
   772  	R_X86_64_TPOFF32  R_X86_64 = 23 /* Offset in static TLS block */
   773  )
   774  
   775  var rx86_64Strings = []intName{
   776  	{0, "R_X86_64_NONE"},
   777  	{1, "R_X86_64_64"},
   778  	{2, "R_X86_64_PC32"},
   779  	{3, "R_X86_64_GOT32"},
   780  	{4, "R_X86_64_PLT32"},
   781  	{5, "R_X86_64_COPY"},
   782  	{6, "R_X86_64_GLOB_DAT"},
   783  	{7, "R_X86_64_JMP_SLOT"},
   784  	{8, "R_X86_64_RELATIVE"},
   785  	{9, "R_X86_64_GOTPCREL"},
   786  	{10, "R_X86_64_32"},
   787  	{11, "R_X86_64_32S"},
   788  	{12, "R_X86_64_16"},
   789  	{13, "R_X86_64_PC16"},
   790  	{14, "R_X86_64_8"},
   791  	{15, "R_X86_64_PC8"},
   792  	{16, "R_X86_64_DTPMOD64"},
   793  	{17, "R_X86_64_DTPOFF64"},
   794  	{18, "R_X86_64_TPOFF64"},
   795  	{19, "R_X86_64_TLSGD"},
   796  	{20, "R_X86_64_TLSLD"},
   797  	{21, "R_X86_64_DTPOFF32"},
   798  	{22, "R_X86_64_GOTTPOFF"},
   799  	{23, "R_X86_64_TPOFF32"},
   800  }
   801  
   802  func (i R_X86_64) String() string   { return stringName(uint32(i), rx86_64Strings, false) }
   803  func (i R_X86_64) GoString() string { return stringName(uint32(i), rx86_64Strings, true) }
   804  
   805  // Relocation types for AArch64 (aka arm64)
   806  type R_AARCH64 int
   807  
   808  const (
   809  	R_AARCH64_NONE                            R_AARCH64 = 0
   810  	R_AARCH64_P32_ABS32                       R_AARCH64 = 1
   811  	R_AARCH64_P32_ABS16                       R_AARCH64 = 2
   812  	R_AARCH64_P32_PREL32                      R_AARCH64 = 3
   813  	R_AARCH64_P32_PREL16                      R_AARCH64 = 4
   814  	R_AARCH64_P32_MOVW_UABS_G0                R_AARCH64 = 5
   815  	R_AARCH64_P32_MOVW_UABS_G0_NC             R_AARCH64 = 6
   816  	R_AARCH64_P32_MOVW_UABS_G1                R_AARCH64 = 7
   817  	R_AARCH64_P32_MOVW_SABS_G0                R_AARCH64 = 8
   818  	R_AARCH64_P32_LD_PREL_LO19                R_AARCH64 = 9
   819  	R_AARCH64_P32_ADR_PREL_LO21               R_AARCH64 = 10
   820  	R_AARCH64_P32_ADR_PREL_PG_HI21            R_AARCH64 = 11
   821  	R_AARCH64_P32_ADD_ABS_LO12_NC             R_AARCH64 = 12
   822  	R_AARCH64_P32_LDST8_ABS_LO12_NC           R_AARCH64 = 13
   823  	R_AARCH64_P32_LDST16_ABS_LO12_NC          R_AARCH64 = 14
   824  	R_AARCH64_P32_LDST32_ABS_LO12_NC          R_AARCH64 = 15
   825  	R_AARCH64_P32_LDST64_ABS_LO12_NC          R_AARCH64 = 16
   826  	R_AARCH64_P32_LDST128_ABS_LO12_NC         R_AARCH64 = 17
   827  	R_AARCH64_P32_TSTBR14                     R_AARCH64 = 18
   828  	R_AARCH64_P32_CONDBR19                    R_AARCH64 = 19
   829  	R_AARCH64_P32_JUMP26                      R_AARCH64 = 20
   830  	R_AARCH64_P32_CALL26                      R_AARCH64 = 21
   831  	R_AARCH64_P32_GOT_LD_PREL19               R_AARCH64 = 25
   832  	R_AARCH64_P32_ADR_GOT_PAGE                R_AARCH64 = 26
   833  	R_AARCH64_P32_LD32_GOT_LO12_NC            R_AARCH64 = 27
   834  	R_AARCH64_P32_TLSGD_ADR_PAGE21            R_AARCH64 = 81
   835  	R_AARCH64_P32_TLSGD_ADD_LO12_NC           R_AARCH64 = 82
   836  	R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21   R_AARCH64 = 103
   837  	R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC R_AARCH64 = 104
   838  	R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19    R_AARCH64 = 105
   839  	R_AARCH64_P32_TLSLE_MOVW_TPREL_G1         R_AARCH64 = 106
   840  	R_AARCH64_P32_TLSLE_MOVW_TPREL_G0         R_AARCH64 = 107
   841  	R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC      R_AARCH64 = 108
   842  	R_AARCH64_P32_TLSLE_ADD_TPREL_HI12        R_AARCH64 = 109
   843  	R_AARCH64_P32_TLSLE_ADD_TPREL_LO12        R_AARCH64 = 110
   844  	R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC     R_AARCH64 = 111
   845  	R_AARCH64_P32_TLSDESC_LD_PREL19           R_AARCH64 = 122
   846  	R_AARCH64_P32_TLSDESC_ADR_PREL21          R_AARCH64 = 123
   847  	R_AARCH64_P32_TLSDESC_ADR_PAGE21          R_AARCH64 = 124
   848  	R_AARCH64_P32_TLSDESC_LD32_LO12_NC        R_AARCH64 = 125
   849  	R_AARCH64_P32_TLSDESC_ADD_LO12_NC         R_AARCH64 = 126
   850  	R_AARCH64_P32_TLSDESC_CALL                R_AARCH64 = 127
   851  	R_AARCH64_P32_COPY                        R_AARCH64 = 180
   852  	R_AARCH64_P32_GLOB_DAT                    R_AARCH64 = 181
   853  	R_AARCH64_P32_JUMP_SLOT                   R_AARCH64 = 182
   854  	R_AARCH64_P32_RELATIVE                    R_AARCH64 = 183
   855  	R_AARCH64_P32_TLS_DTPMOD                  R_AARCH64 = 184
   856  	R_AARCH64_P32_TLS_DTPREL                  R_AARCH64 = 185
   857  	R_AARCH64_P32_TLS_TPREL                   R_AARCH64 = 186
   858  	R_AARCH64_P32_TLSDESC                     R_AARCH64 = 187
   859  	R_AARCH64_P32_IRELATIVE                   R_AARCH64 = 188
   860  	R_AARCH64_NULL                            R_AARCH64 = 256
   861  	R_AARCH64_ABS64                           R_AARCH64 = 257
   862  	R_AARCH64_ABS32                           R_AARCH64 = 258
   863  	R_AARCH64_ABS16                           R_AARCH64 = 259
   864  	R_AARCH64_PREL64                          R_AARCH64 = 260
   865  	R_AARCH64_PREL32                          R_AARCH64 = 261
   866  	R_AARCH64_PREL16                          R_AARCH64 = 262
   867  	R_AARCH64_MOVW_UABS_G0                    R_AARCH64 = 263
   868  	R_AARCH64_MOVW_UABS_G0_NC                 R_AARCH64 = 264
   869  	R_AARCH64_MOVW_UABS_G1                    R_AARCH64 = 265
   870  	R_AARCH64_MOVW_UABS_G1_NC                 R_AARCH64 = 266
   871  	R_AARCH64_MOVW_UABS_G2                    R_AARCH64 = 267
   872  	R_AARCH64_MOVW_UABS_G2_NC                 R_AARCH64 = 268
   873  	R_AARCH64_MOVW_UABS_G3                    R_AARCH64 = 269
   874  	R_AARCH64_MOVW_SABS_G0                    R_AARCH64 = 270
   875  	R_AARCH64_MOVW_SABS_G1                    R_AARCH64 = 271
   876  	R_AARCH64_MOVW_SABS_G2                    R_AARCH64 = 272
   877  	R_AARCH64_LD_PREL_LO19                    R_AARCH64 = 273
   878  	R_AARCH64_ADR_PREL_LO21                   R_AARCH64 = 274
   879  	R_AARCH64_ADR_PREL_PG_HI21                R_AARCH64 = 275
   880  	R_AARCH64_ADR_PREL_PG_HI21_NC             R_AARCH64 = 276
   881  	R_AARCH64_ADD_ABS_LO12_NC                 R_AARCH64 = 277
   882  	R_AARCH64_LDST8_ABS_LO12_NC               R_AARCH64 = 278
   883  	R_AARCH64_TSTBR14                         R_AARCH64 = 279
   884  	R_AARCH64_CONDBR19                        R_AARCH64 = 280
   885  	R_AARCH64_JUMP26                          R_AARCH64 = 282
   886  	R_AARCH64_CALL26                          R_AARCH64 = 283
   887  	R_AARCH64_LDST16_ABS_LO12_NC              R_AARCH64 = 284
   888  	R_AARCH64_LDST32_ABS_LO12_NC              R_AARCH64 = 285
   889  	R_AARCH64_LDST64_ABS_LO12_NC              R_AARCH64 = 286
   890  	R_AARCH64_LDST128_ABS_LO12_NC             R_AARCH64 = 299
   891  	R_AARCH64_GOT_LD_PREL19                   R_AARCH64 = 309
   892  	R_AARCH64_ADR_GOT_PAGE                    R_AARCH64 = 311
   893  	R_AARCH64_LD64_GOT_LO12_NC                R_AARCH64 = 312
   894  	R_AARCH64_TLSGD_ADR_PAGE21                R_AARCH64 = 513
   895  	R_AARCH64_TLSGD_ADD_LO12_NC               R_AARCH64 = 514
   896  	R_AARCH64_TLSIE_MOVW_GOTTPREL_G1          R_AARCH64 = 539
   897  	R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC       R_AARCH64 = 540
   898  	R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21       R_AARCH64 = 541
   899  	R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC     R_AARCH64 = 542
   900  	R_AARCH64_TLSIE_LD_GOTTPREL_PREL19        R_AARCH64 = 543
   901  	R_AARCH64_TLSLE_MOVW_TPREL_G2             R_AARCH64 = 544
   902  	R_AARCH64_TLSLE_MOVW_TPREL_G1             R_AARCH64 = 545
   903  	R_AARCH64_TLSLE_MOVW_TPREL_G1_NC          R_AARCH64 = 546
   904  	R_AARCH64_TLSLE_MOVW_TPREL_G0             R_AARCH64 = 547
   905  	R_AARCH64_TLSLE_MOVW_TPREL_G0_NC          R_AARCH64 = 548
   906  	R_AARCH64_TLSLE_ADD_TPREL_HI12            R_AARCH64 = 549
   907  	R_AARCH64_TLSLE_ADD_TPREL_LO12            R_AARCH64 = 550
   908  	R_AARCH64_TLSLE_ADD_TPREL_LO12_NC         R_AARCH64 = 551
   909  	R_AARCH64_TLSDESC_LD_PREL19               R_AARCH64 = 560
   910  	R_AARCH64_TLSDESC_ADR_PREL21              R_AARCH64 = 561
   911  	R_AARCH64_TLSDESC_ADR_PAGE21              R_AARCH64 = 562
   912  	R_AARCH64_TLSDESC_LD64_LO12_NC            R_AARCH64 = 563
   913  	R_AARCH64_TLSDESC_ADD_LO12_NC             R_AARCH64 = 564
   914  	R_AARCH64_TLSDESC_OFF_G1                  R_AARCH64 = 565
   915  	R_AARCH64_TLSDESC_OFF_G0_NC               R_AARCH64 = 566
   916  	R_AARCH64_TLSDESC_LDR                     R_AARCH64 = 567
   917  	R_AARCH64_TLSDESC_ADD                     R_AARCH64 = 568
   918  	R_AARCH64_TLSDESC_CALL                    R_AARCH64 = 569
   919  	R_AARCH64_COPY                            R_AARCH64 = 1024
   920  	R_AARCH64_GLOB_DAT                        R_AARCH64 = 1025
   921  	R_AARCH64_JUMP_SLOT                       R_AARCH64 = 1026
   922  	R_AARCH64_RELATIVE                        R_AARCH64 = 1027
   923  	R_AARCH64_TLS_DTPMOD64                    R_AARCH64 = 1028
   924  	R_AARCH64_TLS_DTPREL64                    R_AARCH64 = 1029
   925  	R_AARCH64_TLS_TPREL64                     R_AARCH64 = 1030
   926  	R_AARCH64_TLSDESC                         R_AARCH64 = 1031
   927  	R_AARCH64_IRELATIVE                       R_AARCH64 = 1032
   928  )
   929  
   930  var raarch64Strings = []intName{
   931  	{0, "R_AARCH64_NONE"},
   932  	{1, "R_AARCH64_P32_ABS32"},
   933  	{2, "R_AARCH64_P32_ABS16"},
   934  	{3, "R_AARCH64_P32_PREL32"},
   935  	{4, "R_AARCH64_P32_PREL16"},
   936  	{5, "R_AARCH64_P32_MOVW_UABS_G0"},
   937  	{6, "R_AARCH64_P32_MOVW_UABS_G0_NC"},
   938  	{7, "R_AARCH64_P32_MOVW_UABS_G1"},
   939  	{8, "R_AARCH64_P32_MOVW_SABS_G0"},
   940  	{9, "R_AARCH64_P32_LD_PREL_LO19"},
   941  	{10, "R_AARCH64_P32_ADR_PREL_LO21"},
   942  	{11, "R_AARCH64_P32_ADR_PREL_PG_HI21"},
   943  	{12, "R_AARCH64_P32_ADD_ABS_LO12_NC"},
   944  	{13, "R_AARCH64_P32_LDST8_ABS_LO12_NC"},
   945  	{14, "R_AARCH64_P32_LDST16_ABS_LO12_NC"},
   946  	{15, "R_AARCH64_P32_LDST32_ABS_LO12_NC"},
   947  	{16, "R_AARCH64_P32_LDST64_ABS_LO12_NC"},
   948  	{17, "R_AARCH64_P32_LDST128_ABS_LO12_NC"},
   949  	{18, "R_AARCH64_P32_TSTBR14"},
   950  	{19, "R_AARCH64_P32_CONDBR19"},
   951  	{20, "R_AARCH64_P32_JUMP26"},
   952  	{21, "R_AARCH64_P32_CALL26"},
   953  	{25, "R_AARCH64_P32_GOT_LD_PREL19"},
   954  	{26, "R_AARCH64_P32_ADR_GOT_PAGE"},
   955  	{27, "R_AARCH64_P32_LD32_GOT_LO12_NC"},
   956  	{81, "R_AARCH64_P32_TLSGD_ADR_PAGE21"},
   957  	{82, "R_AARCH64_P32_TLSGD_ADD_LO12_NC"},
   958  	{103, "R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21"},
   959  	{104, "R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC"},
   960  	{105, "R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19"},
   961  	{106, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G1"},
   962  	{107, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0"},
   963  	{108, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC"},
   964  	{109, "R_AARCH64_P32_TLSLE_ADD_TPREL_HI12"},
   965  	{110, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12"},
   966  	{111, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC"},
   967  	{122, "R_AARCH64_P32_TLSDESC_LD_PREL19"},
   968  	{123, "R_AARCH64_P32_TLSDESC_ADR_PREL21"},
   969  	{124, "R_AARCH64_P32_TLSDESC_ADR_PAGE21"},
   970  	{125, "R_AARCH64_P32_TLSDESC_LD32_LO12_NC"},
   971  	{126, "R_AARCH64_P32_TLSDESC_ADD_LO12_NC"},
   972  	{127, "R_AARCH64_P32_TLSDESC_CALL"},
   973  	{180, "R_AARCH64_P32_COPY"},
   974  	{181, "R_AARCH64_P32_GLOB_DAT"},
   975  	{182, "R_AARCH64_P32_JUMP_SLOT"},
   976  	{183, "R_AARCH64_P32_RELATIVE"},
   977  	{184, "R_AARCH64_P32_TLS_DTPMOD"},
   978  	{185, "R_AARCH64_P32_TLS_DTPREL"},
   979  	{186, "R_AARCH64_P32_TLS_TPREL"},
   980  	{187, "R_AARCH64_P32_TLSDESC"},
   981  	{188, "R_AARCH64_P32_IRELATIVE"},
   982  	{256, "R_AARCH64_NULL"},
   983  	{257, "R_AARCH64_ABS64"},
   984  	{258, "R_AARCH64_ABS32"},
   985  	{259, "R_AARCH64_ABS16"},
   986  	{260, "R_AARCH64_PREL64"},
   987  	{261, "R_AARCH64_PREL32"},
   988  	{262, "R_AARCH64_PREL16"},
   989  	{263, "R_AARCH64_MOVW_UABS_G0"},
   990  	{264, "R_AARCH64_MOVW_UABS_G0_NC"},
   991  	{265, "R_AARCH64_MOVW_UABS_G1"},
   992  	{266, "R_AARCH64_MOVW_UABS_G1_NC"},
   993  	{267, "R_AARCH64_MOVW_UABS_G2"},
   994  	{268, "R_AARCH64_MOVW_UABS_G2_NC"},
   995  	{269, "R_AARCH64_MOVW_UABS_G3"},
   996  	{270, "R_AARCH64_MOVW_SABS_G0"},
   997  	{271, "R_AARCH64_MOVW_SABS_G1"},
   998  	{272, "R_AARCH64_MOVW_SABS_G2"},
   999  	{273, "R_AARCH64_LD_PREL_LO19"},
  1000  	{274, "R_AARCH64_ADR_PREL_LO21"},
  1001  	{275, "R_AARCH64_ADR_PREL_PG_HI21"},
  1002  	{276, "R_AARCH64_ADR_PREL_PG_HI21_NC"},
  1003  	{277, "R_AARCH64_ADD_ABS_LO12_NC"},
  1004  	{278, "R_AARCH64_LDST8_ABS_LO12_NC"},
  1005  	{279, "R_AARCH64_TSTBR14"},
  1006  	{280, "R_AARCH64_CONDBR19"},
  1007  	{282, "R_AARCH64_JUMP26"},
  1008  	{283, "R_AARCH64_CALL26"},
  1009  	{284, "R_AARCH64_LDST16_ABS_LO12_NC"},
  1010  	{285, "R_AARCH64_LDST32_ABS_LO12_NC"},
  1011  	{286, "R_AARCH64_LDST64_ABS_LO12_NC"},
  1012  	{299, "R_AARCH64_LDST128_ABS_LO12_NC"},
  1013  	{309, "R_AARCH64_GOT_LD_PREL19"},
  1014  	{311, "R_AARCH64_ADR_GOT_PAGE"},
  1015  	{312, "R_AARCH64_LD64_GOT_LO12_NC"},
  1016  	{513, "R_AARCH64_TLSGD_ADR_PAGE21"},
  1017  	{514, "R_AARCH64_TLSGD_ADD_LO12_NC"},
  1018  	{539, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G1"},
  1019  	{540, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC"},
  1020  	{541, "R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21"},
  1021  	{542, "R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC"},
  1022  	{543, "R_AARCH64_TLSIE_LD_GOTTPREL_PREL19"},
  1023  	{544, "R_AARCH64_TLSLE_MOVW_TPREL_G2"},
  1024  	{545, "R_AARCH64_TLSLE_MOVW_TPREL_G1"},
  1025  	{546, "R_AARCH64_TLSLE_MOVW_TPREL_G1_NC"},
  1026  	{547, "R_AARCH64_TLSLE_MOVW_TPREL_G0"},
  1027  	{548, "R_AARCH64_TLSLE_MOVW_TPREL_G0_NC"},
  1028  	{549, "R_AARCH64_TLSLE_ADD_TPREL_HI12"},
  1029  	{550, "R_AARCH64_TLSLE_ADD_TPREL_LO12"},
  1030  	{551, "R_AARCH64_TLSLE_ADD_TPREL_LO12_NC"},
  1031  	{560, "R_AARCH64_TLSDESC_LD_PREL19"},
  1032  	{561, "R_AARCH64_TLSDESC_ADR_PREL21"},
  1033  	{562, "R_AARCH64_TLSDESC_ADR_PAGE21"},
  1034  	{563, "R_AARCH64_TLSDESC_LD64_LO12_NC"},
  1035  	{564, "R_AARCH64_TLSDESC_ADD_LO12_NC"},
  1036  	{565, "R_AARCH64_TLSDESC_OFF_G1"},
  1037  	{566, "R_AARCH64_TLSDESC_OFF_G0_NC"},
  1038  	{567, "R_AARCH64_TLSDESC_LDR"},
  1039  	{568, "R_AARCH64_TLSDESC_ADD"},
  1040  	{569, "R_AARCH64_TLSDESC_CALL"},
  1041  	{1024, "R_AARCH64_COPY"},
  1042  	{1025, "R_AARCH64_GLOB_DAT"},
  1043  	{1026, "R_AARCH64_JUMP_SLOT"},
  1044  	{1027, "R_AARCH64_RELATIVE"},
  1045  	{1028, "R_AARCH64_TLS_DTPMOD64"},
  1046  	{1029, "R_AARCH64_TLS_DTPREL64"},
  1047  	{1030, "R_AARCH64_TLS_TPREL64"},
  1048  	{1031, "R_AARCH64_TLSDESC"},
  1049  	{1032, "R_AARCH64_IRELATIVE"},
  1050  }
  1051  
  1052  func (i R_AARCH64) String() string   { return stringName(uint32(i), raarch64Strings, false) }
  1053  func (i R_AARCH64) GoString() string { return stringName(uint32(i), raarch64Strings, true) }
  1054  
  1055  // Relocation types for Alpha.
  1056  type R_ALPHA int
  1057  
  1058  const (
  1059  	R_ALPHA_NONE           R_ALPHA = 0  /* No reloc */
  1060  	R_ALPHA_REFLONG        R_ALPHA = 1  /* Direct 32 bit */
  1061  	R_ALPHA_REFQUAD        R_ALPHA = 2  /* Direct 64 bit */
  1062  	R_ALPHA_GPREL32        R_ALPHA = 3  /* GP relative 32 bit */
  1063  	R_ALPHA_LITERAL        R_ALPHA = 4  /* GP relative 16 bit w/optimization */
  1064  	R_ALPHA_LITUSE         R_ALPHA = 5  /* Optimization hint for LITERAL */
  1065  	R_ALPHA_GPDISP         R_ALPHA = 6  /* Add displacement to GP */
  1066  	R_ALPHA_BRADDR         R_ALPHA = 7  /* PC+4 relative 23 bit shifted */
  1067  	R_ALPHA_HINT           R_ALPHA = 8  /* PC+4 relative 16 bit shifted */
  1068  	R_ALPHA_SREL16         R_ALPHA = 9  /* PC relative 16 bit */
  1069  	R_ALPHA_SREL32         R_ALPHA = 10 /* PC relative 32 bit */
  1070  	R_ALPHA_SREL64         R_ALPHA = 11 /* PC relative 64 bit */
  1071  	R_ALPHA_OP_PUSH        R_ALPHA = 12 /* OP stack push */
  1072  	R_ALPHA_OP_STORE       R_ALPHA = 13 /* OP stack pop and store */
  1073  	R_ALPHA_OP_PSUB        R_ALPHA = 14 /* OP stack subtract */
  1074  	R_ALPHA_OP_PRSHIFT     R_ALPHA = 15 /* OP stack right shift */
  1075  	R_ALPHA_GPVALUE        R_ALPHA = 16
  1076  	R_ALPHA_GPRELHIGH      R_ALPHA = 17
  1077  	R_ALPHA_GPRELLOW       R_ALPHA = 18
  1078  	R_ALPHA_IMMED_GP_16    R_ALPHA = 19
  1079  	R_ALPHA_IMMED_GP_HI32  R_ALPHA = 20
  1080  	R_ALPHA_IMMED_SCN_HI32 R_ALPHA = 21
  1081  	R_ALPHA_IMMED_BR_HI32  R_ALPHA = 22
  1082  	R_ALPHA_IMMED_LO32     R_ALPHA = 23
  1083  	R_ALPHA_COPY           R_ALPHA = 24 /* Copy symbol at runtime */
  1084  	R_ALPHA_GLOB_DAT       R_ALPHA = 25 /* Create GOT entry */
  1085  	R_ALPHA_JMP_SLOT       R_ALPHA = 26 /* Create PLT entry */
  1086  	R_ALPHA_RELATIVE       R_ALPHA = 27 /* Adjust by program base */
  1087  )
  1088  
  1089  var ralphaStrings = []intName{
  1090  	{0, "R_ALPHA_NONE"},
  1091  	{1, "R_ALPHA_REFLONG"},
  1092  	{2, "R_ALPHA_REFQUAD"},
  1093  	{3, "R_ALPHA_GPREL32"},
  1094  	{4, "R_ALPHA_LITERAL"},
  1095  	{5, "R_ALPHA_LITUSE"},
  1096  	{6, "R_ALPHA_GPDISP"},
  1097  	{7, "R_ALPHA_BRADDR"},
  1098  	{8, "R_ALPHA_HINT"},
  1099  	{9, "R_ALPHA_SREL16"},
  1100  	{10, "R_ALPHA_SREL32"},
  1101  	{11, "R_ALPHA_SREL64"},
  1102  	{12, "R_ALPHA_OP_PUSH"},
  1103  	{13, "R_ALPHA_OP_STORE"},
  1104  	{14, "R_ALPHA_OP_PSUB"},
  1105  	{15, "R_ALPHA_OP_PRSHIFT"},
  1106  	{16, "R_ALPHA_GPVALUE"},
  1107  	{17, "R_ALPHA_GPRELHIGH"},
  1108  	{18, "R_ALPHA_GPRELLOW"},
  1109  	{19, "R_ALPHA_IMMED_GP_16"},
  1110  	{20, "R_ALPHA_IMMED_GP_HI32"},
  1111  	{21, "R_ALPHA_IMMED_SCN_HI32"},
  1112  	{22, "R_ALPHA_IMMED_BR_HI32"},
  1113  	{23, "R_ALPHA_IMMED_LO32"},
  1114  	{24, "R_ALPHA_COPY"},
  1115  	{25, "R_ALPHA_GLOB_DAT"},
  1116  	{26, "R_ALPHA_JMP_SLOT"},
  1117  	{27, "R_ALPHA_RELATIVE"},
  1118  }
  1119  
  1120  func (i R_ALPHA) String() string   { return stringName(uint32(i), ralphaStrings, false) }
  1121  func (i R_ALPHA) GoString() string { return stringName(uint32(i), ralphaStrings, true) }
  1122  
  1123  // Relocation types for ARM.
  1124  type R_ARM int
  1125  
  1126  const (
  1127  	R_ARM_NONE          R_ARM = 0 /* No relocation. */
  1128  	R_ARM_PC24          R_ARM = 1
  1129  	R_ARM_ABS32         R_ARM = 2
  1130  	R_ARM_REL32         R_ARM = 3
  1131  	R_ARM_PC13          R_ARM = 4
  1132  	R_ARM_ABS16         R_ARM = 5
  1133  	R_ARM_ABS12         R_ARM = 6
  1134  	R_ARM_THM_ABS5      R_ARM = 7
  1135  	R_ARM_ABS8          R_ARM = 8
  1136  	R_ARM_SBREL32       R_ARM = 9
  1137  	R_ARM_THM_PC22      R_ARM = 10
  1138  	R_ARM_THM_PC8       R_ARM = 11
  1139  	R_ARM_AMP_VCALL9    R_ARM = 12
  1140  	R_ARM_SWI24         R_ARM = 13
  1141  	R_ARM_THM_SWI8      R_ARM = 14
  1142  	R_ARM_XPC25         R_ARM = 15
  1143  	R_ARM_THM_XPC22     R_ARM = 16
  1144  	R_ARM_COPY          R_ARM = 20 /* Copy data from shared object. */
  1145  	R_ARM_GLOB_DAT      R_ARM = 21 /* Set GOT entry to data address. */
  1146  	R_ARM_JUMP_SLOT     R_ARM = 22 /* Set GOT entry to code address. */
  1147  	R_ARM_RELATIVE      R_ARM = 23 /* Add load address of shared object. */
  1148  	R_ARM_GOTOFF        R_ARM = 24 /* Add GOT-relative symbol address. */
  1149  	R_ARM_GOTPC         R_ARM = 25 /* Add PC-relative GOT table address. */
  1150  	R_ARM_GOT32         R_ARM = 26 /* Add PC-relative GOT offset. */
  1151  	R_ARM_PLT32         R_ARM = 27 /* Add PC-relative PLT offset. */
  1152  	R_ARM_GNU_VTENTRY   R_ARM = 100
  1153  	R_ARM_GNU_VTINHERIT R_ARM = 101
  1154  	R_ARM_RSBREL32      R_ARM = 250
  1155  	R_ARM_THM_RPC22     R_ARM = 251
  1156  	R_ARM_RREL32        R_ARM = 252
  1157  	R_ARM_RABS32        R_ARM = 253
  1158  	R_ARM_RPC24         R_ARM = 254
  1159  	R_ARM_RBASE         R_ARM = 255
  1160  )
  1161  
  1162  var rarmStrings = []intName{
  1163  	{0, "R_ARM_NONE"},
  1164  	{1, "R_ARM_PC24"},
  1165  	{2, "R_ARM_ABS32"},
  1166  	{3, "R_ARM_REL32"},
  1167  	{4, "R_ARM_PC13"},
  1168  	{5, "R_ARM_ABS16"},
  1169  	{6, "R_ARM_ABS12"},
  1170  	{7, "R_ARM_THM_ABS5"},
  1171  	{8, "R_ARM_ABS8"},
  1172  	{9, "R_ARM_SBREL32"},
  1173  	{10, "R_ARM_THM_PC22"},
  1174  	{11, "R_ARM_THM_PC8"},
  1175  	{12, "R_ARM_AMP_VCALL9"},
  1176  	{13, "R_ARM_SWI24"},
  1177  	{14, "R_ARM_THM_SWI8"},
  1178  	{15, "R_ARM_XPC25"},
  1179  	{16, "R_ARM_THM_XPC22"},
  1180  	{20, "R_ARM_COPY"},
  1181  	{21, "R_ARM_GLOB_DAT"},
  1182  	{22, "R_ARM_JUMP_SLOT"},
  1183  	{23, "R_ARM_RELATIVE"},
  1184  	{24, "R_ARM_GOTOFF"},
  1185  	{25, "R_ARM_GOTPC"},
  1186  	{26, "R_ARM_GOT32"},
  1187  	{27, "R_ARM_PLT32"},
  1188  	{100, "R_ARM_GNU_VTENTRY"},
  1189  	{101, "R_ARM_GNU_VTINHERIT"},
  1190  	{250, "R_ARM_RSBREL32"},
  1191  	{251, "R_ARM_THM_RPC22"},
  1192  	{252, "R_ARM_RREL32"},
  1193  	{253, "R_ARM_RABS32"},
  1194  	{254, "R_ARM_RPC24"},
  1195  	{255, "R_ARM_RBASE"},
  1196  }
  1197  
  1198  func (i R_ARM) String() string   { return stringName(uint32(i), rarmStrings, false) }
  1199  func (i R_ARM) GoString() string { return stringName(uint32(i), rarmStrings, true) }
  1200  
  1201  // Relocation types for 386.
  1202  type R_386 int
  1203  
  1204  const (
  1205  	R_386_NONE         R_386 = 0  /* No relocation. */
  1206  	R_386_32           R_386 = 1  /* Add symbol value. */
  1207  	R_386_PC32         R_386 = 2  /* Add PC-relative symbol value. */
  1208  	R_386_GOT32        R_386 = 3  /* Add PC-relative GOT offset. */
  1209  	R_386_PLT32        R_386 = 4  /* Add PC-relative PLT offset. */
  1210  	R_386_COPY         R_386 = 5  /* Copy data from shared object. */
  1211  	R_386_GLOB_DAT     R_386 = 6  /* Set GOT entry to data address. */
  1212  	R_386_JMP_SLOT     R_386 = 7  /* Set GOT entry to code address. */
  1213  	R_386_RELATIVE     R_386 = 8  /* Add load address of shared object. */
  1214  	R_386_GOTOFF       R_386 = 9  /* Add GOT-relative symbol address. */
  1215  	R_386_GOTPC        R_386 = 10 /* Add PC-relative GOT table address. */
  1216  	R_386_TLS_TPOFF    R_386 = 14 /* Negative offset in static TLS block */
  1217  	R_386_TLS_IE       R_386 = 15 /* Absolute address of GOT for -ve static TLS */
  1218  	R_386_TLS_GOTIE    R_386 = 16 /* GOT entry for negative static TLS block */
  1219  	R_386_TLS_LE       R_386 = 17 /* Negative offset relative to static TLS */
  1220  	R_386_TLS_GD       R_386 = 18 /* 32 bit offset to GOT (index,off) pair */
  1221  	R_386_TLS_LDM      R_386 = 19 /* 32 bit offset to GOT (index,zero) pair */
  1222  	R_386_TLS_GD_32    R_386 = 24 /* 32 bit offset to GOT (index,off) pair */
  1223  	R_386_TLS_GD_PUSH  R_386 = 25 /* pushl instruction for Sun ABI GD sequence */
  1224  	R_386_TLS_GD_CALL  R_386 = 26 /* call instruction for Sun ABI GD sequence */
  1225  	R_386_TLS_GD_POP   R_386 = 27 /* popl instruction for Sun ABI GD sequence */
  1226  	R_386_TLS_LDM_32   R_386 = 28 /* 32 bit offset to GOT (index,zero) pair */
  1227  	R_386_TLS_LDM_PUSH R_386 = 29 /* pushl instruction for Sun ABI LD sequence */
  1228  	R_386_TLS_LDM_CALL R_386 = 30 /* call instruction for Sun ABI LD sequence */
  1229  	R_386_TLS_LDM_POP  R_386 = 31 /* popl instruction for Sun ABI LD sequence */
  1230  	R_386_TLS_LDO_32   R_386 = 32 /* 32 bit offset from start of TLS block */
  1231  	R_386_TLS_IE_32    R_386 = 33 /* 32 bit offset to GOT static TLS offset entry */
  1232  	R_386_TLS_LE_32    R_386 = 34 /* 32 bit offset within static TLS block */
  1233  	R_386_TLS_DTPMOD32 R_386 = 35 /* GOT entry containing TLS index */
  1234  	R_386_TLS_DTPOFF32 R_386 = 36 /* GOT entry containing TLS offset */
  1235  	R_386_TLS_TPOFF32  R_386 = 37 /* GOT entry of -ve static TLS offset */
  1236  )
  1237  
  1238  var r386Strings = []intName{
  1239  	{0, "R_386_NONE"},
  1240  	{1, "R_386_32"},
  1241  	{2, "R_386_PC32"},
  1242  	{3, "R_386_GOT32"},
  1243  	{4, "R_386_PLT32"},
  1244  	{5, "R_386_COPY"},
  1245  	{6, "R_386_GLOB_DAT"},
  1246  	{7, "R_386_JMP_SLOT"},
  1247  	{8, "R_386_RELATIVE"},
  1248  	{9, "R_386_GOTOFF"},
  1249  	{10, "R_386_GOTPC"},
  1250  	{14, "R_386_TLS_TPOFF"},
  1251  	{15, "R_386_TLS_IE"},
  1252  	{16, "R_386_TLS_GOTIE"},
  1253  	{17, "R_386_TLS_LE"},
  1254  	{18, "R_386_TLS_GD"},
  1255  	{19, "R_386_TLS_LDM"},
  1256  	{24, "R_386_TLS_GD_32"},
  1257  	{25, "R_386_TLS_GD_PUSH"},
  1258  	{26, "R_386_TLS_GD_CALL"},
  1259  	{27, "R_386_TLS_GD_POP"},
  1260  	{28, "R_386_TLS_LDM_32"},
  1261  	{29, "R_386_TLS_LDM_PUSH"},
  1262  	{30, "R_386_TLS_LDM_CALL"},
  1263  	{31, "R_386_TLS_LDM_POP"},
  1264  	{32, "R_386_TLS_LDO_32"},
  1265  	{33, "R_386_TLS_IE_32"},
  1266  	{34, "R_386_TLS_LE_32"},
  1267  	{35, "R_386_TLS_DTPMOD32"},
  1268  	{36, "R_386_TLS_DTPOFF32"},
  1269  	{37, "R_386_TLS_TPOFF32"},
  1270  }
  1271  
  1272  func (i R_386) String() string   { return stringName(uint32(i), r386Strings, false) }
  1273  func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) }
  1274  
  1275  // Relocation types for MIPS.
  1276  type R_MIPS int
  1277  
  1278  const (
  1279  	R_MIPS_NONE          R_MIPS = 0
  1280  	R_MIPS_16            R_MIPS = 1
  1281  	R_MIPS_32            R_MIPS = 2
  1282  	R_MIPS_REL32         R_MIPS = 3
  1283  	R_MIPS_26            R_MIPS = 4
  1284  	R_MIPS_HI16          R_MIPS = 5  /* high 16 bits of symbol value */
  1285  	R_MIPS_LO16          R_MIPS = 6  /* low 16 bits of symbol value */
  1286  	R_MIPS_GPREL16       R_MIPS = 7  /* GP-relative reference  */
  1287  	R_MIPS_LITERAL       R_MIPS = 8  /* Reference to literal section  */
  1288  	R_MIPS_GOT16         R_MIPS = 9  /* Reference to global offset table */
  1289  	R_MIPS_PC16          R_MIPS = 10 /* 16 bit PC relative reference */
  1290  	R_MIPS_CALL16        R_MIPS = 11 /* 16 bit call through glbl offset tbl */
  1291  	R_MIPS_GPREL32       R_MIPS = 12
  1292  	R_MIPS_SHIFT5        R_MIPS = 16
  1293  	R_MIPS_SHIFT6        R_MIPS = 17
  1294  	R_MIPS_64            R_MIPS = 18
  1295  	R_MIPS_GOT_DISP      R_MIPS = 19
  1296  	R_MIPS_GOT_PAGE      R_MIPS = 20
  1297  	R_MIPS_GOT_OFST      R_MIPS = 21
  1298  	R_MIPS_GOT_HI16      R_MIPS = 22
  1299  	R_MIPS_GOT_LO16      R_MIPS = 23
  1300  	R_MIPS_SUB           R_MIPS = 24
  1301  	R_MIPS_INSERT_A      R_MIPS = 25
  1302  	R_MIPS_INSERT_B      R_MIPS = 26
  1303  	R_MIPS_DELETE        R_MIPS = 27
  1304  	R_MIPS_HIGHER        R_MIPS = 28
  1305  	R_MIPS_HIGHEST       R_MIPS = 29
  1306  	R_MIPS_CALL_HI16     R_MIPS = 30
  1307  	R_MIPS_CALL_LO16     R_MIPS = 31
  1308  	R_MIPS_SCN_DISP      R_MIPS = 32
  1309  	R_MIPS_REL16         R_MIPS = 33
  1310  	R_MIPS_ADD_IMMEDIATE R_MIPS = 34
  1311  	R_MIPS_PJUMP         R_MIPS = 35
  1312  	R_MIPS_RELGOT        R_MIPS = 36
  1313  	R_MIPS_JALR          R_MIPS = 37
  1314  
  1315  	R_MIPS_TLS_DTPMOD32    R_MIPS = 38 /* Module number 32 bit */
  1316  	R_MIPS_TLS_DTPREL32    R_MIPS = 39 /* Module-relative offset 32 bit */
  1317  	R_MIPS_TLS_DTPMOD64    R_MIPS = 40 /* Module number 64 bit */
  1318  	R_MIPS_TLS_DTPREL64    R_MIPS = 41 /* Module-relative offset 64 bit */
  1319  	R_MIPS_TLS_GD          R_MIPS = 42 /* 16 bit GOT offset for GD */
  1320  	R_MIPS_TLS_LDM         R_MIPS = 43 /* 16 bit GOT offset for LDM */
  1321  	R_MIPS_TLS_DTPREL_HI16 R_MIPS = 44 /* Module-relative offset, high 16 bits */
  1322  	R_MIPS_TLS_DTPREL_LO16 R_MIPS = 45 /* Module-relative offset, low 16 bits */
  1323  	R_MIPS_TLS_GOTTPREL    R_MIPS = 46 /* 16 bit GOT offset for IE */
  1324  	R_MIPS_TLS_TPREL32     R_MIPS = 47 /* TP-relative offset, 32 bit */
  1325  	R_MIPS_TLS_TPREL64     R_MIPS = 48 /* TP-relative offset, 64 bit */
  1326  	R_MIPS_TLS_TPREL_HI16  R_MIPS = 49 /* TP-relative offset, high 16 bits */
  1327  	R_MIPS_TLS_TPREL_LO16  R_MIPS = 50 /* TP-relative offset, low 16 bits */
  1328  )
  1329  
  1330  var rmipsStrings = []intName{
  1331  	{0, "R_MIPS_NONE"},
  1332  	{1, "R_MIPS_16"},
  1333  	{2, "R_MIPS_32"},
  1334  	{3, "R_MIPS_REL32"},
  1335  	{4, "R_MIPS_26"},
  1336  	{5, "R_MIPS_HI16"},
  1337  	{6, "R_MIPS_LO16"},
  1338  	{7, "R_MIPS_GPREL16"},
  1339  	{8, "R_MIPS_LITERAL"},
  1340  	{9, "R_MIPS_GOT16"},
  1341  	{10, "R_MIPS_PC16"},
  1342  	{11, "R_MIPS_CALL16"},
  1343  	{12, "R_MIPS_GPREL32"},
  1344  	{16, "R_MIPS_SHIFT5"},
  1345  	{17, "R_MIPS_SHIFT6"},
  1346  	{18, "R_MIPS_64"},
  1347  	{19, "R_MIPS_GOT_DISP"},
  1348  	{20, "R_MIPS_GOT_PAGE"},
  1349  	{21, "R_MIPS_GOT_OFST"},
  1350  	{22, "R_MIPS_GOT_HI16"},
  1351  	{23, "R_MIPS_GOT_LO16"},
  1352  	{24, "R_MIPS_SUB"},
  1353  	{25, "R_MIPS_INSERT_A"},
  1354  	{26, "R_MIPS_INSERT_B"},
  1355  	{27, "R_MIPS_DELETE"},
  1356  	{28, "R_MIPS_HIGHER"},
  1357  	{29, "R_MIPS_HIGHEST"},
  1358  	{30, "R_MIPS_CALL_HI16"},
  1359  	{31, "R_MIPS_CALL_LO16"},
  1360  	{32, "R_MIPS_SCN_DISP"},
  1361  	{33, "R_MIPS_REL16"},
  1362  	{34, "R_MIPS_ADD_IMMEDIATE"},
  1363  	{35, "R_MIPS_PJUMP"},
  1364  	{36, "R_MIPS_RELGOT"},
  1365  	{37, "R_MIPS_JALR"},
  1366  	{38, "R_MIPS_TLS_DTPMOD32"},
  1367  	{39, "R_MIPS_TLS_DTPREL32"},
  1368  	{40, "R_MIPS_TLS_DTPMOD64"},
  1369  	{41, "R_MIPS_TLS_DTPREL64"},
  1370  	{42, "R_MIPS_TLS_GD"},
  1371  	{43, "R_MIPS_TLS_LDM"},
  1372  	{44, "R_MIPS_TLS_DTPREL_HI16"},
  1373  	{45, "R_MIPS_TLS_DTPREL_LO16"},
  1374  	{46, "R_MIPS_TLS_GOTTPREL"},
  1375  	{47, "R_MIPS_TLS_TPREL32"},
  1376  	{48, "R_MIPS_TLS_TPREL64"},
  1377  	{49, "R_MIPS_TLS_TPREL_HI16"},
  1378  	{50, "R_MIPS_TLS_TPREL_LO16"},
  1379  }
  1380  
  1381  func (i R_MIPS) String() string   { return stringName(uint32(i), rmipsStrings, false) }
  1382  func (i R_MIPS) GoString() string { return stringName(uint32(i), rmipsStrings, true) }
  1383  
  1384  // Relocation types for PowerPC.
  1385  type R_PPC int
  1386  
  1387  const (
  1388  	R_PPC_NONE            R_PPC = 0 /* No relocation. */
  1389  	R_PPC_ADDR32          R_PPC = 1
  1390  	R_PPC_ADDR24          R_PPC = 2
  1391  	R_PPC_ADDR16          R_PPC = 3
  1392  	R_PPC_ADDR16_LO       R_PPC = 4
  1393  	R_PPC_ADDR16_HI       R_PPC = 5
  1394  	R_PPC_ADDR16_HA       R_PPC = 6
  1395  	R_PPC_ADDR14          R_PPC = 7
  1396  	R_PPC_ADDR14_BRTAKEN  R_PPC = 8
  1397  	R_PPC_ADDR14_BRNTAKEN R_PPC = 9
  1398  	R_PPC_REL24           R_PPC = 10
  1399  	R_PPC_REL14           R_PPC = 11
  1400  	R_PPC_REL14_BRTAKEN   R_PPC = 12
  1401  	R_PPC_REL14_BRNTAKEN  R_PPC = 13
  1402  	R_PPC_GOT16           R_PPC = 14
  1403  	R_PPC_GOT16_LO        R_PPC = 15
  1404  	R_PPC_GOT16_HI        R_PPC = 16
  1405  	R_PPC_GOT16_HA        R_PPC = 17
  1406  	R_PPC_PLTREL24        R_PPC = 18
  1407  	R_PPC_COPY            R_PPC = 19
  1408  	R_PPC_GLOB_DAT        R_PPC = 20
  1409  	R_PPC_JMP_SLOT        R_PPC = 21
  1410  	R_PPC_RELATIVE        R_PPC = 22
  1411  	R_PPC_LOCAL24PC       R_PPC = 23
  1412  	R_PPC_UADDR32         R_PPC = 24
  1413  	R_PPC_UADDR16         R_PPC = 25
  1414  	R_PPC_REL32           R_PPC = 26
  1415  	R_PPC_PLT32           R_PPC = 27
  1416  	R_PPC_PLTREL32        R_PPC = 28
  1417  	R_PPC_PLT16_LO        R_PPC = 29
  1418  	R_PPC_PLT16_HI        R_PPC = 30
  1419  	R_PPC_PLT16_HA        R_PPC = 31
  1420  	R_PPC_SDAREL16        R_PPC = 32
  1421  	R_PPC_SECTOFF         R_PPC = 33
  1422  	R_PPC_SECTOFF_LO      R_PPC = 34
  1423  	R_PPC_SECTOFF_HI      R_PPC = 35
  1424  	R_PPC_SECTOFF_HA      R_PPC = 36
  1425  	R_PPC_TLS             R_PPC = 67
  1426  	R_PPC_DTPMOD32        R_PPC = 68
  1427  	R_PPC_TPREL16         R_PPC = 69
  1428  	R_PPC_TPREL16_LO      R_PPC = 70
  1429  	R_PPC_TPREL16_HI      R_PPC = 71
  1430  	R_PPC_TPREL16_HA      R_PPC = 72
  1431  	R_PPC_TPREL32         R_PPC = 73
  1432  	R_PPC_DTPREL16        R_PPC = 74
  1433  	R_PPC_DTPREL16_LO     R_PPC = 75
  1434  	R_PPC_DTPREL16_HI     R_PPC = 76
  1435  	R_PPC_DTPREL16_HA     R_PPC = 77
  1436  	R_PPC_DTPREL32        R_PPC = 78
  1437  	R_PPC_GOT_TLSGD16     R_PPC = 79
  1438  	R_PPC_GOT_TLSGD16_LO  R_PPC = 80
  1439  	R_PPC_GOT_TLSGD16_HI  R_PPC = 81
  1440  	R_PPC_GOT_TLSGD16_HA  R_PPC = 82
  1441  	R_PPC_GOT_TLSLD16     R_PPC = 83
  1442  	R_PPC_GOT_TLSLD16_LO  R_PPC = 84
  1443  	R_PPC_GOT_TLSLD16_HI  R_PPC = 85
  1444  	R_PPC_GOT_TLSLD16_HA  R_PPC = 86
  1445  	R_PPC_GOT_TPREL16     R_PPC = 87
  1446  	R_PPC_GOT_TPREL16_LO  R_PPC = 88
  1447  	R_PPC_GOT_TPREL16_HI  R_PPC = 89
  1448  	R_PPC_GOT_TPREL16_HA  R_PPC = 90
  1449  	R_PPC_EMB_NADDR32     R_PPC = 101
  1450  	R_PPC_EMB_NADDR16     R_PPC = 102
  1451  	R_PPC_EMB_NADDR16_LO  R_PPC = 103
  1452  	R_PPC_EMB_NADDR16_HI  R_PPC = 104
  1453  	R_PPC_EMB_NADDR16_HA  R_PPC = 105
  1454  	R_PPC_EMB_SDAI16      R_PPC = 106
  1455  	R_PPC_EMB_SDA2I16     R_PPC = 107
  1456  	R_PPC_EMB_SDA2REL     R_PPC = 108
  1457  	R_PPC_EMB_SDA21       R_PPC = 109
  1458  	R_PPC_EMB_MRKREF      R_PPC = 110
  1459  	R_PPC_EMB_RELSEC16    R_PPC = 111
  1460  	R_PPC_EMB_RELST_LO    R_PPC = 112
  1461  	R_PPC_EMB_RELST_HI    R_PPC = 113
  1462  	R_PPC_EMB_RELST_HA    R_PPC = 114
  1463  	R_PPC_EMB_BIT_FLD     R_PPC = 115
  1464  	R_PPC_EMB_RELSDA      R_PPC = 116
  1465  )
  1466  
  1467  var rppcStrings = []intName{
  1468  	{0, "R_PPC_NONE"},
  1469  	{1, "R_PPC_ADDR32"},
  1470  	{2, "R_PPC_ADDR24"},
  1471  	{3, "R_PPC_ADDR16"},
  1472  	{4, "R_PPC_ADDR16_LO"},
  1473  	{5, "R_PPC_ADDR16_HI"},
  1474  	{6, "R_PPC_ADDR16_HA"},
  1475  	{7, "R_PPC_ADDR14"},
  1476  	{8, "R_PPC_ADDR14_BRTAKEN"},
  1477  	{9, "R_PPC_ADDR14_BRNTAKEN"},
  1478  	{10, "R_PPC_REL24"},
  1479  	{11, "R_PPC_REL14"},
  1480  	{12, "R_PPC_REL14_BRTAKEN"},
  1481  	{13, "R_PPC_REL14_BRNTAKEN"},
  1482  	{14, "R_PPC_GOT16"},
  1483  	{15, "R_PPC_GOT16_LO"},
  1484  	{16, "R_PPC_GOT16_HI"},
  1485  	{17, "R_PPC_GOT16_HA"},
  1486  	{18, "R_PPC_PLTREL24"},
  1487  	{19, "R_PPC_COPY"},
  1488  	{20, "R_PPC_GLOB_DAT"},
  1489  	{21, "R_PPC_JMP_SLOT"},
  1490  	{22, "R_PPC_RELATIVE"},
  1491  	{23, "R_PPC_LOCAL24PC"},
  1492  	{24, "R_PPC_UADDR32"},
  1493  	{25, "R_PPC_UADDR16"},
  1494  	{26, "R_PPC_REL32"},
  1495  	{27, "R_PPC_PLT32"},
  1496  	{28, "R_PPC_PLTREL32"},
  1497  	{29, "R_PPC_PLT16_LO"},
  1498  	{30, "R_PPC_PLT16_HI"},
  1499  	{31, "R_PPC_PLT16_HA"},
  1500  	{32, "R_PPC_SDAREL16"},
  1501  	{33, "R_PPC_SECTOFF"},
  1502  	{34, "R_PPC_SECTOFF_LO"},
  1503  	{35, "R_PPC_SECTOFF_HI"},
  1504  	{36, "R_PPC_SECTOFF_HA"},
  1505  
  1506  	{67, "R_PPC_TLS"},
  1507  	{68, "R_PPC_DTPMOD32"},
  1508  	{69, "R_PPC_TPREL16"},
  1509  	{70, "R_PPC_TPREL16_LO"},
  1510  	{71, "R_PPC_TPREL16_HI"},
  1511  	{72, "R_PPC_TPREL16_HA"},
  1512  	{73, "R_PPC_TPREL32"},
  1513  	{74, "R_PPC_DTPREL16"},
  1514  	{75, "R_PPC_DTPREL16_LO"},
  1515  	{76, "R_PPC_DTPREL16_HI"},
  1516  	{77, "R_PPC_DTPREL16_HA"},
  1517  	{78, "R_PPC_DTPREL32"},
  1518  	{79, "R_PPC_GOT_TLSGD16"},
  1519  	{80, "R_PPC_GOT_TLSGD16_LO"},
  1520  	{81, "R_PPC_GOT_TLSGD16_HI"},
  1521  	{82, "R_PPC_GOT_TLSGD16_HA"},
  1522  	{83, "R_PPC_GOT_TLSLD16"},
  1523  	{84, "R_PPC_GOT_TLSLD16_LO"},
  1524  	{85, "R_PPC_GOT_TLSLD16_HI"},
  1525  	{86, "R_PPC_GOT_TLSLD16_HA"},
  1526  	{87, "R_PPC_GOT_TPREL16"},
  1527  	{88, "R_PPC_GOT_TPREL16_LO"},
  1528  	{89, "R_PPC_GOT_TPREL16_HI"},
  1529  	{90, "R_PPC_GOT_TPREL16_HA"},
  1530  
  1531  	{101, "R_PPC_EMB_NADDR32"},
  1532  	{102, "R_PPC_EMB_NADDR16"},
  1533  	{103, "R_PPC_EMB_NADDR16_LO"},
  1534  	{104, "R_PPC_EMB_NADDR16_HI"},
  1535  	{105, "R_PPC_EMB_NADDR16_HA"},
  1536  	{106, "R_PPC_EMB_SDAI16"},
  1537  	{107, "R_PPC_EMB_SDA2I16"},
  1538  	{108, "R_PPC_EMB_SDA2REL"},
  1539  	{109, "R_PPC_EMB_SDA21"},
  1540  	{110, "R_PPC_EMB_MRKREF"},
  1541  	{111, "R_PPC_EMB_RELSEC16"},
  1542  	{112, "R_PPC_EMB_RELST_LO"},
  1543  	{113, "R_PPC_EMB_RELST_HI"},
  1544  	{114, "R_PPC_EMB_RELST_HA"},
  1545  	{115, "R_PPC_EMB_BIT_FLD"},
  1546  	{116, "R_PPC_EMB_RELSDA"},
  1547  }
  1548  
  1549  func (i R_PPC) String() string   { return stringName(uint32(i), rppcStrings, false) }
  1550  func (i R_PPC) GoString() string { return stringName(uint32(i), rppcStrings, true) }
  1551  
  1552  // Relocation types for 64-bit PowerPC or Power Architecture processors.
  1553  type R_PPC64 int
  1554  
  1555  const (
  1556  	R_PPC64_NONE               R_PPC64 = 0
  1557  	R_PPC64_ADDR32             R_PPC64 = 1
  1558  	R_PPC64_ADDR24             R_PPC64 = 2
  1559  	R_PPC64_ADDR16             R_PPC64 = 3
  1560  	R_PPC64_ADDR16_LO          R_PPC64 = 4
  1561  	R_PPC64_ADDR16_HI          R_PPC64 = 5
  1562  	R_PPC64_ADDR16_HA          R_PPC64 = 6
  1563  	R_PPC64_ADDR14             R_PPC64 = 7
  1564  	R_PPC64_ADDR14_BRTAKEN     R_PPC64 = 8
  1565  	R_PPC64_ADDR14_BRNTAKEN    R_PPC64 = 9
  1566  	R_PPC64_REL24              R_PPC64 = 10
  1567  	R_PPC64_REL14              R_PPC64 = 11
  1568  	R_PPC64_REL14_BRTAKEN      R_PPC64 = 12
  1569  	R_PPC64_REL14_BRNTAKEN     R_PPC64 = 13
  1570  	R_PPC64_GOT16              R_PPC64 = 14
  1571  	R_PPC64_GOT16_LO           R_PPC64 = 15
  1572  	R_PPC64_GOT16_HI           R_PPC64 = 16
  1573  	R_PPC64_GOT16_HA           R_PPC64 = 17
  1574  	R_PPC64_JMP_SLOT           R_PPC64 = 21
  1575  	R_PPC64_REL32              R_PPC64 = 26
  1576  	R_PPC64_ADDR64             R_PPC64 = 38
  1577  	R_PPC64_ADDR16_HIGHER      R_PPC64 = 39
  1578  	R_PPC64_ADDR16_HIGHERA     R_PPC64 = 40
  1579  	R_PPC64_ADDR16_HIGHEST     R_PPC64 = 41
  1580  	R_PPC64_ADDR16_HIGHESTA    R_PPC64 = 42
  1581  	R_PPC64_REL64              R_PPC64 = 44
  1582  	R_PPC64_TOC16              R_PPC64 = 47
  1583  	R_PPC64_TOC16_LO           R_PPC64 = 48
  1584  	R_PPC64_TOC16_HI           R_PPC64 = 49
  1585  	R_PPC64_TOC16_HA           R_PPC64 = 50
  1586  	R_PPC64_TOC                R_PPC64 = 51
  1587  	R_PPC64_ADDR16_DS          R_PPC64 = 56
  1588  	R_PPC64_ADDR16_LO_DS       R_PPC64 = 57
  1589  	R_PPC64_GOT16_DS           R_PPC64 = 58
  1590  	R_PPC64_GOT16_LO_DS        R_PPC64 = 59
  1591  	R_PPC64_TOC16_DS           R_PPC64 = 63
  1592  	R_PPC64_TOC16_LO_DS        R_PPC64 = 64
  1593  	R_PPC64_TLS                R_PPC64 = 67
  1594  	R_PPC64_DTPMOD64           R_PPC64 = 68
  1595  	R_PPC64_TPREL16            R_PPC64 = 69
  1596  	R_PPC64_TPREL16_LO         R_PPC64 = 70
  1597  	R_PPC64_TPREL16_HI         R_PPC64 = 71
  1598  	R_PPC64_TPREL16_HA         R_PPC64 = 72
  1599  	R_PPC64_TPREL64            R_PPC64 = 73
  1600  	R_PPC64_DTPREL16           R_PPC64 = 74
  1601  	R_PPC64_DTPREL16_LO        R_PPC64 = 75
  1602  	R_PPC64_DTPREL16_HI        R_PPC64 = 76
  1603  	R_PPC64_DTPREL16_HA        R_PPC64 = 77
  1604  	R_PPC64_DTPREL64           R_PPC64 = 78
  1605  	R_PPC64_GOT_TLSGD16        R_PPC64 = 79
  1606  	R_PPC64_GOT_TLSGD16_LO     R_PPC64 = 80
  1607  	R_PPC64_GOT_TLSGD16_HI     R_PPC64 = 81
  1608  	R_PPC64_GOT_TLSGD16_HA     R_PPC64 = 82
  1609  	R_PPC64_GOT_TLSLD16        R_PPC64 = 83
  1610  	R_PPC64_GOT_TLSLD16_LO     R_PPC64 = 84
  1611  	R_PPC64_GOT_TLSLD16_HI     R_PPC64 = 85
  1612  	R_PPC64_GOT_TLSLD16_HA     R_PPC64 = 86
  1613  	R_PPC64_GOT_TPREL16_DS     R_PPC64 = 87
  1614  	R_PPC64_GOT_TPREL16_LO_DS  R_PPC64 = 88
  1615  	R_PPC64_GOT_TPREL16_HI     R_PPC64 = 89
  1616  	R_PPC64_GOT_TPREL16_HA     R_PPC64 = 90
  1617  	R_PPC64_GOT_DTPREL16_DS    R_PPC64 = 91
  1618  	R_PPC64_GOT_DTPREL16_LO_DS R_PPC64 = 92
  1619  	R_PPC64_GOT_DTPREL16_HI    R_PPC64 = 93
  1620  	R_PPC64_GOT_DTPREL16_HA    R_PPC64 = 94
  1621  	R_PPC64_TPREL16_DS         R_PPC64 = 95
  1622  	R_PPC64_TPREL16_LO_DS      R_PPC64 = 96
  1623  	R_PPC64_TPREL16_HIGHER     R_PPC64 = 97
  1624  	R_PPC64_TPREL16_HIGHERA    R_PPC64 = 98
  1625  	R_PPC64_TPREL16_HIGHEST    R_PPC64 = 99
  1626  	R_PPC64_TPREL16_HIGHESTA   R_PPC64 = 100
  1627  	R_PPC64_DTPREL16_DS        R_PPC64 = 101
  1628  	R_PPC64_DTPREL16_LO_DS     R_PPC64 = 102
  1629  	R_PPC64_DTPREL16_HIGHER    R_PPC64 = 103
  1630  	R_PPC64_DTPREL16_HIGHERA   R_PPC64 = 104
  1631  	R_PPC64_DTPREL16_HIGHEST   R_PPC64 = 105
  1632  	R_PPC64_DTPREL16_HIGHESTA  R_PPC64 = 106
  1633  	R_PPC64_TLSGD              R_PPC64 = 107
  1634  	R_PPC64_TLSLD              R_PPC64 = 108
  1635  	R_PPC64_REL16              R_PPC64 = 249
  1636  	R_PPC64_REL16_LO           R_PPC64 = 250
  1637  	R_PPC64_REL16_HI           R_PPC64 = 251
  1638  	R_PPC64_REL16_HA           R_PPC64 = 252
  1639  )
  1640  
  1641  var rppc64Strings = []intName{
  1642  	{0, "R_PPC64_NONE"},
  1643  	{1, "R_PPC64_ADDR32"},
  1644  	{2, "R_PPC64_ADDR24"},
  1645  	{3, "R_PPC64_ADDR16"},
  1646  	{4, "R_PPC64_ADDR16_LO"},
  1647  	{5, "R_PPC64_ADDR16_HI"},
  1648  	{6, "R_PPC64_ADDR16_HA"},
  1649  	{7, "R_PPC64_ADDR14"},
  1650  	{8, "R_PPC64_ADDR14_BRTAKEN"},
  1651  	{9, "R_PPC64_ADDR14_BRNTAKEN"},
  1652  	{10, "R_PPC64_REL24"},
  1653  	{11, "R_PPC64_REL14"},
  1654  	{12, "R_PPC64_REL14_BRTAKEN"},
  1655  	{13, "R_PPC64_REL14_BRNTAKEN"},
  1656  	{14, "R_PPC64_GOT16"},
  1657  	{15, "R_PPC64_GOT16_LO"},
  1658  	{16, "R_PPC64_GOT16_HI"},
  1659  	{17, "R_PPC64_GOT16_HA"},
  1660  	{21, "R_PPC64_JMP_SLOT"},
  1661  	{26, "R_PPC64_REL32"},
  1662  	{38, "R_PPC64_ADDR64"},
  1663  	{39, "R_PPC64_ADDR16_HIGHER"},
  1664  	{40, "R_PPC64_ADDR16_HIGHERA"},
  1665  	{41, "R_PPC64_ADDR16_HIGHEST"},
  1666  	{42, "R_PPC64_ADDR16_HIGHESTA"},
  1667  	{44, "R_PPC64_REL64"},
  1668  	{47, "R_PPC64_TOC16"},
  1669  	{48, "R_PPC64_TOC16_LO"},
  1670  	{49, "R_PPC64_TOC16_HI"},
  1671  	{50, "R_PPC64_TOC16_HA"},
  1672  	{51, "R_PPC64_TOC"},
  1673  	{56, "R_PPC64_ADDR16_DS"},
  1674  	{57, "R_PPC64_ADDR16_LO_DS"},
  1675  	{58, "R_PPC64_GOT16_DS"},
  1676  	{59, "R_PPC64_GOT16_LO_DS"},
  1677  	{63, "R_PPC64_TOC16_DS"},
  1678  	{64, "R_PPC64_TOC16_LO_DS"},
  1679  	{67, "R_PPC64_TLS"},
  1680  	{68, "R_PPC64_DTPMOD64"},
  1681  	{69, "R_PPC64_TPREL16"},
  1682  	{70, "R_PPC64_TPREL16_LO"},
  1683  	{71, "R_PPC64_TPREL16_HI"},
  1684  	{72, "R_PPC64_TPREL16_HA"},
  1685  	{73, "R_PPC64_TPREL64"},
  1686  	{74, "R_PPC64_DTPREL16"},
  1687  	{75, "R_PPC64_DTPREL16_LO"},
  1688  	{76, "R_PPC64_DTPREL16_HI"},
  1689  	{77, "R_PPC64_DTPREL16_HA"},
  1690  	{78, "R_PPC64_DTPREL64"},
  1691  	{79, "R_PPC64_GOT_TLSGD16"},
  1692  	{80, "R_PPC64_GOT_TLSGD16_LO"},
  1693  	{81, "R_PPC64_GOT_TLSGD16_HI"},
  1694  	{82, "R_PPC64_GOT_TLSGD16_HA"},
  1695  	{83, "R_PPC64_GOT_TLSLD16"},
  1696  	{84, "R_PPC64_GOT_TLSLD16_LO"},
  1697  	{85, "R_PPC64_GOT_TLSLD16_HI"},
  1698  	{86, "R_PPC64_GOT_TLSLD16_HA"},
  1699  	{87, "R_PPC64_GOT_TPREL16_DS"},
  1700  	{88, "R_PPC64_GOT_TPREL16_LO_DS"},
  1701  	{89, "R_PPC64_GOT_TPREL16_HI"},
  1702  	{90, "R_PPC64_GOT_TPREL16_HA"},
  1703  	{91, "R_PPC64_GOT_DTPREL16_DS"},
  1704  	{92, "R_PPC64_GOT_DTPREL16_LO_DS"},
  1705  	{93, "R_PPC64_GOT_DTPREL16_HI"},
  1706  	{94, "R_PPC64_GOT_DTPREL16_HA"},
  1707  	{95, "R_PPC64_TPREL16_DS"},
  1708  	{96, "R_PPC64_TPREL16_LO_DS"},
  1709  	{97, "R_PPC64_TPREL16_HIGHER"},
  1710  	{98, "R_PPC64_TPREL16_HIGHERA"},
  1711  	{99, "R_PPC64_TPREL16_HIGHEST"},
  1712  	{100, "R_PPC64_TPREL16_HIGHESTA"},
  1713  	{101, "R_PPC64_DTPREL16_DS"},
  1714  	{102, "R_PPC64_DTPREL16_LO_DS"},
  1715  	{103, "R_PPC64_DTPREL16_HIGHER"},
  1716  	{104, "R_PPC64_DTPREL16_HIGHERA"},
  1717  	{105, "R_PPC64_DTPREL16_HIGHEST"},
  1718  	{106, "R_PPC64_DTPREL16_HIGHESTA"},
  1719  	{107, "R_PPC64_TLSGD"},
  1720  	{108, "R_PPC64_TLSLD"},
  1721  	{249, "R_PPC64_REL16"},
  1722  	{250, "R_PPC64_REL16_LO"},
  1723  	{251, "R_PPC64_REL16_HI"},
  1724  	{252, "R_PPC64_REL16_HA"},
  1725  }
  1726  
  1727  func (i R_PPC64) String() string   { return stringName(uint32(i), rppc64Strings, false) }
  1728  func (i R_PPC64) GoString() string { return stringName(uint32(i), rppc64Strings, true) }
  1729  
  1730  // Relocation types for RISC-V processors.
  1731  type R_RISCV int
  1732  
  1733  const (
  1734  	R_RISCV_NONE         R_RISCV = 0  /* No relocation. */
  1735  	R_RISCV_32           R_RISCV = 1  /* Add 32 bit zero extended symbol value */
  1736  	R_RISCV_64           R_RISCV = 2  /* Add 64 bit symbol value. */
  1737  	R_RISCV_RELATIVE     R_RISCV = 3  /* Add load address of shared object. */
  1738  	R_RISCV_COPY         R_RISCV = 4  /* Copy data from shared object. */
  1739  	R_RISCV_JUMP_SLOT    R_RISCV = 5  /* Set GOT entry to code address. */
  1740  	R_RISCV_TLS_DTPMOD32 R_RISCV = 6  /* 32 bit ID of module containing symbol */
  1741  	R_RISCV_TLS_DTPMOD64 R_RISCV = 7  /* ID of module containing symbol */
  1742  	R_RISCV_TLS_DTPREL32 R_RISCV = 8  /* 32 bit relative offset in TLS block */
  1743  	R_RISCV_TLS_DTPREL64 R_RISCV = 9  /* Relative offset in TLS block */
  1744  	R_RISCV_TLS_TPREL32  R_RISCV = 10 /* 32 bit relative offset in static TLS block */
  1745  	R_RISCV_TLS_TPREL64  R_RISCV = 11 /* Relative offset in static TLS block */
  1746  )
  1747  
  1748  var rxRISCVStrings = []intName{
  1749  	{0, "R_RISCV_NONE"},
  1750  	{1, "R_RISCV_32"},
  1751  	{2, "R_RISCV_64"},
  1752  	{3, "R_RISCV_RELATIVE"},
  1753  	{4, "R_RISCV_COPY"},
  1754  	{5, "R_RISCV_JUMP_SLOT"},
  1755  	{6, "R_RISCV_TLS_DTPMOD32"},
  1756  	{7, "R_RISCV_TLS_DTPMOD64"},
  1757  	{8, "R_RISCV_TLS_DTPREL32"},
  1758  	{9, "R_RISCV_TLS_DTPREL64"},
  1759  	{10, "R_RISCV_TLS_TPREL32"},
  1760  	{11, "R_RISCV_TLS_TPREL64"},
  1761  }
  1762  
  1763  func (i R_RISCV) String() string   { return stringName(uint32(i), rxRISCVStrings, false) }
  1764  func (i R_RISCV) GoString() string { return stringName(uint32(i), rxRISCVStrings, true) }
  1765  
  1766  // Relocation types for s390x processors.
  1767  type R_390 int
  1768  
  1769  const (
  1770  	R_390_NONE        R_390 = 0
  1771  	R_390_8           R_390 = 1
  1772  	R_390_12          R_390 = 2
  1773  	R_390_16          R_390 = 3
  1774  	R_390_32          R_390 = 4
  1775  	R_390_PC32        R_390 = 5
  1776  	R_390_GOT12       R_390 = 6
  1777  	R_390_GOT32       R_390 = 7
  1778  	R_390_PLT32       R_390 = 8
  1779  	R_390_COPY        R_390 = 9
  1780  	R_390_GLOB_DAT    R_390 = 10
  1781  	R_390_JMP_SLOT    R_390 = 11
  1782  	R_390_RELATIVE    R_390 = 12
  1783  	R_390_GOTOFF      R_390 = 13
  1784  	R_390_GOTPC       R_390 = 14
  1785  	R_390_GOT16       R_390 = 15
  1786  	R_390_PC16        R_390 = 16
  1787  	R_390_PC16DBL     R_390 = 17
  1788  	R_390_PLT16DBL    R_390 = 18
  1789  	R_390_PC32DBL     R_390 = 19
  1790  	R_390_PLT32DBL    R_390 = 20
  1791  	R_390_GOTPCDBL    R_390 = 21
  1792  	R_390_64          R_390 = 22
  1793  	R_390_PC64        R_390 = 23
  1794  	R_390_GOT64       R_390 = 24
  1795  	R_390_PLT64       R_390 = 25
  1796  	R_390_GOTENT      R_390 = 26
  1797  	R_390_GOTOFF16    R_390 = 27
  1798  	R_390_GOTOFF64    R_390 = 28
  1799  	R_390_GOTPLT12    R_390 = 29
  1800  	R_390_GOTPLT16    R_390 = 30
  1801  	R_390_GOTPLT32    R_390 = 31
  1802  	R_390_GOTPLT64    R_390 = 32
  1803  	R_390_GOTPLTENT   R_390 = 33
  1804  	R_390_GOTPLTOFF16 R_390 = 34
  1805  	R_390_GOTPLTOFF32 R_390 = 35
  1806  	R_390_GOTPLTOFF64 R_390 = 36
  1807  	R_390_TLS_LOAD    R_390 = 37
  1808  	R_390_TLS_GDCALL  R_390 = 38
  1809  	R_390_TLS_LDCALL  R_390 = 39
  1810  	R_390_TLS_GD32    R_390 = 40
  1811  	R_390_TLS_GD64    R_390 = 41
  1812  	R_390_TLS_GOTIE12 R_390 = 42
  1813  	R_390_TLS_GOTIE32 R_390 = 43
  1814  	R_390_TLS_GOTIE64 R_390 = 44
  1815  	R_390_TLS_LDM32   R_390 = 45
  1816  	R_390_TLS_LDM64   R_390 = 46
  1817  	R_390_TLS_IE32    R_390 = 47
  1818  	R_390_TLS_IE64    R_390 = 48
  1819  	R_390_TLS_IEENT   R_390 = 49
  1820  	R_390_TLS_LE32    R_390 = 50
  1821  	R_390_TLS_LE64    R_390 = 51
  1822  	R_390_TLS_LDO32   R_390 = 52
  1823  	R_390_TLS_LDO64   R_390 = 53
  1824  	R_390_TLS_DTPMOD  R_390 = 54
  1825  	R_390_TLS_DTPOFF  R_390 = 55
  1826  	R_390_TLS_TPOFF   R_390 = 56
  1827  	R_390_20          R_390 = 57
  1828  	R_390_GOT20       R_390 = 58
  1829  	R_390_GOTPLT20    R_390 = 59
  1830  	R_390_TLS_GOTIE20 R_390 = 60
  1831  )
  1832  
  1833  var r390Strings = []intName{
  1834  	{0, "R_390_NONE"},
  1835  	{1, "R_390_8"},
  1836  	{2, "R_390_12"},
  1837  	{3, "R_390_16"},
  1838  	{4, "R_390_32"},
  1839  	{5, "R_390_PC32"},
  1840  	{6, "R_390_GOT12"},
  1841  	{7, "R_390_GOT32"},
  1842  	{8, "R_390_PLT32"},
  1843  	{9, "R_390_COPY"},
  1844  	{10, "R_390_GLOB_DAT"},
  1845  	{11, "R_390_JMP_SLOT"},
  1846  	{12, "R_390_RELATIVE"},
  1847  	{13, "R_390_GOTOFF"},
  1848  	{14, "R_390_GOTPC"},
  1849  	{15, "R_390_GOT16"},
  1850  	{16, "R_390_PC16"},
  1851  	{17, "R_390_PC16DBL"},
  1852  	{18, "R_390_PLT16DBL"},
  1853  	{19, "R_390_PC32DBL"},
  1854  	{20, "R_390_PLT32DBL"},
  1855  	{21, "R_390_GOTPCDBL"},
  1856  	{22, "R_390_64"},
  1857  	{23, "R_390_PC64"},
  1858  	{24, "R_390_GOT64"},
  1859  	{25, "R_390_PLT64"},
  1860  	{26, "R_390_GOTENT"},
  1861  	{27, "R_390_GOTOFF16"},
  1862  	{28, "R_390_GOTOFF64"},
  1863  	{29, "R_390_GOTPLT12"},
  1864  	{30, "R_390_GOTPLT16"},
  1865  	{31, "R_390_GOTPLT32"},
  1866  	{32, "R_390_GOTPLT64"},
  1867  	{33, "R_390_GOTPLTENT"},
  1868  	{34, "R_390_GOTPLTOFF16"},
  1869  	{35, "R_390_GOTPLTOFF32"},
  1870  	{36, "R_390_GOTPLTOFF64"},
  1871  	{37, "R_390_TLS_LOAD"},
  1872  	{38, "R_390_TLS_GDCALL"},
  1873  	{39, "R_390_TLS_LDCALL"},
  1874  	{40, "R_390_TLS_GD32"},
  1875  	{41, "R_390_TLS_GD64"},
  1876  	{42, "R_390_TLS_GOTIE12"},
  1877  	{43, "R_390_TLS_GOTIE32"},
  1878  	{44, "R_390_TLS_GOTIE64"},
  1879  	{45, "R_390_TLS_LDM32"},
  1880  	{46, "R_390_TLS_LDM64"},
  1881  	{47, "R_390_TLS_IE32"},
  1882  	{48, "R_390_TLS_IE64"},
  1883  	{49, "R_390_TLS_IEENT"},
  1884  	{50, "R_390_TLS_LE32"},
  1885  	{51, "R_390_TLS_LE64"},
  1886  	{52, "R_390_TLS_LDO32"},
  1887  	{53, "R_390_TLS_LDO64"},
  1888  	{54, "R_390_TLS_DTPMOD"},
  1889  	{55, "R_390_TLS_DTPOFF"},
  1890  	{56, "R_390_TLS_TPOFF"},
  1891  	{57, "R_390_20"},
  1892  	{58, "R_390_GOT20"},
  1893  	{59, "R_390_GOTPLT20"},
  1894  	{60, "R_390_TLS_GOTIE20"},
  1895  }
  1896  
  1897  func (i R_390) String() string   { return stringName(uint32(i), r390Strings, false) }
  1898  func (i R_390) GoString() string { return stringName(uint32(i), r390Strings, true) }
  1899  
  1900  // Relocation types for SPARC.
  1901  type R_SPARC int
  1902  
  1903  const (
  1904  	R_SPARC_NONE     R_SPARC = 0
  1905  	R_SPARC_8        R_SPARC = 1
  1906  	R_SPARC_16       R_SPARC = 2
  1907  	R_SPARC_32       R_SPARC = 3
  1908  	R_SPARC_DISP8    R_SPARC = 4
  1909  	R_SPARC_DISP16   R_SPARC = 5
  1910  	R_SPARC_DISP32   R_SPARC = 6
  1911  	R_SPARC_WDISP30  R_SPARC = 7
  1912  	R_SPARC_WDISP22  R_SPARC = 8
  1913  	R_SPARC_HI22     R_SPARC = 9
  1914  	R_SPARC_22       R_SPARC = 10
  1915  	R_SPARC_13       R_SPARC = 11
  1916  	R_SPARC_LO10     R_SPARC = 12
  1917  	R_SPARC_GOT10    R_SPARC = 13
  1918  	R_SPARC_GOT13    R_SPARC = 14
  1919  	R_SPARC_GOT22    R_SPARC = 15
  1920  	R_SPARC_PC10     R_SPARC = 16
  1921  	R_SPARC_PC22     R_SPARC = 17
  1922  	R_SPARC_WPLT30   R_SPARC = 18
  1923  	R_SPARC_COPY     R_SPARC = 19
  1924  	R_SPARC_GLOB_DAT R_SPARC = 20
  1925  	R_SPARC_JMP_SLOT R_SPARC = 21
  1926  	R_SPARC_RELATIVE R_SPARC = 22
  1927  	R_SPARC_UA32     R_SPARC = 23
  1928  	R_SPARC_PLT32    R_SPARC = 24
  1929  	R_SPARC_HIPLT22  R_SPARC = 25
  1930  	R_SPARC_LOPLT10  R_SPARC = 26
  1931  	R_SPARC_PCPLT32  R_SPARC = 27
  1932  	R_SPARC_PCPLT22  R_SPARC = 28
  1933  	R_SPARC_PCPLT10  R_SPARC = 29
  1934  	R_SPARC_10       R_SPARC = 30
  1935  	R_SPARC_11       R_SPARC = 31
  1936  	R_SPARC_64       R_SPARC = 32
  1937  	R_SPARC_OLO10    R_SPARC = 33
  1938  	R_SPARC_HH22     R_SPARC = 34
  1939  	R_SPARC_HM10     R_SPARC = 35
  1940  	R_SPARC_LM22     R_SPARC = 36
  1941  	R_SPARC_PC_HH22  R_SPARC = 37
  1942  	R_SPARC_PC_HM10  R_SPARC = 38
  1943  	R_SPARC_PC_LM22  R_SPARC = 39
  1944  	R_SPARC_WDISP16  R_SPARC = 40
  1945  	R_SPARC_WDISP19  R_SPARC = 41
  1946  	R_SPARC_GLOB_JMP R_SPARC = 42
  1947  	R_SPARC_7        R_SPARC = 43
  1948  	R_SPARC_5        R_SPARC = 44
  1949  	R_SPARC_6        R_SPARC = 45
  1950  	R_SPARC_DISP64   R_SPARC = 46
  1951  	R_SPARC_PLT64    R_SPARC = 47
  1952  	R_SPARC_HIX22    R_SPARC = 48
  1953  	R_SPARC_LOX10    R_SPARC = 49
  1954  	R_SPARC_H44      R_SPARC = 50
  1955  	R_SPARC_M44      R_SPARC = 51
  1956  	R_SPARC_L44      R_SPARC = 52
  1957  	R_SPARC_REGISTER R_SPARC = 53
  1958  	R_SPARC_UA64     R_SPARC = 54
  1959  	R_SPARC_UA16     R_SPARC = 55
  1960  )
  1961  
  1962  var rsparcStrings = []intName{
  1963  	{0, "R_SPARC_NONE"},
  1964  	{1, "R_SPARC_8"},
  1965  	{2, "R_SPARC_16"},
  1966  	{3, "R_SPARC_32"},
  1967  	{4, "R_SPARC_DISP8"},
  1968  	{5, "R_SPARC_DISP16"},
  1969  	{6, "R_SPARC_DISP32"},
  1970  	{7, "R_SPARC_WDISP30"},
  1971  	{8, "R_SPARC_WDISP22"},
  1972  	{9, "R_SPARC_HI22"},
  1973  	{10, "R_SPARC_22"},
  1974  	{11, "R_SPARC_13"},
  1975  	{12, "R_SPARC_LO10"},
  1976  	{13, "R_SPARC_GOT10"},
  1977  	{14, "R_SPARC_GOT13"},
  1978  	{15, "R_SPARC_GOT22"},
  1979  	{16, "R_SPARC_PC10"},
  1980  	{17, "R_SPARC_PC22"},
  1981  	{18, "R_SPARC_WPLT30"},
  1982  	{19, "R_SPARC_COPY"},
  1983  	{20, "R_SPARC_GLOB_DAT"},
  1984  	{21, "R_SPARC_JMP_SLOT"},
  1985  	{22, "R_SPARC_RELATIVE"},
  1986  	{23, "R_SPARC_UA32"},
  1987  	{24, "R_SPARC_PLT32"},
  1988  	{25, "R_SPARC_HIPLT22"},
  1989  	{26, "R_SPARC_LOPLT10"},
  1990  	{27, "R_SPARC_PCPLT32"},
  1991  	{28, "R_SPARC_PCPLT22"},
  1992  	{29, "R_SPARC_PCPLT10"},
  1993  	{30, "R_SPARC_10"},
  1994  	{31, "R_SPARC_11"},
  1995  	{32, "R_SPARC_64"},
  1996  	{33, "R_SPARC_OLO10"},
  1997  	{34, "R_SPARC_HH22"},
  1998  	{35, "R_SPARC_HM10"},
  1999  	{36, "R_SPARC_LM22"},
  2000  	{37, "R_SPARC_PC_HH22"},
  2001  	{38, "R_SPARC_PC_HM10"},
  2002  	{39, "R_SPARC_PC_LM22"},
  2003  	{40, "R_SPARC_WDISP16"},
  2004  	{41, "R_SPARC_WDISP19"},
  2005  	{42, "R_SPARC_GLOB_JMP"},
  2006  	{43, "R_SPARC_7"},
  2007  	{44, "R_SPARC_5"},
  2008  	{45, "R_SPARC_6"},
  2009  	{46, "R_SPARC_DISP64"},
  2010  	{47, "R_SPARC_PLT64"},
  2011  	{48, "R_SPARC_HIX22"},
  2012  	{49, "R_SPARC_LOX10"},
  2013  	{50, "R_SPARC_H44"},
  2014  	{51, "R_SPARC_M44"},
  2015  	{52, "R_SPARC_L44"},
  2016  	{53, "R_SPARC_REGISTER"},
  2017  	{54, "R_SPARC_UA64"},
  2018  	{55, "R_SPARC_UA16"},
  2019  }
  2020  
  2021  func (i R_SPARC) String() string   { return stringName(uint32(i), rsparcStrings, false) }
  2022  func (i R_SPARC) GoString() string { return stringName(uint32(i), rsparcStrings, true) }
  2023  
  2024  // Magic number for the elf trampoline, chosen wisely to be an immediate value.
  2025  const ARM_MAGIC_TRAMP_NUMBER = 0x5c000003
  2026  
  2027  // ELF32 File header.
  2028  type Header32 struct {
  2029  	Ident     [EI_NIDENT]byte /* File identification. */
  2030  	Type      uint16          /* File type. */
  2031  	Machine   uint16          /* Machine architecture. */
  2032  	Version   uint32          /* ELF format version. */
  2033  	Entry     uint32          /* Entry point. */
  2034  	Phoff     uint32          /* Program header file offset. */
  2035  	Shoff     uint32          /* Section header file offset. */
  2036  	Flags     uint32          /* Architecture-specific flags. */
  2037  	Ehsize    uint16          /* Size of ELF header in bytes. */
  2038  	Phentsize uint16          /* Size of program header entry. */
  2039  	Phnum     uint16          /* Number of program header entries. */
  2040  	Shentsize uint16          /* Size of section header entry. */
  2041  	Shnum     uint16          /* Number of section header entries. */
  2042  	Shstrndx  uint16          /* Section name strings section. */
  2043  }
  2044  
  2045  // ELF32 Section header.
  2046  type Section32 struct {
  2047  	Name      uint32 /* Section name (index into the section header string table). */
  2048  	Type      uint32 /* Section type. */
  2049  	Flags     uint32 /* Section flags. */
  2050  	Addr      uint32 /* Address in memory image. */
  2051  	Off       uint32 /* Offset in file. */
  2052  	Size      uint32 /* Size in bytes. */
  2053  	Link      uint32 /* Index of a related section. */
  2054  	Info      uint32 /* Depends on section type. */
  2055  	Addralign uint32 /* Alignment in bytes. */
  2056  	Entsize   uint32 /* Size of each entry in section. */
  2057  }
  2058  
  2059  // ELF32 Program header.
  2060  type Prog32 struct {
  2061  	Type   uint32 /* Entry type. */
  2062  	Off    uint32 /* File offset of contents. */
  2063  	Vaddr  uint32 /* Virtual address in memory image. */
  2064  	Paddr  uint32 /* Physical address (not used). */
  2065  	Filesz uint32 /* Size of contents in file. */
  2066  	Memsz  uint32 /* Size of contents in memory. */
  2067  	Flags  uint32 /* Access permission flags. */
  2068  	Align  uint32 /* Alignment in memory and file. */
  2069  }
  2070  
  2071  // ELF32 Dynamic structure. The ".dynamic" section contains an array of them.
  2072  type Dyn32 struct {
  2073  	Tag int32  /* Entry type. */
  2074  	Val uint32 /* Integer/Address value. */
  2075  }
  2076  
  2077  // ELF32 Compression header.
  2078  type Chdr32 struct {
  2079  	Type      uint32
  2080  	Size      uint32
  2081  	Addralign uint32
  2082  }
  2083  
  2084  /*
  2085   * Relocation entries.
  2086   */
  2087  
  2088  // ELF32 Relocations that don't need an addend field.
  2089  type Rel32 struct {
  2090  	Off  uint32 /* Location to be relocated. */
  2091  	Info uint32 /* Relocation type and symbol index. */
  2092  }
  2093  
  2094  // ELF32 Relocations that need an addend field.
  2095  type Rela32 struct {
  2096  	Off    uint32 /* Location to be relocated. */
  2097  	Info   uint32 /* Relocation type and symbol index. */
  2098  	Addend int32  /* Addend. */
  2099  }
  2100  
  2101  func R_SYM32(info uint32) uint32      { return info >> 8 }
  2102  func R_TYPE32(info uint32) uint32     { return info & 0xff }
  2103  func R_INFO32(sym, typ uint32) uint32 { return sym<<8 | typ }
  2104  
  2105  // ELF32 Symbol.
  2106  type Sym32 struct {
  2107  	Name  uint32
  2108  	Value uint32
  2109  	Size  uint32
  2110  	Info  uint8
  2111  	Other uint8
  2112  	Shndx uint16
  2113  }
  2114  
  2115  const Sym32Size = 16
  2116  
  2117  func ST_BIND(info uint8) SymBind { return SymBind(info >> 4) }
  2118  func ST_TYPE(info uint8) SymType { return SymType(info & 0xF) }
  2119  func ST_INFO(bind SymBind, typ SymType) uint8 {
  2120  	return uint8(bind)<<4 | uint8(typ)&0xf
  2121  }
  2122  func ST_VISIBILITY(other uint8) SymVis { return SymVis(other & 3) }
  2123  
  2124  /*
  2125   * ELF64
  2126   */
  2127  
  2128  // ELF64 file header.
  2129  type Header64 struct {
  2130  	Ident     [EI_NIDENT]byte /* File identification. */
  2131  	Type      uint16          /* File type. */
  2132  	Machine   uint16          /* Machine architecture. */
  2133  	Version   uint32          /* ELF format version. */
  2134  	Entry     uint64          /* Entry point. */
  2135  	Phoff     uint64          /* Program header file offset. */
  2136  	Shoff     uint64          /* Section header file offset. */
  2137  	Flags     uint32          /* Architecture-specific flags. */
  2138  	Ehsize    uint16          /* Size of ELF header in bytes. */
  2139  	Phentsize uint16          /* Size of program header entry. */
  2140  	Phnum     uint16          /* Number of program header entries. */
  2141  	Shentsize uint16          /* Size of section header entry. */
  2142  	Shnum     uint16          /* Number of section header entries. */
  2143  	Shstrndx  uint16          /* Section name strings section. */
  2144  }
  2145  
  2146  // ELF64 Section header.
  2147  type Section64 struct {
  2148  	Name      uint32 /* Section name (index into the section header string table). */
  2149  	Type      uint32 /* Section type. */
  2150  	Flags     uint64 /* Section flags. */
  2151  	Addr      uint64 /* Address in memory image. */
  2152  	Off       uint64 /* Offset in file. */
  2153  	Size      uint64 /* Size in bytes. */
  2154  	Link      uint32 /* Index of a related section. */
  2155  	Info      uint32 /* Depends on section type. */
  2156  	Addralign uint64 /* Alignment in bytes. */
  2157  	Entsize   uint64 /* Size of each entry in section. */
  2158  }
  2159  
  2160  // ELF64 Program header.
  2161  type Prog64 struct {
  2162  	Type   uint32 /* Entry type. */
  2163  	Flags  uint32 /* Access permission flags. */
  2164  	Off    uint64 /* File offset of contents. */
  2165  	Vaddr  uint64 /* Virtual address in memory image. */
  2166  	Paddr  uint64 /* Physical address (not used). */
  2167  	Filesz uint64 /* Size of contents in file. */
  2168  	Memsz  uint64 /* Size of contents in memory. */
  2169  	Align  uint64 /* Alignment in memory and file. */
  2170  }
  2171  
  2172  // ELF64 Dynamic structure. The ".dynamic" section contains an array of them.
  2173  type Dyn64 struct {
  2174  	Tag int64  /* Entry type. */
  2175  	Val uint64 /* Integer/address value */
  2176  }
  2177  
  2178  // ELF64 Compression header.
  2179  type Chdr64 struct {
  2180  	Type      uint32
  2181  	_         uint32 /* Reserved. */
  2182  	Size      uint64
  2183  	Addralign uint64
  2184  }
  2185  
  2186  /*
  2187   * Relocation entries.
  2188   */
  2189  
  2190  /* ELF64 relocations that don't need an addend field. */
  2191  type Rel64 struct {
  2192  	Off  uint64 /* Location to be relocated. */
  2193  	Info uint64 /* Relocation type and symbol index. */
  2194  }
  2195  
  2196  /* ELF64 relocations that need an addend field. */
  2197  type Rela64 struct {
  2198  	Off    uint64 /* Location to be relocated. */
  2199  	Info   uint64 /* Relocation type and symbol index. */
  2200  	Addend int64  /* Addend. */
  2201  }
  2202  
  2203  func R_SYM64(info uint64) uint32    { return uint32(info >> 32) }
  2204  func R_TYPE64(info uint64) uint32   { return uint32(info) }
  2205  func R_INFO(sym, typ uint32) uint64 { return uint64(sym)<<32 | uint64(typ) }
  2206  
  2207  // ELF64 symbol table entries.
  2208  type Sym64 struct {
  2209  	Name  uint32 /* String table index of name. */
  2210  	Info  uint8  /* Type and binding information. */
  2211  	Other uint8  /* Reserved (not used). */
  2212  	Shndx uint16 /* Section index of symbol. */
  2213  	Value uint64 /* Symbol value. */
  2214  	Size  uint64 /* Size of associated object. */
  2215  }
  2216  
  2217  const Sym64Size = 24
  2218  
  2219  type intName struct {
  2220  	i uint32
  2221  	s string
  2222  }
  2223  
  2224  func stringName(i uint32, names []intName, goSyntax bool) string {
  2225  	for _, n := range names {
  2226  		if n.i == i {
  2227  			if goSyntax {
  2228  				return "elf." + n.s
  2229  			}
  2230  			return n.s
  2231  		}
  2232  	}
  2233  
  2234  	// second pass - look for smaller to add with.
  2235  	// assume sorted already
  2236  	for j := len(names) - 1; j >= 0; j-- {
  2237  		n := names[j]
  2238  		if n.i < i {
  2239  			s := n.s
  2240  			if goSyntax {
  2241  				s = "elf." + s
  2242  			}
  2243  			return s + "+" + strconv.FormatUint(uint64(i-n.i), 10)
  2244  		}
  2245  	}
  2246  
  2247  	return strconv.FormatUint(uint64(i), 10)
  2248  }
  2249  
  2250  func flagName(i uint32, names []intName, goSyntax bool) string {
  2251  	s := ""
  2252  	for _, n := range names {
  2253  		if n.i&i == n.i {
  2254  			if len(s) > 0 {
  2255  				s += "+"
  2256  			}
  2257  			if goSyntax {
  2258  				s += "elf."
  2259  			}
  2260  			s += n.s
  2261  			i -= n.i
  2262  		}
  2263  	}
  2264  	if len(s) == 0 {
  2265  		return "0x" + strconv.FormatUint(uint64(i), 16)
  2266  	}
  2267  	if i != 0 {
  2268  		s += "+0x" + strconv.FormatUint(uint64(i), 16)
  2269  	}
  2270  	return s
  2271  }