Lines Matching +full:lower +full:- +full:case

4  * Copyright 2002-2004  Rusty Russell, IBM Corporation
5 * Copyright 2006-2008 Sam Ravnborg
6 * Based in part on module-init-tools/depmod.c,file2alias
47 /* Trim EXPORT_SYMBOLs that are unused by in-tree modules */
70 * here we use Elf_Addr instead of long for covering cross-compile
73 #define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
98 return strcmp(str + strlen(str) - strlen(postfix), postfix) == 0; in strends()
132 nbytes -= bytes_read; in read_text_file()
167 if (!strcmp(mod->dump_file, filename) && in find_module()
168 !strcmp(mod->name, modname)) in find_module()
181 INIT_LIST_HEAD(&mod->exported_symbols); in new_module()
182 INIT_LIST_HEAD(&mod->unresolved_symbols); in new_module()
183 INIT_LIST_HEAD(&mod->missing_namespaces); in new_module()
184 INIT_LIST_HEAD(&mod->imported_namespaces); in new_module()
185 INIT_LIST_HEAD(&mod->aliases); in new_module()
187 memcpy(mod->name, name, namelen); in new_module()
188 mod->name[namelen] = '\0'; in new_module()
189 mod->is_vmlinux = (strcmp(mod->name, "vmlinux") == 0); in new_module()
192 * Set mod->is_gpl_compatible to true by default. If MODULE_LICENSE() in new_module()
196 mod->is_gpl_compatible = true; in new_module()
198 list_add_tail(&mod->list, &modules); in new_module()
228 strcpy(s->name, name); in alloc_symbol()
236 hash_add(symbol_hashtable, &sym->hnode, hash_str(sym->name)); in hash_add_symbol()
244 sym->weak = weak; in sym_add_unresolved()
246 list_add_tail(&sym->list, &mod->unresolved_symbols); in sym_add_unresolved()
258 if (strcmp(s->name, name) == 0 && (!mod || s->module == mod)) in sym_find_with_module()
286 if (!strcmp(list->namespace, namespace)) in contains_namespace()
299 strcpy(ns_entry->namespace, namespace); in add_namespace()
300 list_add_tail(&ns_entry->list, head); in add_namespace()
307 Elf_Shdr *sechdr = &info->sechdrs[secindex]; in sym_get_data_by_offset()
309 return (void *)info->hdr + sechdr->sh_offset + offset; in sym_get_data_by_offset()
315 sym->st_value); in sym_get_data()
320 return sym_get_data_by_offset(info, info->secindex_strings, in sech_name()
321 sechdr->sh_name); in sech_name()
327 * If sym->st_shndx is a special section index, there is no in sec_name()
329 * Return "" if the index is out of range of info->sechdrs[] array. in sec_name()
331 if (secindex >= info->num_sections) in sec_name()
334 return sech_name(info, &info->sechdrs[secindex]); in sec_name()
342 if (s && (!external_module || s->module->is_vmlinux || s->module == mod)) { in sym_add_exported()
344 mod->name, name, s->module->name, in sym_add_exported()
345 s->module->is_vmlinux ? "" : ".ko"); in sym_add_exported()
349 s->module = mod; in sym_add_exported()
350 s->is_gpl_only = gpl_only; in sym_add_exported()
351 s->namespace = xstrdup(namespace); in sym_add_exported()
352 list_add_tail(&s->list, &mod->exported_symbols); in sym_add_exported()
360 sym->crc = crc; in sym_set_crc()
361 sym->crc_valid = true; in sym_set_crc()
400 hdr = grab_file(filename, &info->size); in parse_elf()
410 info->hdr = hdr; in parse_elf()
411 if (info->size < sizeof(*hdr)) { in parse_elf()
416 if ((hdr->e_ident[EI_MAG0] != ELFMAG0) || in parse_elf()
417 (hdr->e_ident[EI_MAG1] != ELFMAG1) || in parse_elf()
418 (hdr->e_ident[EI_MAG2] != ELFMAG2) || in parse_elf()
419 (hdr->e_ident[EI_MAG3] != ELFMAG3)) { in parse_elf()
420 /* Not an ELF file - silently ignore it */ in parse_elf()
424 switch (hdr->e_ident[EI_DATA]) { in parse_elf()
425 case ELFDATA2LSB: in parse_elf()
428 case ELFDATA2MSB: in parse_elf()
436 hdr->e_type = TO_NATIVE(hdr->e_type); in parse_elf()
437 hdr->e_machine = TO_NATIVE(hdr->e_machine); in parse_elf()
438 hdr->e_version = TO_NATIVE(hdr->e_version); in parse_elf()
439 hdr->e_entry = TO_NATIVE(hdr->e_entry); in parse_elf()
440 hdr->e_phoff = TO_NATIVE(hdr->e_phoff); in parse_elf()
441 hdr->e_shoff = TO_NATIVE(hdr->e_shoff); in parse_elf()
442 hdr->e_flags = TO_NATIVE(hdr->e_flags); in parse_elf()
443 hdr->e_ehsize = TO_NATIVE(hdr->e_ehsize); in parse_elf()
444 hdr->e_phentsize = TO_NATIVE(hdr->e_phentsize); in parse_elf()
445 hdr->e_phnum = TO_NATIVE(hdr->e_phnum); in parse_elf()
446 hdr->e_shentsize = TO_NATIVE(hdr->e_shentsize); in parse_elf()
447 hdr->e_shnum = TO_NATIVE(hdr->e_shnum); in parse_elf()
448 hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx); in parse_elf()
449 sechdrs = (void *)hdr + hdr->e_shoff; in parse_elf()
450 info->sechdrs = sechdrs; in parse_elf()
453 if (hdr->e_type != ET_REL) in parse_elf()
457 if (hdr->e_shoff > info->size) in parse_elf()
459 (unsigned long)hdr->e_shoff, filename, info->size); in parse_elf()
461 if (hdr->e_shnum == SHN_UNDEF) { in parse_elf()
466 info->num_sections = TO_NATIVE(sechdrs[0].sh_size); in parse_elf()
469 info->num_sections = hdr->e_shnum; in parse_elf()
471 if (hdr->e_shstrndx == SHN_XINDEX) { in parse_elf()
472 info->secindex_strings = TO_NATIVE(sechdrs[0].sh_link); in parse_elf()
475 info->secindex_strings = hdr->e_shstrndx; in parse_elf()
479 for (i = 0; i < info->num_sections; i++) { in parse_elf()
492 secstrings = (void *)hdr + sechdrs[info->secindex_strings].sh_offset; in parse_elf()
493 for (i = 1; i < info->num_sections; i++) { in parse_elf()
497 if (!nobits && sechdrs[i].sh_offset > info->size) in parse_elf()
506 info->modinfo = (void *)hdr + sechdrs[i].sh_offset; in parse_elf()
507 info->modinfo_len = sechdrs[i].sh_size; in parse_elf()
509 info->export_symbol_secndx = i; in parse_elf()
511 info->no_trim_symbol = (void *)hdr + sechdrs[i].sh_offset; in parse_elf()
512 info->no_trim_symbol_len = sechdrs[i].sh_size; in parse_elf()
518 info->symtab_start = (void *)hdr + in parse_elf()
520 info->symtab_stop = (void *)hdr + in parse_elf()
523 info->strtab = (void *)hdr + in parse_elf()
530 info->symtab_shndx_start = (void *)hdr + in parse_elf()
532 info->symtab_shndx_stop = (void *)hdr + in parse_elf()
536 if (!info->symtab_start) in parse_elf()
540 for (sym = info->symtab_start; sym < info->symtab_stop; sym++) { in parse_elf()
541 sym->st_shndx = TO_NATIVE(sym->st_shndx); in parse_elf()
542 sym->st_name = TO_NATIVE(sym->st_name); in parse_elf()
543 sym->st_value = TO_NATIVE(sym->st_value); in parse_elf()
544 sym->st_size = TO_NATIVE(sym->st_size); in parse_elf()
554 for (p = info->symtab_shndx_start; p < info->symtab_shndx_stop; in parse_elf()
567 release_file(info->hdr, info->size); in parse_elf_finish()
578 if (info->hdr->e_machine == EM_PPC) in ignore_undef_symbol()
587 if (info->hdr->e_machine == EM_PPC64) in ignore_undef_symbol()
602 switch (sym->st_shndx) { in handle_symbol()
603 case SHN_COMMON: in handle_symbol()
607 warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); in handle_symbol()
609 case SHN_UNDEF: in handle_symbol()
611 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && in handle_symbol()
612 ELF_ST_BIND(sym->st_info) != STB_WEAK) in handle_symbol()
616 if (info->hdr->e_machine == EM_SPARC || in handle_symbol()
617 info->hdr->e_machine == EM_SPARCV9) { in handle_symbol()
619 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) in handle_symbol()
630 ELF_ST_BIND(sym->st_info) == STB_WEAK); in handle_symbol()
634 mod->has_init = true; in handle_symbol()
636 mod->has_cleanup = true; in handle_symbol()
646 /* Skip non-zero chars */ in next_string()
649 if ((*secsize)-- <= 1) in next_string()
656 if ((*secsize)-- <= 1) in next_string()
667 char *modinfo = info->modinfo; in get_next_modinfo()
668 unsigned long size = info->modinfo_len; in get_next_modinfo()
671 size -= prev - modinfo; in get_next_modinfo()
690 return sym ? elf->strtab + sym->st_name : ""; in sym_name()
724 ".GCC.command.line", /* record-gcc-switches */
739 ".llvm.call-graph-profile", /* call graph */
753 if (sechdr->sh_type == SHT_PROGBITS && in check_section()
754 !(sechdr->sh_flags & SHF_ALLOC) && in check_section()
756 warn("%s (%s): unexpected non-allocatable section.\n" in check_section()
802 * this array is forbidden (black-list). Can be empty.
805 * targeting sections in this array (white-list). Can be empty.
844 /* If you're adding any new black-listed sections in here, consider
860 * handling relocations to un-resolved symbols, trying to match it in section_mismatch()
870 if (match(fromsec, check->fromsec)) { in section_mismatch()
871 if (check->bad_tosec[0] && match(tosec, check->bad_tosec)) in section_mismatch()
873 if (check->good_tosec[0] && !match(tosec, check->good_tosec)) in section_mismatch()
905 * these from non-init sections as these symbols don't have any memory
914 * in functions like cpumask_empty() -- generating an associated symbol
988 if (secndx >= elf->num_sections) in is_executable_section()
991 return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0; in is_executable_section()
1011 /* check whitelist - we may ignore it */ in default_mismatch_handler()
1024 warn("%s: section mismatch in reference: %s%s0x%x (section: %s) -> %s (section: %s)\n", in default_mismatch_handler()
1026 (unsigned int)(faddr - (fromsym[0] ? from->st_value : 0)), in default_mismatch_handler()
1029 if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) { in default_mismatch_handler()
1030 if (match(tosec, mismatch->bad_tosec)) in default_mismatch_handler()
1032 "section \"%s\" which is black-listed.\n" in default_mismatch_handler()
1047 error("%s+0x%lx references non-executable section '%s'\n", in default_mismatch_handler()
1062 label = find_fromsym(elf, faddr, elf->export_symbol_secndx); in check_export_symbol()
1067 mod->name, label_name); in check_export_symbol()
1071 if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && in check_export_symbol()
1072 ELF_ST_BIND(sym->st_info) != STB_WEAK) { in check_export_symbol()
1073 error("%s: local symbol '%s' was exported\n", mod->name, in check_export_symbol()
1081 mod->name, name); in check_export_symbol()
1092 mod->name, data, name); in check_export_symbol()
1103 s->is_func = (ELF_ST_TYPE(sym->st_info) == STT_FUNC); in check_export_symbol()
1109 if (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64 && in check_export_symbol()
1110 elf->hdr->e_machine == EM_PARISC && in check_export_symbol()
1111 ELF_ST_TYPE(sym->st_info) == STT_LOPROC) in check_export_symbol()
1112 s->is_func = true; in check_export_symbol()
1116 mod->name, name); in check_export_symbol()
1119 mod->name, name); in check_export_symbol()
1130 if (module_enabled && elf->export_symbol_secndx == fsecndx) { in check_section_mismatch()
1139 default_mismatch_handler(mod->name, elf, mismatch, sym, in check_section_mismatch()
1147 case R_386_32: in addend_386_rel()
1149 case R_386_PC32: in addend_386_rel()
1153 return (Elf_Addr)(-1); in addend_386_rel()
1158 uint8_t shift = 31 - index; in sign_extend32()
1165 uint32_t inst, upper, lower, sign, j1, j2; in addend_arm_rel() local
1169 case R_ARM_ABS32: in addend_arm_rel()
1170 case R_ARM_REL32: in addend_arm_rel()
1172 return inst + sym->st_value; in addend_arm_rel()
1173 case R_ARM_MOVW_ABS_NC: in addend_arm_rel()
1174 case R_ARM_MOVT_ABS: in addend_arm_rel()
1178 return offset + sym->st_value; in addend_arm_rel()
1179 case R_ARM_PC24: in addend_arm_rel()
1180 case R_ARM_CALL: in addend_arm_rel()
1181 case R_ARM_JUMP24: in addend_arm_rel()
1184 return offset + sym->st_value + 8; in addend_arm_rel()
1185 case R_ARM_THM_MOVW_ABS_NC: in addend_arm_rel()
1186 case R_ARM_THM_MOVT_ABS: in addend_arm_rel()
1188 lower = get_unaligned_native((uint16_t *)loc + 1); in addend_arm_rel()
1191 ((lower & 0x7000) >> 4) | in addend_arm_rel()
1192 (lower & 0x00ff), in addend_arm_rel()
1194 return offset + sym->st_value; in addend_arm_rel()
1195 case R_ARM_THM_JUMP19: in addend_arm_rel()
1200 * J1 = lower[13] in addend_arm_rel()
1201 * J2 = lower[11] in addend_arm_rel()
1202 * imm11 = lower[10:0] in addend_arm_rel()
1206 lower = get_unaligned_native((uint16_t *)loc + 1); in addend_arm_rel()
1209 j1 = (lower >> 13) & 1; in addend_arm_rel()
1210 j2 = (lower >> 11) & 1; in addend_arm_rel()
1213 ((lower & 0x07ff) << 1), in addend_arm_rel()
1215 return offset + sym->st_value + 4; in addend_arm_rel()
1216 case R_ARM_THM_PC22: in addend_arm_rel()
1217 case R_ARM_THM_JUMP24: in addend_arm_rel()
1222 * J1 = lower[13] in addend_arm_rel()
1223 * J2 = lower[11] in addend_arm_rel()
1224 * imm11 = lower[10:0] in addend_arm_rel()
1230 lower = get_unaligned_native((uint16_t *)loc + 1); in addend_arm_rel()
1233 j1 = (lower >> 13) & 1; in addend_arm_rel()
1234 j2 = (lower >> 11) & 1; in addend_arm_rel()
1239 ((lower & 0x07ff) << 1), in addend_arm_rel()
1241 return offset + sym->st_value + 4; in addend_arm_rel()
1244 return (Elf_Addr)(-1); in addend_arm_rel()
1253 case R_MIPS_LO16: in addend_mips_rel()
1255 case R_MIPS_26: in addend_mips_rel()
1257 case R_MIPS_32: in addend_mips_rel()
1260 return (Elf_Addr)(-1); in addend_mips_rel()
1298 bool is_64bit = (elf->hdr->e_ident[EI_CLASS] == ELFCLASS64); in get_rel_type_and_sym()
1300 if (elf->hdr->e_machine == EM_MIPS && is_64bit) { in get_rel_type_and_sym()
1303 *r_type = mips64_r_info->r_type; in get_rel_type_and_sym()
1304 *r_sym = TO_NATIVE(mips64_r_info->r_sym); in get_rel_type_and_sym()
1328 r_offset = TO_NATIVE(rela->r_offset); in section_rela()
1329 get_rel_type_and_sym(elf, rela->r_info, &r_type, &r_sym); in section_rela()
1331 tsym = elf->symtab_start + r_sym; in section_rela()
1332 taddr = tsym->st_value + TO_NATIVE(rela->r_addend); in section_rela()
1334 switch (elf->hdr->e_machine) { in section_rela()
1335 case EM_RISCV: in section_rela()
1340 case EM_LOONGARCH: in section_rela()
1342 case R_LARCH_SUB32: in section_rela()
1346 case R_LARCH_RELAX: in section_rela()
1347 case R_LARCH_ALIGN: in section_rela()
1371 r_offset = TO_NATIVE(rel->r_offset); in section_rel()
1372 get_rel_type_and_sym(elf, rel->r_info, &r_type, &r_sym); in section_rel()
1375 tsym = elf->symtab_start + r_sym; in section_rel()
1377 switch (elf->hdr->e_machine) { in section_rel()
1378 case EM_386: in section_rel()
1381 case EM_ARM: in section_rel()
1384 case EM_MIPS: in section_rel()
1398 * either when loaded or when used as built-in.
1401 * Likewise for modules used built-in the sections marked __exit
1403 * only when a module is unloaded which never happens for built-in modules.
1413 for (i = 0; i < elf->num_sections; i++) { in check_sec_ref()
1414 Elf_Shdr *sechdr = &elf->sechdrs[i]; in check_sec_ref()
1416 check_section(mod->name, elf, sechdr); in check_sec_ref()
1418 if (sechdr->sh_type == SHT_REL || sechdr->sh_type == SHT_RELA) { in check_sec_ref()
1420 unsigned int secndx = sechdr->sh_info; in check_sec_ref()
1429 stop = start + sechdr->sh_size; in check_sec_ref()
1431 if (sechdr->sh_type == SHT_RELA) in check_sec_ref()
1467 dirlen = base - object; in extract_crcs_for_object()
1495 namelen = p - name; in extract_crcs_for_object()
1531 if (mod->is_vmlinux) { in mod_set_crcs()
1535 ret = snprintf(objlist, sizeof(objlist), "%s.mod", mod->name); in mod_set_crcs()
1570 mod = new_module(modname, strlen(modname) - strlen(".o")); in read_symbols()
1574 mod->no_trim_symbol = xmalloc(info.no_trim_symbol_len); in read_symbols()
1575 memcpy(mod->no_trim_symbol, info.no_trim_symbol, in read_symbols()
1577 mod->no_trim_symbol_len = info.no_trim_symbol_len; in read_symbols()
1580 if (!mod->is_vmlinux) { in read_symbols()
1586 mod->is_gpl_compatible = false; in read_symbols()
1594 add_namespace(&mod->imported_namespaces, namespace); in read_symbols()
1604 symname = remove_dot(info.strtab + sym->st_name); in read_symbols()
1612 if (!mod->is_vmlinux) { in read_symbols()
1615 get_src_version(mod->name, mod->srcversion, in read_symbols()
1616 sizeof(mod->srcversion) - 1); in read_symbols()
1623 * Our trick to get versioning for module struct etc. - it's in read_symbols()
1645 fname[strlen(fname)-1] = '\0'; in read_symbols_from_files()
1673 if (buf->size - buf->pos < len) { in buf_write()
1674 buf->size += len + SZ; in buf_write()
1675 buf->p = xrealloc(buf->p, buf->size); in buf_write()
1677 strncpy(buf->p + buf->pos, s, len); in buf_write()
1678 buf->pos += len; in buf_write()
1685 list_for_each_entry(s, &mod->unresolved_symbols, list) { in check_exports()
1687 exp = find_symbol(s->name); in check_exports()
1689 if (!s->weak && nr_unresolved++ < MAX_UNRESOLVED_REPORTS) in check_exports()
1692 s->name, mod->name); in check_exports()
1695 if (exp->module == mod) { in check_exports()
1697 s->name, mod->name); in check_exports()
1701 exp->used = true; in check_exports()
1702 s->module = exp->module; in check_exports()
1703 s->crc_valid = exp->crc_valid; in check_exports()
1704 s->crc = exp->crc; in check_exports()
1706 basename = strrchr(mod->name, '/'); in check_exports()
1710 basename = mod->name; in check_exports()
1712 if (!contains_namespace(&mod->imported_namespaces, exp->namespace)) { in check_exports()
1715 basename, exp->name, exp->namespace); in check_exports()
1716 add_namespace(&mod->missing_namespaces, exp->namespace); in check_exports()
1719 if (!mod->is_gpl_compatible && exp->is_gpl_only) in check_exports()
1720 error("GPL-incompatible module %s.ko uses GPL-only symbol '%s'\n", in check_exports()
1721 basename, exp->name); in check_exports()
1736 sym->used = true; in handle_white_list_exports()
1749 unsigned long size = mod->no_trim_symbol_len; in keep_no_trim_symbols()
1751 for (char *s = mod->no_trim_symbol; s; s = next_string(s , &size)) { in keep_no_trim_symbols()
1760 sym->used = true; in keep_no_trim_symbols()
1768 mod_name = strrchr(mod->name, '/'); in check_modname_len()
1770 mod_name = mod->name; in check_modname_len()
1774 error("module name is too long [%s.ko]\n", mod->name); in check_modname_len()
1783 buf_printf(b, "#include <linux/export-internal.h>\n"); in add_header()
1791 if (mod->has_init) in add_header()
1793 if (mod->has_cleanup) in add_header()
1803 if (strstarts(mod->name, "drivers/staging")) in add_header()
1806 if (strstarts(mod->name, "tools/testing")) in add_header()
1816 list_for_each_entry(sym, &mod->exported_symbols, list) { in add_exported_symbols()
1817 if (trim_unused_exports && !sym->used) in add_exported_symbols()
1821 sym->is_func ? "FUNC" : "DATA", sym->name, in add_exported_symbols()
1822 sym->is_gpl_only ? "_gpl" : "", sym->namespace); in add_exported_symbols()
1830 list_for_each_entry(sym, &mod->exported_symbols, list) { in add_exported_symbols()
1831 if (trim_unused_exports && !sym->used) in add_exported_symbols()
1834 if (!sym->crc_valid) in add_exported_symbols()
1836 "Is \"%s\" prototyped in <asm/asm-prototypes.h>?\n", in add_exported_symbols()
1837 sym->name, mod->name, mod->is_vmlinux ? "" : ".ko", in add_exported_symbols()
1838 sym->name); in add_exported_symbols()
1841 sym->name, sym->crc, sym->is_gpl_only ? "_gpl" : ""); in add_exported_symbols()
1858 list_for_each_entry(s, &mod->unresolved_symbols, list) { in add_extended_versions()
1859 if (!s->module) in add_extended_versions()
1861 if (!s->crc_valid) { in add_extended_versions()
1863 s->name, mod->name); in add_extended_versions()
1866 buf_printf(b, "\t0x%08x,\n", s->crc); in add_extended_versions()
1872 list_for_each_entry(s, &mod->unresolved_symbols, list) { in add_extended_versions()
1873 if (!s->module) in add_extended_versions()
1875 if (!s->crc_valid) in add_extended_versions()
1883 buf_printf(b, "\t\"%s\\0\"\n", s->name); in add_extended_versions()
1902 list_for_each_entry(s, &mod->unresolved_symbols, list) { in add_versions()
1903 if (!s->module) in add_versions()
1905 if (!s->crc_valid) { in add_versions()
1907 s->name, mod->name); in add_versions()
1910 if (strlen(s->name) >= MODULE_NAME_LEN) { in add_versions()
1916 s->name, mod->name); in add_versions()
1921 s->crc, s->name); in add_versions()
1932 /* Clear ->seen flag of modules that own symbols needed by this. */ in add_depends()
1933 list_for_each_entry(s, &mod->unresolved_symbols, list) { in add_depends()
1934 if (s->module) in add_depends()
1935 s->module->seen = s->module->is_vmlinux; in add_depends()
1940 list_for_each_entry(s, &mod->unresolved_symbols, list) { in add_depends()
1942 if (!s->module) in add_depends()
1945 if (s->module->seen) in add_depends()
1948 s->module->seen = true; in add_depends()
1949 p = strrchr(s->module->name, '/'); in add_depends()
1953 p = s->module->name; in add_depends()
1962 if (mod->srcversion[0]) { in add_srcversion()
1965 mod->srcversion); in add_srcversion()
1981 if (fwrite(b->p, 1, b->pos, file) != b->pos) { in write_buf()
2004 if (st.st_size != b->pos) in write_if_changed()
2007 tmp = xmalloc(b->pos); in write_if_changed()
2008 if (fread(tmp, 1, b->pos, file) != b->pos) in write_if_changed()
2011 if (memcmp(tmp, b->p, b->pos) != 0) in write_if_changed()
2031 "#include <linux/export-internal.h>\n"); in write_vmlinux_export_c_file()
2053 list_for_each_entry_safe(alias, next, &mod->aliases, node) { in write_mod_c_file()
2054 buf_printf(&buf, "MODULE_ALIAS(\"%s\");\n", alias->str); in write_mod_c_file()
2055 list_del(&alias->node); in write_mod_c_file()
2061 ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name); in write_mod_c_file()
2123 mod->dump_file = fname; in read_dump()
2142 if (mod->dump_file) in write_dump()
2144 list_for_each_entry(sym, &mod->exported_symbols, list) { in write_dump()
2145 if (trim_unused_exports && !sym->used) in write_dump()
2149 sym->crc, sym->name, mod->name, in write_dump()
2150 sym->is_gpl_only ? "_GPL" : "", in write_dump()
2151 sym->namespace); in write_dump()
2166 if (mod->dump_file || list_empty(&mod->missing_namespaces)) in write_namespace_deps_files()
2169 buf_printf(&ns_deps_buf, "%s.ko:", mod->name); in write_namespace_deps_files()
2171 list_for_each_entry(ns, &mod->missing_namespaces, list) in write_namespace_deps_files()
2172 buf_printf(&ns_deps_buf, " %s", ns->namespace); in write_namespace_deps_files()
2194 case 0x0102: in check_host_endian()
2197 case 0x0201: in check_host_endian()
2215 while ((opt = getopt(argc, argv, "ei:MmnT:to:au:WwENd:xb")) != -1) { in main()
2217 case 'e': in main()
2220 case 'i': in main()
2222 dl->file = optarg; in main()
2223 list_add_tail(&dl->list, &dump_lists); in main()
2225 case 'M': in main()
2228 case 'm': in main()
2231 case 'n': in main()
2234 case 'o': in main()
2237 case 'a': in main()
2240 case 'T': in main()
2243 case 't': in main()
2246 case 'u': in main()
2249 case 'W': in main()
2252 case 'w': in main()
2255 case 'E': in main()
2258 case 'N': in main()
2261 case 'd': in main()
2264 case 'b': in main()
2267 case 'x': in main()
2278 read_dump(dl->file); in main()
2279 list_del(&dl->list); in main()
2292 if (mod->dump_file || mod->is_vmlinux) in main()
2303 if (mod->dump_file) in main()
2306 if (mod->is_vmlinux) in main()
2323 nr_unresolved - MAX_UNRESOLVED_REPORTS); in main()