Lines Matching refs:ehdr

14 static Elf_Ehdr ehdr;
96 sec_strtab = secs[ehdr.e_shstrndx].strtab;
97 if (shndx < ehdr.e_shnum)
112 for (i = 0; i < ehdr.e_shnum; i++)
163 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
171 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
179 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
191 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
207 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1)
210 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0)
213 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS)
216 if ((ehdr.e_ident[EI_DATA] != ELFDATA2LSB) &&
217 (ehdr.e_ident[EI_DATA] != ELFDATA2MSB))
220 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT)
224 ehdr.e_type = elf_half_to_cpu(ehdr.e_type);
225 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine);
226 ehdr.e_version = elf_word_to_cpu(ehdr.e_version);
227 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry);
228 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff);
229 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff);
230 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags);
231 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize);
232 ehdr.e_phentsize = elf_half_to_cpu(ehdr.e_phentsize);
233 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum);
234 ehdr.e_shentsize = elf_half_to_cpu(ehdr.e_shentsize);
235 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum);
236 ehdr.e_shstrndx = elf_half_to_cpu(ehdr.e_shstrndx);
238 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN))
241 if (ehdr.e_machine != ELF_MACHINE)
244 if (ehdr.e_version != EV_CURRENT)
247 if (ehdr.e_ehsize != sizeof(Elf_Ehdr))
250 if (ehdr.e_phentsize != sizeof(Elf_Phdr))
253 if (ehdr.e_shentsize != sizeof(Elf_Shdr))
256 if (ehdr.e_shstrndx >= ehdr.e_shnum)
265 secs = calloc(ehdr.e_shnum, sizeof(struct section));
267 die("Unable to allocate %d section headers\n", ehdr.e_shnum);
269 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
270 die("Seek to %d failed: %s\n", ehdr.e_shoff, strerror(errno));
272 for (i = 0; i < ehdr.e_shnum; i++) {
278 i, ehdr.e_shnum, strerror(errno));
289 if (sec->shdr.sh_link < ehdr.e_shnum)
298 for (i = 0; i < ehdr.e_shnum; i++) {
323 for (i = 0; i < ehdr.e_shnum; i++) {
366 for (i = 0; i < ehdr.e_shnum; i++) {
412 for (i = 0; i < ehdr.e_shnum; i++) {
424 i, ehdr.e_shnum, strerror(errno));
438 i, ehdr.e_shnum, strerror(errno));
473 for (i = 0; i < ehdr.e_shnum; i++) {