Lines Matching refs:elf

259 static const char *sec_name(struct elf_info *elf, int secindex);
263 static enum export export_from_secname(struct elf_info *elf, unsigned int sec) in export_from_secname() argument
265 const char *secname = sec_name(elf, sec); in export_from_secname()
281 static enum export export_from_sec(struct elf_info *elf, unsigned int sec) in export_from_sec() argument
283 if (sec == elf->export_sec) in export_from_sec()
285 else if (sec == elf->export_unused_sec) in export_from_sec()
287 else if (sec == elf->export_gpl_sec) in export_from_sec()
289 else if (sec == elf->export_unused_gpl_sec) in export_from_sec()
291 else if (sec == elf->export_gpl_future_sec) in export_from_sec()
730 static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) in sym_name() argument
733 return elf->strtab + sym->st_name; in sym_name()
738 static const char *sec_name(struct elf_info *elf, int secindex) in sec_name() argument
740 Elf_Shdr *sechdrs = elf->sechdrs; in sec_name()
741 return (void *)elf->hdr + in sec_name()
742 elf->sechdrs[elf->secindex_strings].sh_offset + in sec_name()
746 static const char *sech_name(struct elf_info *elf, Elf_Shdr *sechdr) in sech_name() argument
748 return (void *)elf->hdr + in sech_name()
749 elf->sechdrs[elf->secindex_strings].sh_offset + in sech_name()
835 static void check_section(const char *modname, struct elf_info *elf, in check_section() argument
838 const char *sec = sech_name(elf, sechdr); in check_section()
1137 static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr, in find_elf_symbol() argument
1149 relsym_secindex = get_secindex(elf, relsym); in find_elf_symbol()
1150 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { in find_elf_symbol()
1151 if (get_secindex(elf, sym) != relsym_secindex) in find_elf_symbol()
1188 static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) in is_valid_name() argument
1190 const char *name = elf->strtab + sym->st_name; in is_valid_name()
1203 static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, in find_elf_symbol2() argument
1210 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { in find_elf_symbol2()
1215 symsec = sec_name(elf, get_secindex(elf, sym)); in find_elf_symbol2()
1218 if (!is_valid_name(elf, sym)) in find_elf_symbol2()
1441 static void check_section_mismatch(const char *modname, struct elf_info *elf, in check_section_mismatch() argument
1447 tosec = sec_name(elf, get_secindex(elf, sym)); in check_section_mismatch()
1455 from = find_elf_symbol2(elf, r->r_offset, fromsec); in check_section_mismatch()
1456 fromsym = sym_name(elf, from); in check_section_mismatch()
1457 to = find_elf_symbol(elf, r->r_addend, sym); in check_section_mismatch()
1458 tosym = sym_name(elf, to); in check_section_mismatch()
1471 static unsigned int *reloc_location(struct elf_info *elf, in reloc_location() argument
1474 Elf_Shdr *sechdrs = elf->sechdrs; in reloc_location()
1477 return (void *)elf->hdr + sechdrs[section].sh_offset + in reloc_location()
1481 static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) in addend_386_rel() argument
1484 unsigned int *location = reloc_location(elf, sechdr, r); in addend_386_rel()
1493 if (elf->hdr->e_type == ET_EXEC) in addend_386_rel()
1500 static int addend_arm_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) in addend_arm_rel() argument
1508 (elf->symtab_start + ELF_R_SYM(r->r_info)); in addend_arm_rel()
1512 r->r_addend = (int)(long)(elf->hdr + in addend_arm_rel()
1522 static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) in addend_mips_rel() argument
1525 unsigned int *location = reloc_location(elf, sechdr, r); in addend_mips_rel()
1545 static void section_rela(const char *modname, struct elf_info *elf, in section_rela() argument
1554 Elf_Rela *start = (void *)elf->hdr + sechdr->sh_offset; in section_rela()
1557 fromsec = sech_name(elf, sechdr); in section_rela()
1566 if (elf->hdr->e_machine == EM_MIPS) { in section_rela()
1581 sym = elf->symtab_start + r_sym; in section_rela()
1585 check_section_mismatch(modname, elf, &r, sym, fromsec); in section_rela()
1589 static void section_rel(const char *modname, struct elf_info *elf, in section_rel() argument
1598 Elf_Rel *start = (void *)elf->hdr + sechdr->sh_offset; in section_rel()
1601 fromsec = sech_name(elf, sechdr); in section_rel()
1610 if (elf->hdr->e_machine == EM_MIPS) { in section_rel()
1625 switch (elf->hdr->e_machine) { in section_rel()
1627 if (addend_386_rel(elf, sechdr, &r)) in section_rel()
1631 if (addend_arm_rel(elf, sechdr, &r)) in section_rel()
1635 if (addend_mips_rel(elf, sechdr, &r)) in section_rel()
1639 sym = elf->symtab_start + r_sym; in section_rel()
1643 check_section_mismatch(modname, elf, &r, sym, fromsec); in section_rel()
1660 struct elf_info *elf) in check_sec_ref() argument
1663 Elf_Shdr *sechdrs = elf->sechdrs; in check_sec_ref()
1666 for (i = 0; i < elf->num_sections; i++) { in check_sec_ref()
1667 check_section(modname, elf, &elf->sechdrs[i]); in check_sec_ref()
1670 section_rela(modname, elf, &elf->sechdrs[i]); in check_sec_ref()
1672 section_rel(modname, elf, &elf->sechdrs[i]); in check_sec_ref()