Remove unnecessary elfcpp_config.h file.
[binutils.git] / elfcpp / elfcpp_internal.h
blob321bcae74a3aed1eb9b7a8371c615f6e07c9bfcd
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 #ifndef ELFCPP_INTERNAL_H
7 #define ELFCPP_INTERNAL_H
9 namespace elfcpp
12 namespace internal
15 // The ELF file header.
17 template<int size>
18 struct Ehdr_data
20 unsigned char e_ident[EI_NIDENT];
21 Elf_Half e_type;
22 Elf_Half e_machine;
23 Elf_Word e_version;
24 typename Elf_types<size>::Elf_Addr e_entry;
25 typename Elf_types<size>::Elf_Off e_phoff;
26 typename Elf_types<size>::Elf_Off e_shoff;
27 Elf_Word e_flags;
28 Elf_Half e_ehsize;
29 Elf_Half e_phentsize;
30 Elf_Half e_phnum;
31 Elf_Half e_shentsize;
32 Elf_Half e_shnum;
33 Elf_Half e_shstrndx;
36 // An ELF section header.
38 template<int size>
39 struct Shdr_data
41 Elf_Word sh_name;
42 Elf_Word sh_type;
43 typename Elf_types<size>::Elf_WXword sh_flags;
44 typename Elf_types<size>::Elf_Addr sh_addr;
45 typename Elf_types<size>::Elf_Off sh_offset;
46 typename Elf_types<size>::Elf_WXword sh_size;
47 Elf_Word sh_link;
48 Elf_Word sh_info;
49 typename Elf_types<size>::Elf_WXword sh_addralign;
50 typename Elf_types<size>::Elf_WXword sh_entsize;
53 // An ELF segment header. We use template specialization for the
54 // 32-bit and 64-bit versions because the fields are in a different
55 // order.
57 template<int size>
58 struct Phdr_data;
60 template<>
61 struct Phdr_data<32>
63 Elf_Word p_type;
64 Elf_types<32>::Elf_Off p_offset;
65 Elf_types<32>::Elf_Addr p_vaddr;
66 Elf_types<32>::Elf_Addr p_paddr;
67 Elf_Word p_filesz;
68 Elf_Word p_memsz;
69 Elf_Word p_flags;
70 Elf_Word p_align;
73 template<>
74 struct Phdr_data<64>
76 Elf_Word p_type;
77 Elf_Word p_flags;
78 Elf_types<64>::Elf_Off p_offset;
79 Elf_types<64>::Elf_Addr p_vaddr;
80 Elf_types<64>::Elf_Addr p_paddr;
81 Elf_Xword p_filesz;
82 Elf_Xword p_memsz;
83 Elf_Xword p_align;
86 // An ELF symbol table entry. We use template specialization for the
87 // 32-bit and 64-bit versions because the fields are in a different
88 // order.
90 template<int size>
91 struct Sym_data;
93 template<>
94 struct Sym_data<32>
96 Elf_Word st_name;
97 Elf_types<32>::Elf_Addr st_value;
98 Elf_Word st_size;
99 unsigned char st_info;
100 unsigned char st_other;
101 Elf_Half st_shndx;
104 template<>
105 struct Sym_data<64>
107 Elf_Word st_name;
108 unsigned char st_info;
109 unsigned char st_other;
110 Elf_Half st_shndx;
111 Elf_types<64>::Elf_Addr st_value;
112 Elf_Xword st_size;
115 // ELF relocation table entries.
117 template<int size>
118 struct Rel_data
120 typename Elf_types<size>::Elf_Addr r_offset;
121 typename Elf_types<size>::Elf_WXword r_info;
124 template<int size>
125 struct Rela_data
127 typename Elf_types<size>::Elf_Addr r_offset;
128 typename Elf_types<size>::Elf_WXword r_info;
129 typename Elf_types<size>::Elf_Swxword r_addend;
132 // An entry in the ELF SHT_DYNAMIC section aka PT_DYNAMIC segment.
134 template<int size>
135 struct Dyn_data
137 typename Elf_types<size>::Elf_Swxword d_tag;
138 typename Elf_types<size>::Elf_WXword d_val;
141 // An entry in a SHT_GNU_verdef section. This structure is the same
142 // in 32-bit and 64-bit ELF files.
144 struct Verdef_data
146 // Version number of structure (VER_DEF_*).
147 Elf_Half vd_version;
148 // Bit flags (VER_FLG_*).
149 Elf_Half vd_flags;
150 // Version index.
151 Elf_Half vd_ndx;
152 // Number of auxiliary Verdaux entries.
153 Elf_Half vd_cnt;
154 // Hash of name.
155 Elf_Word vd_hash;
156 // Byte offset to first Verdaux entry.
157 Elf_Word vd_aux;
158 // Byte offset to next Verdef entry.
159 Elf_Word vd_next;
162 // An auxiliary entry in a SHT_GNU_verdef section. This structure is
163 // the same in 32-bit and 64-bit ELF files.
165 struct Verdaux_data
167 // Offset in string table of version name.
168 Elf_Word vda_name;
169 // Byte offset to next Verdaux entry.
170 Elf_Word vda_next;
173 // An entry in a SHT_GNU_verneed section. This structure is the same
174 // in 32-bit and 64-bit ELF files.
176 struct Verneed_data
178 // Version number of structure (VER_NEED_*).
179 Elf_Half vn_version;
180 // Number of auxiliary Vernaux entries.
181 Elf_Half vn_cnt;
182 // Offset in string table of library name.
183 Elf_Word vn_file;
184 // Byte offset to first Vernaux entry.
185 Elf_Word vn_aux;
186 // Byt eoffset to next Verneed entry.
187 Elf_Word vn_next;
190 // An auxiliary entry in a SHT_GNU_verneed section. This structure is
191 // the same in 32-bit and 64-bit ELF files.
193 struct Vernaux_data
195 // Hash of dependency name.
196 Elf_Word vna_hash;
197 // Bit flags (VER_FLG_*).
198 Elf_Half vna_flags;
199 // Version index used in SHT_GNU_versym entries.
200 Elf_Half vna_other;
201 // Offset in string table of version name.
202 Elf_Word vna_name;
203 // Byte offset to next Vernaux entry.
204 Elf_Word vna_next;
207 } // End namespace internal.
209 } // End namespace elfcpp.
211 #endif // !defined(ELFCPP_INTERNAL_H)