Lines Matching refs:ex
115 get_mid(const Elf32_Ehdr *ex)
117 switch (ex->e_machine) {
137 if (ex->e_ident[EI_DATA] == ELFDATA2LSB)
155 if (ex->e_ident[EI_CLASS] == ELFCLASS32)
172 warnx("Unsupported machine `%d'", ex->e_machine);
195 Elf32_Ehdr ex;
243 i = read(infile, &ex, sizeof ex);
244 if (i != sizeof ex) {
251 ex.e_type = bswap16(ex.e_type);
252 ex.e_machine = bswap16(ex.e_machine);
253 ex.e_version = bswap32(ex.e_version);
254 ex.e_entry = bswap32(ex.e_entry);
255 ex.e_phoff = bswap32(ex.e_phoff);
256 ex.e_shoff = bswap32(ex.e_shoff);
257 ex.e_flags = bswap32(ex.e_flags);
258 ex.e_ehsize = bswap16(ex.e_ehsize);
259 ex.e_phentsize = bswap16(ex.e_phentsize);
260 ex.e_phnum = bswap16(ex.e_phnum);
261 ex.e_shentsize = bswap16(ex.e_shentsize);
262 ex.e_shnum = bswap16(ex.e_shnum);
263 ex.e_shstrndx = bswap16(ex.e_shstrndx);
266 if (ex.e_ident[EI_CLASS] == ELFCLASS64)
270 ph = saveRead(infile, ex.e_phoff,
271 (size_t)ex.e_phnum * sizeof(Elf32_Phdr), "ph");
273 bswap32_region((int32_t*)ph, sizeof(Elf32_Phdr) * ex.e_phnum);
276 sh = saveRead(infile, ex.e_shoff,
277 (size_t)ex.e_shnum * sizeof(Elf32_Shdr), "sh");
279 bswap32_region((int32_t*)sh, sizeof(Elf32_Shdr) * ex.e_shnum);
282 shstrtab = saveRead(infile, sh[ex.e_shstrndx].sh_offset,
283 (size_t)sh[ex.e_shstrndx].sh_size, "shstrtab");
287 symTypeTable = malloc(ex.e_shnum * sizeof(int));
290 memset(symTypeTable, 0, ex.e_shnum * sizeof(int));
294 for (i = 0; i < ex.e_shnum; i++) {
311 qsort(ph, ex.e_phnum, sizeof(Elf32_Phdr), phcmp);
312 for (i = 0; i < ex.e_phnum; i++) {
372 mid = get_mid(&ex);
379 aex.a_entry = ex.e_entry;
408 for (i = 0; i < ex.e_phnum; i++) {