Lines Matching defs:ehdr
14 static Elf_Ehdr ehdr;
340 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) {
344 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) {
347 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) {
350 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) {
353 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) {
357 ehdr.e_type = elf_half_to_cpu(ehdr.e_type);
358 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine);
359 ehdr.e_version = elf_word_to_cpu(ehdr.e_version);
360 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry);
361 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff);
362 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff);
363 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags);
364 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize);
365 ehdr.e_phentsize = elf_half_to_cpu(ehdr.e_phentsize);
366 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum);
367 ehdr.e_shentsize = elf_half_to_cpu(ehdr.e_shentsize);
368 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum);
369 ehdr.e_shstrndx = elf_half_to_cpu(ehdr.e_shstrndx);
371 shnum = ehdr.e_shnum;
372 shstrndx = ehdr.e_shstrndx;
374 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN))
376 if (ehdr.e_machine != ELF_MACHINE)
378 if (ehdr.e_version != EV_CURRENT)
380 if (ehdr.e_ehsize != sizeof(Elf_Ehdr))
382 if (ehdr.e_phentsize != sizeof(Elf_Phdr))
384 if (ehdr.e_shentsize != sizeof(Elf_Shdr))
391 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
392 die("Seek to %d failed: %s\n", ehdr.e_shoff, strerror(errno));
418 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) {
420 ehdr.e_shoff, strerror(errno));