Lines Matching refs:ehdr
21 static Elf32_Ehdr ehdr; variable
204 sec_strtab = secs[ehdr.e_shstrndx].strtab; in sec_name()
206 if (shndx < ehdr.e_shnum) { in sec_name()
254 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { in read_ehdr()
258 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) { in read_ehdr()
261 if (ehdr.e_ident[EI_CLASS] != ELFCLASS32) { in read_ehdr()
264 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { in read_ehdr()
267 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) { in read_ehdr()
271 ehdr.e_type = elf16_to_cpu(ehdr.e_type); in read_ehdr()
272 ehdr.e_machine = elf16_to_cpu(ehdr.e_machine); in read_ehdr()
273 ehdr.e_version = elf32_to_cpu(ehdr.e_version); in read_ehdr()
274 ehdr.e_entry = elf32_to_cpu(ehdr.e_entry); in read_ehdr()
275 ehdr.e_phoff = elf32_to_cpu(ehdr.e_phoff); in read_ehdr()
276 ehdr.e_shoff = elf32_to_cpu(ehdr.e_shoff); in read_ehdr()
277 ehdr.e_flags = elf32_to_cpu(ehdr.e_flags); in read_ehdr()
278 ehdr.e_ehsize = elf16_to_cpu(ehdr.e_ehsize); in read_ehdr()
279 ehdr.e_phentsize = elf16_to_cpu(ehdr.e_phentsize); in read_ehdr()
280 ehdr.e_phnum = elf16_to_cpu(ehdr.e_phnum); in read_ehdr()
281 ehdr.e_shentsize = elf16_to_cpu(ehdr.e_shentsize); in read_ehdr()
282 ehdr.e_shnum = elf16_to_cpu(ehdr.e_shnum); in read_ehdr()
283 ehdr.e_shstrndx = elf16_to_cpu(ehdr.e_shstrndx); in read_ehdr()
285 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN)) { in read_ehdr()
288 if (ehdr.e_machine != EM_386) { in read_ehdr()
291 if (ehdr.e_version != EV_CURRENT) { in read_ehdr()
294 if (ehdr.e_ehsize != sizeof(Elf32_Ehdr)) { in read_ehdr()
297 if (ehdr.e_phentsize != sizeof(Elf32_Phdr)) { in read_ehdr()
300 if (ehdr.e_shentsize != sizeof(Elf32_Shdr)) { in read_ehdr()
303 if (ehdr.e_shstrndx >= ehdr.e_shnum) { in read_ehdr()
313 secs = calloc(ehdr.e_shnum, sizeof(struct section)); in read_shdrs()
316 ehdr.e_shnum); in read_shdrs()
318 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0) { in read_shdrs()
320 ehdr.e_shoff, strerror(errno)); in read_shdrs()
322 for (i = 0; i < ehdr.e_shnum; i++) { in read_shdrs()
326 i, ehdr.e_shnum, strerror(errno)); in read_shdrs()
337 if (sec->shdr.sh_link < ehdr.e_shnum) in read_shdrs()
346 for (i = 0; i < ehdr.e_shnum; i++) { in read_strtabs()
371 for (i = 0; i < ehdr.e_shnum; i++) { in read_symtabs()
404 for (i = 0; i < ehdr.e_shnum; i++) { in read_relocs()
437 for (i = 0; i < ehdr.e_shnum; i++) { in print_absolute_symbols()
469 for (i = 0; i < ehdr.e_shnum; i++) { in print_absolute_relocs()
538 for (i = 0; i < ehdr.e_shnum; i++) { in walk_relocs()