Lines Matching refs:ehdr
14 static Elf_Ehdr ehdr; variable
367 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { in read_ehdr()
371 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { in read_ehdr()
374 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) { in read_ehdr()
377 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { in read_ehdr()
380 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) { in read_ehdr()
384 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr()
385 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr()
386 ehdr.e_version = elf_word_to_cpu(ehdr.e_version); in read_ehdr()
387 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr()
388 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff); in read_ehdr()
389 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff); in read_ehdr()
390 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags); in read_ehdr()
391 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize); in read_ehdr()
392 ehdr.e_phentsize = elf_half_to_cpu(ehdr.e_phentsize); in read_ehdr()
393 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum); in read_ehdr()
394 ehdr.e_shentsize = elf_half_to_cpu(ehdr.e_shentsize); in read_ehdr()
395 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum); in read_ehdr()
396 ehdr.e_shstrndx = elf_half_to_cpu(ehdr.e_shstrndx); in read_ehdr()
398 shnum = ehdr.e_shnum; in read_ehdr()
399 shstrndx = ehdr.e_shstrndx; in read_ehdr()
401 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN)) in read_ehdr()
403 if (ehdr.e_machine != ELF_MACHINE) in read_ehdr()
405 if (ehdr.e_version != EV_CURRENT) in read_ehdr()
407 if (ehdr.e_ehsize != sizeof(Elf_Ehdr)) in read_ehdr()
409 if (ehdr.e_phentsize != sizeof(Elf_Phdr)) in read_ehdr()
411 if (ehdr.e_shentsize != sizeof(Elf_Shdr)) in read_ehdr()
418 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) in read_ehdr()
419 die("Seek to %" FMT " failed: %s\n", ehdr.e_shoff, strerror(errno)); in read_ehdr()
445 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) { in read_shdrs()
447 ehdr.e_shoff, strerror(errno)); in read_shdrs()