summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/elfcpp
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-06-13 12:38:00 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2014-06-13 12:38:00 -0700
commit54f1b3cf509cd889905287cb8ce6c5ae33911a21 (patch)
treee39b1a7fa04db86a8215b7f9d4656d74e394aec0 /binutils-2.25/elfcpp
parent2a6558a8ecfb81d75215b4ec7dc61113e12cfd5f (diff)
downloadtoolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.tar.gz
toolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.tar.bz2
toolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.zip
Add upstream binutils-2.25 snapshot 4/4 2014
For MIPS -mmsa support Change-Id: I08c4f002fa7b33dec85ed75956e6ab551bb03c96
Diffstat (limited to 'binutils-2.25/elfcpp')
-rw-r--r--binutils-2.25/elfcpp/ChangeLog300
-rw-r--r--binutils-2.25/elfcpp/README16
-rw-r--r--binutils-2.25/elfcpp/arm.h352
-rw-r--r--binutils-2.25/elfcpp/dwarf.h240
-rw-r--r--binutils-2.25/elfcpp/elfcpp.h1923
-rw-r--r--binutils-2.25/elfcpp/elfcpp_file.h688
-rw-r--r--binutils-2.25/elfcpp/elfcpp_internal.h240
-rw-r--r--binutils-2.25/elfcpp/elfcpp_swap.h500
-rw-r--r--binutils-2.25/elfcpp/i386.h98
-rw-r--r--binutils-2.25/elfcpp/mips.h267
-rw-r--r--binutils-2.25/elfcpp/powerpc.h213
-rw-r--r--binutils-2.25/elfcpp/sparc.h173
-rw-r--r--binutils-2.25/elfcpp/tilegx.h171
-rw-r--r--binutils-2.25/elfcpp/x86_64.h102
14 files changed, 5283 insertions, 0 deletions
diff --git a/binutils-2.25/elfcpp/ChangeLog b/binutils-2.25/elfcpp/ChangeLog
new file mode 100644
index 00000000..41897fb8
--- /dev/null
+++ b/binutils-2.25/elfcpp/ChangeLog
@@ -0,0 +1,300 @@
+2013-03-01 Cary Coutant <ccoutant@google.com>
+
+ * dwarf.h (enum DW_LANG): Adjust spacing for consistency.
+ (enum DW_SECT): New enum type.
+
+2012-12-17 Nick Clifton <nickc@redhat.com>
+
+ * README: Add copyright notice.
+
+2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
+
+ * arm.h: New enum for EABI soft- and hard-float flags.
+
+2012-09-15 Jiong Wang <jiwang@tilera.com>
+
+ * tilegx.h: New file.
+ * elfcpp.h: add EM_TILEGX.
+
+2012-08-14 Alan Modra <amodra@gmail.com>
+
+ * powerpc.h: Add more relocs.
+ (R_PPC_REL16*): Rename to R_POWERPC_REL16*.
+
+2012-05-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/14091
+ * x86_64.h (R_X86_64_RELATIVE64): New.
+
+2012-05-01 Cary Coutant <ccoutant@google.com>
+
+ * dwarf.h (enum DW_TAG, enum DW_FORM, enum DW_AT, enum DW_ENCODING)
+ (enum DW_OP, enum DW_CFA): Remove.
+ Include dwarf2.def.
+
+2012-04-23 Cary Coutant <ccoutant@google.com>
+
+ * elfcpp_swap.h (struct Swap_aligned32): New template.
+
+2012-04-16 David S. Miller <davem@davemloft.net>
+
+ * sparc.h (R_SPARC_JMP_IREL): New relocation.
+
+2012-04-12 David S. Miller <davem@davemloft.net>
+
+ * sparc.h (R_SPARC_WDISP10): New relocation.
+
+2012-03-12 Cary Coutant <ccoutant@google.com>
+
+ Update DWARF enums from ../include/dwarf2.h.
+ * dwarf.h (enum DW_TAG): Add new DWARF-4 tags.
+ (enum DW_FORM): Add new DWARF-4 and Fission extensions.
+ (enum DW_AT): New enum.
+ (enum DW_LINE_EXTENDED_OPS): Add new DWARF-4 opcode.
+ (enum DW_ENCODING): Add new DWARF-4 encoding.
+ (enum DW_OP): Add new DWARF-4 opcodes.
+ (enum DW_CHILDREN): New enum.
+ (enum DW_LANG): New enum.
+
+2012-01-27 Aleksandar Simeonov <asimeonov@mips.com>
+
+ * mips.h: New file
+ * elfcpp.h (SHT_MIPS_REGINFO): New enums for processor-specific flags.
+ (SHF_MIPS_GPREL): Likewise.
+ (PT_MIPS_REGINFO, PT_MIPS_RTPROC, PT_MIPS_OPTIONS): Likewise.
+ (DT_MIPS_RLD_VERSION, DT_MIPS_TIME_STAMP, DT_MIPS_ICHECKSUM,
+ DT_MIPS_IVERSION, DT_MIPS_FLAGS, DT_MIPS_BASE_ADDRESS, DT_MIPS_MSYM,
+ DT_MIPS_CONFLICT, DT_MIPS_LIBLIST, DT_MIPS_LOCAL_GOTNO,
+ DT_MIPS_CONFLICTNO, DT_MIPS_LIBLISTNO, DT_MIPS_SYMTABNO,
+ DT_MIPS_UNREFEXTNO, DT_MIPS_GOTSYM, DT_MIPS_HIPAGENO, DT_MIPS_RLD_MAP,
+ DT_MIPS_DELTA_CLASS, DT_MIPS_DELTA_CLASS_NO, DT_MIPS_DELTA_INSTANCE,
+ DT_MIPS_DELTA_INSTANCE_NO, DT_MIPS_DELTA_RELOC, DT_MIPS_DELTA_RELOC_NO,
+ DT_MIPS_DELTA_SYM, DT_MIPS_DELTA_SYM_NO, DT_MIPS_DELTA_CLASSSYM,
+ DT_MIPS_DELTA_CLASSSYM_NO, DT_MIPS_CXX_FLAGS, DT_MIPS_PIXIE_INIT,
+ DT_MIPS_SYMBOL_LIB, DT_MIPS_LOCALPAGE_GOTIDX, DT_MIPS_LOCAL_GOTIDX,
+ DT_MIPS_HIDDEN_GOTIDX, DT_MIPS_PROTECTED_GOTIDX, DT_MIPS_OPTIONS,
+ DT_MIPS_INTERFACE, DT_MIPS_DYNSTR_ALIGN, DT_MIPS_INTERFACE_SIZE,
+ DT_MIPS_RLD_TEXT_RESOLVE_ADDR, DT_MIPS_PERF_SUFFIX,
+ DT_MIPS_COMPACT_SIZE, DT_MIPS_GP_VALUE, DT_MIPS_AUX_DYNAMIC,
+ DT_MIPS_PLTGOT, DT_MIPS_RWPLT): Likewise.
+
+2012-01-27 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp.h (STT_GNU_IFUNC): Add comment.
+
+2011-07-03 Samuel Thibault <samuel.thibault@gnu.org>
+ Thomas Schwinge <thomas@schwinge.name>
+
+ PR binutils/12913
+ * elfcpp.h (ELFOSABI): Add ELFOSABI_GNU with value of ELFOSABI_LINUX,
+ keep ELFOSABI_LINUX as an alias. Remove ELFOSABI_HURD.
+
+2011-07-01 Ian Lance Taylor <iant@google.com>
+
+ * dwarf.h (enum DW_CFA): Define.
+
+2010-08-12 Cary Coutant <ccoutant@google.com>
+
+ * elfcpp.h (enum SHT): Add SHT_GNU_INCREMENTAL_GOT_PLT.
+
+2010-08-12 Cary Coutant <ccoutant@google.com>
+
+ * elfcpp.h (enum SHT): Add SHT_GNU_INCREMENTAL_SYMTAB,
+ SHT_GNU_INCREMENTAL_RELOCS.
+
+2010-08-04 Ian Lance Taylor <iant@google.com>
+
+ * i386.h (R_386_IRELATIVE): Define.
+ * powerpc.h (R_POWERPC_IRELATIVE): Define.
+ (R_PPC_RELAX32, R_PPC_RELAX32PC): Don't define.
+ (R_PPC_RELAX32_PLT, R_PPC_RELAX32PC_PLT): Don't define.
+ * sparc.h (R_SPARC_IRELATIVE): Define.
+ * x86_64.h (R_X86_64_IRELATIVE): Define.
+ (R_X86_64_GNU_VTINHERIT): Rename from R_386_GNU_VTINHERIT.
+ (R_X86_64_GNU_VTENTRY): Rename from R_386_GNU_VTENTRY.
+
+2010-05-12 Doug Kwan <dougkwan@google.com>
+
+ * arm.h (Tag_FP_arch, Tag_ABI_align_needed, Tag_ABI_align_preserved,
+ Tag_FP_HP_extension, Tag_MPextension_use_legacy): Rename from
+ existing tags.
+ (Tag_undefined40, Tag_undefined41, Tag_MPextension_use,
+ Tag_undefined43): New tags.
+ (Targ_VFP_arch, Tag_ABI_align8_needed, TAG_ABI_align8_preserved,
+ Tag_VFP_HP_extension): Define aliases for backward compatiblity.
+
+2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * elfcpp.h (VER_FLG_INFO): Define.
+
+2010-01-21 Doug Kwan <dougkwan@google.com>
+
+ * arm.h (EXIDX_CANTUNWIND): New enum.
+
+2010-01-19 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp.h (PN_XNUM): Define.
+
+2009-12-14 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp_file.h: Revert last patch.
+
+2009-12-11 Nick Clifton <nickc@redhat.com>
+
+ * elfcpp_file.h: Fix shadowed variable warnings.
+
+2009-12-10 Doug Kwan <dougkwan@google.com>
+
+ * arm.h: New enums for EABI object attribute tags and values.
+
+2009-12-05 Doug Kwan <dougkwan@google.com>
+
+ * arm.h: Define enums for Tag_CPU_arch EABI attribute.
+
+2009-11-24 Rafael Avila de Espindola <espindola@google.com>
+
+ * elfcpp_file.h: Include elfcpp.h.
+
+2009-11-03 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp.h: Remove trailing commas from enum definitions.
+
+2009-10-30 Doug Kwan <dougkwan@google.com>
+
+ * arm.h (EF_ARM_BE8, EF_ARM_EABIMASK, EF_ARM_EABI_UNKNOWN,
+ EF_ARM_EABI_VER1, EF_ARM_EABI_VER2, EF_ARM_EABI_VER3,
+ EF_ARM_EABI_VER4, EF_ARM_EABI_VER5): New enums for processor-specific
+ flags.
+ (arm_eabi_version): New inline function.
+ * elfcpp.h: Add a comment about DT_ENCODING.
+
+2009-10-16 Doug Kwan <dougkwan@google.com>
+
+ * elfcpp/elfcpp.h (DT_PREINIT_ARRAY): Correct enum value.
+
+2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * elfcpp/elfcpp_file.h (Elf_file::section_name): Change shstr_size
+ to Elf_WXword.
+
+2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
+
+ * elf_file.h: (class Elf_strtab): New class.
+
+2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
+
+ * elfcpp_file.h: Fix header guard. Include <cstdio>.
+ (class Elf_recognizer): New class, code from gold/object.cc.
+ (Elf_file::find_section_by_type): New method.
+
+2009-07-23 Ulrich Drepper <drepper@redhat.com>
+
+ * elfcpp.h (enum STB): Add STB_GNU_UNIQUE.
+
+2009-06-21 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp.h (SHN_X86_64_LCOMMON): Define enum constant.
+ (enum SHT): Add SHT_X86_64_UNWIND.
+ (enum SHF): Add SHT_X86_64_LARGE.
+
+2009-05-27 Doug Kwan <dougkwan@google.com>
+
+ * arm.h: New file.
+ * elfcpp.h (enum SHT): Add ARM-specific special sections.
+ (enum PT): Add ARM-specific section types.
+ (enum SST): Add STT_ARM_TFUNC.
+
+2009-04-30 Nick Clifton <nickc@redhat.com>
+
+ * elfcpp.h (enum STT): Add STT_GNU_IFUNC.
+
+2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
+
+ * elfcpp.h (SHT_GNU_INCREMENTAL_INPUTS): Define.
+
+2009-03-01 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp_swap.h: #include "config.h". Only #include <byteswap.h>
+ if HAVE_BYTESWAP_H is defined; if not, provide definitions for
+ bswap_{16,32,64}. For gcc 4.3 and later, use the builtin bswap
+ functions. Check WORDS_BIGENDIAN rather than __BYTE_ORDER.
+
+2009-01-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elfcpp.h (enum STT): Remove STT_IFUNC.
+
+2008-12-03 Nick Clifton <nickc@redhat.com>
+
+ * elfcpp.h (enum STT): Add STT_IFUNC.
+
+2008-06-12 David S. Miller <davem@davemloft.net>
+
+ * powerpc.h: New file.
+ * elfcpp.h (SHT_ORDERED): New enum constant.
+ (DT_PPC_GOT, DT_PPC64_GLINK, DT_PPC64_OPD, DT_PPC64_OPDSZ): Same.
+
+2008-05-28 Caleb Howe <cshowe@google.com>
+
+ * dwarf.h (enum DW_FORM): Define.
+
+2008-04-19 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp_file.h (class Elf_file): Add large_shndx_offset_ field.
+ (Elf_file::large_shndx_offset): New function.
+ (Elf_file::construct): Initialize large_shndx_offset_.
+ (Elf_File::initialize_shnum): If necessary, adjust shstrndx_ and
+ set large_shndx_offset_.
+
+2008-04-16 David S. Miller <davem@davemloft.net>
+
+ * elfcpp.h (DF_1_NOW, DF_1_GLOBAL, DF_1_GROUP,
+ DF_1_NODELETE, DF_1_LOADFLTR, DF_1_INITFIRST,
+ DF_1_NOOPEN, DF_1_ORIGIN, DF_1_DIRECT, DF_1_TRANS,
+ DF_1_INTERPOSE, DF_1_NODEFLIB, DF_1_NODUMP,
+ DF_1_CONLFAT): New enum constants.
+
+2008-04-15 David S. Miller <davem@davemloft.net>
+
+ * sparc.h (EF_SPARC_EXT_MASK, EF_SPARC_32PLUS_MASK,
+ EF_SPARC_32PLUS, EF_SPARC_SUN_US1, EF_SPARC_HAL_R1,
+ EF_SPARC_SUN_US3, EF_SPARC_LEDATA, EF_SPARCV9_MM,
+ EF_SPARCV9_TSO, EF_SPARCV9_PSO, EF_SPARCV9_RMO):
+ Define as enum constants.
+
+2008-04-11 David S. Miller <davem@davemloft.net>
+
+ * sparc.h: New file
+ * elfcpp.h (SHN_BEFORE, SHN_AFTER): New enum constants.
+ (SHT_SPARC_GOTDATA, SHF_ORDERED, SHF_EXCLUDE,
+ STT_SPARC_REGISTER, DT_SPARC_REGISTER): Likewise.
+
+2008-04-03 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp_swap.h (Swap_unaligned<64, true>::writeval): Correct
+ byte order.
+
+2008-03-24 Ian Lance Taylor <iant@google.com>
+
+ * elfcpp.h (NT_VERSION, NT_ARCH): Define as enum constants.
+ (NT_GNU_ABI_TAG, NT_GNU_HWCAP): Likewise.
+ (NT_GNU_BUILD_ID, NT_GNU_GOLD_VERSION): Likewise.
+ (ELF_NOTE_OS_LINUX, ELF_NOTE_OS_GNU): Likewise.
+ (ELF_NOTE_OS_SOLARIS2, ELF_NOTE_OS_NETBSD): Likewise.
+ (ELF_NOTE_OS_SYLLABLE): Likewise.
+
+2008-03-21 Ian Lance Taylor <iant@google.com>
+
+ * Added source code to GNU binutils.
+
+Copyright (C) 2008-2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+
+Local Variables:
+mode: change-log
+left-margin: 8
+fill-column: 74
+version-control: never
+End:
diff --git a/binutils-2.25/elfcpp/README b/binutils-2.25/elfcpp/README
new file mode 100644
index 00000000..8739b968
--- /dev/null
+++ b/binutils-2.25/elfcpp/README
@@ -0,0 +1,16 @@
+elfcpp is a C++ library for reading and writing ELF information. This
+was written to support gold, the ELF linker, and may not be generally
+useful.
+
+elfcpp does not do file I/O. It deals only with offsets and memory
+data.
+
+For efficiency, most accessors are templates with two arguments: the
+ELF file class (32 or 64 bits) and the endianness.
+
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
diff --git a/binutils-2.25/elfcpp/arm.h b/binutils-2.25/elfcpp/arm.h
new file mode 100644
index 00000000..ab0618a3
--- /dev/null
+++ b/binutils-2.25/elfcpp/arm.h
@@ -0,0 +1,352 @@
+// arm.h -- ELF definitions specific to EM_ARM -*- C++ -*-
+
+// Copyright 2009, 2012 Free Software Foundation, Inc.
+// Written by Doug Kwan <dougkwan@google.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_ARM_H
+#define ELFCPP_ARM_H
+
+// The relocation type information is taken from:
+//
+// ELF for the ARM Architecture
+// Document number: ARM IHI 0044C, current through ABI release 2.07
+// Date of Issue: 10th October, 2008
+//
+
+namespace elfcpp
+{
+
+//
+// ARM Relocations Codes
+//
+
+// Operation notes:
+// S: Address of the symbol.
+// A: Addend for relocation.
+// P: Address of the place being relocated.
+// Pa: Adjusted address of the place being relocated (P & 0xfffffffc)
+// T: is 1 if S has type STT_FUNC and the symbol addresses a Thumb
+// instruction.Thumb-bit; it is 0 otherwise.
+// B(S): Addressing origin of the output segment defining S.
+// GOT_ORG: Addressing origin of the Global Offset Table.
+// GOT(S): Address of the GOT entry for S.
+//
+
+enum
+{
+ // Type Class Operation
+ // ------------------------------
+ R_ARM_NONE = 0, // Static Misc
+ R_ARM_PC24 = 1, // Deprecated ARM ((S + A) | T) - P
+ R_ARM_ABS32 = 2, // Static Data (S + A) | T
+ R_ARM_REL32 = 3, // Static Data ((S + A) | T) - P
+ R_ARM_LDR_PC_G0 = 4, // Static ARM S + A - P
+ R_ARM_ABS16 = 5, // Static Data S + A
+ R_ARM_ABS12 = 6, // Static ARM S + A
+ R_ARM_THM_ABS5 = 7, // Static Thumb16 S + A
+ R_ARM_ABS8 = 8, // Static Data S + A
+ R_ARM_SBREL32 = 9, // Static Data ((S + A) | T) - B(S)
+ R_ARM_THM_CALL = 10, // Static Thumb32 ((S + A) | T) - P
+ R_ARM_THM_PC8 = 11, // Static Thumb16
+ R_ARM_BREL_ADJ = 12, // Dynamic Data DeltaB(S) + A
+ R_ARM_TLS_DESC = 13, // Dynamic Data
+ R_ARM_THM_SWI8 = 14, // Obsolete
+ R_ARM_XPC25 = 15, // Obsolete
+ R_ARM_THM_XPC22 = 16, // Obsolete
+ R_ARM_TLS_DTPMOD32 = 17, // Dynamic Data Module(S)
+ R_ARM_TLS_DTPOFF32 = 18, // Dynamic Data S + A - TLS
+ R_ARM_TLS_TPOFF32 = 19, // Dynamic Data S + A - tp
+ R_ARM_COPY = 20, // Dynamic Misc
+ R_ARM_GLOB_DAT = 21, // Dynamic Data (S + A) | T
+ R_ARM_JUMP_SLOT = 22, // Dynamic Data (S + A) | T
+ R_ARM_RELATIVE = 23, // Dynamic Data B(S) + A
+ R_ARM_GOTOFF32 = 24, // Static Data (((S + A) | T) - GOT_ORG
+ R_ARM_BASE_PREL = 25, // Static Data B(S) + A - P
+ R_ARM_GOT_BREL = 26, // Static Data GOT(S) + A - GOT_ORG
+ R_ARM_PLT32 = 27, // Deprecated ARM ((S + A) | T) - P
+ R_ARM_CALL = 28, // Static ARM ((S + A) | T) - P
+ R_ARM_JUMP24 = 29, // Static ARM ((S + A) | T) - P
+ R_ARM_THM_JUMP24 = 30, // Static Thumb32 ((S + A) | T) - P
+ R_ARM_BASE_ABS = 31, // Static Data B(S) + A
+ R_ARM_ALU_PCREL_7_0 = 32, // Obsolete
+ R_ARM_ALU_PCREL_15_8 = 33, // Obsolete
+ R_ARM_ALU_PCREL_23_15 = 34, // Obsolete
+ R_ARM_LDR_SBREL_11_0_NC = 35, // Deprecated ARM S + A - B(S)
+ R_ARM_ALU_SBREL_19_12_NC = 36,// Deprecated ARM S + A - B(S)
+ R_ARM_ALU_SBREL_27_20_CK = 37,// Deprecated ARM S + A - B(S)
+ R_ARM_TARGET1 = 38, // Data Misc (S + A) | T or
+ // ((S + A) | T) - P
+ R_ARM_SBREL31 = 39, // Deprecated Data ((S + A) | T) - B(S)
+ R_ARM_V4BX = 40, // Static Misc
+ R_ARM_TARGET2 = 41, // Static Misc
+ R_ARM_PREL31 = 42, // Static Data ((S + A) | T) - P
+ R_ARM_MOVW_ABS_NC = 43, // Static ARM (S + A) | T
+ R_ARM_MOVT_ABS = 44, // Static ARM S + A
+ R_ARM_MOVW_PREL_NC = 45, // Static ARM ((S + A) | T) - P
+ R_ARM_MOVT_PREL = 46, // Static ARM S + A - P
+ R_ARM_THM_MOVW_ABS_NC = 47, // Static Thumb32 (S + A) | T
+ R_ARM_THM_MOVT_ABS = 48, // Static Thumb32 S + A - P
+ R_ARM_THM_MOVW_PREL_NC = 49, // Static Thumb32 ((S + A) | T) - P
+ R_ARM_THM_MOVT_PREL = 50, // Static Thumb32 S + A - P
+ R_ARM_THM_JUMP19 = 51, // Static Thumb32 ((S + A) | T) - P
+ R_ARM_THM_JUMP6 = 52, // Static Thumb16 S + A - P
+ R_ARM_THM_ALU_PREL_11_0 = 53, // Static Thumb32 ((S + A) | T) - Pa
+ R_ARM_THM_PC12 = 54, // Static Thumb32 S + A - Pa
+ R_ARM_ABS32_NOI = 55, // Static Data S + A
+ R_ARM_REL32_NOI = 56, // Static Data S + A - P
+ R_ARM_ALU_PC_G0_NC = 57, // Static ARM ((S + A) | T) - P
+ R_ARM_ALU_PC_G0 = 58, // Static ARM ((S + A) | T) - P
+ R_ARM_ALU_PC_G1_NC = 59, // Static ARM ((S + A) | T) - P
+ R_ARM_ALU_PC_G1 = 60, // Static ARM ((S + A) | T) - P
+ R_ARM_ALU_PC_G2 = 61, // Static ARM ((S + A) | T) - P
+ R_ARM_LDR_PC_G1 = 62, // Static ARM S + A - P
+ R_ARM_LDR_PC_G2 = 63, // Static ARM S + A - P
+ R_ARM_LDRS_PC_G0 = 64, // Static ARM S + A - P
+ R_ARM_LDRS_PC_G1 = 65, // Static ARM S + A - P
+ R_ARM_LDRS_PC_G2 = 66, // Static ARM S + A - P
+ R_ARM_LDC_PC_G0 = 67, // Static ARM S + A - P
+ R_ARM_LDC_PC_G1 = 68, // Static ARM S + A - P
+ R_ARM_LDC_PC_G2 = 69, // Static ARM S + A - P
+ R_ARM_ALU_SB_G0_NC = 70, // Static ARM ((S + A) | T) - B(S)
+ R_ARM_ALU_SB_G0 = 71, // Static ARM ((S + A) | T) - B(S)
+ R_ARM_ALU_SB_G1_NC = 72, // Static ARM ((S + A) | T) - B(S)
+ R_ARM_ALU_SB_G1 = 73, // Static ARM ((S + A) | T) - B(S)
+ R_ARM_ALU_SB_G2 = 74, // Static ARM ((S + A) | T) - B(S)
+ R_ARM_LDR_SB_G0 = 75, // Static ARM S + A - B(S)
+ R_ARM_LDR_SB_G1 = 76, // Static ARM S + A - B(S)
+ R_ARM_LDR_SB_G2 = 77, // Static ARM S + A - B(S)
+ R_ARM_LDRS_SB_G0 = 78, // Static ARM S + A - B(S)
+ R_ARM_LDRS_SB_G1 = 79, // Static ARM S + A - B(S)
+ R_ARM_LDRS_SB_G2 = 80, // Static ARM S + A - B(S)
+ R_ARM_LDC_SB_G0 = 81, // Static ARM S + A - B(S)
+ R_ARM_LDC_SB_G1 = 82, // Static ARM S + A - B(S)
+ R_ARM_LDC_SB_G2 = 83, // Static ARM S + A - B(S)
+ R_ARM_MOVW_BREL_NC = 84, // Static ARM ((S + A) | T) - B(S)
+ R_ARM_MOVT_BREL = 85, // Static ARM S + A - B(S)
+ R_ARM_MOVW_BREL = 86, // Static ARM ((S + A) | T) - B(S)
+ R_ARM_THM_MOVW_BREL_NC = 87, // Static Thumb32 ((S + A) | T) - B(S)
+ R_ARM_THM_MOVT_BREL = 88, // Static Thumb32 S + A - B(S)
+ R_ARM_THM_MOVW_BREL = 89, // Static Thumb32 ((S + A) | T) - B(S)
+ R_ARM_TLS_GOTDESC = 90, // Static Data
+ R_ARM_TLS_CALL = 91, // Static ARM
+ R_ARM_TLS_DESCSEQ = 92, // Static ARM TLS relaxation
+ R_ARM_THM_TLS_CALL = 93, // Static Thumb32
+ R_ARM_PLT32_ABS = 94, // Static Data PLT(S) + A
+ R_ARM_GOT_ABS = 95, // Static Data GOT(S) + A
+ R_ARM_GOT_PREL = 96, // Static Data GOT(S) + A - P
+ R_ARM_GOT_BREL12 = 97, // Static ARM GOT(S) + A - GOT_ORG
+ R_ARM_GOTOFF12 = 98, // Static ARM S + A - GOT_ROG
+ R_ARM_GOTRELAX = 99, // Static Misc
+ R_ARM_GNU_VTENTRY = 100, // Deprecated Data
+ R_ARM_GNU_VTINHERIT = 101, // Deprecated Data
+ R_ARM_THM_JUMP11 = 102, // Static Thumb16 S + A - P
+ R_ARM_THM_JUMP8 = 103, // Static Thumb16 S + A - P
+ R_ARM_TLS_GD32 = 104, // Static Data GOT(S) + A - P
+ R_ARM_TLS_LDM32 = 105, // Static Data GOT(S) + A - P
+ R_ARM_TLS_LDO32 = 106, // Static Data S + A - TLS
+ R_ARM_TLS_IE32 = 107, // Static Data GOT(S) + A - P
+ R_ARM_TLS_LE32 = 108, // Static Data S + A - tp
+ R_ARM_TLS_LDO12 = 109, // Static ARM S + A - TLS
+ R_ARM_TLS_LE12 = 110, // Static ARM S + A - tp
+ R_ARM_TLS_IE12GP = 111, // Static ARM GOT(S) + A - GOT_ORG
+ R_ARM_PRIVATE_0 = 112, // Private (n = 0, 1, ... 15)
+ R_ARM_PRIVATE_1 = 113,
+ R_ARM_PRIVATE_2 = 114,
+ R_ARM_PRIVATE_3 = 115,
+ R_ARM_PRIVATE_4 = 116,
+ R_ARM_PRIVATE_5 = 117,
+ R_ARM_PRIVATE_6 = 118,
+ R_ARM_PRIVATE_7 = 119,
+ R_ARM_PRIVATE_8 = 120,
+ R_ARM_PRIVATE_9 = 121,
+ R_ARM_PRIVATE_10 = 122,
+ R_ARM_PRIVATE_11 = 123,
+ R_ARM_PRIVATE_12 = 124,
+ R_ARM_PRIVATE_13 = 125,
+ R_ARM_PRIVATE_14 = 126,
+ R_ARM_PRIVATE_15 = 127,
+ R_ARM_ME_TOO = 128, // Obsolete
+ R_ARM_THM_TLS_DESCSEQ16 = 129,// Static Thumb16
+ R_ARM_THM_TLS_DESCSEQ32 = 130,// Static Thumb32
+ // 131 - 139 Unallocated
+ // 140 - 159 Dynamic Reserved for future allocation
+ // 160 - 255 Unallocated
+};
+
+// e_flags values used for ARM. We only support flags defined in AAELF.
+
+enum
+{
+ EF_ARM_BE8 = 0x00800000,
+
+ // Mask to extract EABI version, not really a flag value.
+ EF_ARM_EABIMASK = 0xFF000000,
+
+ EF_ARM_EABI_UNKNOWN = 0x00000000,
+ EF_ARM_EABI_VER1 = 0x01000000,
+ EF_ARM_EABI_VER2 = 0x02000000,
+ EF_ARM_EABI_VER3 = 0x03000000,
+ EF_ARM_EABI_VER4 = 0x04000000,
+ EF_ARM_EABI_VER5 = 0x05000000,
+};
+
+// Extract EABI version from flags.
+
+inline Elf_Word
+arm_eabi_version(Elf_Word flags)
+{ return flags & EF_ARM_EABIMASK; }
+
+// EABI_VER5 e_flags values for identifying soft- and hard-float ABI
+// choice.
+enum
+{
+ EF_ARM_ABI_FLOAT_SOFT = 0x200,
+ EF_ARM_ABI_FLOAT_HARD = 0x400,
+};
+
+// Values for the Tag_CPU_arch EABI attribute.
+enum
+{
+ TAG_CPU_ARCH_PRE_V4,
+ TAG_CPU_ARCH_V4,
+ TAG_CPU_ARCH_V4T,
+ TAG_CPU_ARCH_V5T,
+ TAG_CPU_ARCH_V5TE,
+ TAG_CPU_ARCH_V5TEJ,
+ TAG_CPU_ARCH_V6,
+ TAG_CPU_ARCH_V6KZ,
+ TAG_CPU_ARCH_V6T2,
+ TAG_CPU_ARCH_V6K,
+ TAG_CPU_ARCH_V7,
+ TAG_CPU_ARCH_V6_M,
+ TAG_CPU_ARCH_V6S_M,
+ TAG_CPU_ARCH_V7E_M,
+ MAX_TAG_CPU_ARCH = TAG_CPU_ARCH_V7E_M,
+ // Pseudo-architecture to allow objects to be compatible with the subset of
+ // armv4t and armv6-m. This value should never be stored in object files.
+ TAG_CPU_ARCH_V4T_PLUS_V6_M = (MAX_TAG_CPU_ARCH + 1)
+};
+
+// EABI object attributes.
+enum
+{
+ // 0-3 are generic.
+ Tag_CPU_raw_name = 4,
+ Tag_CPU_name = 5,
+ Tag_CPU_arch = 6,
+ Tag_CPU_arch_profile = 7,
+ Tag_ARM_ISA_use = 8,
+ Tag_THUMB_ISA_use = 9,
+ Tag_FP_arch = 10,
+ Tag_WMMX_arch = 11,
+ Tag_Advanced_SIMD_arch = 12,
+ Tag_PCS_config = 13,
+ Tag_ABI_PCS_R9_use = 14,
+ Tag_ABI_PCS_RW_data = 15,
+ Tag_ABI_PCS_RO_data = 16,
+ Tag_ABI_PCS_GOT_use = 17,
+ Tag_ABI_PCS_wchar_t = 18,
+ Tag_ABI_FP_rounding = 19,
+ Tag_ABI_FP_denormal = 20,
+ Tag_ABI_FP_exceptions = 21,
+ Tag_ABI_FP_user_exceptions = 22,
+ Tag_ABI_FP_number_model = 23,
+ Tag_ABI_align_needed = 24,
+ Tag_ABI_align_preserved = 25,
+ Tag_ABI_enum_size = 26,
+ Tag_ABI_HardFP_use = 27,
+ Tag_ABI_VFP_args = 28,
+ Tag_ABI_WMMX_args = 29,
+ Tag_ABI_optimization_goals = 30,
+ Tag_ABI_FP_optimization_goals = 31,
+ // 32 is generic (Tag_compatibility).
+ Tag_undefined33 = 33,
+ Tag_CPU_unaligned_access = 34,
+ Tag_undefined35 = 35,
+ Tag_FP_HP_extension = 36,
+ Tag_undefined37 = 37,
+ Tag_ABI_FP_16bit_format = 38,
+ Tag_undefined39 = 39,
+ Tag_undefined40 = 40,
+ Tag_undefined41 = 41,
+ Tag_MPextension_use = 42,
+ Tag_undefined43 = 43,
+ Tag_DIV_use = 44,
+ Tag_nodefaults = 64,
+ Tag_also_compatible_with = 65,
+ Tag_T2EE_use = 66,
+ Tag_conformance = 67,
+ Tag_Virtualization_use = 68,
+ Tag_undefined69 = 69,
+ Tag_MPextension_use_legacy = 70,
+
+ // The following tags are legacy names for other tags.
+ Tag_VFP_arch = Tag_FP_arch,
+ Tag_ABI_align8_needed = Tag_ABI_align_needed,
+ Tag_ABI_align8_preserved = Tag_ABI_align_preserved,
+ Tag_VFP_HP_extension = Tag_FP_HP_extension
+};
+
+// Values for Tag_ABI_PCS_R9_use.
+enum
+{
+ AEABI_R9_V6 = 0,
+ AEABI_R9_SB = 1,
+ AEABI_R9_TLS = 2,
+ AEABI_R9_unused = 3
+};
+
+// Values for Tag_ABI_PCS_RW_data.
+enum
+{
+ AEABI_PCS_RW_data_absolute = 0,
+ AEABI_PCS_RW_data_PCrel = 1,
+ AEABI_PCS_RW_data_SBrel = 2,
+ AEABI_PCS_RW_data_unused = 3
+};
+
+// Values for Tag_ABI_enum_size.
+enum
+{
+ AEABI_enum_unused = 0,
+ AEABI_enum_short = 1,
+ AEABI_enum_wide = 2,
+ AEABI_enum_forced_wide = 3
+};
+
+// For Exception Index Table. (Exception handling ABI for the ARM
+// architectue, Section 5)
+enum
+{
+ EXIDX_CANTUNWIND = 1,
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_ARM_H)
diff --git a/binutils-2.25/elfcpp/dwarf.h b/binutils-2.25/elfcpp/dwarf.h
new file mode 100644
index 00000000..de8b9baa
--- /dev/null
+++ b/binutils-2.25/elfcpp/dwarf.h
@@ -0,0 +1,240 @@
+// dwarf.h -- DWARF2 constants -*- C++ -*-
+
+// Copyright 2006, 2007, 2008, 2011, 2012 Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_DWARF_H
+#define ELFCPP_DWARF_H
+
+namespace elfcpp
+{
+
+// DWARF2 codes.
+
+// Include DW_TAG, DW_FORM, DW_AT, DW_OP, DW_ATE, and DW_CFA
+// codes from dwarf2.def.
+
+#define DW_FIRST_TAG(name, value) enum DW_TAG { \
+ name = value
+#define DW_TAG(name, value) , name = value
+#define DW_TAG_DUP(name, value) , name = value
+#define DW_END_TAG };
+
+#define DW_FIRST_FORM(name, value) enum DW_FORM { \
+ name = value
+#define DW_FORM(name, value) , name = value
+#define DW_END_FORM };
+
+#define DW_FIRST_AT(name, value) enum DW_AT { \
+ name = value
+#define DW_AT(name, value) , name = value
+#define DW_AT_DUP(name, value) , name = value
+#define DW_END_AT };
+
+#define DW_FIRST_OP(name, value) enum DW_OP { \
+ name = value
+#define DW_OP(name, value) , name = value
+#define DW_OP_DUP(name, value) , name = value
+#define DW_END_OP };
+
+#define DW_FIRST_ATE(name, value) enum DW_ENCODING { \
+ name = value
+#define DW_ATE(name, value) , name = value
+#define DW_ATE_DUP(name, value) , name = value
+#define DW_END_ATE };
+
+#define DW_FIRST_CFA(name, value) enum DW_CFA { \
+ name = value
+#define DW_CFA(name, value) , name = value
+#define DW_END_CFA };
+
+#include "dwarf2.def"
+
+#undef DW_FIRST_TAG
+#undef DW_TAG
+#undef DW_TAG_DUP
+#undef DW_END_TAG
+
+#undef DW_FIRST_FORM
+#undef DW_FORM
+#undef DW_END_FORM
+
+#undef DW_FIRST_AT
+#undef DW_AT
+#undef DW_AT_DUP
+#undef DW_END_AT
+
+#undef DW_FIRST_OP
+#undef DW_OP
+#undef DW_OP_DUP
+#undef DW_END_OP
+
+#undef DW_FIRST_ATE
+#undef DW_ATE
+#undef DW_ATE_DUP
+#undef DW_END_ATE
+
+#undef DW_FIRST_CFA
+#undef DW_CFA
+#undef DW_END_CFA
+
+// Frame unwind information.
+
+enum DW_EH_PE
+{
+ DW_EH_PE_absptr = 0x00,
+ DW_EH_PE_omit = 0xff,
+
+ DW_EH_PE_uleb128 = 0x01,
+ DW_EH_PE_udata2 = 0x02,
+ DW_EH_PE_udata4 = 0x03,
+ DW_EH_PE_udata8 = 0x04,
+ DW_EH_PE_signed = 0x08,
+ DW_EH_PE_sleb128 = 0x09,
+ DW_EH_PE_sdata2 = 0x0a,
+ DW_EH_PE_sdata4 = 0x0b,
+ DW_EH_PE_sdata8 = 0x0c,
+
+ DW_EH_PE_pcrel = 0x10,
+ DW_EH_PE_textrel = 0x20,
+ DW_EH_PE_datarel = 0x30,
+ DW_EH_PE_funcrel = 0x40,
+ DW_EH_PE_aligned = 0x50,
+
+ DW_EH_PE_indirect = 0x80
+};
+
+// Line number opcodes.
+
+enum DW_LINE_OPS
+{
+ DW_LNS_extended_op = 0,
+ DW_LNS_copy = 1,
+ DW_LNS_advance_pc = 2,
+ DW_LNS_advance_line = 3,
+ DW_LNS_set_file = 4,
+ DW_LNS_set_column = 5,
+ DW_LNS_negate_stmt = 6,
+ DW_LNS_set_basic_block = 7,
+ DW_LNS_const_add_pc = 8,
+ DW_LNS_fixed_advance_pc = 9,
+ // DWARF 3.
+ DW_LNS_set_prologue_end = 10,
+ DW_LNS_set_epilogue_begin = 11,
+ DW_LNS_set_isa = 12
+};
+
+// Line number extended opcodes.
+
+enum DW_LINE_EXTENDED_OPS
+{
+ DW_LNE_end_sequence = 1,
+ DW_LNE_set_address = 2,
+ DW_LNE_define_file = 3,
+ // DWARF4.
+ DW_LNE_set_discriminator = 4,
+ // HP extensions.
+ DW_LNE_HP_negate_is_UV_update = 0x11,
+ DW_LNE_HP_push_context = 0x12,
+ DW_LNE_HP_pop_context = 0x13,
+ DW_LNE_HP_set_file_line_column = 0x14,
+ DW_LNE_HP_set_routine_name = 0x15,
+ DW_LNE_HP_set_sequence = 0x16,
+ DW_LNE_HP_negate_post_semantics = 0x17,
+ DW_LNE_HP_negate_function_exit = 0x18,
+ DW_LNE_HP_negate_front_end_logical = 0x19,
+ DW_LNE_HP_define_proc = 0x20
+};
+
+enum DW_CHILDREN
+{
+ DW_CHILDREN_no =0x00,
+ DW_CHILDREN_yes =0x01
+};
+
+// Source language names and codes.
+enum DW_LANG
+{
+ DW_LANG_C89 = 0x0001,
+ DW_LANG_C = 0x0002,
+ DW_LANG_Ada83 = 0x0003,
+ DW_LANG_C_plus_plus = 0x0004,
+ DW_LANG_Cobol74 = 0x0005,
+ DW_LANG_Cobol85 = 0x0006,
+ DW_LANG_Fortran77 = 0x0007,
+ DW_LANG_Fortran90 = 0x0008,
+ DW_LANG_Pascal83 = 0x0009,
+ DW_LANG_Modula2 = 0x000a,
+ // DWARF 3.
+ DW_LANG_Java = 0x000b,
+ DW_LANG_C99 = 0x000c,
+ DW_LANG_Ada95 = 0x000d,
+ DW_LANG_Fortran95 = 0x000e,
+ DW_LANG_PLI = 0x000f,
+ DW_LANG_ObjC = 0x0010,
+ DW_LANG_ObjC_plus_plus = 0x0011,
+ DW_LANG_UPC = 0x0012,
+ DW_LANG_D = 0x0013,
+ // DWARF 4.
+ DW_LANG_Python = 0x0014,
+ // DWARF 5.
+ DW_LANG_Go = 0x0016,
+ DW_LANG_lo_user = 0x8000, // Implementation-defined range start.
+ DW_LANG_hi_user = 0xffff, // Implementation-defined range start.
+ // MIPS.
+ DW_LANG_Mips_Assembler = 0x8001,
+ // UPC.
+ DW_LANG_Upc = 0x8765,
+ // HP extensions.
+ DW_LANG_HP_Bliss = 0x8003,
+ DW_LANG_HP_Basic91 = 0x8004,
+ DW_LANG_HP_Pascal91 = 0x8005,
+ DW_LANG_HP_IMacro = 0x8006,
+ DW_LANG_HP_Assembler = 0x8007
+};
+
+// DWARF section identifiers used in the package format.
+// Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP.
+
+enum DW_SECT
+{
+ DW_SECT_INFO = 1,
+ DW_SECT_TYPES = 2,
+ DW_SECT_ABBREV = 3,
+ DW_SECT_LINE = 4,
+ DW_SECT_LOC = 5,
+ DW_SECT_STR_OFFSETS = 6,
+ DW_SECT_MACINFO = 7,
+ DW_SECT_MACRO = 8,
+ DW_SECT_MAX = DW_SECT_MACRO,
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_DWARF_H)
diff --git a/binutils-2.25/elfcpp/elfcpp.h b/binutils-2.25/elfcpp/elfcpp.h
new file mode 100644
index 00000000..067c7752
--- /dev/null
+++ b/binutils-2.25/elfcpp/elfcpp.h
@@ -0,0 +1,1923 @@
+// elfcpp.h -- main header file for elfcpp -*- C++ -*-
+
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
+// Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+// This is the external interface for elfcpp.
+
+#ifndef ELFCPP_H
+#define ELFCPP_H
+
+#include "elfcpp_swap.h"
+
+#include <stdint.h>
+
+namespace elfcpp
+{
+
+// Basic ELF types.
+
+// These types are always the same size.
+
+typedef uint16_t Elf_Half;
+typedef uint32_t Elf_Word;
+typedef int32_t Elf_Sword;
+typedef uint64_t Elf_Xword;
+typedef int64_t Elf_Sxword;
+
+// These types vary in size depending on the ELF file class. The
+// template parameter should be 32 or 64.
+
+template<int size>
+struct Elf_types;
+
+template<>
+struct Elf_types<32>
+{
+ typedef uint32_t Elf_Addr;
+ typedef uint32_t Elf_Off;
+ typedef uint32_t Elf_WXword;
+ typedef int32_t Elf_Swxword;
+};
+
+template<>
+struct Elf_types<64>
+{
+ typedef uint64_t Elf_Addr;
+ typedef uint64_t Elf_Off;
+ typedef uint64_t Elf_WXword;
+ typedef int64_t Elf_Swxword;
+};
+
+// Offsets within the Ehdr e_ident field.
+
+const int EI_MAG0 = 0;
+const int EI_MAG1 = 1;
+const int EI_MAG2 = 2;
+const int EI_MAG3 = 3;
+const int EI_CLASS = 4;
+const int EI_DATA = 5;
+const int EI_VERSION = 6;
+const int EI_OSABI = 7;
+const int EI_ABIVERSION = 8;
+const int EI_PAD = 9;
+const int EI_NIDENT = 16;
+
+// The valid values found in Ehdr e_ident[EI_MAG0 through EI_MAG3].
+
+const int ELFMAG0 = 0x7f;
+const int ELFMAG1 = 'E';
+const int ELFMAG2 = 'L';
+const int ELFMAG3 = 'F';
+
+// The valid values found in Ehdr e_ident[EI_CLASS].
+
+enum
+{
+ ELFCLASSNONE = 0,
+ ELFCLASS32 = 1,
+ ELFCLASS64 = 2
+};
+
+// The valid values found in Ehdr e_ident[EI_DATA].
+
+enum
+{
+ ELFDATANONE = 0,
+ ELFDATA2LSB = 1,
+ ELFDATA2MSB = 2
+};
+
+// The valid values found in Ehdr e_ident[EI_VERSION] and e_version.
+
+enum
+{
+ EV_NONE = 0,
+ EV_CURRENT = 1
+};
+
+// The valid values found in Ehdr e_ident[EI_OSABI].
+
+enum ELFOSABI
+{
+ ELFOSABI_NONE = 0,
+ ELFOSABI_HPUX = 1,
+ ELFOSABI_NETBSD = 2,
+ ELFOSABI_GNU = 3,
+ // ELFOSABI_LINUX is an alias for ELFOSABI_GNU.
+ ELFOSABI_LINUX = 3,
+ ELFOSABI_SOLARIS = 6,
+ ELFOSABI_AIX = 7,
+ ELFOSABI_IRIX = 8,
+ ELFOSABI_FREEBSD = 9,
+ ELFOSABI_TRU64 = 10,
+ ELFOSABI_MODESTO = 11,
+ ELFOSABI_OPENBSD = 12,
+ ELFOSABI_OPENVMS = 13,
+ ELFOSABI_NSK = 14,
+ ELFOSABI_AROS = 15,
+ // A GNU extension for the ARM.
+ ELFOSABI_ARM = 97,
+ // A GNU extension for the MSP.
+ ELFOSABI_STANDALONE = 255
+};
+
+// The valid values found in the Ehdr e_type field.
+
+enum ET
+{
+ ET_NONE = 0,
+ ET_REL = 1,
+ ET_EXEC = 2,
+ ET_DYN = 3,
+ ET_CORE = 4,
+ ET_LOOS = 0xfe00,
+ ET_HIOS = 0xfeff,
+ ET_LOPROC = 0xff00,
+ ET_HIPROC = 0xffff
+};
+
+// The valid values found in the Ehdr e_machine field.
+
+enum EM
+{
+ EM_NONE = 0,
+ EM_M32 = 1,
+ EM_SPARC = 2,
+ EM_386 = 3,
+ EM_68K = 4,
+ EM_88K = 5,
+ // 6 used to be EM_486
+ EM_860 = 7,
+ EM_MIPS = 8,
+ EM_S370 = 9,
+ EM_MIPS_RS3_LE = 10,
+ // 11 was the old Sparc V9 ABI.
+ // 12 through 14 are reserved.
+ EM_PARISC = 15,
+ // 16 is reserved.
+ // Some old PowerPC object files use 17.
+ EM_VPP500 = 17,
+ EM_SPARC32PLUS = 18,
+ EM_960 = 19,
+ EM_PPC = 20,
+ EM_PPC64 = 21,
+ EM_S390 = 22,
+ // 23 through 35 are served.
+ EM_V800 = 36,
+ EM_FR20 = 37,
+ EM_RH32 = 38,
+ EM_RCE = 39,
+ EM_ARM = 40,
+ EM_ALPHA = 41,
+ EM_SH = 42,
+ EM_SPARCV9 = 43,
+ EM_TRICORE = 44,
+ EM_ARC = 45,
+ EM_H8_300 = 46,
+ EM_H8_300H = 47,
+ EM_H8S = 48,
+ EM_H8_500 = 49,
+ EM_IA_64 = 50,
+ EM_MIPS_X = 51,
+ EM_COLDFIRE = 52,
+ EM_68HC12 = 53,
+ EM_MMA = 54,
+ EM_PCP = 55,
+ EM_NCPU = 56,
+ EM_NDR1 = 57,
+ EM_STARCORE = 58,
+ EM_ME16 = 59,
+ EM_ST100 = 60,
+ EM_TINYJ = 61,
+ EM_X86_64 = 62,
+ EM_PDSP = 63,
+ EM_PDP10 = 64,
+ EM_PDP11 = 65,
+ EM_FX66 = 66,
+ EM_ST9PLUS = 67,
+ EM_ST7 = 68,
+ EM_68HC16 = 69,
+ EM_68HC11 = 70,
+ EM_68HC08 = 71,
+ EM_68HC05 = 72,
+ EM_SVX = 73,
+ EM_ST19 = 74,
+ EM_VAX = 75,
+ EM_CRIS = 76,
+ EM_JAVELIN = 77,
+ EM_FIREPATH = 78,
+ EM_ZSP = 79,
+ EM_MMIX = 80,
+ EM_HUANY = 81,
+ EM_PRISM = 82,
+ EM_AVR = 83,
+ EM_FR30 = 84,
+ EM_D10V = 85,
+ EM_D30V = 86,
+ EM_V850 = 87,
+ EM_M32R = 88,
+ EM_MN10300 = 89,
+ EM_MN10200 = 90,
+ EM_PJ = 91,
+ EM_OPENRISC = 92,
+ EM_ARC_A5 = 93,
+ EM_XTENSA = 94,
+ EM_VIDEOCORE = 95,
+ EM_TMM_GPP = 96,
+ EM_NS32K = 97,
+ EM_TPC = 98,
+ // Some old picoJava object files use 99 (EM_PJ is correct).
+ EM_SNP1K = 99,
+ EM_ST200 = 100,
+ EM_IP2K = 101,
+ EM_MAX = 102,
+ EM_CR = 103,
+ EM_F2MC16 = 104,
+ EM_MSP430 = 105,
+ EM_BLACKFIN = 106,
+ EM_SE_C33 = 107,
+ EM_SEP = 108,
+ EM_ARCA = 109,
+ EM_UNICORE = 110,
+ EM_ALTERA_NIOS2 = 113,
+ EM_CRX = 114,
+ EM_TILEGX = 191,
+ // The Morph MT.
+ EM_MT = 0x2530,
+ // DLX.
+ EM_DLX = 0x5aa5,
+ // FRV.
+ EM_FRV = 0x5441,
+ // Infineon Technologies 16-bit microcontroller with C166-V2 core.
+ EM_X16X = 0x4688,
+ // Xstorym16
+ EM_XSTORMY16 = 0xad45,
+ // Renesas M32C
+ EM_M32C = 0xfeb0,
+ // Vitesse IQ2000
+ EM_IQ2000 = 0xfeba,
+ // NIOS
+ EM_NIOS32 = 0xfebb
+ // Old AVR objects used 0x1057 (EM_AVR is correct).
+ // Old MSP430 objects used 0x1059 (EM_MSP430 is correct).
+ // Old FR30 objects used 0x3330 (EM_FR30 is correct).
+ // Old OpenRISC objects used 0x3426 and 0x8472 (EM_OPENRISC is correct).
+ // Old D10V objects used 0x7650 (EM_D10V is correct).
+ // Old D30V objects used 0x7676 (EM_D30V is correct).
+ // Old IP2X objects used 0x8217 (EM_IP2K is correct).
+ // Old PowerPC objects used 0x9025 (EM_PPC is correct).
+ // Old Alpha objects used 0x9026 (EM_ALPHA is correct).
+ // Old M32R objects used 0x9041 (EM_M32R is correct).
+ // Old V850 objects used 0x9080 (EM_V850 is correct).
+ // Old S/390 objects used 0xa390 (EM_S390 is correct).
+ // Old Xtensa objects used 0xabc7 (EM_XTENSA is correct).
+ // Old MN10300 objects used 0xbeef (EM_MN10300 is correct).
+ // Old MN10200 objects used 0xdead (EM_MN10200 is correct).
+};
+
+// A special value found in the Ehdr e_phnum field.
+
+enum
+{
+ // Number of program segments stored in sh_info field of first
+ // section headre.
+ PN_XNUM = 0xffff
+};
+
+// Special section indices.
+
+enum
+{
+ SHN_UNDEF = 0,
+ SHN_LORESERVE = 0xff00,
+ SHN_LOPROC = 0xff00,
+ SHN_HIPROC = 0xff1f,
+ SHN_LOOS = 0xff20,
+ SHN_HIOS = 0xff3f,
+ SHN_ABS = 0xfff1,
+ SHN_COMMON = 0xfff2,
+ SHN_XINDEX = 0xffff,
+ SHN_HIRESERVE = 0xffff,
+
+ // Provide for initial and final section ordering in conjunction
+ // with the SHF_LINK_ORDER and SHF_ORDERED section flags.
+ SHN_BEFORE = 0xff00,
+ SHN_AFTER = 0xff01,
+
+ // x86_64 specific large common symbol.
+ SHN_X86_64_LCOMMON = 0xff02
+};
+
+// The valid values found in the Shdr sh_type field.
+
+enum SHT
+{
+ SHT_NULL = 0,
+ SHT_PROGBITS = 1,
+ SHT_SYMTAB = 2,
+ SHT_STRTAB = 3,
+ SHT_RELA = 4,
+ SHT_HASH = 5,
+ SHT_DYNAMIC = 6,
+ SHT_NOTE = 7,
+ SHT_NOBITS = 8,
+ SHT_REL = 9,
+ SHT_SHLIB = 10,
+ SHT_DYNSYM = 11,
+ SHT_INIT_ARRAY = 14,
+ SHT_FINI_ARRAY = 15,
+ SHT_PREINIT_ARRAY = 16,
+ SHT_GROUP = 17,
+ SHT_SYMTAB_SHNDX = 18,
+ SHT_LOOS = 0x60000000,
+ SHT_HIOS = 0x6fffffff,
+ SHT_LOPROC = 0x70000000,
+ SHT_HIPROC = 0x7fffffff,
+ SHT_LOUSER = 0x80000000,
+ SHT_HIUSER = 0xffffffff,
+ // The remaining values are not in the standard.
+ // Incremental build data.
+ SHT_GNU_INCREMENTAL_INPUTS = 0x6fff4700,
+ SHT_GNU_INCREMENTAL_SYMTAB = 0x6fff4701,
+ SHT_GNU_INCREMENTAL_RELOCS = 0x6fff4702,
+ SHT_GNU_INCREMENTAL_GOT_PLT = 0x6fff4703,
+ // Object attributes.
+ SHT_GNU_ATTRIBUTES = 0x6ffffff5,
+ // GNU style dynamic hash table.
+ SHT_GNU_HASH = 0x6ffffff6,
+ // List of prelink dependencies.
+ SHT_GNU_LIBLIST = 0x6ffffff7,
+ // Versions defined by file.
+ SHT_SUNW_verdef = 0x6ffffffd,
+ SHT_GNU_verdef = 0x6ffffffd,
+ // Versions needed by file.
+ SHT_SUNW_verneed = 0x6ffffffe,
+ SHT_GNU_verneed = 0x6ffffffe,
+ // Symbol versions,
+ SHT_SUNW_versym = 0x6fffffff,
+ SHT_GNU_versym = 0x6fffffff,
+
+ SHT_SPARC_GOTDATA = 0x70000000,
+
+ // ARM-specific section types.
+ // Exception Index table.
+ SHT_ARM_EXIDX = 0x70000001,
+ // BPABI DLL dynamic linking pre-emption map.
+ SHT_ARM_PREEMPTMAP = 0x70000002,
+ // Object file compatibility attributes.
+ SHT_ARM_ATTRIBUTES = 0x70000003,
+ // Support for debugging overlaid programs.
+ SHT_ARM_DEBUGOVERLAY = 0x70000004,
+ SHT_ARM_OVERLAYSECTION = 0x70000005,
+
+ // x86_64 unwind information.
+ SHT_X86_64_UNWIND = 0x70000001,
+
+ //MIPS-specific section types.
+ // Register info section
+ SHT_MIPS_REGINFO = 0x70000006,
+
+ // Link editor is to sort the entries in this section based on the
+ // address specified in the associated symbol table entry.
+ SHT_ORDERED = 0x7fffffff
+};
+
+// The valid bit flags found in the Shdr sh_flags field.
+
+enum SHF
+{
+ SHF_WRITE = 0x1,
+ SHF_ALLOC = 0x2,
+ SHF_EXECINSTR = 0x4,
+ SHF_MERGE = 0x10,
+ SHF_STRINGS = 0x20,
+ SHF_INFO_LINK = 0x40,
+ SHF_LINK_ORDER = 0x80,
+ SHF_OS_NONCONFORMING = 0x100,
+ SHF_GROUP = 0x200,
+ SHF_TLS = 0x400,
+ SHF_MASKOS = 0x0ff00000,
+ SHF_MASKPROC = 0xf0000000,
+
+ // Indicates this section requires ordering in relation to
+ // other sections of the same type. Ordered sections are
+ // combined within the section pointed to by the sh_link entry.
+ // The sh_info values SHN_BEFORE and SHN_AFTER imply that the
+ // sorted section is to precede or follow, respectively, all
+ // other sections in the set being ordered.
+ SHF_ORDERED = 0x40000000,
+ // This section is excluded from input to the link-edit of an
+ // executable or shared object. This flag is ignored if SHF_ALLOC
+ // is also set, or if relocations exist against the section.
+ SHF_EXCLUDE = 0x80000000,
+
+ // Section with data that is GP relative addressable.
+ SHF_MIPS_GPREL = 0x10000000,
+
+ // x86_64 specific large section.
+ SHF_X86_64_LARGE = 0x10000000
+};
+
+// Bit flags which appear in the first 32-bit word of the section data
+// of a SHT_GROUP section.
+
+enum
+{
+ GRP_COMDAT = 0x1,
+ GRP_MASKOS = 0x0ff00000,
+ GRP_MASKPROC = 0xf0000000
+};
+
+// The valid values found in the Phdr p_type field.
+
+enum PT
+{
+ PT_NULL = 0,
+ PT_LOAD = 1,
+ PT_DYNAMIC = 2,
+ PT_INTERP = 3,
+ PT_NOTE = 4,
+ PT_SHLIB = 5,
+ PT_PHDR = 6,
+ PT_TLS = 7,
+ PT_LOOS = 0x60000000,
+ PT_HIOS = 0x6fffffff,
+ PT_LOPROC = 0x70000000,
+ PT_HIPROC = 0x7fffffff,
+ // The remaining values are not in the standard.
+ // Frame unwind information.
+ PT_GNU_EH_FRAME = 0x6474e550,
+ PT_SUNW_EH_FRAME = 0x6474e550,
+ // Stack flags.
+ PT_GNU_STACK = 0x6474e551,
+ // Read only after relocation.
+ PT_GNU_RELRO = 0x6474e552,
+ // Platform architecture compatibility information
+ PT_ARM_ARCHEXT = 0x70000000,
+ // Exception unwind tables
+ PT_ARM_EXIDX = 0x70000001,
+ // Register usage information. Identifies one .reginfo section.
+ PT_MIPS_REGINFO =0x70000000,
+ // Runtime procedure table.
+ PT_MIPS_RTPROC = 0x70000001,
+ // .MIPS.options section.
+ PT_MIPS_OPTIONS = 0x70000002
+};
+
+// The valid bit flags found in the Phdr p_flags field.
+
+enum PF
+{
+ PF_X = 0x1,
+ PF_W = 0x2,
+ PF_R = 0x4,
+ PF_MASKOS = 0x0ff00000,
+ PF_MASKPROC = 0xf0000000
+};
+
+// Symbol binding from Sym st_info field.
+
+enum STB
+{
+ STB_LOCAL = 0,
+ STB_GLOBAL = 1,
+ STB_WEAK = 2,
+ STB_LOOS = 10,
+ STB_GNU_UNIQUE = 10,
+ STB_HIOS = 12,
+ STB_LOPROC = 13,
+ STB_HIPROC = 15
+};
+
+// Symbol types from Sym st_info field.
+
+enum STT
+{
+ STT_NOTYPE = 0,
+ STT_OBJECT = 1,
+ STT_FUNC = 2,
+ STT_SECTION = 3,
+ STT_FILE = 4,
+ STT_COMMON = 5,
+ STT_TLS = 6,
+
+ // GNU extension: symbol value points to a function which is called
+ // at runtime to determine the final value of the symbol.
+ STT_GNU_IFUNC = 10,
+
+ STT_LOOS = 10,
+ STT_HIOS = 12,
+ STT_LOPROC = 13,
+ STT_HIPROC = 15,
+
+ // The section type that must be used for register symbols on
+ // Sparc. These symbols initialize a global register.
+ STT_SPARC_REGISTER = 13,
+
+ // ARM: a THUMB function. This is not defined in ARM ELF Specification but
+ // used by the GNU tool-chain.
+ STT_ARM_TFUNC = 13
+};
+
+inline STB
+elf_st_bind(unsigned char info)
+{
+ return static_cast<STB>(info >> 4);
+}
+
+inline STT
+elf_st_type(unsigned char info)
+{
+ return static_cast<STT>(info & 0xf);
+}
+
+inline unsigned char
+elf_st_info(STB bind, STT type)
+{
+ return ((static_cast<unsigned char>(bind) << 4)
+ + (static_cast<unsigned char>(type) & 0xf));
+}
+
+// Symbol visibility from Sym st_other field.
+
+enum STV
+{
+ STV_DEFAULT = 0,
+ STV_INTERNAL = 1,
+ STV_HIDDEN = 2,
+ STV_PROTECTED = 3
+};
+
+inline STV
+elf_st_visibility(unsigned char other)
+{
+ return static_cast<STV>(other & 0x3);
+}
+
+inline unsigned char
+elf_st_nonvis(unsigned char other)
+{
+ return static_cast<STV>(other >> 2);
+}
+
+inline unsigned char
+elf_st_other(STV vis, unsigned char nonvis)
+{
+ return ((nonvis << 2)
+ + (static_cast<unsigned char>(vis) & 3));
+}
+
+// Reloc information from Rel/Rela r_info field.
+
+template<int size>
+unsigned int
+elf_r_sym(typename Elf_types<size>::Elf_WXword);
+
+template<>
+inline unsigned int
+elf_r_sym<32>(Elf_Word v)
+{
+ return v >> 8;
+}
+
+template<>
+inline unsigned int
+elf_r_sym<64>(Elf_Xword v)
+{
+ return v >> 32;
+}
+
+template<int size>
+unsigned int
+elf_r_type(typename Elf_types<size>::Elf_WXword);
+
+template<>
+inline unsigned int
+elf_r_type<32>(Elf_Word v)
+{
+ return v & 0xff;
+}
+
+template<>
+inline unsigned int
+elf_r_type<64>(Elf_Xword v)
+{
+ return v & 0xffffffff;
+}
+
+template<int size>
+typename Elf_types<size>::Elf_WXword
+elf_r_info(unsigned int s, unsigned int t);
+
+template<>
+inline Elf_Word
+elf_r_info<32>(unsigned int s, unsigned int t)
+{
+ return (s << 8) + (t & 0xff);
+}
+
+template<>
+inline Elf_Xword
+elf_r_info<64>(unsigned int s, unsigned int t)
+{
+ return (static_cast<Elf_Xword>(s) << 32) + (t & 0xffffffff);
+}
+
+// Dynamic tags found in the PT_DYNAMIC segment.
+
+enum DT
+{
+ DT_NULL = 0,
+ DT_NEEDED = 1,
+ DT_PLTRELSZ = 2,
+ DT_PLTGOT = 3,
+ DT_HASH = 4,
+ DT_STRTAB = 5,
+ DT_SYMTAB = 6,
+ DT_RELA = 7,
+ DT_RELASZ = 8,
+ DT_RELAENT = 9,
+ DT_STRSZ = 10,
+ DT_SYMENT = 11,
+ DT_INIT = 12,
+ DT_FINI = 13,
+ DT_SONAME = 14,
+ DT_RPATH = 15,
+ DT_SYMBOLIC = 16,
+ DT_REL = 17,
+ DT_RELSZ = 18,
+ DT_RELENT = 19,
+ DT_PLTREL = 20,
+ DT_DEBUG = 21,
+ DT_TEXTREL = 22,
+ DT_JMPREL = 23,
+ DT_BIND_NOW = 24,
+ DT_INIT_ARRAY = 25,
+ DT_FINI_ARRAY = 26,
+ DT_INIT_ARRAYSZ = 27,
+ DT_FINI_ARRAYSZ = 28,
+ DT_RUNPATH = 29,
+ DT_FLAGS = 30,
+
+ // This is used to mark a range of dynamic tags. It is not really
+ // a tag value.
+ DT_ENCODING = 32,
+
+ DT_PREINIT_ARRAY = 32,
+ DT_PREINIT_ARRAYSZ = 33,
+ DT_LOOS = 0x6000000d,
+ DT_HIOS = 0x6ffff000,
+ DT_LOPROC = 0x70000000,
+ DT_HIPROC = 0x7fffffff,
+
+ // The remaining values are extensions used by GNU or Solaris.
+ DT_VALRNGLO = 0x6ffffd00,
+ DT_GNU_PRELINKED = 0x6ffffdf5,
+ DT_GNU_CONFLICTSZ = 0x6ffffdf6,
+ DT_GNU_LIBLISTSZ = 0x6ffffdf7,
+ DT_CHECKSUM = 0x6ffffdf8,
+ DT_PLTPADSZ = 0x6ffffdf9,
+ DT_MOVEENT = 0x6ffffdfa,
+ DT_MOVESZ = 0x6ffffdfb,
+ DT_FEATURE = 0x6ffffdfc,
+ DT_POSFLAG_1 = 0x6ffffdfd,
+ DT_SYMINSZ = 0x6ffffdfe,
+ DT_SYMINENT = 0x6ffffdff,
+ DT_VALRNGHI = 0x6ffffdff,
+
+ DT_ADDRRNGLO = 0x6ffffe00,
+ DT_GNU_HASH = 0x6ffffef5,
+ DT_TLSDESC_PLT = 0x6ffffef6,
+ DT_TLSDESC_GOT = 0x6ffffef7,
+ DT_GNU_CONFLICT = 0x6ffffef8,
+ DT_GNU_LIBLIST = 0x6ffffef9,
+ DT_CONFIG = 0x6ffffefa,
+ DT_DEPAUDIT = 0x6ffffefb,
+ DT_AUDIT = 0x6ffffefc,
+ DT_PLTPAD = 0x6ffffefd,
+ DT_MOVETAB = 0x6ffffefe,
+ DT_SYMINFO = 0x6ffffeff,
+ DT_ADDRRNGHI = 0x6ffffeff,
+
+ DT_RELACOUNT = 0x6ffffff9,
+ DT_RELCOUNT = 0x6ffffffa,
+ DT_FLAGS_1 = 0x6ffffffb,
+ DT_VERDEF = 0x6ffffffc,
+ DT_VERDEFNUM = 0x6ffffffd,
+ DT_VERNEED = 0x6ffffffe,
+ DT_VERNEEDNUM = 0x6fffffff,
+
+ DT_VERSYM = 0x6ffffff0,
+
+ // Specify the value of _GLOBAL_OFFSET_TABLE_.
+ DT_PPC_GOT = 0x70000000,
+
+ // Specify the start of the .glink section.
+ DT_PPC64_GLINK = 0x70000000,
+
+ // Specify the start and size of the .opd section.
+ DT_PPC64_OPD = 0x70000001,
+ DT_PPC64_OPDSZ = 0x70000002,
+
+ // The index of an STT_SPARC_REGISTER symbol within the DT_SYMTAB
+ // symbol table. One dynamic entry exists for every STT_SPARC_REGISTER
+ // symbol in the symbol table.
+ DT_SPARC_REGISTER = 0x70000001,
+
+ // MIPS specific dynamic array tags.
+ // 32 bit version number for runtime linker interface.
+ DT_MIPS_RLD_VERSION = 0x70000001,
+ // Time stamp.
+ DT_MIPS_TIME_STAMP = 0x70000002,
+ // Checksum of external strings and common sizes.
+ DT_MIPS_ICHECKSUM = 0x70000003,
+ // Index of version string in string table.
+ DT_MIPS_IVERSION = 0x70000004,
+ // 32 bits of flags.
+ DT_MIPS_FLAGS = 0x70000005,
+ // Base address of the segment.
+ DT_MIPS_BASE_ADDRESS = 0x70000006,
+ // ???
+ DT_MIPS_MSYM = 0x70000007,
+ // Address of .conflict section.
+ DT_MIPS_CONFLICT = 0x70000008,
+ // Address of .liblist section.
+ DT_MIPS_LIBLIST = 0x70000009,
+ // Number of local global offset table entries.
+ DT_MIPS_LOCAL_GOTNO = 0x7000000a,
+ // Number of entries in the .conflict section.
+ DT_MIPS_CONFLICTNO = 0x7000000b,
+ // Number of entries in the .liblist section.
+ DT_MIPS_LIBLISTNO = 0x70000010,
+ // Number of entries in the .dynsym section.
+ DT_MIPS_SYMTABNO = 0x70000011,
+ // Index of first external dynamic symbol not referenced locally.
+ DT_MIPS_UNREFEXTNO = 0x70000012,
+ // Index of first dynamic symbol in global offset table.
+ DT_MIPS_GOTSYM = 0x70000013,
+ // Number of page table entries in global offset table.
+ DT_MIPS_HIPAGENO = 0x70000014,
+ // Address of run time loader map, used for debugging.
+ DT_MIPS_RLD_MAP = 0x70000016,
+ // Delta C++ class definition.
+ DT_MIPS_DELTA_CLASS = 0x70000017,
+ // Number of entries in DT_MIPS_DELTA_CLASS.
+ DT_MIPS_DELTA_CLASS_NO = 0x70000018,
+ // Delta C++ class instances.
+ DT_MIPS_DELTA_INSTANCE = 0x70000019,
+ // Number of entries in DT_MIPS_DELTA_INSTANCE.
+ DT_MIPS_DELTA_INSTANCE_NO = 0x7000001a,
+ // Delta relocations.
+ DT_MIPS_DELTA_RELOC = 0x7000001b,
+ // Number of entries in DT_MIPS_DELTA_RELOC.
+ DT_MIPS_DELTA_RELOC_NO = 0x7000001c,
+ // Delta symbols that Delta relocations refer to.
+ DT_MIPS_DELTA_SYM = 0x7000001d,
+ // Number of entries in DT_MIPS_DELTA_SYM.
+ DT_MIPS_DELTA_SYM_NO = 0x7000001e,
+ // Delta symbols that hold class declarations.
+ DT_MIPS_DELTA_CLASSSYM = 0x70000020,
+ // Number of entries in DT_MIPS_DELTA_CLASSSYM.
+ DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021,
+ // Flags indicating information about C++ flavor.
+ DT_MIPS_CXX_FLAGS = 0x70000022,
+ // Pixie information (???).
+ DT_MIPS_PIXIE_INIT = 0x70000023,
+ // Address of .MIPS.symlib
+ DT_MIPS_SYMBOL_LIB = 0x70000024,
+ // The GOT index of the first PTE for a segment
+ DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025,
+ // The GOT index of the first PTE for a local symbol
+ DT_MIPS_LOCAL_GOTIDX = 0x70000026,
+ // The GOT index of the first PTE for a hidden symbol
+ DT_MIPS_HIDDEN_GOTIDX = 0x70000027,
+ // The GOT index of the first PTE for a protected symbol
+ DT_MIPS_PROTECTED_GOTIDX = 0x70000028,
+ // Address of `.MIPS.options'.
+ DT_MIPS_OPTIONS = 0x70000029,
+ // Address of `.interface'.
+ DT_MIPS_INTERFACE = 0x7000002a,
+ // ???
+ DT_MIPS_DYNSTR_ALIGN = 0x7000002b,
+ // Size of the .interface section.
+ DT_MIPS_INTERFACE_SIZE = 0x7000002c,
+ // Size of rld_text_resolve function stored in the GOT.
+ DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d,
+ // Default suffix of DSO to be added by rld on dlopen() calls.
+ DT_MIPS_PERF_SUFFIX = 0x7000002e,
+ // Size of compact relocation section (O32).
+ DT_MIPS_COMPACT_SIZE = 0x7000002f,
+ // GP value for auxiliary GOTs.
+ DT_MIPS_GP_VALUE = 0x70000030,
+ // Address of auxiliary .dynamic.
+ DT_MIPS_AUX_DYNAMIC = 0x70000031,
+ // Address of the base of the PLTGOT.
+ DT_MIPS_PLTGOT = 0x70000032,
+ // Points to the base of a writable PLT.
+ DT_MIPS_RWPLT = 0x70000034,
+
+ DT_AUXILIARY = 0x7ffffffd,
+ DT_USED = 0x7ffffffe,
+ DT_FILTER = 0x7fffffff
+};
+
+// Flags found in the DT_FLAGS dynamic element.
+
+enum DF
+{
+ DF_ORIGIN = 0x1,
+ DF_SYMBOLIC = 0x2,
+ DF_TEXTREL = 0x4,
+ DF_BIND_NOW = 0x8,
+ DF_STATIC_TLS = 0x10
+};
+
+// Flags found in the DT_FLAGS_1 dynamic element.
+
+enum DF_1
+{
+ DF_1_NOW = 0x1,
+ DF_1_GLOBAL = 0x2,
+ DF_1_GROUP = 0x4,
+ DF_1_NODELETE = 0x8,
+ DF_1_LOADFLTR = 0x10,
+ DF_1_INITFIRST = 0x20,
+ DF_1_NOOPEN = 0x40,
+ DF_1_ORIGIN = 0x80,
+ DF_1_DIRECT = 0x100,
+ DF_1_TRANS = 0x200,
+ DF_1_INTERPOSE = 0x400,
+ DF_1_NODEFLIB = 0x800,
+ DF_1_NODUMP = 0x1000,
+ DF_1_CONLFAT = 0x2000
+};
+
+// Version numbers which appear in the vd_version field of a Verdef
+// structure.
+
+const int VER_DEF_NONE = 0;
+const int VER_DEF_CURRENT = 1;
+
+// Version numbers which appear in the vn_version field of a Verneed
+// structure.
+
+const int VER_NEED_NONE = 0;
+const int VER_NEED_CURRENT = 1;
+
+// Bit flags which appear in vd_flags of Verdef and vna_flags of
+// Vernaux.
+
+const int VER_FLG_BASE = 0x1;
+const int VER_FLG_WEAK = 0x2;
+const int VER_FLG_INFO = 0x4;
+
+// Special constants found in the SHT_GNU_versym entries.
+
+const int VER_NDX_LOCAL = 0;
+const int VER_NDX_GLOBAL = 1;
+
+// A SHT_GNU_versym section holds 16-bit words. This bit is set if
+// the symbol is hidden and can only be seen when referenced using an
+// explicit version number. This is a GNU extension.
+
+const int VERSYM_HIDDEN = 0x8000;
+
+// This is the mask for the rest of the data in a word read from a
+// SHT_GNU_versym section.
+
+const int VERSYM_VERSION = 0x7fff;
+
+// Note descriptor type codes for notes in a non-core file with an
+// empty name.
+
+enum
+{
+ // A version string.
+ NT_VERSION = 1,
+ // An architecture string.
+ NT_ARCH = 2
+};
+
+// Note descriptor type codes for notes in a non-core file with the
+// name "GNU".
+
+enum
+{
+ // The minimum ABI level. This is used by the dynamic linker to
+ // describe the minimal kernel version on which a shared library may
+ // be used. Th value should be four words. Word 0 is an OS
+ // descriptor (see below). Word 1 is the major version of the ABI.
+ // Word 2 is the minor version. Word 3 is the subminor version.
+ NT_GNU_ABI_TAG = 1,
+ // Hardware capabilities information. Word 0 is the number of
+ // entries. Word 1 is a bitmask of enabled entries. The rest of
+ // the descriptor is a series of entries, where each entry is a
+ // single byte followed by a nul terminated string. The byte gives
+ // the bit number to test if enabled in the bitmask.
+ NT_GNU_HWCAP = 2,
+ // The build ID as set by the linker's --build-id option. The
+ // format of the descriptor depends on the build ID style.
+ NT_GNU_BUILD_ID = 3,
+ // The version of gold used to link. Th descriptor is just a
+ // string.
+ NT_GNU_GOLD_VERSION = 4
+};
+
+// The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note.
+
+enum
+{
+ ELF_NOTE_OS_LINUX = 0,
+ ELF_NOTE_OS_GNU = 1,
+ ELF_NOTE_OS_SOLARIS2 = 2,
+ ELF_NOTE_OS_FREEBSD = 3,
+ ELF_NOTE_OS_NETBSD = 4,
+ ELF_NOTE_OS_SYLLABLE = 5
+};
+
+} // End namespace elfcpp.
+
+// Include internal details after defining the types.
+#include "elfcpp_internal.h"
+
+namespace elfcpp
+{
+
+// The offset of the ELF file header in the ELF file.
+
+const int file_header_offset = 0;
+
+// ELF structure sizes.
+
+template<int size>
+struct Elf_sizes
+{
+ // Size of ELF file header.
+ static const int ehdr_size = sizeof(internal::Ehdr_data<size>);
+ // Size of ELF segment header.
+ static const int phdr_size = sizeof(internal::Phdr_data<size>);
+ // Size of ELF section header.
+ static const int shdr_size = sizeof(internal::Shdr_data<size>);
+ // Size of ELF symbol table entry.
+ static const int sym_size = sizeof(internal::Sym_data<size>);
+ // Sizes of ELF reloc entries.
+ static const int rel_size = sizeof(internal::Rel_data<size>);
+ static const int rela_size = sizeof(internal::Rela_data<size>);
+ // Size of ELF dynamic entry.
+ static const int dyn_size = sizeof(internal::Dyn_data<size>);
+ // Size of ELF version structures.
+ static const int verdef_size = sizeof(internal::Verdef_data);
+ static const int verdaux_size = sizeof(internal::Verdaux_data);
+ static const int verneed_size = sizeof(internal::Verneed_data);
+ static const int vernaux_size = sizeof(internal::Vernaux_data);
+};
+
+// Accessor class for the ELF file header.
+
+template<int size, bool big_endian>
+class Ehdr
+{
+ public:
+ Ehdr(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(p))
+ { }
+
+ template<typename File>
+ Ehdr(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Ehdr_data<size>*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ const unsigned char*
+ get_e_ident() const
+ { return this->p_->e_ident; }
+
+ Elf_Half
+ get_e_type() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_type); }
+
+ Elf_Half
+ get_e_machine() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_machine); }
+
+ Elf_Word
+ get_e_version() const
+ { return Convert<32, big_endian>::convert_host(this->p_->e_version); }
+
+ typename Elf_types<size>::Elf_Addr
+ get_e_entry() const
+ { return Convert<size, big_endian>::convert_host(this->p_->e_entry); }
+
+ typename Elf_types<size>::Elf_Off
+ get_e_phoff() const
+ { return Convert<size, big_endian>::convert_host(this->p_->e_phoff); }
+
+ typename Elf_types<size>::Elf_Off
+ get_e_shoff() const
+ { return Convert<size, big_endian>::convert_host(this->p_->e_shoff); }
+
+ Elf_Word
+ get_e_flags() const
+ { return Convert<32, big_endian>::convert_host(this->p_->e_flags); }
+
+ Elf_Half
+ get_e_ehsize() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_ehsize); }
+
+ Elf_Half
+ get_e_phentsize() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_phentsize); }
+
+ Elf_Half
+ get_e_phnum() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_phnum); }
+
+ Elf_Half
+ get_e_shentsize() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_shentsize); }
+
+ Elf_Half
+ get_e_shnum() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_shnum); }
+
+ Elf_Half
+ get_e_shstrndx() const
+ { return Convert<16, big_endian>::convert_host(this->p_->e_shstrndx); }
+
+ private:
+ const internal::Ehdr_data<size>* p_;
+};
+
+// Write class for the ELF file header.
+
+template<int size, bool big_endian>
+class Ehdr_write
+{
+ public:
+ Ehdr_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Ehdr_data<size>*>(p))
+ { }
+
+ void
+ put_e_ident(const unsigned char v[EI_NIDENT]) const
+ { memcpy(this->p_->e_ident, v, EI_NIDENT); }
+
+ void
+ put_e_type(Elf_Half v)
+ { this->p_->e_type = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ put_e_machine(Elf_Half v)
+ { this->p_->e_machine = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ put_e_version(Elf_Word v)
+ { this->p_->e_version = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_e_entry(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->e_entry = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_e_phoff(typename Elf_types<size>::Elf_Off v)
+ { this->p_->e_phoff = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_e_shoff(typename Elf_types<size>::Elf_Off v)
+ { this->p_->e_shoff = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_e_flags(Elf_Word v)
+ { this->p_->e_flags = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_e_ehsize(Elf_Half v)
+ { this->p_->e_ehsize = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ put_e_phentsize(Elf_Half v)
+ { this->p_->e_phentsize = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ put_e_phnum(Elf_Half v)
+ { this->p_->e_phnum = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ put_e_shentsize(Elf_Half v)
+ { this->p_->e_shentsize = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ put_e_shnum(Elf_Half v)
+ { this->p_->e_shnum = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ put_e_shstrndx(Elf_Half v)
+ { this->p_->e_shstrndx = Convert<16, big_endian>::convert_host(v); }
+
+ private:
+ internal::Ehdr_data<size>* p_;
+};
+
+// Accessor class for an ELF section header.
+
+template<int size, bool big_endian>
+class Shdr
+{
+ public:
+ Shdr(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Shdr_data<size>*>(p))
+ { }
+
+ template<typename File>
+ Shdr(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Shdr_data<size>*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ Elf_Word
+ get_sh_name() const
+ { return Convert<32, big_endian>::convert_host(this->p_->sh_name); }
+
+ Elf_Word
+ get_sh_type() const
+ { return Convert<32, big_endian>::convert_host(this->p_->sh_type); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_sh_flags() const
+ { return Convert<size, big_endian>::convert_host(this->p_->sh_flags); }
+
+ typename Elf_types<size>::Elf_Addr
+ get_sh_addr() const
+ { return Convert<size, big_endian>::convert_host(this->p_->sh_addr); }
+
+ typename Elf_types<size>::Elf_Off
+ get_sh_offset() const
+ { return Convert<size, big_endian>::convert_host(this->p_->sh_offset); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_sh_size() const
+ { return Convert<size, big_endian>::convert_host(this->p_->sh_size); }
+
+ Elf_Word
+ get_sh_link() const
+ { return Convert<32, big_endian>::convert_host(this->p_->sh_link); }
+
+ Elf_Word
+ get_sh_info() const
+ { return Convert<32, big_endian>::convert_host(this->p_->sh_info); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_sh_addralign() const
+ { return
+ Convert<size, big_endian>::convert_host(this->p_->sh_addralign); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_sh_entsize() const
+ { return Convert<size, big_endian>::convert_host(this->p_->sh_entsize); }
+
+ private:
+ const internal::Shdr_data<size>* p_;
+};
+
+// Write class for an ELF section header.
+
+template<int size, bool big_endian>
+class Shdr_write
+{
+ public:
+ Shdr_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Shdr_data<size>*>(p))
+ { }
+
+ void
+ put_sh_name(Elf_Word v)
+ { this->p_->sh_name = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_sh_type(Elf_Word v)
+ { this->p_->sh_type = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_sh_flags(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->sh_flags = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_sh_addr(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->sh_addr = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_sh_offset(typename Elf_types<size>::Elf_Off v)
+ { this->p_->sh_offset = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_sh_size(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->sh_size = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_sh_link(Elf_Word v)
+ { this->p_->sh_link = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_sh_info(Elf_Word v)
+ { this->p_->sh_info = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_sh_addralign(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->sh_addralign = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_sh_entsize(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->sh_entsize = Convert<size, big_endian>::convert_host(v); }
+
+ private:
+ internal::Shdr_data<size>* p_;
+};
+
+// Accessor class for an ELF segment header.
+
+template<int size, bool big_endian>
+class Phdr
+{
+ public:
+ Phdr(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Phdr_data<size>*>(p))
+ { }
+
+ template<typename File>
+ Phdr(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<internal::Phdr_data<size>*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ Elf_Word
+ get_p_type() const
+ { return Convert<32, big_endian>::convert_host(this->p_->p_type); }
+
+ typename Elf_types<size>::Elf_Off
+ get_p_offset() const
+ { return Convert<size, big_endian>::convert_host(this->p_->p_offset); }
+
+ typename Elf_types<size>::Elf_Addr
+ get_p_vaddr() const
+ { return Convert<size, big_endian>::convert_host(this->p_->p_vaddr); }
+
+ typename Elf_types<size>::Elf_Addr
+ get_p_paddr() const
+ { return Convert<size, big_endian>::convert_host(this->p_->p_paddr); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_p_filesz() const
+ { return Convert<size, big_endian>::convert_host(this->p_->p_filesz); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_p_memsz() const
+ { return Convert<size, big_endian>::convert_host(this->p_->p_memsz); }
+
+ Elf_Word
+ get_p_flags() const
+ { return Convert<32, big_endian>::convert_host(this->p_->p_flags); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_p_align() const
+ { return Convert<size, big_endian>::convert_host(this->p_->p_align); }
+
+ private:
+ const internal::Phdr_data<size>* p_;
+};
+
+// Write class for an ELF segment header.
+
+template<int size, bool big_endian>
+class Phdr_write
+{
+ public:
+ Phdr_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Phdr_data<size>*>(p))
+ { }
+
+ void
+ put_p_type(Elf_Word v)
+ { this->p_->p_type = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_p_offset(typename Elf_types<size>::Elf_Off v)
+ { this->p_->p_offset = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_p_vaddr(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->p_vaddr = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_p_paddr(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->p_paddr = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_p_filesz(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->p_filesz = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_p_memsz(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->p_memsz = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_p_flags(Elf_Word v)
+ { this->p_->p_flags = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_p_align(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->p_align = Convert<size, big_endian>::convert_host(v); }
+
+ private:
+ internal::Phdr_data<size>* p_;
+};
+
+// Accessor class for an ELF symbol table entry.
+
+template<int size, bool big_endian>
+class Sym
+{
+ public:
+ Sym(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Sym_data<size>*>(p))
+ { }
+
+ template<typename File>
+ Sym(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Sym_data<size>*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ Elf_Word
+ get_st_name() const
+ { return Convert<32, big_endian>::convert_host(this->p_->st_name); }
+
+ typename Elf_types<size>::Elf_Addr
+ get_st_value() const
+ { return Convert<size, big_endian>::convert_host(this->p_->st_value); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_st_size() const
+ { return Convert<size, big_endian>::convert_host(this->p_->st_size); }
+
+ unsigned char
+ get_st_info() const
+ { return this->p_->st_info; }
+
+ STB
+ get_st_bind() const
+ { return elf_st_bind(this->get_st_info()); }
+
+ STT
+ get_st_type() const
+ { return elf_st_type(this->get_st_info()); }
+
+ unsigned char
+ get_st_other() const
+ { return this->p_->st_other; }
+
+ STV
+ get_st_visibility() const
+ { return elf_st_visibility(this->get_st_other()); }
+
+ unsigned char
+ get_st_nonvis() const
+ { return elf_st_nonvis(this->get_st_other()); }
+
+ Elf_Half
+ get_st_shndx() const
+ { return Convert<16, big_endian>::convert_host(this->p_->st_shndx); }
+
+ private:
+ const internal::Sym_data<size>* p_;
+};
+
+// Writer class for an ELF symbol table entry.
+
+template<int size, bool big_endian>
+class Sym_write
+{
+ public:
+ Sym_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Sym_data<size>*>(p))
+ { }
+
+ void
+ put_st_name(Elf_Word v)
+ { this->p_->st_name = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ put_st_value(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->st_value = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_st_size(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->st_size = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_st_info(unsigned char v)
+ { this->p_->st_info = v; }
+
+ void
+ put_st_info(STB bind, STT type)
+ { this->p_->st_info = elf_st_info(bind, type); }
+
+ void
+ put_st_other(unsigned char v)
+ { this->p_->st_other = v; }
+
+ void
+ put_st_other(STV vis, unsigned char nonvis)
+ { this->p_->st_other = elf_st_other(vis, nonvis); }
+
+ void
+ put_st_shndx(Elf_Half v)
+ { this->p_->st_shndx = Convert<16, big_endian>::convert_host(v); }
+
+ Sym<size, big_endian>
+ sym()
+ { return Sym<size, big_endian>(reinterpret_cast<unsigned char*>(this->p_)); }
+
+ private:
+ internal::Sym_data<size>* p_;
+};
+
+// Accessor classes for an ELF REL relocation entry.
+
+template<int size, bool big_endian>
+class Rel
+{
+ public:
+ Rel(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Rel_data<size>*>(p))
+ { }
+
+ template<typename File>
+ Rel(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Rel_data<size>*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ typename Elf_types<size>::Elf_Addr
+ get_r_offset() const
+ { return Convert<size, big_endian>::convert_host(this->p_->r_offset); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_r_info() const
+ { return Convert<size, big_endian>::convert_host(this->p_->r_info); }
+
+ private:
+ const internal::Rel_data<size>* p_;
+};
+
+// Writer class for an ELF Rel relocation.
+
+template<int size, bool big_endian>
+class Rel_write
+{
+ public:
+ Rel_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Rel_data<size>*>(p))
+ { }
+
+ void
+ put_r_offset(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_r_info(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->r_info = Convert<size, big_endian>::convert_host(v); }
+
+ private:
+ internal::Rel_data<size>* p_;
+};
+
+// Accessor class for an ELF Rela relocation.
+
+template<int size, bool big_endian>
+class Rela
+{
+ public:
+ Rela(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Rela_data<size>*>(p))
+ { }
+
+ template<typename File>
+ Rela(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Rela_data<size>*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ typename Elf_types<size>::Elf_Addr
+ get_r_offset() const
+ { return Convert<size, big_endian>::convert_host(this->p_->r_offset); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_r_info() const
+ { return Convert<size, big_endian>::convert_host(this->p_->r_info); }
+
+ typename Elf_types<size>::Elf_Swxword
+ get_r_addend() const
+ { return Convert<size, big_endian>::convert_host(this->p_->r_addend); }
+
+ private:
+ const internal::Rela_data<size>* p_;
+};
+
+// Writer class for an ELF Rela relocation.
+
+template<int size, bool big_endian>
+class Rela_write
+{
+ public:
+ Rela_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Rela_data<size>*>(p))
+ { }
+
+ void
+ put_r_offset(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->r_offset = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_r_info(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->r_info = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_r_addend(typename Elf_types<size>::Elf_Swxword v)
+ { this->p_->r_addend = Convert<size, big_endian>::convert_host(v); }
+
+ private:
+ internal::Rela_data<size>* p_;
+};
+
+// Accessor classes for entries in the ELF SHT_DYNAMIC section aka
+// PT_DYNAMIC segment.
+
+template<int size, bool big_endian>
+class Dyn
+{
+ public:
+ Dyn(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Dyn_data<size>*>(p))
+ { }
+
+ template<typename File>
+ Dyn(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Dyn_data<size>*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ typename Elf_types<size>::Elf_Swxword
+ get_d_tag() const
+ { return Convert<size, big_endian>::convert_host(this->p_->d_tag); }
+
+ typename Elf_types<size>::Elf_WXword
+ get_d_val() const
+ { return Convert<size, big_endian>::convert_host(this->p_->d_val); }
+
+ typename Elf_types<size>::Elf_Addr
+ get_d_ptr() const
+ { return Convert<size, big_endian>::convert_host(this->p_->d_val); }
+
+ private:
+ const internal::Dyn_data<size>* p_;
+};
+
+// Write class for an entry in the SHT_DYNAMIC section.
+
+template<int size, bool big_endian>
+class Dyn_write
+{
+ public:
+ Dyn_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Dyn_data<size>*>(p))
+ { }
+
+ void
+ put_d_tag(typename Elf_types<size>::Elf_Swxword v)
+ { this->p_->d_tag = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_d_val(typename Elf_types<size>::Elf_WXword v)
+ { this->p_->d_val = Convert<size, big_endian>::convert_host(v); }
+
+ void
+ put_d_ptr(typename Elf_types<size>::Elf_Addr v)
+ { this->p_->d_val = Convert<size, big_endian>::convert_host(v); }
+
+ private:
+ internal::Dyn_data<size>* p_;
+};
+
+// Accessor classes for entries in the ELF SHT_GNU_verdef section.
+
+template<int size, bool big_endian>
+class Verdef
+{
+ public:
+ Verdef(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Verdef_data*>(p))
+ { }
+
+ template<typename File>
+ Verdef(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Verdef_data*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ Elf_Half
+ get_vd_version() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vd_version); }
+
+ Elf_Half
+ get_vd_flags() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vd_flags); }
+
+ Elf_Half
+ get_vd_ndx() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vd_ndx); }
+
+ Elf_Half
+ get_vd_cnt() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vd_cnt); }
+
+ Elf_Word
+ get_vd_hash() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vd_hash); }
+
+ Elf_Word
+ get_vd_aux() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vd_aux); }
+
+ Elf_Word
+ get_vd_next() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vd_next); }
+
+ private:
+ const internal::Verdef_data* p_;
+};
+
+template<int size, bool big_endian>
+class Verdef_write
+{
+ public:
+ Verdef_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Verdef_data*>(p))
+ { }
+
+ void
+ set_vd_version(Elf_Half v)
+ { this->p_->vd_version = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vd_flags(Elf_Half v)
+ { this->p_->vd_flags = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vd_ndx(Elf_Half v)
+ { this->p_->vd_ndx = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vd_cnt(Elf_Half v)
+ { this->p_->vd_cnt = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vd_hash(Elf_Word v)
+ { this->p_->vd_hash = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ set_vd_aux(Elf_Word v)
+ { this->p_->vd_aux = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ set_vd_next(Elf_Word v)
+ { this->p_->vd_next = Convert<32, big_endian>::convert_host(v); }
+
+ private:
+ internal::Verdef_data* p_;
+};
+
+// Accessor classes for auxiliary entries in the ELF SHT_GNU_verdef
+// section.
+
+template<int size, bool big_endian>
+class Verdaux
+{
+ public:
+ Verdaux(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Verdaux_data*>(p))
+ { }
+
+ template<typename File>
+ Verdaux(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Verdaux_data*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ Elf_Word
+ get_vda_name() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vda_name); }
+
+ Elf_Word
+ get_vda_next() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vda_next); }
+
+ private:
+ const internal::Verdaux_data* p_;
+};
+
+template<int size, bool big_endian>
+class Verdaux_write
+{
+ public:
+ Verdaux_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Verdaux_data*>(p))
+ { }
+
+ void
+ set_vda_name(Elf_Word v)
+ { this->p_->vda_name = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ set_vda_next(Elf_Word v)
+ { this->p_->vda_next = Convert<32, big_endian>::convert_host(v); }
+
+ private:
+ internal::Verdaux_data* p_;
+};
+
+// Accessor classes for entries in the ELF SHT_GNU_verneed section.
+
+template<int size, bool big_endian>
+class Verneed
+{
+ public:
+ Verneed(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Verneed_data*>(p))
+ { }
+
+ template<typename File>
+ Verneed(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Verneed_data*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ Elf_Half
+ get_vn_version() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vn_version); }
+
+ Elf_Half
+ get_vn_cnt() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vn_cnt); }
+
+ Elf_Word
+ get_vn_file() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vn_file); }
+
+ Elf_Word
+ get_vn_aux() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vn_aux); }
+
+ Elf_Word
+ get_vn_next() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vn_next); }
+
+ private:
+ const internal::Verneed_data* p_;
+};
+
+template<int size, bool big_endian>
+class Verneed_write
+{
+ public:
+ Verneed_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Verneed_data*>(p))
+ { }
+
+ void
+ set_vn_version(Elf_Half v)
+ { this->p_->vn_version = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vn_cnt(Elf_Half v)
+ { this->p_->vn_cnt = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vn_file(Elf_Word v)
+ { this->p_->vn_file = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ set_vn_aux(Elf_Word v)
+ { this->p_->vn_aux = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ set_vn_next(Elf_Word v)
+ { this->p_->vn_next = Convert<32, big_endian>::convert_host(v); }
+
+ private:
+ internal::Verneed_data* p_;
+};
+
+// Accessor classes for auxiliary entries in the ELF SHT_GNU_verneed
+// section.
+
+template<int size, bool big_endian>
+class Vernaux
+{
+ public:
+ Vernaux(const unsigned char* p)
+ : p_(reinterpret_cast<const internal::Vernaux_data*>(p))
+ { }
+
+ template<typename File>
+ Vernaux(File* file, typename File::Location loc)
+ : p_(reinterpret_cast<const internal::Vernaux_data*>(
+ file->view(loc.file_offset, loc.data_size).data()))
+ { }
+
+ Elf_Word
+ get_vna_hash() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vna_hash); }
+
+ Elf_Half
+ get_vna_flags() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vna_flags); }
+
+ Elf_Half
+ get_vna_other() const
+ { return Convert<16, big_endian>::convert_host(this->p_->vna_other); }
+
+ Elf_Word
+ get_vna_name() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vna_name); }
+
+ Elf_Word
+ get_vna_next() const
+ { return Convert<32, big_endian>::convert_host(this->p_->vna_next); }
+
+ private:
+ const internal::Vernaux_data* p_;
+};
+
+template<int size, bool big_endian>
+class Vernaux_write
+{
+ public:
+ Vernaux_write(unsigned char* p)
+ : p_(reinterpret_cast<internal::Vernaux_data*>(p))
+ { }
+
+ void
+ set_vna_hash(Elf_Word v)
+ { this->p_->vna_hash = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ set_vna_flags(Elf_Half v)
+ { this->p_->vna_flags = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vna_other(Elf_Half v)
+ { this->p_->vna_other = Convert<16, big_endian>::convert_host(v); }
+
+ void
+ set_vna_name(Elf_Word v)
+ { this->p_->vna_name = Convert<32, big_endian>::convert_host(v); }
+
+ void
+ set_vna_next(Elf_Word v)
+ { this->p_->vna_next = Convert<32, big_endian>::convert_host(v); }
+
+ private:
+ internal::Vernaux_data* p_;
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFPCP_H)
diff --git a/binutils-2.25/elfcpp/elfcpp_file.h b/binutils-2.25/elfcpp/elfcpp_file.h
new file mode 100644
index 00000000..8dd7ad5c
--- /dev/null
+++ b/binutils-2.25/elfcpp/elfcpp_file.h
@@ -0,0 +1,688 @@
+// elfcpp_file.h -- file access for elfcpp -*- C++ -*-
+
+// Copyright 2006, 2007, Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+// This header file defines the class Elf_file which can be used to
+// read useful data from an ELF file. The functions here are all
+// templates which take a file interface object as a parameter. This
+// type must have a subtype View. This type must support two methods:
+// View view(off_t file_offset, off_t data_size)
+// returns a View for the specified part of the file.
+// void error(const char* printf_format, ...)
+// prints an error message and does not return. The subtype View must
+// support a method
+// const unsigned char* data()
+// which returns a pointer to a buffer containing the requested data.
+// This general interface is used to read data from the file. Objects
+// of type View will never survive longer than the elfcpp function.
+
+// Some of these functions must return a reference to part of the
+// file. To use these, the file interface must support a subtype
+// Location:
+// Location(off_t file_offset, off_t data_size)
+// To use this in conjunction with the accessors types Shdr, etc., the
+// file interface should support an overload of view:
+// View view(Location)
+// This permits writing
+// elfcpp::Shdr shdr(file, ef.section_header(n));
+
+#ifndef ELFCPP_FILE_H
+#define ELFCPP_FILE_H
+
+#include <string>
+#include <cstdio>
+#include <cstring>
+
+#include "elfcpp.h"
+
+namespace elfcpp
+{
+
+// A simple helper class to recognize if a file has an ELF header.
+
+class Elf_recognizer
+{
+ public:
+ // Maximum header size. The user should try to read this much of
+ // the file when using this class.
+
+ static const int max_header_size = Elf_sizes<64>::ehdr_size;
+
+ // Checks if the file contains the ELF magic. Other header fields
+ // are not checked.
+
+ static bool
+ is_elf_file(const unsigned char* ehdr_buf, int size);
+
+ // Check if EHDR_BUF/BUFSIZE is a valid header of a 32-bit or
+ // 64-bit, little-endian or big-endian ELF file. Assumes
+ // is_elf_file() has been checked to be true. If the header is not
+ // valid, *ERROR contains a human-readable error message. If is is,
+ // *SIZE is set to either 32 or 64, *BIG_ENDIAN is set to indicate
+ // whether the file is big-endian.
+
+ static bool
+ is_valid_header(const unsigned char* ehdr_buf, off_t bufsize,
+ int* size, bool* big_endian,
+ std::string* error);
+};
+
+// This object is used to read an ELF file.
+// SIZE: The size of file, 32 or 64.
+// BIG_ENDIAN: Whether the file is in big-endian format.
+// FILE: A file reading type as described above.
+
+template<int size, bool big_endian, typename File>
+class Elf_file
+{
+ private:
+ typedef Elf_file<size, big_endian, File> This;
+
+ public:
+ static const int ehdr_size = Elf_sizes<size>::ehdr_size;
+ static const int phdr_size = Elf_sizes<size>::phdr_size;
+ static const int shdr_size = Elf_sizes<size>::shdr_size;
+ static const int sym_size = Elf_sizes<size>::sym_size;
+ static const int rel_size = Elf_sizes<size>::rel_size;
+ static const int rela_size = Elf_sizes<size>::rela_size;
+
+ typedef Ehdr<size, big_endian> Ef_ehdr;
+ typedef Phdr<size, big_endian> Ef_phdr;
+ typedef Shdr<size, big_endian> Ef_shdr;
+ typedef Sym<size, big_endian> Ef_sym;
+
+ // Construct an Elf_file given an ELF file header.
+ Elf_file(File* file, const Ef_ehdr& ehdr)
+ { this->construct(file, ehdr); }
+
+ // Construct an ELF file.
+ inline
+ Elf_file(File* file);
+
+ // Return the file offset to the section headers.
+ off_t
+ shoff() const
+ { return this->shoff_; }
+
+ // Find the first section with an sh_type field equal to TYPE and
+ // return its index. Returns SHN_UNDEF if there is no such section.
+ unsigned int
+ find_section_by_type(unsigned int type);
+
+ // Return the number of sections.
+ unsigned int
+ shnum()
+ {
+ this->initialize_shnum();
+ return this->shnum_;
+ }
+
+ // Return the section index of the section name string table.
+ unsigned int
+ shstrndx()
+ {
+ this->initialize_shnum();
+ return this->shstrndx_;
+ }
+
+ // Return the value to subtract from section indexes >=
+ // SHN_LORESERVE. See the comment in initialize_shnum.
+ int
+ large_shndx_offset()
+ {
+ this->initialize_shnum();
+ return this->large_shndx_offset_;
+ }
+
+ // Return the location of the header of section SHNDX.
+ typename File::Location
+ section_header(unsigned int shndx)
+ {
+ return typename File::Location(this->section_header_offset(shndx),
+ shdr_size);
+ }
+
+ // Return the name of section SHNDX.
+ std::string
+ section_name(unsigned int shndx);
+
+ // Return the location of the contents of section SHNDX.
+ typename File::Location
+ section_contents(unsigned int shndx);
+
+ // Return the size of section SHNDX.
+ typename Elf_types<size>::Elf_WXword
+ section_size(unsigned int shndx);
+
+ // Return the flags of section SHNDX.
+ typename Elf_types<size>::Elf_WXword
+ section_flags(unsigned int shndx);
+
+ // Return the address of section SHNDX.
+ typename Elf_types<size>::Elf_Addr
+ section_addr(unsigned int shndx);
+
+ // Return the type of section SHNDX.
+ Elf_Word
+ section_type(unsigned int shndx);
+
+ // Return the link field of section SHNDX.
+ Elf_Word
+ section_link(unsigned int shndx);
+
+ // Return the info field of section SHNDX.
+ Elf_Word
+ section_info(unsigned int shndx);
+
+ // Return the addralign field of section SHNDX.
+ typename Elf_types<size>::Elf_WXword
+ section_addralign(unsigned int shndx);
+
+ private:
+ // Shared constructor code.
+ void
+ construct(File* file, const Ef_ehdr& ehdr);
+
+ // Initialize shnum_ and shstrndx_.
+ void
+ initialize_shnum();
+
+ // Return the file offset of the header of section SHNDX.
+ off_t
+ section_header_offset(unsigned int shndx);
+
+ // The file we are reading.
+ File* file_;
+ // The file offset to the section headers.
+ off_t shoff_;
+ // The number of sections.
+ unsigned int shnum_;
+ // The section index of the section name string table.
+ unsigned int shstrndx_;
+ // Offset to add to sections larger than SHN_LORESERVE.
+ int large_shndx_offset_;
+};
+
+// A small wrapper around SHT_STRTAB data mapped to memory. It checks that the
+// index is not out of bounds and the string is NULL-terminated.
+
+class Elf_strtab
+{
+ public:
+ // Construct an Elf_strtab for a section with contents *P and size SIZE.
+ Elf_strtab(const unsigned char* p, size_t size);
+
+ // Return the file offset to the section headers.
+ bool
+ get_c_string(size_t offset, const char** cstring) const
+ {
+ if (offset >= this->usable_size_)
+ return false;
+ *cstring = this->base_ + offset;
+ return true;
+ }
+
+ private:
+ // Contents of the section mapped to memory.
+ const char* base_;
+ // One larger that the position of the last NULL character in the section.
+ // For valid SHT_STRTAB sections, this is the size of the section.
+ size_t usable_size_;
+};
+
+// Inline function definitions.
+
+// Check for presence of the ELF magic number.
+
+inline bool
+Elf_recognizer::is_elf_file(const unsigned char* ehdr_buf, int size)
+{
+ if (size < 4)
+ return false;
+
+ static unsigned char elfmagic[4] =
+ {
+ elfcpp::ELFMAG0, elfcpp::ELFMAG1,
+ elfcpp::ELFMAG2, elfcpp::ELFMAG3
+ };
+ return memcmp(ehdr_buf, elfmagic, 4) == 0;
+}
+
+namespace
+{
+
+// Print a number to a string.
+
+inline std::string
+internal_printf_int(const char* format, int arg)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), format, arg);
+ return std::string(buf);
+}
+
+} // End anonymous namespace.
+
+// Check the validity of the ELF header.
+
+inline bool
+Elf_recognizer::is_valid_header(
+ const unsigned char* ehdr_buf,
+ off_t bufsize,
+ int* size,
+ bool* big_endian,
+ std::string* error)
+{
+ if (bufsize < elfcpp::EI_NIDENT)
+ {
+ *error = _("ELF file too short");
+ return false;
+ }
+
+ int v = ehdr_buf[elfcpp::EI_VERSION];
+ if (v != elfcpp::EV_CURRENT)
+ {
+ if (v == elfcpp::EV_NONE)
+ *error = _("invalid ELF version 0");
+ else
+ *error = internal_printf_int(_("unsupported ELF version %d"), v);
+ return false;
+ }
+
+ int c = ehdr_buf[elfcpp::EI_CLASS];
+ if (c == elfcpp::ELFCLASSNONE)
+ {
+ *error = _("invalid ELF class 0");
+ return false;
+ }
+ else if (c != elfcpp::ELFCLASS32
+ && c != elfcpp::ELFCLASS64)
+ {
+ *error = internal_printf_int(_("unsupported ELF class %d"), c);
+ return false;
+ }
+
+ int d = ehdr_buf[elfcpp::EI_DATA];
+ if (d == elfcpp::ELFDATANONE)
+ {
+ *error = _("invalid ELF data encoding");
+ return false;
+ }
+ else if (d != elfcpp::ELFDATA2LSB
+ && d != elfcpp::ELFDATA2MSB)
+ {
+ *error = internal_printf_int(_("unsupported ELF data encoding %d"), d);
+ return false;
+ }
+
+ *big_endian = (d == elfcpp::ELFDATA2MSB);
+
+ if (c == elfcpp::ELFCLASS32)
+ {
+ if (bufsize < elfcpp::Elf_sizes<32>::ehdr_size)
+ {
+ *error = _("ELF file too short");
+ return false;
+ }
+ *size = 32;
+ }
+ else
+ {
+ if (bufsize < elfcpp::Elf_sizes<64>::ehdr_size)
+ {
+ *error = _("ELF file too short");
+ return false;
+ }
+ *size = 64;
+ }
+
+ return true;
+}
+
+// Template function definitions.
+
+// Construct an Elf_file given an ELF file header.
+
+template<int size, bool big_endian, typename File>
+void
+Elf_file<size, big_endian, File>::construct(File* file, const Ef_ehdr& ehdr)
+{
+ this->file_ = file;
+ this->shoff_ = ehdr.get_e_shoff();
+ this->shnum_ = ehdr.get_e_shnum();
+ this->shstrndx_ = ehdr.get_e_shstrndx();
+ this->large_shndx_offset_ = 0;
+ if (ehdr.get_e_ehsize() != This::ehdr_size)
+ file->error(_("bad e_ehsize (%d != %d)"),
+ ehdr.get_e_ehsize(), This::ehdr_size);
+ if (ehdr.get_e_shentsize() != This::shdr_size)
+ file->error(_("bad e_shentsize (%d != %d)"),
+ ehdr.get_e_shentsize(), This::shdr_size);
+}
+
+// Construct an ELF file.
+
+template<int size, bool big_endian, typename File>
+inline
+Elf_file<size, big_endian, File>::Elf_file(File* file)
+{
+ typename File::View v(file->view(file_header_offset, This::ehdr_size));
+ this->construct(file, Ef_ehdr(v.data()));
+}
+
+// Initialize the shnum_ and shstrndx_ fields, handling overflow.
+
+template<int size, bool big_endian, typename File>
+void
+Elf_file<size, big_endian, File>::initialize_shnum()
+{
+ if ((this->shnum_ == 0 || this->shstrndx_ == SHN_XINDEX)
+ && this->shoff_ != 0)
+ {
+ typename File::View v(this->file_->view(this->shoff_, This::shdr_size));
+ Ef_shdr shdr(v.data());
+
+ if (this->shnum_ == 0)
+ this->shnum_ = shdr.get_sh_size();
+
+ if (this->shstrndx_ == SHN_XINDEX)
+ {
+ this->shstrndx_ = shdr.get_sh_link();
+
+ // Versions of the GNU binutils between 2.12 and 2.18 did
+ // not handle objects with more than SHN_LORESERVE sections
+ // correctly. All large section indexes were offset by
+ // 0x100. Some information can be found here:
+ // http://sourceware.org/bugzilla/show_bug.cgi?id=5900 .
+ // Fortunately these object files are easy to detect, as the
+ // GNU binutils always put the section header string table
+ // near the end of the list of sections. Thus if the
+ // section header string table index is larger than the
+ // number of sections, then we know we have to subtract
+ // 0x100 to get the real section index.
+ if (this->shstrndx_ >= this->shnum_)
+ {
+ if (this->shstrndx_ >= elfcpp::SHN_LORESERVE + 0x100)
+ {
+ this->large_shndx_offset_ = - 0x100;
+ this->shstrndx_ -= 0x100;
+ }
+ if (this->shstrndx_ >= this->shnum_)
+ this->file_->error(_("bad shstrndx: %u >= %u"),
+ this->shstrndx_, this->shnum_);
+ }
+ }
+ }
+}
+
+// Find section with sh_type equal to TYPE and return its index.
+// Returns SHN_UNDEF if not found.
+
+template<int size, bool big_endian, typename File>
+unsigned int
+Elf_file<size, big_endian, File>::find_section_by_type(unsigned int type)
+{
+ unsigned int shnum = this->shnum();
+ typename File::View v(this->file_->view(this->shoff_,
+ This::shdr_size * shnum));
+ for (unsigned int i = 0; i < shnum; i++)
+ {
+ Ef_shdr shdr(v.data() + This::shdr_size * i);
+ if (shdr.get_sh_type() == type)
+ return i;
+ }
+ return SHN_UNDEF;
+}
+
+// Return the file offset of the section header of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+off_t
+Elf_file<size, big_endian, File>::section_header_offset(unsigned int shndx)
+{
+ if (shndx >= this->shnum())
+ this->file_->error(_("section_header_offset: bad shndx %u >= %u"),
+ shndx, this->shnum());
+ return this->shoff_ + This::shdr_size * shndx;
+}
+
+// Return the name of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+std::string
+Elf_file<size, big_endian, File>::section_name(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ // Get the section name offset.
+ unsigned int sh_name;
+ {
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+ Ef_shdr shdr(v.data());
+ sh_name = shdr.get_sh_name();
+ }
+
+ // Get the file offset for the section name string table data.
+ off_t shstr_off;
+ typename Elf_types<size>::Elf_WXword shstr_size;
+ {
+ const unsigned int shstrndx = this->shstrndx_;
+ typename File::View v(file->view(this->section_header_offset(shstrndx),
+ This::shdr_size));
+ Ef_shdr shstr_shdr(v.data());
+ shstr_off = shstr_shdr.get_sh_offset();
+ shstr_size = shstr_shdr.get_sh_size();
+ }
+
+ if (sh_name >= shstr_size)
+ file->error(_("bad section name offset for section %u: %u"),
+ shndx, sh_name);
+
+ typename File::View v(file->view(shstr_off, shstr_size));
+
+ const unsigned char* datau = v.data();
+ const char* data = reinterpret_cast<const char*>(datau);
+ const void* p = ::memchr(data + sh_name, '\0', shstr_size - sh_name);
+ if (p == NULL)
+ file->error(_("missing null terminator for name of section %u"),
+ shndx);
+
+ size_t len = static_cast<const char*>(p) - (data + sh_name);
+
+ return std::string(data + sh_name, len);
+}
+
+// Return the contents of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+typename File::Location
+Elf_file<size, big_endian, File>::section_contents(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_contents: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+ Ef_shdr shdr(v.data());
+ return typename File::Location(shdr.get_sh_offset(), shdr.get_sh_size());
+}
+
+// Get the size of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+typename Elf_types<size>::Elf_WXword
+Elf_file<size, big_endian, File>::section_size(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_size: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_size();
+}
+
+// Return the section flags of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+typename Elf_types<size>::Elf_WXword
+Elf_file<size, big_endian, File>::section_flags(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_flags: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_flags();
+}
+
+// Return the address of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+typename Elf_types<size>::Elf_Addr
+Elf_file<size, big_endian, File>::section_addr(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_flags: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_addr();
+}
+
+// Return the type of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+Elf_Word
+Elf_file<size, big_endian, File>::section_type(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_type: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_type();
+}
+
+// Return the sh_link field of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+Elf_Word
+Elf_file<size, big_endian, File>::section_link(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_link: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_link();
+}
+
+// Return the sh_info field of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+Elf_Word
+Elf_file<size, big_endian, File>::section_info(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_info: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_info();
+}
+
+// Return the sh_addralign field of section SHNDX.
+
+template<int size, bool big_endian, typename File>
+typename Elf_types<size>::Elf_WXword
+Elf_file<size, big_endian, File>::section_addralign(unsigned int shndx)
+{
+ File* const file = this->file_;
+
+ if (shndx >= this->shnum())
+ file->error(_("section_addralign: bad shndx %u >= %u"),
+ shndx, this->shnum());
+
+ typename File::View v(file->view(this->section_header_offset(shndx),
+ This::shdr_size));
+
+ Ef_shdr shdr(v.data());
+ return shdr.get_sh_addralign();
+}
+
+inline
+Elf_strtab::Elf_strtab(const unsigned char* p, size_t size)
+{
+ // Check if the section is NUL-terminated. If it isn't, we ignore
+ // the last part to make sure we don't return non-NUL-terminated
+ // strings.
+ while (size > 0 && p[size - 1] != 0)
+ size--;
+ this->base_ = reinterpret_cast<const char*>(p);
+ this->usable_size_ = size;
+}
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_FILE_H)
diff --git a/binutils-2.25/elfcpp/elfcpp_internal.h b/binutils-2.25/elfcpp/elfcpp_internal.h
new file mode 100644
index 00000000..df84e7e7
--- /dev/null
+++ b/binutils-2.25/elfcpp/elfcpp_internal.h
@@ -0,0 +1,240 @@
+// elfcpp_internal.h -- internals for elfcpp -*- C++ -*-
+
+// Copyright 2006, 2007, Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+// This is included by elfcpp.h, the external interface, but holds
+// information which we want to keep private.
+
+#ifndef ELFCPP_INTERNAL_H
+#define ELFCPP_INTERNAL_H
+
+namespace elfcpp
+{
+
+namespace internal
+{
+
+// The ELF file header.
+
+template<int size>
+struct Ehdr_data
+{
+ unsigned char e_ident[EI_NIDENT];
+ Elf_Half e_type;
+ Elf_Half e_machine;
+ Elf_Word e_version;
+ typename Elf_types<size>::Elf_Addr e_entry;
+ typename Elf_types<size>::Elf_Off e_phoff;
+ typename Elf_types<size>::Elf_Off e_shoff;
+ Elf_Word e_flags;
+ Elf_Half e_ehsize;
+ Elf_Half e_phentsize;
+ Elf_Half e_phnum;
+ Elf_Half e_shentsize;
+ Elf_Half e_shnum;
+ Elf_Half e_shstrndx;
+};
+
+// An ELF section header.
+
+template<int size>
+struct Shdr_data
+{
+ Elf_Word sh_name;
+ Elf_Word sh_type;
+ typename Elf_types<size>::Elf_WXword sh_flags;
+ typename Elf_types<size>::Elf_Addr sh_addr;
+ typename Elf_types<size>::Elf_Off sh_offset;
+ typename Elf_types<size>::Elf_WXword sh_size;
+ Elf_Word sh_link;
+ Elf_Word sh_info;
+ typename Elf_types<size>::Elf_WXword sh_addralign;
+ typename Elf_types<size>::Elf_WXword sh_entsize;
+};
+
+// An ELF segment header. We use template specialization for the
+// 32-bit and 64-bit versions because the fields are in a different
+// order.
+
+template<int size>
+struct Phdr_data;
+
+template<>
+struct Phdr_data<32>
+{
+ Elf_Word p_type;
+ Elf_types<32>::Elf_Off p_offset;
+ Elf_types<32>::Elf_Addr p_vaddr;
+ Elf_types<32>::Elf_Addr p_paddr;
+ Elf_Word p_filesz;
+ Elf_Word p_memsz;
+ Elf_Word p_flags;
+ Elf_Word p_align;
+};
+
+template<>
+struct Phdr_data<64>
+{
+ Elf_Word p_type;
+ Elf_Word p_flags;
+ Elf_types<64>::Elf_Off p_offset;
+ Elf_types<64>::Elf_Addr p_vaddr;
+ Elf_types<64>::Elf_Addr p_paddr;
+ Elf_Xword p_filesz;
+ Elf_Xword p_memsz;
+ Elf_Xword p_align;
+};
+
+// An ELF symbol table entry. We use template specialization for the
+// 32-bit and 64-bit versions because the fields are in a different
+// order.
+
+template<int size>
+struct Sym_data;
+
+template<>
+struct Sym_data<32>
+{
+ Elf_Word st_name;
+ Elf_types<32>::Elf_Addr st_value;
+ Elf_Word st_size;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf_Half st_shndx;
+};
+
+template<>
+struct Sym_data<64>
+{
+ Elf_Word st_name;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf_Half st_shndx;
+ Elf_types<64>::Elf_Addr st_value;
+ Elf_Xword st_size;
+};
+
+// ELF relocation table entries.
+
+template<int size>
+struct Rel_data
+{
+ typename Elf_types<size>::Elf_Addr r_offset;
+ typename Elf_types<size>::Elf_WXword r_info;
+};
+
+template<int size>
+struct Rela_data
+{
+ typename Elf_types<size>::Elf_Addr r_offset;
+ typename Elf_types<size>::Elf_WXword r_info;
+ typename Elf_types<size>::Elf_Swxword r_addend;
+};
+
+// An entry in the ELF SHT_DYNAMIC section aka PT_DYNAMIC segment.
+
+template<int size>
+struct Dyn_data
+{
+ typename Elf_types<size>::Elf_Swxword d_tag;
+ typename Elf_types<size>::Elf_WXword d_val;
+};
+
+// An entry in a SHT_GNU_verdef section. This structure is the same
+// in 32-bit and 64-bit ELF files.
+
+struct Verdef_data
+{
+ // Version number of structure (VER_DEF_*).
+ Elf_Half vd_version;
+ // Bit flags (VER_FLG_*).
+ Elf_Half vd_flags;
+ // Version index.
+ Elf_Half vd_ndx;
+ // Number of auxiliary Verdaux entries.
+ Elf_Half vd_cnt;
+ // Hash of name.
+ Elf_Word vd_hash;
+ // Byte offset to first Verdaux entry.
+ Elf_Word vd_aux;
+ // Byte offset to next Verdef entry.
+ Elf_Word vd_next;
+};
+
+// An auxiliary entry in a SHT_GNU_verdef section. This structure is
+// the same in 32-bit and 64-bit ELF files.
+
+struct Verdaux_data
+{
+ // Offset in string table of version name.
+ Elf_Word vda_name;
+ // Byte offset to next Verdaux entry.
+ Elf_Word vda_next;
+};
+
+// An entry in a SHT_GNU_verneed section. This structure is the same
+// in 32-bit and 64-bit ELF files.
+
+struct Verneed_data
+{
+ // Version number of structure (VER_NEED_*).
+ Elf_Half vn_version;
+ // Number of auxiliary Vernaux entries.
+ Elf_Half vn_cnt;
+ // Offset in string table of library name.
+ Elf_Word vn_file;
+ // Byte offset to first Vernaux entry.
+ Elf_Word vn_aux;
+ // Byt eoffset to next Verneed entry.
+ Elf_Word vn_next;
+};
+
+// An auxiliary entry in a SHT_GNU_verneed section. This structure is
+// the same in 32-bit and 64-bit ELF files.
+
+struct Vernaux_data
+{
+ // Hash of dependency name.
+ Elf_Word vna_hash;
+ // Bit flags (VER_FLG_*).
+ Elf_Half vna_flags;
+ // Version index used in SHT_GNU_versym entries.
+ Elf_Half vna_other;
+ // Offset in string table of version name.
+ Elf_Word vna_name;
+ // Byte offset to next Vernaux entry.
+ Elf_Word vna_next;
+};
+
+} // End namespace internal.
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_INTERNAL_H)
diff --git a/binutils-2.25/elfcpp/elfcpp_swap.h b/binutils-2.25/elfcpp/elfcpp_swap.h
new file mode 100644
index 00000000..833da5da
--- /dev/null
+++ b/binutils-2.25/elfcpp/elfcpp_swap.h
@@ -0,0 +1,500 @@
+// elfcpp_swap.h -- Handle swapping for elfcpp -*- C++ -*-
+
+// Copyright 2006, 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+// This header file defines basic template classes to efficiently swap
+// numbers between host form and target form. When the host and
+// target have the same endianness, these turn into no-ops.
+
+#ifndef ELFCPP_SWAP_H
+#define ELFCPP_SWAP_H
+
+#include <stdint.h>
+
+// We need an autoconf-generated config.h file for endianness and
+// swapping. We check two macros: WORDS_BIGENDIAN and
+// HAVE_BYTESWAP_H.
+
+#include "config.h"
+
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#else
+// Provide our own versions of the byteswap functions.
+inline uint16_t
+bswap_16(uint16_t v)
+{
+ return ((v >> 8) & 0xff) | ((v & 0xff) << 8);
+}
+
+inline uint32_t
+bswap_32(uint32_t v)
+{
+ return ( ((v & 0xff000000) >> 24)
+ | ((v & 0x00ff0000) >> 8)
+ | ((v & 0x0000ff00) << 8)
+ | ((v & 0x000000ff) << 24));
+}
+
+inline uint64_t
+bswap_64(uint64_t v)
+{
+ return ( ((v & 0xff00000000000000ULL) >> 56)
+ | ((v & 0x00ff000000000000ULL) >> 40)
+ | ((v & 0x0000ff0000000000ULL) >> 24)
+ | ((v & 0x000000ff00000000ULL) >> 8)
+ | ((v & 0x00000000ff000000ULL) << 8)
+ | ((v & 0x0000000000ff0000ULL) << 24)
+ | ((v & 0x000000000000ff00ULL) << 40)
+ | ((v & 0x00000000000000ffULL) << 56));
+}
+#endif // !defined(HAVE_BYTESWAP_H)
+
+// gcc 4.3 and later provides __builtin_bswap32 and __builtin_bswap64.
+
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#undef bswap_32
+#define bswap_32 __builtin_bswap32
+#undef bswap_64
+#define bswap_64 __builtin_bswap64
+#endif
+
+namespace elfcpp
+{
+
+// Endian simply indicates whether the host is big endian or not.
+
+struct Endian
+{
+ public:
+ // Used for template specializations.
+ static const bool host_big_endian =
+#ifdef WORDS_BIGENDIAN
+ true
+#else
+ false
+#endif
+ ;
+};
+
+// Valtype_base is a template based on size (8, 16, 32, 64) which
+// defines the type Valtype as the unsigned integer, and
+// Signed_valtype as the signed integer, of the specified size.
+
+template<int size>
+struct Valtype_base;
+
+template<>
+struct Valtype_base<8>
+{
+ typedef uint8_t Valtype;
+ typedef int8_t Signed_valtype;
+};
+
+template<>
+struct Valtype_base<16>
+{
+ typedef uint16_t Valtype;
+ typedef int16_t Signed_valtype;
+};
+
+template<>
+struct Valtype_base<32>
+{
+ typedef uint32_t Valtype;
+ typedef int32_t Signed_valtype;
+};
+
+template<>
+struct Valtype_base<64>
+{
+ typedef uint64_t Valtype;
+ typedef int64_t Signed_valtype;
+};
+
+// Convert_endian is a template based on size and on whether the host
+// and target have the same endianness. It defines the type Valtype
+// as Valtype_base does, and also defines a function convert_host
+// which takes an argument of type Valtype and returns the same value,
+// but swapped if the host and target have different endianness.
+
+template<int size, bool same_endian>
+struct Convert_endian;
+
+template<int size>
+struct Convert_endian<size, true>
+{
+ typedef typename Valtype_base<size>::Valtype Valtype;
+
+ static inline Valtype
+ convert_host(Valtype v)
+ { return v; }
+};
+
+template<>
+struct Convert_endian<8, false>
+{
+ typedef Valtype_base<8>::Valtype Valtype;
+
+ static inline Valtype
+ convert_host(Valtype v)
+ { return v; }
+};
+
+template<>
+struct Convert_endian<16, false>
+{
+ typedef Valtype_base<16>::Valtype Valtype;
+
+ static inline Valtype
+ convert_host(Valtype v)
+ { return bswap_16(v); }
+};
+
+template<>
+struct Convert_endian<32, false>
+{
+ typedef Valtype_base<32>::Valtype Valtype;
+
+ static inline Valtype
+ convert_host(Valtype v)
+ { return bswap_32(v); }
+};
+
+template<>
+struct Convert_endian<64, false>
+{
+ typedef Valtype_base<64>::Valtype Valtype;
+
+ static inline Valtype
+ convert_host(Valtype v)
+ { return bswap_64(v); }
+};
+
+// Convert is a template based on size and on whether the target is
+// big endian. It defines Valtype and convert_host like
+// Convert_endian. That is, it is just like Convert_endian except in
+// the meaning of the second template parameter.
+
+template<int size, bool big_endian>
+struct Convert
+{
+ typedef typename Valtype_base<size>::Valtype Valtype;
+
+ static inline Valtype
+ convert_host(Valtype v)
+ {
+ return Convert_endian<size, big_endian == Endian::host_big_endian>
+ ::convert_host(v);
+ }
+};
+
+// Swap is a template based on size and on whether the target is big
+// endian. It defines the type Valtype and the functions readval and
+// writeval. The functions read and write values of the appropriate
+// size out of buffers, swapping them if necessary. readval and
+// writeval are overloaded to take pointers to the appropriate type or
+// pointers to unsigned char.
+
+template<int size, bool big_endian>
+struct Swap
+{
+ typedef typename Valtype_base<size>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const Valtype* wv)
+ { return Convert<size, big_endian>::convert_host(*wv); }
+
+ static inline void
+ writeval(Valtype* wv, Valtype v)
+ { *wv = Convert<size, big_endian>::convert_host(v); }
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ { return readval(reinterpret_cast<const Valtype*>(wv)); }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ { writeval(reinterpret_cast<Valtype*>(wv), v); }
+};
+
+// We need to specialize the 8-bit version of Swap to avoid
+// conflicting overloads, since both versions of readval and writeval
+// will have the same type parameters.
+
+template<bool big_endian>
+struct Swap<8, big_endian>
+{
+ typedef typename Valtype_base<8>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const Valtype* wv)
+ { return *wv; }
+
+ static inline void
+ writeval(Valtype* wv, Valtype v)
+ { *wv = v; }
+};
+
+// Swap_unaligned is a template based on size and on whether the
+// target is big endian. It defines the type Valtype and the
+// functions readval and writeval. The functions read and write
+// values of the appropriate size out of buffers which may be
+// misaligned.
+
+template<int size, bool big_endian>
+struct Swap_unaligned;
+
+template<bool big_endian>
+struct Swap_unaligned<8, big_endian>
+{
+ typedef typename Valtype_base<8>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ { return *wv; }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ { *wv = v; }
+};
+
+template<>
+struct Swap_unaligned<16, false>
+{
+ typedef Valtype_base<16>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return (wv[1] << 8) | wv[0];
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ wv[1] = v >> 8;
+ wv[0] = v;
+ }
+};
+
+template<>
+struct Swap_unaligned<16, true>
+{
+ typedef Valtype_base<16>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return (wv[0] << 8) | wv[1];
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ wv[0] = v >> 8;
+ wv[1] = v;
+ }
+};
+
+template<>
+struct Swap_unaligned<32, false>
+{
+ typedef Valtype_base<32>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return (wv[3] << 24) | (wv[2] << 16) | (wv[1] << 8) | wv[0];
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ wv[3] = v >> 24;
+ wv[2] = v >> 16;
+ wv[1] = v >> 8;
+ wv[0] = v;
+ }
+};
+
+template<>
+struct Swap_unaligned<32, true>
+{
+ typedef Valtype_base<32>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return (wv[0] << 24) | (wv[1] << 16) | (wv[2] << 8) | wv[3];
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ wv[0] = v >> 24;
+ wv[1] = v >> 16;
+ wv[2] = v >> 8;
+ wv[3] = v;
+ }
+};
+
+template<>
+struct Swap_unaligned<64, false>
+{
+ typedef Valtype_base<64>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return ((static_cast<Valtype>(wv[7]) << 56)
+ | (static_cast<Valtype>(wv[6]) << 48)
+ | (static_cast<Valtype>(wv[5]) << 40)
+ | (static_cast<Valtype>(wv[4]) << 32)
+ | (static_cast<Valtype>(wv[3]) << 24)
+ | (static_cast<Valtype>(wv[2]) << 16)
+ | (static_cast<Valtype>(wv[1]) << 8)
+ | static_cast<Valtype>(wv[0]));
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ wv[7] = v >> 56;
+ wv[6] = v >> 48;
+ wv[5] = v >> 40;
+ wv[4] = v >> 32;
+ wv[3] = v >> 24;
+ wv[2] = v >> 16;
+ wv[1] = v >> 8;
+ wv[0] = v;
+ }
+};
+
+template<>
+struct Swap_unaligned<64, true>
+{
+ typedef Valtype_base<64>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return ((static_cast<Valtype>(wv[0]) << 56)
+ | (static_cast<Valtype>(wv[1]) << 48)
+ | (static_cast<Valtype>(wv[2]) << 40)
+ | (static_cast<Valtype>(wv[3]) << 32)
+ | (static_cast<Valtype>(wv[4]) << 24)
+ | (static_cast<Valtype>(wv[5]) << 16)
+ | (static_cast<Valtype>(wv[6]) << 8)
+ | static_cast<Valtype>(wv[7]));
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ wv[0] = v >> 56;
+ wv[1] = v >> 48;
+ wv[2] = v >> 40;
+ wv[3] = v >> 32;
+ wv[4] = v >> 24;
+ wv[5] = v >> 16;
+ wv[6] = v >> 8;
+ wv[7] = v;
+ }
+};
+
+// Swap_aligned32 is a template based on size and on whether the
+// target is big endian. It defines the type Valtype and the
+// functions readval and writeval. The functions read and write
+// values of the appropriate size out of buffers which may not be
+// 64-bit aligned, but are 32-bit aligned.
+
+template<int size, bool big_endian>
+struct Swap_aligned32
+{
+ typedef typename Valtype_base<size>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ { return Swap<size, big_endian>::readval(
+ reinterpret_cast<const Valtype*>(wv)); }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ { Swap<size, big_endian>::writeval(reinterpret_cast<Valtype*>(wv), v); }
+};
+
+template<>
+struct Swap_aligned32<64, true>
+{
+ typedef Valtype_base<64>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return ((static_cast<Valtype>(Swap<32, true>::readval(wv)) << 32)
+ | static_cast<Valtype>(Swap<32, true>::readval(wv + 4)));
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ typedef Valtype_base<32>::Valtype Valtype32;
+
+ Swap<32, true>::writeval(wv, static_cast<Valtype32>(v >> 32));
+ Swap<32, true>::writeval(wv + 4, static_cast<Valtype32>(v));
+ }
+};
+
+template<>
+struct Swap_aligned32<64, false>
+{
+ typedef Valtype_base<64>::Valtype Valtype;
+
+ static inline Valtype
+ readval(const unsigned char* wv)
+ {
+ return ((static_cast<Valtype>(Swap<32, false>::readval(wv + 4)) << 32)
+ | static_cast<Valtype>(Swap<32, false>::readval(wv)));
+ }
+
+ static inline void
+ writeval(unsigned char* wv, Valtype v)
+ {
+ typedef Valtype_base<32>::Valtype Valtype32;
+
+ Swap<32, false>::writeval(wv + 4, static_cast<Valtype32>(v >> 32));
+ Swap<32, false>::writeval(wv, static_cast<Valtype32>(v));
+ }
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_SWAP_H)
diff --git a/binutils-2.25/elfcpp/i386.h b/binutils-2.25/elfcpp/i386.h
new file mode 100644
index 00000000..6903859f
--- /dev/null
+++ b/binutils-2.25/elfcpp/i386.h
@@ -0,0 +1,98 @@
+// i386.h -- ELF definitions specific to EM_386 -*- C++ -*-
+
+// Copyright 2006, 2007, 2010 Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_I386_H
+#define ELFCPP_I386_H
+
+// Documentation for the TLS relocs is taken from
+// http://people.redhat.com/drepper/tls.pdf
+// http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt
+
+namespace elfcpp
+{
+
+enum
+{
+ R_386_NONE = 0, // No reloc
+ R_386_32 = 1, // Direct 32 bit zero extended
+ R_386_PC32 = 2, // PC relative 32 bit signed
+ R_386_GOT32 = 3, // 32 bit GOT entry
+ R_386_PLT32 = 4, // 32 bit PLT address
+ R_386_COPY = 5, // Copy symbol at runtime
+ R_386_GLOB_DAT = 6, // Create GOT entry
+ R_386_JUMP_SLOT = 7, // Create PLT entry
+ R_386_RELATIVE = 8, // Adjust by program base
+ R_386_GOTOFF = 9, // 32-bit GOT offset
+ R_386_GOTPC = 10, // 32-bit PC relative offset to GOT
+ // Used by Sun.
+ R_386_32PLT = 11,
+ // TLS extensions.
+ R_386_TLS_TPOFF = 14, // Outstanding Initial Exec reloc, gnu-style (both)
+ R_386_TLS_IE = 15, // Initial Initial Exec reloc, gnu-style (no-PIC)
+ R_386_TLS_GOTIE = 16, // Initial Initial Exec reloc, gnu-style (for PIC)
+ R_386_TLS_LE = 17, // Initial Local Exec reloc, gnu-style
+ R_386_TLS_GD = 18, // Initial General Dynamic reloc, gnu-style
+ R_386_TLS_LDM = 19, // Initial Local Dynamic reloc, gnu-style
+ // GNU extensions.
+ R_386_16 = 20, // Direct 16 bit zero extended
+ R_386_PC16 = 21, // 16 bit sign extended pc relative
+ R_386_8 = 22, // Direct 8 bit sign extended
+ R_386_PC8 = 23, // 8 bit sign extended pc relative
+ // More TLS relocs.
+ R_386_TLS_GD_32 = 24, // Initial General Dynamic reloc, sun-style
+ R_386_TLS_GD_PUSH = 25, // Initial General Dynamic reloc, sun-style
+ R_386_TLS_GD_CALL = 26, // Initial General Dynamic reloc, sun-style
+ R_386_TLS_GD_POP = 27, // Initial General Dynamic reloc, sun-style
+ R_386_TLS_LDM_32 = 28, // Initial Local Dynamic reloc, sun-style
+ R_386_TLS_LDM_PUSH = 29, // Initial Local Dynamic reloc, sun-style
+ R_386_TLS_LDM_CALL = 30, // Initial Local Dynamic reloc, sun-style
+ R_386_TLS_LDM_POP = 31, // Initial Local Dynamic reloc, sun-style
+ R_386_TLS_LDO_32 = 32, // Initial Local Dynamic reloc, sun+gnu styles
+ R_386_TLS_IE_32 = 33, // Initial Initial Exec reloc, sun-style
+ R_386_TLS_LE_32 = 34, // Initial Local Exec reloc, sun-style
+ R_386_TLS_DTPMOD32 = 35, // Outstanding General/Local Dynamic reloc, sun+gnu
+ R_386_TLS_DTPOFF32 = 36, // Outstanding General Dynamic reloc, sun+gnu
+ R_386_TLS_TPOFF32 = 37, // Outstanding Initial Exec reloc, sun-style
+ R_386_TLS_GOTDESC = 39, // GOT offset for TLS descriptor
+ R_386_TLS_DESC_CALL = 40, // Marker of call through TLS desc for relaxation
+ R_386_TLS_DESC = 41, // TLS descriptor containing pointer to code and
+ // to argument, returning TLS offset for symbol
+ R_386_IRELATIVE = 42, // Adjust indirectly by program base
+ // Used by Intel.
+ R_386_USED_BY_INTEL_200 = 200,
+ // GNU vtable garbage collection extensions.
+ R_386_GNU_VTINHERIT = 250,
+ R_386_GNU_VTENTRY = 251
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_I386_H)
diff --git a/binutils-2.25/elfcpp/mips.h b/binutils-2.25/elfcpp/mips.h
new file mode 100644
index 00000000..8c2d8f45
--- /dev/null
+++ b/binutils-2.25/elfcpp/mips.h
@@ -0,0 +1,267 @@
+// mips.h -- ELF definitions specific to EM_MIPS -*- C++ -*-
+
+// Copyright 2012 Free Software Foundation, Inc.
+// Written by Aleksandar Simeonov <aleksandar.simeonov@rt-rk.com>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_MIPS_H
+#define ELFCPP_MIPS_H
+
+// Documentation for the MIPS relocs is taken from
+// http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf
+
+namespace elfcpp
+{
+
+//
+// MIPS Relocation Codes
+//
+
+enum
+{
+ R_MIPS_NONE = 0,
+ R_MIPS_16 = 1,
+ R_MIPS_32 = 2,
+ R_MIPS_REL32 = 3,
+ R_MIPS_26 = 4,
+ R_MIPS_HI16 = 5,
+ R_MIPS_LO16 = 6,
+ R_MIPS_GPREL16 = 7,
+ R_MIPS_LITERAL = 8,
+ R_MIPS_GOT16 = 9,
+ R_MIPS_PC16 = 10,
+ R_MIPS_CALL16 = 11,
+ R_MIPS_GPREL32 = 12,
+ R_MIPS_UNUSED1 = 13,
+ R_MIPS_UNUSED2 = 14,
+ R_MIPS_UNUSED3 = 15,
+ R_MIPS_SHIFT5 = 16,
+ R_MIPS_SHIFT6 = 17,
+ R_MIPS_64 = 18,
+ R_MIPS_GOT_DISP = 19,
+ R_MIPS_GOT_PAGE = 20,
+ R_MIPS_GOT_OFST = 21,
+ R_MIPS_GOT_HI16 = 22,
+ R_MIPS_GOT_LO16 = 23,
+ R_MIPS_SUB = 24,
+ R_MIPS_INSERT_A = 25, // Empty relocation
+ R_MIPS_INSERT_B = 26, // Empty relocation
+ R_MIPS_DELETE = 27, // Empty relocation
+ R_MIPS_HIGHER = 28,
+ R_MIPS_HIGHEST = 29,
+ R_MIPS_CALL_HI16 = 30,
+ R_MIPS_CALL_LO16 = 31,
+ R_MIPS_SCN_DISP = 32,
+ R_MIPS_REL16 = 33, // Empty relocation
+ R_MIPS_ADD_IMMEDIATE = 34, // Empty relocation
+ R_MIPS_PJUMP = 35, // Empty relocation
+ R_MIPS_RELGOT = 36, // Empty relocation
+ R_MIPS_JALR = 37,
+ R_MIPS_TLS_DTPMOD32 = 38,
+ R_MIPS_TLS_DTPREL32 = 39,
+ R_MIPS_TLS_DTPMOD64 = 40, // Empty relocation
+ R_MIPS_TLS_DTPREL64 = 41, // Empty relocation
+ R_MIPS_TLS_GD = 42,
+ R_MIPS_TLS_LDM = 43,
+ R_MIPS_TLS_DTPREL_HI16 = 44,
+ R_MIPS_TLS_DTPREL_LO16 = 45,
+ R_MIPS_TLS_GOTTPREL = 46,
+ R_MIPS_TLS_TPREL32 = 47,
+ R_MIPS_TLS_TPREL64 = 48, // Empty relocation
+ R_MIPS_TLS_TPREL_HI16 = 49,
+ R_MIPS_TLS_TPREL_LO16 = 50,
+ R_MIPS_GLOB_DAT = 51,
+ R_MIPS16_26 = 100,
+ R_MIPS16_GPREL = 101,
+ R_MIPS16_GOT16 = 102,
+ R_MIPS16_CALL16 = 103,
+ R_MIPS16_HI16 = 104,
+ R_MIPS16_LO16 = 105,
+ R_MIPS_COPY = 126,
+ R_MIPS_JUMP_SLOT = 127,
+ R_MIPS_PC32 = 248,
+ R_MIPS_GNU_REL16_S2 = 250,
+ R_MIPS_GNU_VTINHERIT = 253,
+ R_MIPS_GNU_VTENTRY = 254
+};
+
+// Processor specific flags for the ELF header e_flags field. */
+enum
+{
+ // At least one .noreorder directive appears in the source.
+ EF_MIPS_NOREORDER = 0x00000001,
+ // File contains position independent code.
+ EF_MIPS_PIC = 0x00000002,
+ // Code in file uses the standard calling sequence for calling
+ // position independent code.
+ EF_MIPS_CPIC = 0x00000004,
+ // ??? Unknown flag, set in IRIX 6's BSDdup2.o in libbsd.a.
+ EF_MIPS_XGOT = 0x00000008,
+ // Code in file uses UCODE (obsolete)
+ EF_MIPS_UCODE = 0x00000010,
+ // Code in file uses new ABI (-n32 on Irix 6).
+ EF_MIPS_ABI2 = 0x00000020,
+ // Process the .MIPS.options section first by ld
+ EF_MIPS_OPTIONS_FIRST = 0x00000080,
+ // Architectural Extensions used by this file
+ EF_MIPS_ARCH_ASE = 0x0f000000,
+ // Use MDMX multimedia extensions
+ EF_MIPS_ARCH_ASE_MDMX = 0x08000000,
+ // Use MIPS-16 ISA extensions
+ EF_MIPS_ARCH_ASE_M16 = 0x04000000,
+ // Use MICROMIPS ISA extensions.
+ EF_MIPS_ARCH_ASE_MICROMIPS = 0x02000000,
+ // Indicates code compiled for a 64-bit machine in 32-bit mode.
+ // (regs are 32-bits wide.)
+ EF_MIPS_32BITMODE = 0x00000100,
+ // MIPS dynamic
+ EF_MIPS_DYNAMIC = 0x40
+};
+
+// Machine variant if we know it. This field was invented at Cygnus,
+// but it is hoped that other vendors will adopt it. If some standard
+// is developed, this code should be changed to follow it.
+enum
+{
+ EF_MIPS_MACH = 0x00FF0000,
+
+// Cygnus is choosing values between 80 and 9F;
+// 00 - 7F should be left for a future standard;
+// the rest are open.
+
+ E_MIPS_MACH_3900 = 0x00810000,
+ E_MIPS_MACH_4010 = 0x00820000,
+ E_MIPS_MACH_4100 = 0x00830000,
+ E_MIPS_MACH_4650 = 0x00850000,
+ E_MIPS_MACH_4120 = 0x00870000,
+ E_MIPS_MACH_4111 = 0x00880000,
+ E_MIPS_MACH_SB1 = 0x008a0000,
+ E_MIPS_MACH_OCTEON = 0x008b0000,
+ E_MIPS_MACH_XLR = 0x008c0000,
+ E_MIPS_MACH_OCTEON2 = 0x008d0000,
+ E_MIPS_MACH_5400 = 0x00910000,
+ E_MIPS_MACH_5500 = 0x00980000,
+ E_MIPS_MACH_9000 = 0x00990000,
+ E_MIPS_MACH_LS2E = 0x00A00000,
+ E_MIPS_MACH_LS2F = 0x00A10000,
+ E_MIPS_MACH_LS3A = 0x00A20000,
+};
+
+// MIPS architecture
+enum
+{
+ // Four bit MIPS architecture field.
+ EF_MIPS_ARCH = 0xf0000000,
+ // -mips1 code.
+ E_MIPS_ARCH_1 = 0x00000000,
+ // -mips2 code.
+ E_MIPS_ARCH_2 = 0x10000000,
+ // -mips3 code.
+ E_MIPS_ARCH_3 = 0x20000000,
+ // -mips4 code.
+ E_MIPS_ARCH_4 = 0x30000000,
+ // -mips5 code.
+ E_MIPS_ARCH_5 = 0x40000000,
+ // -mips32 code.
+ E_MIPS_ARCH_32 = 0x50000000,
+ // -mips64 code.
+ E_MIPS_ARCH_64 = 0x60000000,
+ // -mips32r2 code.
+ E_MIPS_ARCH_32R2 = 0x70000000,
+ // -mips64r2 code.
+ E_MIPS_ARCH_64R2 = 0x80000000,
+};
+
+enum
+{
+ // Mask to extract ABI version, not really a flag value.
+ EF_MIPS_ABI = 0x0000F000,
+
+ // The original o32 abi.
+ E_MIPS_ABI_O32 = 0x00001000,
+ // O32 extended to work on 64 bit architectures
+ E_MIPS_ABI_O64 = 0x00002000,
+ // EABI in 32 bit mode
+ E_MIPS_ABI_EABI32 = 0x00003000,
+ // EABI in 64 bit mode
+ E_MIPS_ABI_EABI64 = 0x00004000,
+};
+
+// Dynamic section MIPS flags
+enum
+{
+ // None
+ RHF_NONE = 0x00000000,
+ // Use shortcut pointers
+ RHF_QUICKSTART = 0x00000001,
+ // Hash size not power of two
+ RHF_NOTPOT = 0x00000002,
+ // Ignore LD_LIBRARY_PATH
+ RHF_NO_LIBRARY_REPLACEMENT = 0x00000004
+};
+
+// Special values for the st_other field in the symbol table.
+enum
+{
+ // Two topmost bits denote the MIPS ISA for .text symbols:
+ // + 00 -- standard MIPS code,
+ // + 10 -- microMIPS code,
+ // + 11 -- MIPS16 code; requires the following two bits to be set too.
+ // Note that one of the MIPS16 bits overlaps with STO_MIPS_PIC.
+ STO_MIPS_ISA = 0xc0,
+
+ // The MIPS psABI was updated in 2008 with support for PLTs and copy
+ // relocs. There are therefore two types of nonzero SHN_UNDEF functions:
+ // PLT entries and traditional MIPS lazy binding stubs. We mark the former
+ // with STO_MIPS_PLT to distinguish them from the latter.
+ STO_MIPS_PLT = 0x8,
+
+ // This value is used to mark PIC functions in an object that mixes
+ // PIC and non-PIC. Note that this bit overlaps with STO_MIPS16,
+ // although MIPS16 symbols are never considered to be MIPS_PIC.
+ STO_MIPS_PIC = 0x20,
+
+ // This value is used for a mips16 .text symbol.
+ STO_MIPS16 = 0xf0,
+
+ // This value is used for a microMIPS .text symbol. To distinguish from
+ // STO_MIPS16, we set top two bits to be 10 to denote STO_MICROMIPS. The
+ // mask is STO_MIPS_ISA.
+ STO_MICROMIPS = 0x80
+};
+
+// Values for base offsets for thread-local storage
+enum
+{
+ TP_OFFSET = 0x7000,
+ DTP_OFFSET = 0x8000
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_MIPS_H)
diff --git a/binutils-2.25/elfcpp/powerpc.h b/binutils-2.25/elfcpp/powerpc.h
new file mode 100644
index 00000000..2c803af9
--- /dev/null
+++ b/binutils-2.25/elfcpp/powerpc.h
@@ -0,0 +1,213 @@
+// powerpc.h -- ELF definitions specific to EM_PPC and EM_PPC64 -*- C++ -*-
+
+// Copyright 2008, 2010, 2012 Free Software Foundation, Inc.
+// Written by David S. Miller <davem@davemloft.net>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_POWERPC_H
+#define ELFCPP_POWERPC_H
+
+namespace elfcpp
+{
+
+// The relocation numbers for 32-bit and 64-bit powerpc are nearly
+// identical. Therefore I've adopted the convention of using
+// R_POWERPC_foo for values which are the same in R_PPC_* and R_PPC64_*.
+// For relocations which are specific to the word size I will use
+// R_PPC_foo or R_PPC64_foo.
+enum
+{
+ R_POWERPC_NONE = 0,
+ R_POWERPC_ADDR32 = 1,
+ R_POWERPC_ADDR24 = 2,
+ R_POWERPC_ADDR16 = 3,
+ R_POWERPC_ADDR16_LO = 4,
+ R_POWERPC_ADDR16_HI = 5,
+ R_POWERPC_ADDR16_HA = 6,
+ R_POWERPC_ADDR14 = 7,
+ R_POWERPC_ADDR14_BRTAKEN = 8,
+ R_POWERPC_ADDR14_BRNTAKEN = 9,
+ R_POWERPC_REL24 = 10,
+ R_POWERPC_REL14 = 11,
+ R_POWERPC_REL14_BRTAKEN = 12,
+ R_POWERPC_REL14_BRNTAKEN = 13,
+ R_POWERPC_GOT16 = 14,
+ R_POWERPC_GOT16_LO = 15,
+ R_POWERPC_GOT16_HI = 16,
+ R_POWERPC_GOT16_HA = 17,
+ R_PPC_PLTREL24 = 18,
+ R_POWERPC_COPY = 19,
+ R_POWERPC_GLOB_DAT = 20,
+ R_POWERPC_JMP_SLOT = 21,
+ R_POWERPC_RELATIVE = 22,
+ R_PPC_LOCAL24PC = 23,
+ R_POWERPC_UADDR32 = 24,
+ R_POWERPC_UADDR16 = 25,
+ R_POWERPC_REL32 = 26,
+ R_POWERPC_PLT32 = 27,
+ R_POWERPC_PLTREL32 = 28,
+ R_POWERPC_PLT16_LO = 29,
+ R_POWERPC_PLT16_HI = 30,
+ R_POWERPC_PLT16_HA = 31,
+ R_PPC_SDAREL16 = 32,
+ R_POWERPC_SECTOFF = 33,
+ R_POWERPC_SECTOFF_LO = 34,
+ R_POWERPC_SECTOFF_HI = 35,
+ R_POWERPC_SECTOFF_HA = 36,
+ R_POWERPC_ADDR30 = 37,
+ R_PPC64_ADDR64 = 38,
+ R_PPC64_ADDR16_HIGHER = 39,
+ R_PPC64_ADDR16_HIGHERA = 40,
+ R_PPC64_ADDR16_HIGHEST = 41,
+ R_PPC64_ADDR16_HIGHESTA = 42,
+ R_PPC64_UADDR64 = 43,
+ R_PPC64_REL64 = 44,
+ R_PPC64_PLT64 = 45,
+ R_PPC64_PLTREL64 = 46,
+ R_PPC64_TOC16 = 47,
+ R_PPC64_TOC16_LO = 48,
+ R_PPC64_TOC16_HI = 49,
+ R_PPC64_TOC16_HA = 50,
+ R_PPC64_TOC = 51,
+ R_PPC64_PLTGOT16 = 52,
+ R_PPC64_PLTGOT16_LO = 53,
+ R_PPC64_PLTGOT16_HI = 54,
+ R_PPC64_PLTGOT16_HA = 55,
+ R_PPC64_ADDR16_DS = 56,
+ R_PPC64_ADDR16_LO_DS = 57,
+ R_PPC64_GOT16_DS = 58,
+ R_PPC64_GOT16_LO_DS = 59,
+ R_PPC64_PLT16_LO_DS = 60,
+ R_PPC64_SECTOFF_DS = 61,
+ R_PPC64_SECTOFF_LO_DS = 62,
+ R_PPC64_TOC16_DS = 63,
+ R_PPC64_TOC16_LO_DS = 64,
+ R_PPC64_PLTGOT16_DS = 65,
+ R_PPC64_PLTGOT16_LO_DS = 66,
+ R_POWERPC_TLS = 67,
+ R_POWERPC_DTPMOD = 68,
+ R_POWERPC_TPREL16 = 69,
+ R_POWERPC_TPREL16_LO = 70,
+ R_POWERPC_TPREL16_HI = 71,
+ R_POWERPC_TPREL16_HA = 72,
+ R_POWERPC_TPREL = 73,
+ R_POWERPC_DTPREL16 = 74,
+ R_POWERPC_DTPREL16_LO = 75,
+ R_POWERPC_DTPREL16_HI = 76,
+ R_POWERPC_DTPREL16_HA = 77,
+ R_POWERPC_DTPREL = 78,
+ R_POWERPC_GOT_TLSGD16 = 79,
+ R_POWERPC_GOT_TLSGD16_LO = 80,
+ R_POWERPC_GOT_TLSGD16_HI = 81,
+ R_POWERPC_GOT_TLSGD16_HA = 82,
+ R_POWERPC_GOT_TLSLD16 = 83,
+ R_POWERPC_GOT_TLSLD16_LO = 84,
+ R_POWERPC_GOT_TLSLD16_HI = 85,
+ R_POWERPC_GOT_TLSLD16_HA = 86,
+ R_POWERPC_GOT_TPREL16 = 87,
+ R_POWERPC_GOT_TPREL16_LO = 88,
+ R_POWERPC_GOT_TPREL16_HI = 89,
+ R_POWERPC_GOT_TPREL16_HA = 90,
+ R_POWERPC_GOT_DTPREL16 = 91,
+ R_POWERPC_GOT_DTPREL16_LO = 92,
+ R_POWERPC_GOT_DTPREL16_HI = 93,
+ R_POWERPC_GOT_DTPREL16_HA = 94,
+ R_PPC_TLSGD = 95,
+ R_PPC64_TPREL16_DS = 95,
+ R_PPC_TLSLD = 96,
+ R_PPC64_TPREL16_LO_DS = 96,
+ R_PPC64_TPREL16_HIGHER = 97,
+ R_PPC64_TPREL16_HIGHERA = 98,
+ R_PPC64_TPREL16_HIGHEST = 99,
+ R_PPC64_TPREL16_HIGHESTA = 100,
+ R_PPC_EMB_NADDR32 = 101,
+ R_PPC64_DTPREL16_DS = 101,
+ R_PPC_EMB_NADDR16 = 102,
+ R_PPC64_DTPREL16_LO_DS = 102,
+ R_PPC_EMB_NADDR16_LO = 103,
+ R_PPC64_DTPREL16_HIGHER = 103,
+ R_PPC_EMB_NADDR16_HI = 104,
+ R_PPC64_DTPREL16_HIGHERA = 104,
+ R_PPC_EMB_NADDR16_HA = 105,
+ R_PPC64_DTPREL16_HIGHEST = 105,
+ R_PPC_EMB_SDAI16 = 106,
+ R_PPC64_DTPREL16_HIGHESTA = 106,
+ R_PPC_EMB_SDA2I16 = 107,
+ R_PPC64_TLSGD = 107,
+ R_PPC_EMB_SDA2REL = 108,
+ R_PPC64_TLSLD = 108,
+ R_PPC_EMB_SDA21 = 109,
+ R_PPC64_TOCSAVE = 109,
+ R_PPC_EMB_MRKREF = 110,
+ R_PPC_EMB_RELSEC16 = 111,
+ R_PPC_EMB_RELST_LO = 112,
+ R_PPC_EMB_RELST_HI = 113,
+ R_PPC_EMB_RELST_HA = 114,
+ R_PPC_EMB_BIT_FLD = 115,
+ R_PPC_EMB_RELSDA = 116,
+
+ R_PPC_VLE_REL8 = 216,
+ R_PPC_VLE_REL15 = 217,
+ R_PPC_VLE_REL24 = 218,
+ R_PPC_VLE_LO16A = 219,
+ R_PPC_VLE_LO16D = 220,
+ R_PPC_VLE_HI16A = 221,
+ R_PPC_VLE_HI16D = 222,
+ R_PPC_VLE_HA16A = 223,
+ R_PPC_VLE_HA16D = 224,
+ R_PPC_VLE_SDA21 = 225,
+ R_PPC_VLE_SDA21_LO = 226,
+ R_PPC_VLE_SDAREL_LO16A = 227,
+ R_PPC_VLE_SDAREL_LO16D = 228,
+ R_PPC_VLE_SDAREL_HI16A = 229,
+ R_PPC_VLE_SDAREL_HI16D = 230,
+ R_PPC_VLE_SDAREL_HA16A = 231,
+ R_PPC_VLE_SDAREL_HA16D = 232,
+
+ R_PPC64_JMP_IREL = 247,
+ R_POWERPC_IRELATIVE = 248,
+ R_POWERPC_REL16 = 249,
+ R_POWERPC_REL16_LO = 250,
+ R_POWERPC_REL16_HI = 251,
+ R_POWERPC_REL16_HA = 252,
+ R_POWERPC_GNU_VTINHERIT = 253,
+ R_POWERPC_GNU_VTENTRY = 254,
+ R_PPC_TOC16 = 255,
+};
+
+// e_flags values defined for powerpc
+enum
+{
+ EF_PPC_EMB = 0x80000000, // PowerPC embedded flag.
+ EF_PPC_RELOCATABLE = 0x00010000, // PowerPC -mrelocatable flag. */
+ EF_PPC_RELOCATABLE_LIB = 0x00008000, // PowerPC -mrelocatable-lib flag. */
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_POWERPC_H)
diff --git a/binutils-2.25/elfcpp/sparc.h b/binutils-2.25/elfcpp/sparc.h
new file mode 100644
index 00000000..6b561be2
--- /dev/null
+++ b/binutils-2.25/elfcpp/sparc.h
@@ -0,0 +1,173 @@
+// sparc.h -- ELF definitions specific to EM_SPARC -*- C++ -*-
+
+// Copyright 2008, 2010 Free Software Foundation, Inc.
+// Written by David S. Miller <davem@davemloft.net>.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_SPARC_H
+#define ELFCPP_SPARC_H
+
+// Documentation for the TLS relocs is taken from
+// http://people.redhat.com/drepper/tls.pdf
+//
+// More full documentation on sparc specific ELF file
+// format details can be found at
+//
+// http://docs.sun.com/app/docs/doc/819/0690/
+// "Linker and Libraries Guide"
+//
+// specifically Chapter 7 "Object File Format" and
+// Chapter 8 "Thread-Local Storage"
+
+namespace elfcpp
+{
+
+enum
+{
+ R_SPARC_NONE = 0, // No reloc
+ R_SPARC_8 = 1, // Direct 8 bit
+ R_SPARC_16 = 2, // Direct 16 bit
+ R_SPARC_32 = 3, // Direct 32 bit
+ R_SPARC_DISP8 = 4, // PC relative 8 bit
+ R_SPARC_DISP16 = 5, // PC relative 16 bit
+ R_SPARC_DISP32 = 6, // PC relative 32 bit
+ R_SPARC_WDISP30 = 7, // PC relative 30 bit shifted
+ R_SPARC_WDISP22 = 8, // PC relative 22 bit shifted
+ R_SPARC_HI22 = 9, // High 22 bit
+ R_SPARC_22 = 10, // Direct 22 bit
+ R_SPARC_13 = 11, // Direct 13 bit
+ R_SPARC_LO10 = 12, // Truncated 10 bit
+ R_SPARC_GOT10 = 13, // Truncated 10 bit GOT entry
+ R_SPARC_GOT13 = 14, // 13 bit GOT entry
+ R_SPARC_GOT22 = 15, // 22 bit GOT entry shifted
+ R_SPARC_PC10 = 16, // PC relative 10 bit truncated
+ R_SPARC_PC22 = 17, // PC relative 22 bit shifted
+ R_SPARC_WPLT30 = 18, // 30 bit PC relative PLT address
+ R_SPARC_COPY = 19, // Copy symbol at runtime
+ R_SPARC_GLOB_DAT = 20, // Create GOT entry
+ R_SPARC_JMP_SLOT = 21, // Create PLT entry
+ R_SPARC_RELATIVE = 22, // Adjust by program base
+ R_SPARC_UA32 = 23, // Direct 32 bit unaligned
+ R_SPARC_PLT32 = 24, // Direct 32 bit ref to PLT entry
+ R_SPARC_HIPLT22 = 25, // High 22 bit PLT entry
+ R_SPARC_LOPLT10 = 26, // Truncated 10 bit PLT entry
+ R_SPARC_PCPLT32 = 27, // PC rel 32 bit ref to PLT entry
+ R_SPARC_PCPLT22 = 28, // PC rel high 22 bit PLT entry
+ R_SPARC_PCPLT10 = 29, // PC rel trunc 10 bit PLT entry
+ R_SPARC_10 = 30, // Direct 10 bit
+ R_SPARC_11 = 31, // Direct 11 bit
+ R_SPARC_64 = 32, // Direct 64 bit
+ R_SPARC_OLO10 = 33, // 10bit with secondary 13bit addend
+ R_SPARC_HH22 = 34, // Top 22 bits of direct 64 bit
+ R_SPARC_HM10 = 35, // High middle 10 bits of ...
+ R_SPARC_LM22 = 36, // Low middle 22 bits of ...
+ R_SPARC_PC_HH22 = 37, // Top 22 bits of pc rel 64 bit
+ R_SPARC_PC_HM10 = 38, // High middle 10 bit of ...
+ R_SPARC_PC_LM22 = 39, // Low miggle 22 bits of ...
+ R_SPARC_WDISP16 = 40, // PC relative 16 bit shifted
+ R_SPARC_WDISP19 = 41, // PC relative 19 bit shifted
+ R_SPARC_GLOB_JMP = 42, // was part of v9 ABI but was removed
+ R_SPARC_7 = 43, // Direct 7 bit
+ R_SPARC_5 = 44, // Direct 5 bit
+ R_SPARC_6 = 45, // Direct 6 bit
+ R_SPARC_DISP64 = 46, // PC relative 64 bit
+ R_SPARC_PLT64 = 47, // Direct 64 bit ref to PLT entry
+ R_SPARC_HIX22 = 48, // High 22 bit complemented
+ R_SPARC_LOX10 = 49, // Truncated 11 bit complemented
+ R_SPARC_H44 = 50, // Direct high 12 of 44 bit
+ R_SPARC_M44 = 51, // Direct mid 22 of 44 bit
+ R_SPARC_L44 = 52, // Direct low 10 of 44 bit
+ R_SPARC_REGISTER = 53, // Global register usage
+ R_SPARC_UA64 = 54, // Direct 64 bit unaligned
+ R_SPARC_UA16 = 55, // Direct 16 bit unaligned
+ R_SPARC_TLS_GD_HI22 = 56, // Initial General Dynamic reloc, high 22-bit
+ R_SPARC_TLS_GD_LO10 = 57, // Initial General Dynamic reloc, low 10-bit
+ R_SPARC_TLS_GD_ADD = 58, // Initial General Dynamic reloc, add
+ R_SPARC_TLS_GD_CALL = 59, // Initial General Dynamic reloc, call
+ R_SPARC_TLS_LDM_HI22 = 60, // Initial Local Dynamic reloc, high 22-bit
+ R_SPARC_TLS_LDM_LO10 = 61, // Initial Local Dynamic reloc, low 10-bit
+ R_SPARC_TLS_LDM_ADD = 62, // Initial Local Dynamic reloc, add
+ R_SPARC_TLS_LDM_CALL = 63, // Initial Local Dynamic reloc, call
+ R_SPARC_TLS_LDO_HIX22 = 64, // Initial Local Dynamic, high extended 22-bit
+ R_SPARC_TLS_LDO_LOX10 = 65, // Initial Local Dynamic, low extended 10-bit
+ R_SPARC_TLS_LDO_ADD = 66, // Initial Local Dynamic, add extended
+ R_SPARC_TLS_IE_HI22 = 67, // Initial Initial Exec reloc, high 22-bit
+ R_SPARC_TLS_IE_LO10 = 68, // Initial Initial Exec reloc, low 10-bit
+ R_SPARC_TLS_IE_LD = 69, // Initial Initial Exec reloc, load 32-bit
+ R_SPARC_TLS_IE_LDX = 70, // Initial Initial Exec reloc, load 64-bit
+ R_SPARC_TLS_IE_ADD = 71, // Initial Initial Exec reloc, add
+ R_SPARC_TLS_LE_HIX22 = 72, // Initial Local Exec reloc, high extended 22-bit
+ R_SPARC_TLS_LE_LOX10 = 73, // Initial Local Exec reloc, low extended 10-bit
+ R_SPARC_TLS_DTPMOD32 = 74, // Outstanding General/Local Dynamic reloc, 32-bit
+ R_SPARC_TLS_DTPMOD64 = 75, // Outstanding General/Local Dynamic reloc, 64-bit
+ R_SPARC_TLS_DTPOFF32 = 76, // Outstanding General Dynamic reloc, 32-bit
+ R_SPARC_TLS_DTPOFF64 = 77, // Outstanding General Dynamic reloc, 64-bit
+ R_SPARC_TLS_TPOFF32 = 78, // Outstanding Initial Exec reloc, 32-bit
+ R_SPARC_TLS_TPOFF64 = 79, // Outstanding Initial Exec reloc, 64-bit
+
+ // GOT data code transformations
+ R_SPARC_GOTDATA_HIX22 = 80,
+ R_SPARC_GOTDATA_LOX10 = 81,
+ R_SPARC_GOTDATA_OP_HIX22 = 82,
+ R_SPARC_GOTDATA_OP_LOX10 = 83,
+ R_SPARC_GOTDATA_OP = 84,
+
+ R_SPARC_H34 = 85, // Direct high 12 of 34 bit
+ R_SPARC_SIZE32 = 86, // size of symbol, 32-bit
+ R_SPARC_SIZE64 = 87, // size of symbol, 64-bit
+ R_SPARC_WDISP10 = 88, // PC relative 10 bit shifted
+
+ R_SPARC_JMP_IREL = 248, // Create PLT slot to IFUNC function
+ R_SPARC_IRELATIVE = 249, // Adjust indirectly by program base
+
+ // GNU vtable garbage collection extensions.
+ R_SPARC_GNU_VTINHERIT = 250,
+ R_SPARC_GNU_VTENTRY = 251,
+
+ R_SPARC_REV32 = 252,
+};
+
+// e_flags values defined for sparc
+enum
+{
+ EF_SPARC_EXT_MASK = 0xffff00, // reserved for vendor extensions
+ EF_SPARC_32PLUS_MASK = 0xffff00, // bits indicating V8+ type
+ EF_SPARC_32PLUS = 0x000100, // generic V8+ features
+ EF_SPARC_SUN_US1 = 0x000200, // Sun UltraSPARC-I extensions
+ EF_SPARC_HAL_R1 = 0x000400, // HAL R1 extensions
+ EF_SPARC_SUN_US3 = 0x000800, // Sun UltraSPARC-III extensions
+ EF_SPARC_LEDATA = 0x800000, // little endian data
+ EF_SPARCV9_MM = 0x3, // memory model mask
+ EF_SPARCV9_TSO = 0x0, // total store ordering
+ EF_SPARCV9_PSO = 0x1, // partial store ordering
+ EF_SPARCV9_RMO = 0x2, // relaxed store ordering
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_SPARC_H)
diff --git a/binutils-2.25/elfcpp/tilegx.h b/binutils-2.25/elfcpp/tilegx.h
new file mode 100644
index 00000000..fd80bcbc
--- /dev/null
+++ b/binutils-2.25/elfcpp/tilegx.h
@@ -0,0 +1,171 @@
+// tilegx.h -- ELF definitions specific to EM_TILEGX -*- C++ -*-
+
+// Copyright 2012 Free Software Foundation, Inc.
+// Written by Jiong Wang (jiwang@tilera.com)
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_TILEGX_H
+#define ELFCPP_TILEGX_H
+
+namespace elfcpp
+{
+
+// Documentation is taken from
+// http://www.tilera.com/scm/docs/index.html
+
+enum
+{
+ R_TILEGX_NONE = 0,
+ R_TILEGX_64 = 1,
+ R_TILEGX_32 = 2,
+ R_TILEGX_16 = 3,
+ R_TILEGX_8 = 4,
+ R_TILEGX_64_PCREL = 5,
+ R_TILEGX_32_PCREL = 6,
+ R_TILEGX_16_PCREL = 7,
+ R_TILEGX_8_PCREL = 8,
+ R_TILEGX_HW0 = 9,
+ R_TILEGX_HW1 = 10,
+ R_TILEGX_HW2 = 11,
+ R_TILEGX_HW3 = 12,
+ R_TILEGX_HW0_LAST = 13,
+ R_TILEGX_HW1_LAST = 14,
+ R_TILEGX_HW2_LAST = 15,
+ R_TILEGX_COPY = 16,
+ R_TILEGX_GLOB_DAT = 17,
+ R_TILEGX_JMP_SLOT = 18,
+ R_TILEGX_RELATIVE = 19,
+ R_TILEGX_BROFF_X1 = 20,
+ R_TILEGX_JUMPOFF_X1 = 21,
+ R_TILEGX_JUMPOFF_X1_PLT = 22,
+ R_TILEGX_IMM8_X0 = 23,
+ R_TILEGX_IMM8_Y0 = 24,
+ R_TILEGX_IMM8_X1 = 25,
+ R_TILEGX_IMM8_Y1 = 26,
+ R_TILEGX_DEST_IMM8_X1 = 27,
+ R_TILEGX_MT_IMM14_X1 = 28,
+ R_TILEGX_MF_IMM14_X1 = 29,
+ R_TILEGX_MMSTART_X0 = 30,
+ R_TILEGX_MMEND_X0 = 31,
+ R_TILEGX_SHAMT_X0 = 32,
+ R_TILEGX_SHAMT_X1 = 33,
+ R_TILEGX_SHAMT_Y0 = 34,
+ R_TILEGX_SHAMT_Y1 = 35,
+ R_TILEGX_IMM16_X0_HW0 = 36,
+ R_TILEGX_IMM16_X1_HW0 = 37,
+ R_TILEGX_IMM16_X0_HW1 = 38,
+ R_TILEGX_IMM16_X1_HW1 = 39,
+ R_TILEGX_IMM16_X0_HW2 = 40,
+ R_TILEGX_IMM16_X1_HW2 = 41,
+ R_TILEGX_IMM16_X0_HW3 = 42,
+ R_TILEGX_IMM16_X1_HW3 = 43,
+ R_TILEGX_IMM16_X0_HW0_LAST = 44,
+ R_TILEGX_IMM16_X1_HW0_LAST = 45,
+ R_TILEGX_IMM16_X0_HW1_LAST = 46,
+ R_TILEGX_IMM16_X1_HW1_LAST = 47,
+ R_TILEGX_IMM16_X0_HW2_LAST = 48,
+ R_TILEGX_IMM16_X1_HW2_LAST = 49,
+ R_TILEGX_IMM16_X0_HW0_PCREL = 50,
+ R_TILEGX_IMM16_X1_HW0_PCREL = 51,
+ R_TILEGX_IMM16_X0_HW1_PCREL = 52,
+ R_TILEGX_IMM16_X1_HW1_PCREL = 53,
+ R_TILEGX_IMM16_X0_HW2_PCREL = 54,
+ R_TILEGX_IMM16_X1_HW2_PCREL = 55,
+ R_TILEGX_IMM16_X0_HW3_PCREL = 56,
+ R_TILEGX_IMM16_X1_HW3_PCREL = 57,
+ R_TILEGX_IMM16_X0_HW0_LAST_PCREL = 58,
+ R_TILEGX_IMM16_X1_HW0_LAST_PCREL = 59,
+ R_TILEGX_IMM16_X0_HW1_LAST_PCREL = 60,
+ R_TILEGX_IMM16_X1_HW1_LAST_PCREL = 61,
+ R_TILEGX_IMM16_X0_HW2_LAST_PCREL = 62,
+ R_TILEGX_IMM16_X1_HW2_LAST_PCREL = 63,
+ R_TILEGX_IMM16_X0_HW0_GOT = 64,
+ R_TILEGX_IMM16_X1_HW0_GOT = 65,
+
+ R_TILEGX_IMM16_X0_HW0_PLT_PCREL = 66,
+ R_TILEGX_IMM16_X1_HW0_PLT_PCREL = 67,
+ R_TILEGX_IMM16_X0_HW1_PLT_PCREL = 68,
+ R_TILEGX_IMM16_X1_HW1_PLT_PCREL = 69,
+ R_TILEGX_IMM16_X0_HW2_PLT_PCREL = 70,
+ R_TILEGX_IMM16_X1_HW2_PLT_PCREL = 71,
+
+ R_TILEGX_IMM16_X0_HW0_LAST_GOT = 72,
+ R_TILEGX_IMM16_X1_HW0_LAST_GOT = 73,
+ R_TILEGX_IMM16_X0_HW1_LAST_GOT = 74,
+ R_TILEGX_IMM16_X1_HW1_LAST_GOT = 75,
+ R_TILEGX_IMM16_X0_HW0_TLS_GD = 78,
+ R_TILEGX_IMM16_X1_HW0_TLS_GD = 79,
+ R_TILEGX_IMM16_X0_HW0_TLS_LE = 80,
+ R_TILEGX_IMM16_X1_HW0_TLS_LE = 81,
+ R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE = 82,
+ R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE = 83,
+ R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE = 84,
+ R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE = 85,
+ R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD = 86,
+ R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD = 87,
+ R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD = 88,
+ R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD = 89,
+ R_TILEGX_IRELATIVE = 90,
+ R_TILEGX_IMM16_X0_HW0_TLS_IE = 92,
+ R_TILEGX_IMM16_X1_HW0_TLS_IE = 93,
+
+ R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL = 94,
+ R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL = 95,
+ R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL = 96,
+ R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL = 97,
+ R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL = 98,
+ R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL = 99,
+
+ R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE = 100,
+ R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE = 101,
+ R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE = 102,
+ R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE = 103,
+ R_TILEGX_TLS_DTPMOD64 = 106,
+ R_TILEGX_TLS_DTPOFF64 = 107,
+ R_TILEGX_TLS_TPOFF64 = 108,
+ R_TILEGX_TLS_DTPMOD32 = 109,
+ R_TILEGX_TLS_DTPOFF32 = 110,
+ R_TILEGX_TLS_TPOFF32 = 111,
+ R_TILEGX_TLS_GD_CALL = 112,
+ R_TILEGX_IMM8_X0_TLS_GD_ADD = 113,
+ R_TILEGX_IMM8_X1_TLS_GD_ADD = 114,
+ R_TILEGX_IMM8_Y0_TLS_GD_ADD = 115,
+ R_TILEGX_IMM8_Y1_TLS_GD_ADD = 116,
+ R_TILEGX_TLS_IE_LOAD = 117,
+ R_TILEGX_IMM8_X0_TLS_ADD = 118,
+ R_TILEGX_IMM8_X1_TLS_ADD = 119,
+ R_TILEGX_IMM8_Y0_TLS_ADD = 120,
+ R_TILEGX_IMM8_Y1_TLS_ADD = 121,
+ R_TILEGX_GNU_VTINHERIT = 128,
+ R_TILEGX_GNU_VTENTRY = 129,
+ R_TILEGX_NUM = 130
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_TILEGX_H)
diff --git a/binutils-2.25/elfcpp/x86_64.h b/binutils-2.25/elfcpp/x86_64.h
new file mode 100644
index 00000000..a53beac9
--- /dev/null
+++ b/binutils-2.25/elfcpp/x86_64.h
@@ -0,0 +1,102 @@
+// x86-64.h -- ELF definitions specific to EM_X86_64 -*- C++ -*-
+
+// Copyright 2006, 2007, 2010 Free Software Foundation, Inc.
+// Written by Andrew Chatham.
+
+// This file is part of elfcpp.
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// as published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// In addition to the permissions in the GNU Library General Public
+// License, the Free Software Foundation gives you unlimited
+// permission to link the compiled version of this file into
+// combinations with other programs, and to distribute those
+// combinations without any restriction coming from the use of this
+// file. (The Library Public License restrictions do apply in other
+// respects; for example, they cover modification of the file, and
+/// distribution when not linked into a combined executable.)
+
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+// 02110-1301, USA.
+
+#ifndef ELFCPP_X86_64_H
+#define ELFCPP_X86_64_H
+
+namespace elfcpp
+{
+
+// Documentation is taken from
+// http://www.x86-64.org/documentation/abi-0.98.pdf
+// elf.h
+// Documentation for the TLS relocs is taken from
+// http://people.redhat.com/drepper/tls.pdf
+// http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt
+
+enum
+{
+ R_X86_64_NONE = 0, // No reloc
+ R_X86_64_64 = 1, // Direct 64 bit
+ R_X86_64_PC32 = 2, // PC relative 32 bit signed
+ R_X86_64_GOT32 = 3, // 32 bit GOT entry
+ R_X86_64_PLT32 = 4, // 32 bit PLT address
+ R_X86_64_COPY = 5, // Copy symbol at runtime
+ R_X86_64_GLOB_DAT = 6, // Create GOT entry
+ R_X86_64_JUMP_SLOT = 7, // Create PLT entry
+ R_X86_64_RELATIVE = 8, // Adjust by program base
+ R_X86_64_GOTPCREL = 9, // 32 bit signed PC relative offset to GOT
+ R_X86_64_32 = 10, // Direct 32 bit zero extended
+ R_X86_64_32S = 11, // Direct 32 bit sign extended
+ R_X86_64_16 = 12, // Direct 16 bit zero extended
+ R_X86_64_PC16 = 13, // 16 bit sign extended pc relative
+ R_X86_64_8 = 14, // Direct 8 bit sign extended
+ R_X86_64_PC8 = 15, // 8 bit sign extended pc relative
+
+ // TLS relocations
+ R_X86_64_DTPMOD64 = 16, // ID of module containing symbol
+ R_X86_64_DTPOFF64 = 17, // Offset in module's TLS block
+ R_X86_64_TPOFF64 = 18, // Offset in initial TLS block
+ R_X86_64_TLSGD = 19, // 32 bit signed PC relative offset to two
+ // GOT entries for GD symbol
+ R_X86_64_TLSLD = 20, // 32 bit signed PC relative offset to two
+ // GOT entries for LD symbol
+ R_X86_64_DTPOFF32 = 21, // Offset in TLS block
+ R_X86_64_GOTTPOFF = 22, // 32 bit signed PC relative offset to GOT
+ // entry for IE symbol
+ R_X86_64_TPOFF32 = 23, // Offset in initial TLS block
+
+ R_X86_64_PC64 = 24, // 64-bit PC relative
+ R_X86_64_GOTOFF64 = 25, // 64-bit GOT offset
+ R_X86_64_GOTPC32 = 26, // 32-bit PC relative offset to GOT
+
+ R_X86_64_GOT64 = 27, // 64-bit GOT entry offset
+ R_X86_64_GOTPCREL64 = 28, // 64-bit PC relative offset to GOT entry
+ R_X86_64_GOTPC64 = 29, // 64-bit PC relative offset to GOT
+ R_X86_64_GOTPLT64 = 30, // Like GOT64, indicates that PLT entry needed
+ R_X86_64_PLTOFF64 = 31, // 64-bit GOT relative offset to PLT entry
+
+ R_X86_64_SIZE32 = 32,
+ R_X86_64_SIZE64 = 33,
+
+ R_X86_64_GOTPC32_TLSDESC = 34, // 32-bit PC relative to TLS descriptor in GOT
+ R_X86_64_TLSDESC_CALL = 35, // Relaxable call through TLS descriptor
+ R_X86_64_TLSDESC = 36, // 2 by 64-bit TLS descriptor
+ R_X86_64_IRELATIVE = 37, // Adjust indirectly by program base
+ R_X86_64_RELATIVE64 = 38, // 64-bit adjust by program base
+ // GNU vtable garbage collection extensions.
+ R_X86_64_GNU_VTINHERIT = 250,
+ R_X86_64_GNU_VTENTRY = 251
+};
+
+} // End namespace elfcpp.
+
+#endif // !defined(ELFCPP_X86_64_H)