summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-06-06 18:41:59 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2023-06-07 22:41:08 +0900
commit20ff36856fe00879f82de71fe6f1482ca1b72334 (patch)
tree663915b917dc9bed51678c028f89ffacc37457c4
parent7f8256ae0efba344a9b113036b1d545a1f6cdaa7 (diff)
modpost: propagate W=1 build option to modpost
"No build warning" is a strong requirement these days, so you must fix all issues before enabling a new warning flag. We often add a new warning to W=1 first so that the kbuild test robot blocks new breakages. This commit allows modpost to show extra warnings only when W=1 (or KBUILD_EXTRA_WARN=1) is given. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
-rw-r--r--scripts/Makefile.modpost1
-rw-r--r--scripts/mod/modpost.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 0980c58d8afc..074e27c0c140 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -47,6 +47,7 @@ modpost-args = \
$(if $(KBUILD_MODPOST_WARN),-w) \
$(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) \
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \
+ $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \
-o $@
modpost-deps := $(MODPOST)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index d10f5bdcb753..3ea5eb2b1029 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -42,6 +42,8 @@ static bool allow_missing_ns_imports;
static bool error_occurred;
+static bool extra_warn;
+
/*
* Cut off the warnings when there are too many. This typically occurs when
* vmlinux is missing. ('make modules' without building vmlinux.)
@@ -2199,7 +2201,7 @@ int main(int argc, char **argv)
LIST_HEAD(dump_lists);
struct dump_list *dl, *dl2;
- while ((opt = getopt(argc, argv, "ei:mnT:o:awENd:")) != -1) {
+ while ((opt = getopt(argc, argv, "ei:mnT:o:aWwENd:")) != -1) {
switch (opt) {
case 'e':
external_module = true;
@@ -2224,6 +2226,9 @@ int main(int argc, char **argv)
case 'T':
files_source = optarg;
break;
+ case 'W':
+ extra_warn = true;
+ break;
case 'w':
warn_unresolved = true;
break;