1 // elfcpp_internal.h -- internals for elfcpp -*- C++ -*-
3 // Copyright (C) 2006-2016 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of elfcpp.
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public License
10 // as published by the Free Software Foundation; either version 2, or
11 // (at your option) any later version.
13 // In addition to the permissions in the GNU Library General Public
14 // License, the Free Software Foundation gives you unlimited
15 // permission to link the compiled version of this file into
16 // combinations with other programs, and to distribute those
17 // combinations without any restriction coming from the use of this
18 // file. (The Library Public License restrictions do apply in other
19 // respects; for example, they cover modification of the file, and
20 /// distribution when not linked into a combined executable.)
22 // This program is distributed in the hope that it will be useful, but
23 // WITHOUT ANY WARRANTY; without even the implied warranty of
24 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 // Library General Public License for more details.
27 // You should have received a copy of the GNU Library General Public
28 // License along with this program; if not, write to the Free Software
29 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
32 // This is included by elfcpp.h, the external interface, but holds
33 // information which we want to keep private.
35 #ifndef ELFCPP_INTERNAL_H
36 #define ELFCPP_INTERNAL_H
44 // The ELF file header.
49 unsigned char e_ident[EI_NIDENT];
53 typename Elf_types<size>::Elf_Addr e_entry;
54 typename Elf_types<size>::Elf_Off e_phoff;
55 typename Elf_types<size>::Elf_Off e_shoff;
65 // An ELF section header.
72 typename Elf_types<size>::Elf_WXword sh_flags;
73 typename Elf_types<size>::Elf_Addr sh_addr;
74 typename Elf_types<size>::Elf_Off sh_offset;
75 typename Elf_types<size>::Elf_WXword sh_size;
78 typename Elf_types<size>::Elf_WXword sh_addralign;
79 typename Elf_types<size>::Elf_WXword sh_entsize;
82 // An ELF compression header.
92 Elf_Word ch_addralign;
101 Elf_Xword ch_addralign;
104 // An ELF segment header. We use template specialization for the
105 // 32-bit and 64-bit versions because the fields are in a different
115 Elf_types<32>::Elf_Off p_offset;
116 Elf_types<32>::Elf_Addr p_vaddr;
117 Elf_types<32>::Elf_Addr p_paddr;
129 Elf_types<64>::Elf_Off p_offset;
130 Elf_types<64>::Elf_Addr p_vaddr;
131 Elf_types<64>::Elf_Addr p_paddr;
137 // An ELF symbol table entry. We use template specialization for the
138 // 32-bit and 64-bit versions because the fields are in a different
148 Elf_types<32>::Elf_Addr st_value;
150 unsigned char st_info;
151 unsigned char st_other;
159 unsigned char st_info;
160 unsigned char st_other;
162 Elf_types<64>::Elf_Addr st_value;
166 // ELF relocation table entries.
171 typename Elf_types<size>::Elf_Addr r_offset;
172 typename Elf_types<size>::Elf_WXword r_info;
178 typename Elf_types<size>::Elf_Addr r_offset;
179 typename Elf_types<size>::Elf_WXword r_info;
180 typename Elf_types<size>::Elf_Swxword r_addend;
183 // MIPS-64 has a non-standard layout for relocations.
185 struct Mips64_rel_data
187 typename Elf_types<64>::Elf_Addr r_offset;
189 unsigned char r_ssym;
190 unsigned char r_type3;
191 unsigned char r_type2;
192 unsigned char r_type;
195 struct Mips64_rela_data
197 typename Elf_types<64>::Elf_Addr r_offset;
199 unsigned char r_ssym;
200 unsigned char r_type3;
201 unsigned char r_type2;
202 unsigned char r_type;
203 typename Elf_types<64>::Elf_Swxword r_addend;
206 // An entry in the ELF SHT_DYNAMIC section aka PT_DYNAMIC segment.
211 typename Elf_types<size>::Elf_Swxword d_tag;
212 typename Elf_types<size>::Elf_WXword d_val;
215 // An entry in a SHT_GNU_verdef section. This structure is the same
216 // in 32-bit and 64-bit ELF files.
220 // Version number of structure (VER_DEF_*).
222 // Bit flags (VER_FLG_*).
226 // Number of auxiliary Verdaux entries.
230 // Byte offset to first Verdaux entry.
232 // Byte offset to next Verdef entry.
236 // An auxiliary entry in a SHT_GNU_verdef section. This structure is
237 // the same in 32-bit and 64-bit ELF files.
241 // Offset in string table of version name.
243 // Byte offset to next Verdaux entry.
247 // An entry in a SHT_GNU_verneed section. This structure is the same
248 // in 32-bit and 64-bit ELF files.
252 // Version number of structure (VER_NEED_*).
254 // Number of auxiliary Vernaux entries.
256 // Offset in string table of library name.
258 // Byte offset to first Vernaux entry.
260 // Byt eoffset to next Verneed entry.
264 // An auxiliary entry in a SHT_GNU_verneed section. This structure is
265 // the same in 32-bit and 64-bit ELF files.
269 // Hash of dependency name.
271 // Bit flags (VER_FLG_*).
273 // Version index used in SHT_GNU_versym entries.
275 // Offset in string table of version name.
277 // Byte offset to next Vernaux entry.
281 } // End namespace internal.
283 } // End namespace elfcpp.
285 #endif // !defined(ELFCPP_INTERNAL_H)