Lines Matching defs:eif
49 static struct elfinfo eif;
55 if (memcmp((char *)eif.ehdr->e_ident, ELFMAG, SELFMAG) != 0 ||
56 eif.ehdr->e_ident[EI_CLASS] != ELFCLASS ||
57 eif.ehdr->e_type != ET_REL) {
104 for (i = 0; i < eif.symcnt; i++) {
105 sym = &eif.symtab[i];
113 buf = eif.strtab + sym->st_name;
129 for (i = 0; i < eif.ehdr->e_shnum; i++) {
130 if (eif.shdr[i].sh_name == 0) {
133 buf = eif.shstrtab + eif.shdr[i].sh_name;
135 return &eif.shdr[i];
153 if (symidx >= eif.symcnt) {
156 sym = &eif.symtab[symidx];
157 buf = eif.strtab + sym->st_name;
166 return (uintptr_t)((uint8_t *)eif.ehdr +
175 return (uintptr_t)((uint8_t *)eif.ehdr +
181 if (sym->st_shndx >= eif.ehdr->e_shnum) {
184 if (!elf_section_mappable(&eif.shdr[sym->st_shndx])) {
292 memset(&eif, 0, sizeof(struct elfinfo));
294 eif.ehdr = (Elf_Ehdr *)headva;
295 eif.shdr = (Elf_Shdr *)((uint8_t *)eif.ehdr + eif.ehdr->e_shoff);
306 const vaddr_t headva = (vaddr_t)eif.ehdr;
313 for (i = 0; i < eif.ehdr->e_shnum; i++) {
314 if (eif.shdr[i].sh_type != SHT_STRTAB &&
315 eif.shdr[i].sh_type != SHT_REL &&
316 eif.shdr[i].sh_type != SHT_RELA &&
317 eif.shdr[i].sh_type != SHT_SYMTAB) {
320 if (eif.shdr[i].sh_offset == 0) {
326 offboot = basepa + eif.shdr[i].sh_offset - bootpa;
329 eif.shdr[i].sh_offset = (bootva + offboot - headva);
337 const vaddr_t headva = (vaddr_t)eif.ehdr;
344 for (i = 0; i < eif.ehdr->e_shnum; i++) {
345 shdr = &eif.shdr[i];
382 j = eif.ehdr->e_shstrndx;
386 if (j >= eif.ehdr->e_shnum) {
389 eif.shstrtab = (char *)((uint8_t *)eif.ehdr + eif.shdr[j].sh_offset);
390 eif.shstrsz = eif.shdr[j].sh_size;
393 for (i = 0; i < eif.ehdr->e_shnum; i++) {
394 if (eif.shdr[i].sh_type == SHT_SYMTAB)
397 if (i == eif.ehdr->e_shnum) {
400 if (eif.shdr[i].sh_offset == 0) {
403 eif.symtab = (Elf_Sym *)((uint8_t *)eif.ehdr + eif.shdr[i].sh_offset);
404 eif.symcnt = eif.shdr[i].sh_size / sizeof(Elf_Sym);
407 j = eif.shdr[i].sh_link;
408 if (j == SHN_UNDEF || j >= eif.ehdr->e_shnum) {
411 if (eif.shdr[j].sh_type != SHT_STRTAB) {
414 if (eif.shdr[j].sh_offset == 0) {
417 eif.strtab = (char *)((uint8_t *)eif.ehdr + eif.shdr[j].sh_offset);
418 eif.strsz = eif.shdr[j].sh_size;
424 const vaddr_t baseva = (vaddr_t)eif.ehdr;
434 for (i = 0; i < eif.ehdr->e_shnum; i++) {
435 if (!elf_section_mappable(&eif.shdr[i])) {
439 ASSERT(eif.shdr[i].sh_offset != 0);
440 secva = baseva + eif.shdr[i].sh_offset;
441 for (j = 0; j < eif.symcnt; j++) {
442 sym = &eif.symtab[j];
455 for (i = 0; i < eif.ehdr->e_shnum; i++) {
460 if (eif.shdr[i].sh_type != SHT_REL) {
463 ASSERT(eif.shdr[i].sh_offset != 0);
464 reltab = (Elf_Rel *)((uint8_t *)eif.ehdr + eif.shdr[i].sh_offset);
465 nrel = eif.shdr[i].sh_size / sizeof(Elf_Rel);
467 secidx = eif.shdr[i].sh_info;
468 if (secidx >= eif.ehdr->e_shnum) {
471 if (!elf_section_mappable(&eif.shdr[secidx])) {
472 if (elf_can_drop_unmappable(&eif.shdr[secidx])) {
477 base = (uintptr_t)eif.ehdr + eif.shdr[secidx].sh_offset;
490 for (i = 0; i < eif.ehdr->e_shnum; i++) {
495 if (eif.shdr[i].sh_type != SHT_RELA) {
498 ASSERT(eif.shdr[i].sh_offset != 0);
499 relatab = (Elf_Rela *)((uint8_t *)eif.ehdr + eif.shdr[i].sh_offset);
500 nrela = eif.shdr[i].sh_size / sizeof(Elf_Rela);
502 secidx = eif.shdr[i].sh_info;
503 if (secidx >= eif.ehdr->e_shnum) {
506 if (!elf_section_mappable(&eif.shdr[secidx])) {
507 if (elf_can_drop_unmappable(&eif.shdr[secidx])) {
512 base = (uintptr_t)eif.ehdr + eif.shdr[secidx].sh_offset;