Lines Matching defs:info
335 static void *sym_get_data_by_offset(const struct elf_info *info,
338 Elf_Shdr *sechdr = &info->sechdrs[secindex];
340 return (void *)info->hdr + sechdr->sh_offset + offset;
343 void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
345 return sym_get_data_by_offset(info, get_secindex(info, sym),
349 static const char *sech_name(const struct elf_info *info, Elf_Shdr *sechdr)
351 return sym_get_data_by_offset(info, info->secindex_strings,
355 static const char *sec_name(const struct elf_info *info, unsigned int secindex)
360 * Return "" if the index is out of range of info->sechdrs[] array.
362 if (secindex >= info->num_sections)
365 return sech_name(info, &info->sechdrs[secindex]);
424 static int parse_elf(struct elf_info *info, const char *filename)
433 hdr = grab_file(filename, &info->size);
443 info->hdr = hdr;
444 if (info->size < sizeof(*hdr)) {
471 info->sechdrs = sechdrs;
478 if (hdr->e_shoff > info->size) {
480 (unsigned long)hdr->e_shoff, filename, info->size);
489 info->num_sections = TO_NATIVE(sechdrs[0].sh_size);
492 info->num_sections = hdr->e_shnum;
495 info->secindex_strings = TO_NATIVE(sechdrs[0].sh_link);
498 info->secindex_strings = hdr->e_shstrndx;
502 for (i = 0; i < info->num_sections; i++) {
515 secstrings = (void *)hdr + sechdrs[info->secindex_strings].sh_offset;
516 for (i = 1; i < info->num_sections; i++) {
520 if (!nobits && sechdrs[i].sh_offset > info->size) {
530 info->modinfo = (void *)hdr + sechdrs[i].sh_offset;
531 info->modinfo_len = sechdrs[i].sh_size;
533 info->export_symbol_secndx = i;
539 info->symtab_start = (void *)hdr +
541 info->symtab_stop = (void *)hdr +
544 info->strtab = (void *)hdr +
551 info->symtab_shndx_start = (void *)hdr +
553 info->symtab_shndx_stop = (void *)hdr +
557 if (!info->symtab_start)
561 for (sym = info->symtab_start; sym < info->symtab_stop; sym++) {
575 for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop;
583 static void parse_elf_finish(struct elf_info *info)
585 release_file(info->hdr, info->size);
588 static int ignore_undef_symbol(struct elf_info *info, const char *symname)
596 if (info->hdr->e_machine == EM_PPC)
605 if (info->hdr->e_machine == EM_PPC64)
614 if (info->hdr->e_machine == EM_S390)
622 static void handle_symbol(struct module *mod, struct elf_info *info,
637 if (ignore_undef_symbol(info, symname))
639 if (info->hdr->e_machine == EM_SPARC ||
640 info->hdr->e_machine == EM_SPARCV9) {
685 static char *get_next_modinfo(struct elf_info *info, const char *tag,
690 char *modinfo = info->modinfo;
691 unsigned long size = info->modinfo_len;
705 static char *get_modinfo(struct elf_info *info, const char *tag)
708 return get_next_modinfo(info, tag, NULL);
1708 struct elf_info info = { };
1711 if (!parse_elf(&info, modname))
1723 license = get_modinfo(&info, "license");
1731 license = get_next_modinfo(&info, "license", license);
1734 namespace = get_modinfo(&info, "import_ns");
1737 namespace = get_next_modinfo(&info, "import_ns",
1742 if (extra_warn && !get_modinfo(&info, "description"))
1744 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
1745 symname = remove_dot(info.strtab + sym->st_name);
1747 handle_symbol(mod, &info, sym, symname);
1748 handle_moddevtable(mod, &info, sym, symname);
1751 check_sec_ref(mod, &info);
1754 version = get_modinfo(&info, "version");
1760 parse_elf_finish(&info);