Lines Matching refs:info
323 static void *sym_get_data_by_offset(const struct elf_info *info, in sym_get_data_by_offset() argument
326 Elf_Shdr *sechdr = &info->sechdrs[secindex]; in sym_get_data_by_offset()
328 if (info->hdr->e_type != ET_REL) in sym_get_data_by_offset()
331 return (void *)info->hdr + sechdr->sh_offset + offset; in sym_get_data_by_offset()
334 static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym) in sym_get_data() argument
336 return sym_get_data_by_offset(info, get_secindex(info, sym), in sym_get_data()
340 static const char *sech_name(const struct elf_info *info, Elf_Shdr *sechdr) in sech_name() argument
342 return sym_get_data_by_offset(info, info->secindex_strings, in sech_name()
346 static const char *sec_name(const struct elf_info *info, int secindex) in sec_name() argument
348 return sech_name(info, &info->sechdrs[secindex]); in sec_name()
387 static const char *namespace_from_kstrtabns(const struct elf_info *info, in namespace_from_kstrtabns() argument
390 const char *value = sym_get_data(info, sym); in namespace_from_kstrtabns()
478 static int parse_elf(struct elf_info *info, const char *filename) in parse_elf() argument
487 hdr = grab_file(filename, &info->size); in parse_elf()
497 info->hdr = hdr; in parse_elf()
498 if (info->size < sizeof(*hdr)) { in parse_elf()
525 info->sechdrs = sechdrs; in parse_elf()
528 if (hdr->e_shoff > info->size) { in parse_elf()
530 (unsigned long)hdr->e_shoff, filename, info->size); in parse_elf()
539 info->num_sections = TO_NATIVE(sechdrs[0].sh_size); in parse_elf()
542 info->num_sections = hdr->e_shnum; in parse_elf()
545 info->secindex_strings = TO_NATIVE(sechdrs[0].sh_link); in parse_elf()
548 info->secindex_strings = hdr->e_shstrndx; in parse_elf()
552 for (i = 0; i < info->num_sections; i++) { in parse_elf()
565 secstrings = (void *)hdr + sechdrs[info->secindex_strings].sh_offset; in parse_elf()
566 for (i = 1; i < info->num_sections; i++) { in parse_elf()
570 if (!nobits && sechdrs[i].sh_offset > info->size) { in parse_elf()
581 info->modinfo = (void *)hdr + sechdrs[i].sh_offset; in parse_elf()
582 info->modinfo_len = sechdrs[i].sh_size; in parse_elf()
584 info->export_sec = i; in parse_elf()
586 info->export_unused_sec = i; in parse_elf()
588 info->export_gpl_sec = i; in parse_elf()
590 info->export_unused_gpl_sec = i; in parse_elf()
592 info->export_gpl_future_sec = i; in parse_elf()
597 info->symtab_start = (void *)hdr + in parse_elf()
599 info->symtab_stop = (void *)hdr + in parse_elf()
602 info->strtab = (void *)hdr + in parse_elf()
609 info->symtab_shndx_start = (void *)hdr + in parse_elf()
611 info->symtab_shndx_stop = (void *)hdr + in parse_elf()
615 if (!info->symtab_start) in parse_elf()
619 for (sym = info->symtab_start; sym < info->symtab_stop; sym++) { in parse_elf()
633 for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop; in parse_elf()
641 static void parse_elf_finish(struct elf_info *info) in parse_elf_finish() argument
643 release_file(info->hdr, info->size); in parse_elf_finish()
646 static int ignore_undef_symbol(struct elf_info *info, const char *symname) in ignore_undef_symbol() argument
654 if (info->hdr->e_machine == EM_PPC) in ignore_undef_symbol()
663 if (info->hdr->e_machine == EM_PPC64) in ignore_undef_symbol()
676 const struct elf_info *info, in handle_modversion() argument
693 crcp = sym_get_data(info, sym); in handle_modversion()
699 static void handle_symbol(struct module *mod, struct elf_info *info, in handle_symbol() argument
706 export = export_from_secname(info, get_secindex(info, sym)); in handle_symbol()
708 export = export_from_sec(info, get_secindex(info, sym)); in handle_symbol()
722 if (ignore_undef_symbol(info, symname)) in handle_symbol()
724 if (info->hdr->e_machine == EM_SPARC || in handle_symbol()
725 info->hdr->e_machine == EM_SPARCV9) { in handle_symbol()
776 static char *get_next_modinfo(struct elf_info *info, const char *tag, in get_next_modinfo() argument
781 char *modinfo = info->modinfo; in get_next_modinfo()
782 unsigned long size = info->modinfo_len; in get_next_modinfo()
796 static char *get_modinfo(struct elf_info *info, const char *tag) in get_modinfo() argument
799 return get_next_modinfo(info, tag, NULL); in get_modinfo()
2017 struct elf_info info = { }; in read_symbols() local
2020 if (!parse_elf(&info, modname)) in read_symbols()
2037 license = get_modinfo(&info, "license"); in read_symbols()
2047 license = get_next_modinfo(&info, "license", license); in read_symbols()
2050 namespace = get_modinfo(&info, "import_ns"); in read_symbols()
2053 namespace = get_next_modinfo(&info, "import_ns", in read_symbols()
2058 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { in read_symbols()
2059 symname = remove_dot(info.strtab + sym->st_name); in read_symbols()
2061 handle_symbol(mod, &info, sym, symname); in read_symbols()
2062 handle_moddevtable(mod, &info, sym, symname); in read_symbols()
2065 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { in read_symbols()
2066 symname = remove_dot(info.strtab + sym->st_name); in read_symbols()
2071 namespace_from_kstrtabns(&info, in read_symbols()
2075 handle_modversion(mod, &info, sym, in read_symbols()
2080 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { in read_symbols()
2085 find_symbol(remove_dot(info.strtab + in read_symbols()
2093 check_sec_ref(mod, modname, &info); in read_symbols()
2096 version = get_modinfo(&info, "version"); in read_symbols()
2102 parse_elf_finish(&info); in read_symbols()