Lines Matching defs:ehdr
14 static Elf_Ehdr ehdr;
106 sec_strtab = secs[ehdr.e_shstrndx].strtab;
107 if (shndx < ehdr.e_shnum)
122 for (i = 0; i < ehdr.e_shnum; i++)
142 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1)
145 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0)
148 if (ehdr.e_ident[EI_CLASS] != ELF_CLASS)
151 if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB)
154 if (ehdr.e_ident[EI_VERSION] != EV_CURRENT)
157 if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN))
160 if (ehdr.e_machine != ELF_MACHINE)
163 if (ehdr.e_version != EV_CURRENT)
166 if (ehdr.e_ehsize != sizeof(Elf_Ehdr))
169 if (ehdr.e_phentsize != sizeof(Elf_Phdr))
172 if (ehdr.e_shentsize != sizeof(Elf_Shdr))
175 if (ehdr.e_shstrndx >= ehdr.e_shnum)
183 secs = calloc(ehdr.e_shnum, sizeof(struct section));
185 die("Unable to allocate %d section headers\n", ehdr.e_shnum);
187 if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
188 die("Seek to %d failed: %s\n", ehdr.e_shoff, strerror(errno));
190 for (i = 0; i < ehdr.e_shnum; i++) {
196 i, ehdr.e_shnum, strerror(errno));
198 if (sec->shdr.sh_link < ehdr.e_shnum)
207 for (i = 0; i < ehdr.e_shnum; i++) {
232 for (i = 0; i < ehdr.e_shnum; i++) {
266 for (i = 0; i < ehdr.e_shnum; i++) {
299 for (i = 0; i < ehdr.e_shnum; i++) {
311 i, ehdr.e_shnum, strerror(errno));
325 i, ehdr.e_shnum, strerror(errno));
360 for (i = 0; i < ehdr.e_shnum; i++) {