add binutils-2.20.1

This commit is contained in:
Wolfgang Thaller
2012-03-26 21:18:29 +02:00
commit 5d96d8025a
10301 changed files with 3528414 additions and 0 deletions
+114
View File
@@ -0,0 +1,114 @@
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.
+9
View File
@@ -0,0 +1,9 @@
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.
+204
View File
@@ -0,0 +1,204 @@
// arm.h -- ELF definitions specific to EM_ARM -*- C++ -*-
// Copyright 2009, 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
};
} // End namespace elfcpp.
#endif // !defined(ELFCPP_ARM_H)
+408
View File
@@ -0,0 +1,408 @@
// dwarf.h -- DWARF2 constants -*- 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.
#ifndef ELFCPP_DWARF_H
#define ELFCPP_DWARF_H
namespace elfcpp
{
// DWARF2 codes.
enum DW_TAG
{
DW_TAG_padding = 0x00,
DW_TAG_array_type = 0x01,
DW_TAG_class_type = 0x02,
DW_TAG_entry_point = 0x03,
DW_TAG_enumeration_type = 0x04,
DW_TAG_formal_parameter = 0x05,
DW_TAG_imported_declaration = 0x08,
DW_TAG_label = 0x0a,
DW_TAG_lexical_block = 0x0b,
DW_TAG_member = 0x0d,
DW_TAG_pointer_type = 0x0f,
DW_TAG_reference_type = 0x10,
DW_TAG_compile_unit = 0x11,
DW_TAG_string_type = 0x12,
DW_TAG_structure_type = 0x13,
DW_TAG_subroutine_type = 0x15,
DW_TAG_typedef = 0x16,
DW_TAG_union_type = 0x17,
DW_TAG_unspecified_parameters = 0x18,
DW_TAG_variant = 0x19,
DW_TAG_common_block = 0x1a,
DW_TAG_common_inclusion = 0x1b,
DW_TAG_inheritance = 0x1c,
DW_TAG_inlined_subroutine = 0x1d,
DW_TAG_module = 0x1e,
DW_TAG_ptr_to_member_type = 0x1f,
DW_TAG_set_type = 0x20,
DW_TAG_subrange_type = 0x21,
DW_TAG_with_stmt = 0x22,
DW_TAG_access_declaration = 0x23,
DW_TAG_base_type = 0x24,
DW_TAG_catch_block = 0x25,
DW_TAG_const_type = 0x26,
DW_TAG_constant = 0x27,
DW_TAG_enumerator = 0x28,
DW_TAG_file_type = 0x29,
DW_TAG_friend = 0x2a,
DW_TAG_namelist = 0x2b,
DW_TAG_namelist_item = 0x2c,
DW_TAG_packed_type = 0x2d,
DW_TAG_subprogram = 0x2e,
DW_TAG_template_type_param = 0x2f,
DW_TAG_template_value_param = 0x30,
DW_TAG_thrown_type = 0x31,
DW_TAG_try_block = 0x32,
DW_TAG_variant_part = 0x33,
DW_TAG_variable = 0x34,
DW_TAG_volatile_type = 0x35,
// DWARF3.
DW_TAG_dwarf_procedure = 0x36,
DW_TAG_restrict_type = 0x37,
DW_TAG_interface_type = 0x38,
DW_TAG_namespace = 0x39,
DW_TAG_imported_module = 0x3a,
DW_TAG_unspecified_type = 0x3b,
DW_TAG_partial_unit = 0x3c,
DW_TAG_imported_unit = 0x3d,
DW_TAG_condition = 0x3f,
DW_TAG_shared_type = 0x40,
// SGI/MIPS extensions.
DW_TAG_MIPS_loop = 0x4081,
// HP extensions.
// See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz.
DW_TAG_HP_array_descriptor = 0x4090,
// GNU extensions.
DW_TAG_format_label = 0x4101, // For FORTRAN 77 and Fortran 90.
DW_TAG_function_template = 0x4102, // For C++.
DW_TAG_class_template = 0x4103, // For C++.
DW_TAG_GNU_BINCL = 0x4104,
DW_TAG_GNU_EINCL = 0x4105,
// Extensions for UPC. See: http://upc.gwu.edu/~upc.
DW_TAG_upc_shared_type = 0x8765,
DW_TAG_upc_strict_type = 0x8766,
DW_TAG_upc_relaxed_type = 0x8767,
// PGI (STMicroelectronics) extensions. No documentation available.
DW_TAG_PGI_kanji_type = 0xA000,
DW_TAG_PGI_interface_block = 0xA020
};
enum DW_FORM
{
DW_FORM_null = 0x00,
DW_FORM_addr = 0x01,
DW_FORM_block2 = 0x03,
DW_FORM_block4 = 0x04,
DW_FORM_data2 = 0x05,
DW_FORM_data4 = 0x06,
DW_FORM_data8 = 0x07,
DW_FORM_string = 0x08,
DW_FORM_block = 0x09,
DW_FORM_block1 = 0x0a,
DW_FORM_data1 = 0x0b,
DW_FORM_flag = 0x0c,
DW_FORM_sdata = 0x0d,
DW_FORM_strp = 0x0e,
DW_FORM_udata = 0x0f,
DW_FORM_ref_addr = 0x10,
DW_FORM_ref1 = 0x11,
DW_FORM_ref2 = 0x12,
DW_FORM_ref4 = 0x13,
DW_FORM_ref8 = 0x14,
DW_FORM_ref_udata = 0x15,
DW_FORM_indirect = 0x16
};
// 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,
// 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
};
// Type encoding names and codes
enum DW_ENCODING
{
DW_ATE_address =0x1,
DW_ATE_boolean =0x2,
DW_ATE_complex_float =0x3,
DW_ATE_float =0x4,
DW_ATE_signed =0x5,
DW_ATE_signed_char =0x6,
DW_ATE_unsigned =0x7,
DW_ATE_unsigned_char =0x8,
// DWARF3/DWARF3f
DW_ATE_imaginary_float =0x9,
DW_ATE_packed_decimal =0xa,
DW_ATE_numeric_string =0xb,
DW_ATE_edited =0xc,
DW_ATE_signed_fixed =0xd,
DW_ATE_unsigned_fixed =0xe,
DW_ATE_decimal_float =0xf,
DW_ATE_lo_user =0x80,
DW_ATE_hi_user =0xff
};
// Location virtual machine opcodes
enum DW_OP
{
DW_OP_addr =0x03,
DW_OP_deref =0x06,
DW_OP_const1u =0x08,
DW_OP_const1s =0x09,
DW_OP_const2u =0x0a,
DW_OP_const2s =0x0b,
DW_OP_const4u =0x0c,
DW_OP_const4s =0x0d,
DW_OP_const8u =0x0e,
DW_OP_const8s =0x0f,
DW_OP_constu =0x10,
DW_OP_consts =0x11,
DW_OP_dup =0x12,
DW_OP_drop =0x13,
DW_OP_over =0x14,
DW_OP_pick =0x15,
DW_OP_swap =0x16,
DW_OP_rot =0x17,
DW_OP_xderef =0x18,
DW_OP_abs =0x19,
DW_OP_and =0x1a,
DW_OP_div =0x1b,
DW_OP_minus =0x1c,
DW_OP_mod =0x1d,
DW_OP_mul =0x1e,
DW_OP_neg =0x1f,
DW_OP_not =0x20,
DW_OP_or =0x21,
DW_OP_plus =0x22,
DW_OP_plus_uconst =0x23,
DW_OP_shl =0x24,
DW_OP_shr =0x25,
DW_OP_shra =0x26,
DW_OP_xor =0x27,
DW_OP_bra =0x28,
DW_OP_eq =0x29,
DW_OP_ge =0x2a,
DW_OP_gt =0x2b,
DW_OP_le =0x2c,
DW_OP_lt =0x2d,
DW_OP_ne =0x2e,
DW_OP_skip =0x2f,
DW_OP_lit0 =0x30,
DW_OP_lit1 =0x31,
DW_OP_lit2 =0x32,
DW_OP_lit3 =0x33,
DW_OP_lit4 =0x34,
DW_OP_lit5 =0x35,
DW_OP_lit6 =0x36,
DW_OP_lit7 =0x37,
DW_OP_lit8 =0x38,
DW_OP_lit9 =0x39,
DW_OP_lit10 =0x3a,
DW_OP_lit11 =0x3b,
DW_OP_lit12 =0x3c,
DW_OP_lit13 =0x3d,
DW_OP_lit14 =0x3e,
DW_OP_lit15 =0x3f,
DW_OP_lit16 =0x40,
DW_OP_lit17 =0x41,
DW_OP_lit18 =0x42,
DW_OP_lit19 =0x43,
DW_OP_lit20 =0x44,
DW_OP_lit21 =0x45,
DW_OP_lit22 =0x46,
DW_OP_lit23 =0x47,
DW_OP_lit24 =0x48,
DW_OP_lit25 =0x49,
DW_OP_lit26 =0x4a,
DW_OP_lit27 =0x4b,
DW_OP_lit28 =0x4c,
DW_OP_lit29 =0x4d,
DW_OP_lit30 =0x4e,
DW_OP_lit31 =0x4f,
DW_OP_reg0 =0x50,
DW_OP_reg1 =0x51,
DW_OP_reg2 =0x52,
DW_OP_reg3 =0x53,
DW_OP_reg4 =0x54,
DW_OP_reg5 =0x55,
DW_OP_reg6 =0x56,
DW_OP_reg7 =0x57,
DW_OP_reg8 =0x58,
DW_OP_reg9 =0x59,
DW_OP_reg10 =0x5a,
DW_OP_reg11 =0x5b,
DW_OP_reg12 =0x5c,
DW_OP_reg13 =0x5d,
DW_OP_reg14 =0x5e,
DW_OP_reg15 =0x5f,
DW_OP_reg16 =0x60,
DW_OP_reg17 =0x61,
DW_OP_reg18 =0x62,
DW_OP_reg19 =0x63,
DW_OP_reg20 =0x64,
DW_OP_reg21 =0x65,
DW_OP_reg22 =0x66,
DW_OP_reg23 =0x67,
DW_OP_reg24 =0x68,
DW_OP_reg25 =0x69,
DW_OP_reg26 =0x6a,
DW_OP_reg27 =0x6b,
DW_OP_reg28 =0x6c,
DW_OP_reg29 =0x6d,
DW_OP_reg30 =0x6e,
DW_OP_reg31 =0x6f,
DW_OP_breg0 =0x70,
DW_OP_breg1 =0x71,
DW_OP_breg2 =0x72,
DW_OP_breg3 =0x73,
DW_OP_breg4 =0x74,
DW_OP_breg5 =0x75,
DW_OP_breg6 =0x76,
DW_OP_breg7 =0x77,
DW_OP_breg8 =0x78,
DW_OP_breg9 =0x79,
DW_OP_breg10 =0x7a,
DW_OP_breg11 =0x7b,
DW_OP_breg12 =0x7c,
DW_OP_breg13 =0x7d,
DW_OP_breg14 =0x7e,
DW_OP_breg15 =0x7f,
DW_OP_breg16 =0x80,
DW_OP_breg17 =0x81,
DW_OP_breg18 =0x82,
DW_OP_breg19 =0x83,
DW_OP_breg20 =0x84,
DW_OP_breg21 =0x85,
DW_OP_breg22 =0x86,
DW_OP_breg23 =0x87,
DW_OP_breg24 =0x88,
DW_OP_breg25 =0x89,
DW_OP_breg26 =0x8a,
DW_OP_breg27 =0x8b,
DW_OP_breg28 =0x8c,
DW_OP_breg29 =0x8d,
DW_OP_breg30 =0x8e,
DW_OP_breg31 =0x8f,
DW_OP_regX =0x90,
DW_OP_fbreg =0x91,
DW_OP_bregX =0x92,
DW_OP_piece =0x93,
DW_OP_deref_size =0x94,
DW_OP_xderef_size =0x95,
DW_OP_nop =0x96,
// DWARF3/DWARF3f
DW_OP_push_object_address =0x97,
DW_OP_call2 =0x98,
DW_OP_call4 =0x99,
DW_OP_call_ref =0x9a,
DW_OP_form_tls_address =0x9b,
DW_OP_call_frame_cfa =0x9c,
DW_OP_bit_piece =0x9d,
DW_OP_lo_user =0xe0,
DW_OP_hi_user =0xff,
// GNU extensions
DW_OP_GNU_push_tls_address =0xe0
};
} // End namespace elfcpp.
#endif // !defined(ELFCPP_DWARF_H)
File diff suppressed because it is too large Load Diff
+686
View File
@@ -0,0 +1,686 @@
// 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>
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)
+240
View File
@@ -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)
+435
View File
@@ -0,0 +1,435 @@
// elfcpp_swap.h -- Handle swapping for elfcpp -*- C++ -*-
// Copyright 2006, 2007, 2008, 2009 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;
}
};
} // End namespace elfcpp.
#endif // !defined(ELFCPP_SWAP_H)
+97
View File
@@ -0,0 +1,97 @@
// i386.h -- ELF definitions specific to EM_386 -*- 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.
#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
// 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)
+191
View File
@@ -0,0 +1,191 @@
// powerpc.h -- ELF definitions specific to EM_PPC and EM_PPC64 -*- C++ -*-
// Copyright 2008, 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_PPC64_TPREL16_DS = 95,
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_PPC64_DTPREL16_DS = 101,
R_PPC64_DTPREL16_LO_DS = 102,
R_PPC64_DTPREL16_HIGHER = 103,
R_PPC64_DTPREL16_HIGHERA = 104,
R_PPC64_DTPREL16_HIGHEST = 105,
R_PPC64_DTPREL16_HIGHESTA = 106,
R_PPC_EMB_NADDR32 = 101,
R_PPC_EMB_NADDR16 = 102,
R_PPC_EMB_NADDR16_LO = 103,
R_PPC_EMB_NADDR16_HI = 104,
R_PPC_EMB_NADDR16_HA = 105,
R_PPC_EMB_SDAI16 = 106,
R_PPC_EMB_SDA2I16 = 107,
R_PPC_EMB_SDA2REL = 108,
R_PPC_EMB_SDA21 = 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_RELAX32 = 245,
R_PPC_RELAX32PC = 246,
R_PPC_RELAX32_PLT = 247,
R_PPC_RELAX32PC_PLT = 248,
R_PPC_REL16 = 249,
R_PPC_REL16_LO = 250,
R_PPC_REL16_HI = 251,
R_PPC_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)
+169
View File
@@ -0,0 +1,169 @@
// sparc.h -- ELF definitions specific to EM_SPARC -*- C++ -*-
// Copyright 2008, 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
// 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)
+100
View File
@@ -0,0 +1,100 @@
// x86-64.h -- ELF definitions specific to EM_X86_64 -*- C++ -*-
// Copyright 2006, 2007, 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
// GNU vtable garbage collection extensions.
R_386_GNU_VTINHERIT = 250,
R_386_GNU_VTENTRY = 251
};
} // End namespace elfcpp.
#endif // !defined(ELFCPP_X86_64_H)