modpost uses symbol name whitelist patterns to determine whether symbols should be excluded from section mismatch tests. Since ELF local symbols, empty symbol names, and ARM toolchain "magic" symbols have autogenerated symbol names, they can trigger false positive warnings for section mismatches, and are thus excluded from the modpost section mismatch scan. However, it seems useful to have the option to include these autogenerated symbols in some section mismatch scans, as an indicator that a patch set could require more attention during review. To that end, this patch adds a '-P' flag to modpost that disables the filters that exclude autogenerated and empty symbol names. Cc: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> Cc: Michal Marek <michal.lkml@xxxxxxxxxxx> Cc: Jim Wilson <jimw@xxxxxxxxxx> Cc: linux-kbuild@xxxxxxxxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx Signed-off-by: Paul Walmsley <paul.walmsley@xxxxxxxxxx> Signed-off-by: Paul Walmsley <paul@xxxxxxxxx> --- scripts/mod/modpost.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0d998c54564d..38fc1bd47926 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -39,6 +39,8 @@ static int sec_mismatch_verbose = 1; static int sec_mismatch_fatal = 0; /* ignore missing files */ static int ignore_missing_files; +/* accept checks which are more likely to generate false positives if set to 1 */ +static int accept_falsepos_risk; enum export { export_plain, export_unused, export_gpl, @@ -1292,7 +1294,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, symsec = sec_name(elf, get_secindex(elf, sym)); if (strcmp(symsec, sec) != 0) continue; - if (!is_valid_name(elf, sym)) + if (!accept_falsepos_risk && !is_valid_name(elf, sym)) continue; if (sym->st_value <= addr) { if ((addr - sym->st_value) < distance) { @@ -2416,7 +2418,7 @@ int main(int argc, char **argv) struct ext_sym_list *extsym_iter; struct ext_sym_list *extsym_start = NULL; - while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:E")) != -1) { + while ((opt = getopt(argc, argv, "i:I:e:mnPsST:o:awM:K:E")) != -1) { switch (opt) { case 'i': kernel_read = optarg; @@ -2442,6 +2444,9 @@ int main(int argc, char **argv) case 'o': dump_write = optarg; break; + case 'P': + accept_falsepos_risk = 1; + break; case 'a': all_versions = 1; break; -- 2.19.1