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()
986 static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, in find_fromsym() argument
989 return symsearch_find_nearest(elf, addr, secndx, false, ~0); in find_fromsym()
992 static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) in find_tosym() argument
997 if (is_valid_name(elf, sym)) in find_tosym()
1004 new_sym = symsearch_find_nearest(elf, addr, get_secindex(elf, sym), in find_tosym()
1009 static bool is_executable_section(struct elf_info *elf, unsigned int secndx) in is_executable_section() argument
1011 if (secndx >= elf->num_sections) in is_executable_section()
1014 return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0; in is_executable_section()
1017 static void default_mismatch_handler(const char *modname, struct elf_info *elf, in default_mismatch_handler() argument
1028 from = find_fromsym(elf, faddr, fsecndx); in default_mismatch_handler()
1029 fromsym = sym_name(elf, from); in default_mismatch_handler()
1031 tsym = find_tosym(elf, taddr, tsym); in default_mismatch_handler()
1032 tosym = sym_name(elf, tsym); in default_mismatch_handler()
1060 else if (is_executable_section(elf, get_secindex(elf, tsym))) in default_mismatch_handler()
1075 static void check_export_symbol(struct module *mod, struct elf_info *elf, in check_export_symbol() argument
1085 label = find_fromsym(elf, faddr, elf->export_symbol_secndx); in check_export_symbol()
1086 label_name = sym_name(elf, label); in check_export_symbol()
1101 name = sym_name(elf, sym); in check_export_symbol()
1108 data = sym_get_data(elf, label); /* license */ in check_export_symbol()
1132 if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 && in check_export_symbol()
1133 elf->hdr->e_machine == EM_PARISC && in check_export_symbol()
1145 static void check_section_mismatch(struct module *mod, struct elf_info *elf, in check_section_mismatch() argument
1150 const char *tosec = sec_name(elf, get_secindex(elf, sym)); in check_section_mismatch()
1153 if (module_enabled && elf->export_symbol_secndx == fsecndx) { in check_section_mismatch()
1154 check_export_symbol(mod, elf, faddr, tosec, sym); in check_section_mismatch()
1162 default_mismatch_handler(mod->name, elf, mismatch, sym, in check_section_mismatch()
1310 static void get_rel_type_and_sym(struct elf_info *elf, uint64_t r_info, in get_rel_type_and_sym() argument
1321 bool is_64bit = (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64); in get_rel_type_and_sym()
1323 if (elf->hdr->e_machine == EM_MIPS && is_64bit) { in get_rel_type_and_sym()
1340 static void section_rela(struct module *mod, struct elf_info *elf, in section_rela() argument
1352 get_rel_type_and_sym(elf, rela->r_info, &r_type, &r_sym); in section_rela()
1354 tsym = elf->symtab_start + r_sym; in section_rela()
1357 switch (elf->hdr->e_machine) { in section_rela()
1377 check_section_mismatch(mod, elf, tsym, in section_rela()
1382 static void section_rel(struct module *mod, struct elf_info *elf, in section_rel() argument
1395 get_rel_type_and_sym(elf, rel->r_info, &r_type, &r_sym); in section_rel()
1397 loc = sym_get_data_by_offset(elf, fsecndx, r_offset); in section_rel()
1398 tsym = elf->symtab_start + r_sym; in section_rel()
1400 switch (elf->hdr->e_machine) { in section_rel()
1414 check_section_mismatch(mod, elf, tsym, in section_rel()
1431 static void check_sec_ref(struct module *mod, struct elf_info *elf) in check_sec_ref() argument
1436 for (i = 0; i < elf->num_sections; i++) { in check_sec_ref()
1437 Elf_Shdr *sechdr = &elf->sechdrs[i]; in check_sec_ref()
1439 check_section(mod->name, elf, sechdr); in check_sec_ref()
1444 const char *secname = sec_name(elf, secndx); in check_sec_ref()
1451 start = sym_get_data_by_offset(elf, i, 0); in check_sec_ref()
1455 section_rela(mod, elf, secndx, secname, in check_sec_ref()
1458 section_rel(mod, elf, secndx, secname, in check_sec_ref()