Lines Matching refs:sechdrs
183 Elf_Shdr *sechdrs, const char *secstrings) in layout_sections() argument
197 sechdrs[i].sh_entsize = ~0UL; in layout_sections()
201 Elf_Shdr *s = &sechdrs[i]; in layout_sections()
425 static int apply_relocations(Elf32_Shdr *sechdrs, in apply_relocations() argument
431 Elf32_Rel *rel = (void *) sechdrs[relsec].sh_addr; in apply_relocations()
438 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { in apply_relocations()
442 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr in apply_relocations()
445 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr in apply_relocations()
477 static void simplify_symbols(Elf_Shdr *sechdrs, in simplify_symbols() argument
483 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; in simplify_symbols()
485 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); in simplify_symbols()
490 if (strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) == 0) { in simplify_symbols()
491 bssbase = sechdrs[i].sh_addr; in simplify_symbols()
524 secbase = sechdrs[sym[i].st_shndx].sh_addr; in simplify_symbols()
536 static void dump_elfsymbols(Elf_Shdr *sechdrs, unsigned int symindex, in dump_elfsymbols() argument
539 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; in dump_elfsymbols()
540 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); in dump_elfsymbols()
550 static int find_vpe_symbols(struct vpe *v, Elf_Shdr *sechdrs, in find_vpe_symbols() argument
554 Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; in find_vpe_symbols()
555 unsigned int i, n = sechdrs[symindex].sh_size / sizeof(Elf_Sym); in find_vpe_symbols()
579 Elf_Shdr *sechdrs; in vpe_elfload() local
596 || hdr->e_shentsize != sizeof(*sechdrs)) { in vpe_elfload()
612 sechdrs = (void *)hdr + hdr->e_shoff; in vpe_elfload()
613 secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; in vpe_elfload()
614 sechdrs[0].sh_addr = 0; in vpe_elfload()
621 if ((sechdrs[i].sh_type != SHT_NOBITS) && in vpe_elfload()
622 (len < sechdrs[i].sh_offset + sechdrs[i].sh_size)) { in vpe_elfload()
630 sechdrs[i].sh_addr = (size_t) hdr + in vpe_elfload()
631 sechdrs[i].sh_offset; in vpe_elfload()
634 if (sechdrs[i].sh_type == SHT_SYMTAB) { in vpe_elfload()
636 strindex = sechdrs[i].sh_link; in vpe_elfload()
638 sechdrs[strindex].sh_offset; in vpe_elfload()
641 layout_sections(&mod, hdr, sechdrs, secstrings); in vpe_elfload()
654 if (!(sechdrs[i].sh_flags & SHF_ALLOC)) in vpe_elfload()
657 dest = v->load_addr + sechdrs[i].sh_entsize; in vpe_elfload()
659 if (sechdrs[i].sh_type != SHT_NOBITS) in vpe_elfload()
660 memcpy(dest, (void *)sechdrs[i].sh_addr, in vpe_elfload()
661 sechdrs[i].sh_size); in vpe_elfload()
663 sechdrs[i].sh_addr = (unsigned long)dest; in vpe_elfload()
666 secstrings + sechdrs[i].sh_name, in vpe_elfload()
667 sechdrs[i].sh_addr); in vpe_elfload()
671 simplify_symbols(sechdrs, symindex, strtab, secstrings, in vpe_elfload()
676 const char *strtab = (char *)sechdrs[strindex].sh_addr; in vpe_elfload()
677 unsigned int info = sechdrs[i].sh_info; in vpe_elfload()
684 if (!(sechdrs[info].sh_flags & SHF_ALLOC)) in vpe_elfload()
687 if (sechdrs[i].sh_type == SHT_REL) in vpe_elfload()
688 err = apply_relocations(sechdrs, strtab, in vpe_elfload()
690 else if (sechdrs[i].sh_type == SHT_RELA) in vpe_elfload()
691 err = apply_relocate_add(sechdrs, strtab, in vpe_elfload()
714 if (sechdrs[i].sh_type == SHT_SYMTAB) { in vpe_elfload()
716 strindex = sechdrs[i].sh_link; in vpe_elfload()
718 sechdrs[strindex].sh_offset; in vpe_elfload()
724 sechdrs[i].sh_addr = (size_t) hdr + in vpe_elfload()
725 sechdrs[i].sh_offset; in vpe_elfload()
734 if ((find_vpe_symbols(v, sechdrs, symindex, strtab, &mod)) < 0) { in vpe_elfload()