Fix a typo in ChangeLog.
[binutils.git] / elfcpp / elfcpp_internal.h
blob7a2b5d4836bd8420fa83e21cd82b6d75a12058ee
1 // elfcpp_internal.h -- internals for elfcpp -*- C++ -*-
3 // This is included by elfcpp.h, the external interface, but holds
4 // information which we want to keep private.
6 #include "elfcpp_config.h"
8 #ifndef ELFCPP_INTERNAL_H
9 #define ELFCPP_INTERNAL_H
11 namespace elfcpp
14 namespace internal
17 // The ELF file header.
19 template<int size>
20 struct Ehdr_data
22 unsigned char e_ident[EI_NIDENT];
23 Elf_Half e_type;
24 Elf_Half e_machine;
25 Elf_Word e_version;
26 typename Elf_types<size>::Elf_Addr e_entry;
27 typename Elf_types<size>::Elf_Off e_phoff;
28 typename Elf_types<size>::Elf_Off e_shoff;
29 Elf_Word e_flags;
30 Elf_Half e_ehsize;
31 Elf_Half e_phentsize;
32 Elf_Half e_phnum;
33 Elf_Half e_shentsize;
34 Elf_Half e_shnum;
35 Elf_Half e_shstrndx;
38 // An ELF section header.
40 template<int size>
41 struct Shdr_data
43 Elf_Word sh_name;
44 Elf_Word sh_type;
45 typename Elf_types<size>::Elf_WXword sh_flags;
46 typename Elf_types<size>::Elf_Addr sh_addr;
47 typename Elf_types<size>::Elf_Off sh_offset;
48 typename Elf_types<size>::Elf_WXword sh_size;
49 Elf_Word sh_link;
50 Elf_Word sh_info;
51 typename Elf_types<size>::Elf_WXword sh_addralign;
52 typename Elf_types<size>::Elf_WXword sh_entsize;
55 // An ELF segment header. We use template specialization for the
56 // 32-bit and 64-bit versions because the fields are in a different
57 // order.
59 template<int size>
60 struct Phdr_data;
62 template<>
63 struct Phdr_data<32>
65 Elf_Word p_type;
66 Elf_types<32>::Elf_Off p_offset;
67 Elf_types<32>::Elf_Addr p_vaddr;
68 Elf_types<32>::Elf_Addr p_paddr;
69 Elf_Word p_filesz;
70 Elf_Word p_memsz;
71 Elf_Word p_flags;
72 Elf_Word p_align;
75 template<>
76 struct Phdr_data<64>
78 Elf_Word p_type;
79 Elf_Word p_flags;
80 Elf_types<64>::Elf_Off p_offset;
81 Elf_types<64>::Elf_Addr p_vaddr;
82 Elf_types<64>::Elf_Addr p_paddr;
83 Elf_Xword p_filesz;
84 Elf_Xword p_memsz;
85 Elf_Xword p_align;
88 // An ELF symbol table entry. We use template specialization for the
89 // 32-bit and 64-bit versions because the fields are in a different
90 // order.
92 template<int size>
93 struct Sym_data;
95 template<>
96 struct Sym_data<32>
98 Elf_Word st_name;
99 Elf_types<32>::Elf_Addr st_value;
100 Elf_Word st_size;
101 unsigned char st_info;
102 unsigned char st_other;
103 Elf_Half st_shndx;
106 template<>
107 struct Sym_data<64>
109 Elf_Word st_name;
110 unsigned char st_info;
111 unsigned char st_other;
112 Elf_Half st_shndx;
113 Elf_types<64>::Elf_Addr st_value;
114 Elf_Xword st_size;
117 // ELF relocation table entries.
119 template<int size>
120 struct Rel_data
122 typename Elf_types<size>::Elf_Addr r_offset;
123 typename Elf_types<size>::Elf_WXword r_info;
126 template<int size>
127 struct Rela_data
129 typename Elf_types<size>::Elf_Addr r_offset;
130 typename Elf_types<size>::Elf_WXword r_info;
131 typename Elf_types<size>::Elf_Swxword r_addend;
134 // An entry in the ELF SHT_DYNAMIC section aka PT_DYNAMIC segment.
136 template<int size>
137 struct Dyn_data
139 typename Elf_types<size>::Elf_Swxword d_tag;
140 typename Elf_types<size>::Elf_WXword d_val;
143 // An entry in a SHT_GNU_verdef section. This structure is the same
144 // in 32-bit and 64-bit ELF files.
146 struct Verdef_data
148 // Version number of structure (VER_DEF_*).
149 Elf_Half vd_version;
150 // Bit flags (VER_FLG_*).
151 Elf_Half vd_flags;
152 // Version index.
153 Elf_Half vd_ndx;
154 // Number of auxiliary Verdaux entries.
155 Elf_Half vd_cnt;
156 // Hash of name.
157 Elf_Word vd_hash;
158 // Byte offset to first Verdaux entry.
159 Elf_Word vd_aux;
160 // Byte offset to next Verdef entry.
161 Elf_Word vd_next;
164 // An auxiliary entry in a SHT_GNU_verdef section. This structure is
165 // the same in 32-bit and 64-bit ELF files.
167 struct Verdaux_data
169 // Offset in string table of version name.
170 Elf_Word vda_name;
171 // Byte offset to next Verdaux entry.
172 Elf_Word vda_next;
175 // An entry in a SHT_GNU_verneed section. This structure is the same
176 // in 32-bit and 64-bit ELF files.
178 struct Verneed_data
180 // Version number of structure (VER_NEED_*).
181 Elf_Half vn_version;
182 // Number of auxiliary Vernaux entries.
183 Elf_Half vn_cnt;
184 // Offset in string table of library name.
185 Elf_Word vn_file;
186 // Byte offset to first Vernaux entry.
187 Elf_Word vn_aux;
188 // Byt eoffset to next Verneed entry.
189 Elf_Word vn_next;
192 // An auxiliary entry in a SHT_GNU_verneed section. This structure is
193 // the same in 32-bit and 64-bit ELF files.
195 struct Vernaux_data
197 // Hash of dependency name.
198 Elf_Word vna_hash;
199 // Bit flags (VER_FLG_*).
200 Elf_Half vna_flags;
201 // Version index used in SHT_GNU_versym entries.
202 Elf_Half vna_other;
203 // Offset in string table of version name.
204 Elf_Word vna_name;
205 // Byte offset to next Vernaux entry.
206 Elf_Word vna_next;
209 } // End namespace internal.
211 } // End namespace elfcpp.
213 #endif // !defined(ELFCPP_INTERNAL_H)