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 STBelf_st_bind(unsigned char info){ return static_cast<STB>(info >> 4);} inline STTelf_st_type(unsigned char info){ return static_cast<STT>(info & 0xf);} inline unsigned charelf_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 STVelf_st_visibility(unsigned char other){ return static_cast<STV>(other & 0x3);} inline unsigned charelf_st_nonvis(unsigned char other){ return static_cast<STV>(other >> 2);} inline unsigned charelf_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 intelf_r_sym(typename Elf_types<size>::Elf_WXword); template<>inline unsigned intelf_r_sym<32>(Elf_Word v){ return v >> 8;} template<>inline unsigned intelf_r_sym<64>(Elf_Xword v){ return v >> 32;} template<int size>unsigned intelf_r_type(typename Elf_types<size>::Elf_WXword); template<>inline unsigned intelf_r_type<32>(Elf_Word v){ return v & 0xff;} template<>inline unsigned intelf_r_type<64>(Elf_Xword v){ return v & 0xffffffff;} template<int size>typename Elf_types<size>::Elf_WXwordelf_r_info(unsigned int s, unsigned int t); template<>inline Elf_Wordelf_r_info<32>(unsigned int s, unsigned int t){ return (s << 8) + (t & 0xff);} template<>inline Elf_Xwordelf_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);Lines 501–1000 of 1923. Previous lines Load more
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);