Lines Matching refs:elf
711 static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) in sym_name() argument
713 return sym ? elf->strtab + sym->st_name : ""; in sym_name()
771 static void check_section(const char *modname, struct elf_info *elf, in check_section() argument
774 const char *sec = sech_name(elf, sechdr); in check_section()
987 static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, in find_fromsym() argument
990 return symsearch_find_nearest(elf, addr, secndx, false, ~0); in find_fromsym()
993 static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) in find_tosym() argument
998 if (is_valid_name(elf, sym)) in find_tosym()
1005 new_sym = symsearch_find_nearest(elf, addr, get_secindex(elf, sym), in find_tosym()
1010 static bool is_executable_section(struct elf_info *elf, unsigned int secndx) in is_executable_section() argument
1012 if (secndx >= elf->num_sections) in is_executable_section()
1015 return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0; in is_executable_section()
1018 static void default_mismatch_handler(const char *modname, struct elf_info *elf, in default_mismatch_handler() argument
1029 from = find_fromsym(elf, faddr, fsecndx); in default_mismatch_handler()
1030 fromsym = sym_name(elf, from); in default_mismatch_handler()
1032 tsym = find_tosym(elf, taddr, tsym); in default_mismatch_handler()
1033 tosym = sym_name(elf, tsym); in default_mismatch_handler()
1061 else if (is_executable_section(elf, get_secindex(elf, tsym))) in default_mismatch_handler()
1076 static void check_export_symbol(struct module *mod, struct elf_info *elf, in check_export_symbol() argument
1086 label = find_fromsym(elf, faddr, elf->export_symbol_secndx); in check_export_symbol()
1087 label_name = sym_name(elf, label); in check_export_symbol()
1102 name = sym_name(elf, sym); in check_export_symbol()
1109 data = sym_get_data(elf, label); /* license */ in check_export_symbol()
1133 if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 && in check_export_symbol()
1134 elf->hdr->e_machine == EM_PARISC && in check_export_symbol()
1146 static void check_section_mismatch(struct module *mod, struct elf_info *elf, in check_section_mismatch() argument
1151 const char *tosec = sec_name(elf, get_secindex(elf, sym)); in check_section_mismatch()
1154 if (module_enabled && elf->export_symbol_secndx == fsecndx) { in check_section_mismatch()
1155 check_export_symbol(mod, elf, faddr, tosec, sym); in check_section_mismatch()
1163 default_mismatch_handler(mod->name, elf, mismatch, sym, in check_section_mismatch()
1311 static void get_rel_type_and_sym(struct elf_info *elf, uint64_t r_info, in get_rel_type_and_sym() argument
1322 bool is_64bit = (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64); in get_rel_type_and_sym()
1324 if (elf->hdr->e_machine == EM_MIPS && is_64bit) { in get_rel_type_and_sym()
1341 static void section_rela(struct module *mod, struct elf_info *elf, in section_rela() argument
1353 get_rel_type_and_sym(elf, rela->r_info, &r_type, &r_sym); in section_rela()
1355 tsym = elf->symtab_start + r_sym; in section_rela()
1358 switch (elf->hdr->e_machine) { in section_rela()
1378 check_section_mismatch(mod, elf, tsym, in section_rela()
1383 static void section_rel(struct module *mod, struct elf_info *elf, in section_rel() argument
1396 get_rel_type_and_sym(elf, rel->r_info, &r_type, &r_sym); in section_rel()
1398 loc = sym_get_data_by_offset(elf, fsecndx, r_offset); in section_rel()
1399 tsym = elf->symtab_start + r_sym; in section_rel()
1401 switch (elf->hdr->e_machine) { in section_rel()
1415 check_section_mismatch(mod, elf, tsym, in section_rel()
1432 static void check_sec_ref(struct module *mod, struct elf_info *elf) in check_sec_ref() argument
1437 for (i = 0; i < elf->num_sections; i++) { in check_sec_ref()
1438 Elf_Shdr *sechdr = &elf->sechdrs[i]; in check_sec_ref()
1440 check_section(mod->name, elf, sechdr); in check_sec_ref()
1445 const char *secname = sec_name(elf, secndx); in check_sec_ref()
1452 start = sym_get_data_by_offset(elf, i, 0); in check_sec_ref()
1456 section_rela(mod, elf, secndx, secname, in check_sec_ref()
1459 section_rel(mod, elf, secndx, secname, in check_sec_ref()