Lines Matching refs:ex
116 get_mid(const Elf32_Ehdr *ex)
118 switch (ex->e_machine) {
138 if (ex->e_ident[EI_DATA] == ELFDATA2LSB)
156 if (ex->e_ident[EI_CLASS] == ELFCLASS32)
173 warnx("Unsupported machine `%d'", ex->e_machine);
196 Elf32_Ehdr ex;
244 i = read(infile, &ex, sizeof ex);
245 if (i != sizeof ex) {
252 ex.e_type = bswap16(ex.e_type);
253 ex.e_machine = bswap16(ex.e_machine);
254 ex.e_version = bswap32(ex.e_version);
255 ex.e_entry = bswap32(ex.e_entry);
256 ex.e_phoff = bswap32(ex.e_phoff);
257 ex.e_shoff = bswap32(ex.e_shoff);
258 ex.e_flags = bswap32(ex.e_flags);
259 ex.e_ehsize = bswap16(ex.e_ehsize);
260 ex.e_phentsize = bswap16(ex.e_phentsize);
261 ex.e_phnum = bswap16(ex.e_phnum);
262 ex.e_shentsize = bswap16(ex.e_shentsize);
263 ex.e_shnum = bswap16(ex.e_shnum);
264 ex.e_shstrndx = bswap16(ex.e_shstrndx);
267 if (ex.e_ident[EI_CLASS] == ELFCLASS64)
271 ph = saveRead(infile, ex.e_phoff,
272 (size_t)ex.e_phnum * sizeof(Elf32_Phdr), "ph");
274 bswap32_region((int32_t*)ph, sizeof(Elf32_Phdr) * ex.e_phnum);
277 sh = saveRead(infile, ex.e_shoff,
278 (size_t)ex.e_shnum * sizeof(Elf32_Shdr), "sh");
280 bswap32_region((int32_t*)sh, sizeof(Elf32_Shdr) * ex.e_shnum);
283 shstrtab = saveRead(infile, sh[ex.e_shstrndx].sh_offset,
284 (size_t)sh[ex.e_shstrndx].sh_size, "shstrtab");
288 symTypeTable = malloc(ex.e_shnum * sizeof(int));
291 memset(symTypeTable, 0, ex.e_shnum * sizeof(int));
295 for (i = 0; i < ex.e_shnum; i++) {
312 qsort(ph, ex.e_phnum, sizeof(Elf32_Phdr), phcmp);
313 for (i = 0; i < ex.e_phnum; i++) {
373 mid = get_mid(&ex);
380 aex.a_entry = ex.e_entry;
409 for (i = 0; i < ex.e_phnum; i++) {