Lines Matching refs:ehdr
14 static Elf_Ehdr ehdr;
368 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) {
372 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) {
375 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) {
378 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) {
381 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) {
385 ehdr.e_type = elf_half_to_cpu(ehdr.e_type);
386 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine);
387 ehdr.e_version = elf_word_to_cpu(ehdr.e_version);
388 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry);
389 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff);
390 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff);
391 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags);
392 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize);
393 ehdr.e_phentsize = elf_half_to_cpu(ehdr.e_phentsize);
394 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum);
395 ehdr.e_shentsize = elf_half_to_cpu(ehdr.e_shentsize);
396 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum);
397 ehdr.e_shstrndx = elf_half_to_cpu(ehdr.e_shstrndx);
399 shnum = ehdr.e_shnum;
400 shstrndx = ehdr.e_shstrndx;
402 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN))
404 if (ehdr.e_machine != ELF_MACHINE)
406 if (ehdr.e_version != EV_CURRENT)
408 if (ehdr.e_ehsize != sizeof(Elf_Ehdr))
410 if (ehdr.e_phentsize != sizeof(Elf_Phdr))
412 if (ehdr.e_shentsize != sizeof(Elf_Shdr))
419 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
420 die("Seek to %" FMT " failed: %s\n", ehdr.e_shoff, strerror(errno));
446 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) {
448 ehdr.e_shoff, strerror(errno));