Lines Matching refs:ehdr

14 static Elf_Ehdr		ehdr;  variable
341 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { in read_ehdr()
345 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { in read_ehdr()
348 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS) { in read_ehdr()
351 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { in read_ehdr()
354 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) { in read_ehdr()
358 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr()
359 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr()
360 ehdr.e_version = elf_word_to_cpu(ehdr.e_version); in read_ehdr()
361 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr()
362 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff); in read_ehdr()
363 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff); in read_ehdr()
364 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags); in read_ehdr()
365 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize); in read_ehdr()
366 ehdr.e_phentsize = elf_half_to_cpu(ehdr.e_phentsize); in read_ehdr()
367 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum); in read_ehdr()
368 ehdr.e_shentsize = elf_half_to_cpu(ehdr.e_shentsize); in read_ehdr()
369 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum); in read_ehdr()
370 ehdr.e_shstrndx = elf_half_to_cpu(ehdr.e_shstrndx); in read_ehdr()
372 shnum = ehdr.e_shnum; in read_ehdr()
373 shstrndx = ehdr.e_shstrndx; in read_ehdr()
375 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN)) in read_ehdr()
377 if (ehdr.e_machine != ELF_MACHINE) in read_ehdr()
379 if (ehdr.e_version != EV_CURRENT) in read_ehdr()
381 if (ehdr.e_ehsize != sizeof(Elf_Ehdr)) in read_ehdr()
383 if (ehdr.e_phentsize != sizeof(Elf_Phdr)) in read_ehdr()
385 if (ehdr.e_shentsize != sizeof(Elf_Shdr)) in read_ehdr()
392 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) in read_ehdr()
393 die("Seek to %d failed: %s\n", ehdr.e_shoff, strerror(errno)); in read_ehdr()
419 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) { in read_shdrs()
421 ehdr.e_shoff, strerror(errno)); in read_shdrs()