Lines Matching refs:elf
700 static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) in sym_name() argument
702 return sym ? elf->strtab + sym->st_name : ""; in sym_name()
760 static void check_section(const char *modname, struct elf_info *elf, in check_section() argument
763 const char *sec = sech_name(elf, sechdr); in check_section()
975 static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, in find_fromsym() argument
978 return symsearch_find_nearest(elf, addr, secndx, false, ~0); in find_fromsym()
981 static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) in find_tosym() argument
986 if (is_valid_name(elf, sym)) in find_tosym()
993 new_sym = symsearch_find_nearest(elf, addr, get_secindex(elf, sym), in find_tosym()
998 static bool is_executable_section(struct elf_info *elf, unsigned int secndx) in is_executable_section() argument
1000 if (secndx >= elf->num_sections) in is_executable_section()
1003 return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0; in is_executable_section()
1006 static void default_mismatch_handler(const char *modname, struct elf_info *elf, in default_mismatch_handler() argument
1017 from = find_fromsym(elf, faddr, fsecndx); in default_mismatch_handler()
1018 fromsym = sym_name(elf, from); in default_mismatch_handler()
1020 tsym = find_tosym(elf, taddr, tsym); in default_mismatch_handler()
1021 tosym = sym_name(elf, tsym); in default_mismatch_handler()
1049 else if (is_executable_section(elf, get_secindex(elf, tsym))) in default_mismatch_handler()
1064 static void check_export_symbol(struct module *mod, struct elf_info *elf, in check_export_symbol() argument
1074 label = find_fromsym(elf, faddr, elf->export_symbol_secndx); in check_export_symbol()
1075 label_name = sym_name(elf, label); in check_export_symbol()
1090 name = sym_name(elf, sym); in check_export_symbol()
1097 data = sym_get_data(elf, label); /* license */ in check_export_symbol()
1121 if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 && in check_export_symbol()
1122 elf->hdr->e_machine == EM_PARISC && in check_export_symbol()
1134 static void check_section_mismatch(struct module *mod, struct elf_info *elf, in check_section_mismatch() argument
1139 const char *tosec = sec_name(elf, get_secindex(elf, sym)); in check_section_mismatch()
1142 if (module_enabled && elf->export_symbol_secndx == fsecndx) { in check_section_mismatch()
1143 check_export_symbol(mod, elf, faddr, tosec, sym); in check_section_mismatch()
1151 default_mismatch_handler(mod->name, elf, mismatch, sym, in check_section_mismatch()
1299 static void get_rel_type_and_sym(struct elf_info *elf, uint64_t r_info, in get_rel_type_and_sym() argument
1310 bool is_64bit = (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64); in get_rel_type_and_sym()
1312 if (elf->hdr->e_machine == EM_MIPS && is_64bit) { in get_rel_type_and_sym()
1329 static void section_rela(struct module *mod, struct elf_info *elf, in section_rela() argument
1341 get_rel_type_and_sym(elf, rela->r_info, &r_type, &r_sym); in section_rela()
1343 tsym = elf->symtab_start + r_sym; in section_rela()
1346 switch (elf->hdr->e_machine) { in section_rela()
1366 check_section_mismatch(mod, elf, tsym, in section_rela()
1371 static void section_rel(struct module *mod, struct elf_info *elf, in section_rel() argument
1384 get_rel_type_and_sym(elf, rel->r_info, &r_type, &r_sym); in section_rel()
1386 loc = sym_get_data_by_offset(elf, fsecndx, r_offset); in section_rel()
1387 tsym = elf->symtab_start + r_sym; in section_rel()
1389 switch (elf->hdr->e_machine) { in section_rel()
1403 check_section_mismatch(mod, elf, tsym, in section_rel()
1420 static void check_sec_ref(struct module *mod, struct elf_info *elf) in check_sec_ref() argument
1425 for (i = 0; i < elf->num_sections; i++) { in check_sec_ref()
1426 Elf_Shdr *sechdr = &elf->sechdrs[i]; in check_sec_ref()
1428 check_section(mod->name, elf, sechdr); in check_sec_ref()
1433 const char *secname = sec_name(elf, secndx); in check_sec_ref()
1440 start = sym_get_data_by_offset(elf, i, 0); in check_sec_ref()
1444 section_rela(mod, elf, secndx, secname, in check_sec_ref()
1447 section_rel(mod, elf, secndx, secname, in check_sec_ref()