Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

modpost: always show verbose warning for section mismatch

Unless CONFIG_DEBUG_SECTION_MISMATCH is enabled, modpost only shows
the number of section mismatches.

If you want to know the symbols causing the issue, you need to rebuild
with CONFIG_DEBUG_SECTION_MISMATCH. It is tedious.

I think it is fine to show annoying warning when a new section mismatch
comes in.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

+5 -23
-1
scripts/Makefile.modpost
··· 77 77 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ 78 78 $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \ 79 79 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ 80 - $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 81 80 $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ 82 81 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 83 82
+5 -22
scripts/mod/modpost.c
··· 35 35 static int warn_unresolved = 0; 36 36 /* How a symbol is exported */ 37 37 static int sec_mismatch_count = 0; 38 - static int sec_mismatch_verbose = 1; 39 38 static int sec_mismatch_fatal = 0; 40 39 /* ignore missing files */ 41 40 static int ignore_missing_files; ··· 1405 1406 char *prl_to; 1406 1407 1407 1408 sec_mismatch_count++; 1408 - if (!sec_mismatch_verbose) 1409 - return; 1410 1409 1411 1410 get_pretty_name(from_is_func, &from, &from_p); 1412 1411 get_pretty_name(to_is_func, &to, &to_p); ··· 1652 1655 1653 1656 sec_mismatch_count++; 1654 1657 1655 - if (sec_mismatch_verbose) 1656 - report_extable_warnings(modname, elf, mismatch, r, sym, 1657 - fromsec, tosec); 1658 + report_extable_warnings(modname, elf, mismatch, r, sym, fromsec, tosec); 1658 1659 1659 1660 if (match(tosec, mismatch->bad_tosec)) 1660 1661 fatal("The relocation at %s+0x%lx references\n" ··· 2428 2433 struct ext_sym_list *extsym_iter; 2429 2434 struct ext_sym_list *extsym_start = NULL; 2430 2435 2431 - while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awE")) != -1) { 2436 + while ((opt = getopt(argc, argv, "i:I:e:mnsT:o:awE")) != -1) { 2432 2437 switch (opt) { 2433 2438 case 'i': 2434 2439 kernel_read = optarg; ··· 2459 2464 break; 2460 2465 case 's': 2461 2466 vmlinux_section_warnings = 0; 2462 - break; 2463 - case 'S': 2464 - sec_mismatch_verbose = 0; 2465 2467 break; 2466 2468 case 'T': 2467 2469 files_source = optarg; ··· 2517 2525 } 2518 2526 if (dump_write) 2519 2527 write_dump(dump_write); 2520 - if (sec_mismatch_count) { 2521 - if (!sec_mismatch_verbose) { 2522 - warn("modpost: Found %d section mismatch(es).\n" 2523 - "To see full details build your kernel with:\n" 2524 - "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", 2525 - sec_mismatch_count); 2526 - } 2527 - if (sec_mismatch_fatal) { 2528 - fatal("modpost: Section mismatches detected.\n" 2529 - "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); 2530 - } 2531 - } 2528 + if (sec_mismatch_count && sec_mismatch_fatal) 2529 + fatal("modpost: Section mismatches detected.\n" 2530 + "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); 2532 2531 free(buf.p); 2533 2532 2534 2533 return err;