Lines Matching refs:elf
702 static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) in sym_name() argument
704 return sym ? elf->strtab + sym->st_name : ""; in sym_name()
762 static void check_section(const char *modname, struct elf_info *elf, in check_section() argument
765 const char *sec = sech_name(elf, sechdr); in check_section()
977 static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, in find_fromsym() argument
980 return symsearch_find_nearest(elf, addr, secndx, false, ~0); in find_fromsym()
983 static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) in find_tosym() argument
988 if (is_valid_name(elf, sym)) in find_tosym()
995 new_sym = symsearch_find_nearest(elf, addr, get_secindex(elf, sym), in find_tosym()
1000 static bool is_executable_section(struct elf_info *elf, unsigned int secndx) in is_executable_section() argument
1002 if (secndx >= elf->num_sections) in is_executable_section()
1005 return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0; in is_executable_section()
1008 static void default_mismatch_handler(const char *modname, struct elf_info *elf, in default_mismatch_handler() argument
1019 from = find_fromsym(elf, faddr, fsecndx); in default_mismatch_handler()
1020 fromsym = sym_name(elf, from); in default_mismatch_handler()
1022 tsym = find_tosym(elf, taddr, tsym); in default_mismatch_handler()
1023 tosym = sym_name(elf, tsym); in default_mismatch_handler()
1051 else if (is_executable_section(elf, get_secindex(elf, tsym))) in default_mismatch_handler()
1066 static void check_export_symbol(struct module *mod, struct elf_info *elf, in check_export_symbol() argument
1076 label = find_fromsym(elf, faddr, elf->export_symbol_secndx); in check_export_symbol()
1077 label_name = sym_name(elf, label); in check_export_symbol()
1092 name = sym_name(elf, sym); in check_export_symbol()
1099 data = sym_get_data(elf, label); /* license */ in check_export_symbol()
1123 if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 && in check_export_symbol()
1124 elf->hdr->e_machine == EM_PARISC && in check_export_symbol()
1136 static void check_section_mismatch(struct module *mod, struct elf_info *elf, in check_section_mismatch() argument
1141 const char *tosec = sec_name(elf, get_secindex(elf, sym)); in check_section_mismatch()
1144 if (module_enabled && elf->export_symbol_secndx == fsecndx) { in check_section_mismatch()
1145 check_export_symbol(mod, elf, faddr, tosec, sym); in check_section_mismatch()
1153 default_mismatch_handler(mod->name, elf, mismatch, sym, in check_section_mismatch()
1301 static void get_rel_type_and_sym(struct elf_info *elf, uint64_t r_info, in get_rel_type_and_sym() argument
1312 bool is_64bit = (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64); in get_rel_type_and_sym()
1314 if (elf->hdr->e_machine == EM_MIPS && is_64bit) { in get_rel_type_and_sym()
1331 static void section_rela(struct module *mod, struct elf_info *elf, in section_rela() argument
1343 get_rel_type_and_sym(elf, rela->r_info, &r_type, &r_sym); in section_rela()
1345 tsym = elf->symtab_start + r_sym; in section_rela()
1348 switch (elf->hdr->e_machine) { in section_rela()
1368 check_section_mismatch(mod, elf, tsym, in section_rela()
1373 static void section_rel(struct module *mod, struct elf_info *elf, in section_rel() argument
1386 get_rel_type_and_sym(elf, rel->r_info, &r_type, &r_sym); in section_rel()
1388 loc = sym_get_data_by_offset(elf, fsecndx, r_offset); in section_rel()
1389 tsym = elf->symtab_start + r_sym; in section_rel()
1391 switch (elf->hdr->e_machine) { in section_rel()
1405 check_section_mismatch(mod, elf, tsym, in section_rel()
1422 static void check_sec_ref(struct module *mod, struct elf_info *elf) in check_sec_ref() argument
1427 for (i = 0; i < elf->num_sections; i++) { in check_sec_ref()
1428 Elf_Shdr *sechdr = &elf->sechdrs[i]; in check_sec_ref()
1430 check_section(mod->name, elf, sechdr); in check_sec_ref()
1435 const char *secname = sec_name(elf, secndx); in check_sec_ref()
1442 start = sym_get_data_by_offset(elf, i, 0); in check_sec_ref()
1446 section_rela(mod, elf, secndx, secname, in check_sec_ref()
1449 section_rel(mod, elf, secndx, secname, in check_sec_ref()