Lines Matching refs:ehdr

41 static Elf_Ehdr		ehdr;
82 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
90 if (ehdr.e_ident[EI_DATA] == ELFDATA2LSB)
120 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1)
122 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0)
124 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS)
126 if (ehdr.e_ident[EI_DATA] != ELF_ENDIAN)
128 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT)
132 ehdr.e_type = elf_half_to_cpu(ehdr.e_type);
133 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine);
134 ehdr.e_version = elf_word_to_cpu(ehdr.e_version);
135 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry);
136 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff);
137 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff);
138 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags);
139 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize);
140 ehdr.e_phentsize = elf_half_to_cpu(ehdr.e_phentsize);
141 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum);
142 ehdr.e_shentsize = elf_half_to_cpu(ehdr.e_shentsize);
143 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum);
144 ehdr.e_shstrndx = elf_half_to_cpu(ehdr.e_shstrndx);
146 shnum = ehdr.e_shnum;
147 shstrndx = ehdr.e_shstrndx;
149 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN))
151 if (ehdr.e_machine != ELF_MACHINE)
153 if (ehdr.e_version != EV_CURRENT)
155 if (ehdr.e_ehsize != sizeof(Elf_Ehdr))
157 if (ehdr.e_phentsize != sizeof(Elf_Phdr))
159 if (ehdr.e_shentsize != sizeof(Elf_Shdr))
165 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
166 die("Seek to %" FMT " failed: %s\n", ehdr.e_shoff, strerror(errno));
191 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
192 die("Seek to %" FMT " failed: %s\n", ehdr.e_shoff, strerror(errno));