Skip to contentSkip to conversation

kbuild: do not automatically add -w option to modpost

PATCH In review Masahiro Yamada 2 participants 2 messages Jan 26, 2023 – Jan 27, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kbuild: do not automatically add -w option to modpost

When there is a missing input file (vmlinux.o or Module.symvers), you are likely to get a ton of unresolved symbols.

Currently, Kbuild automatically adds the -w option to allow module builds to continue with warnings instead of errors.

This may not be what the user expects because it is generally more useful to catch all possible issues at build time instead of at run time.

Let's not do what the user did not ask.

If you still want to build modules anyway, you can proceed by explicitly setting KBUILD_MODPOST_WARN=1. Since you may miss a real issue, you need to be aware of what you are doing.

---

Changes in v2:
- Fix the closing parenthesis

 scripts/Makefile.modpost | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
scripts/Makefile.modpost +3 -5
index 43343e13c542..0980c58d8afc 100644
@@ -121,16 +121,14 @@ modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS))
 
 endif # ($(KBUILD_EXTMOD),)
 
-ifneq ($(missing-input),)
-modpost-args += -w
-endif
-
 quiet_cmd_modpost = MODPOST $@
       cmd_modpost = \
 	$(if $(missing-input), \
 		echo >&2 "WARNING: $(missing-input) is missing."; \
 		echo >&2 "         Modules may not have dependencies or modversions."; \
-		echo >&2 "         You may get many unresolved symbol warnings.";) \
+		echo >&2 "         You may get many unresolved symbol errors."; \
+		echo >&2 "         You can set KBUILD_MODPOST_WARN=1 to turn errors into warning"; \
+		echo >&2 "         if you want to proceed at your own risk.";) \
 	$(MODPOST) $(modpost-args)
 
 targets += $(output-symdump)
Signature · 1 line
2.34.1
Tested-by on v2 1/1
#1 lore raw
Quoted 52 lines · Masahiro Yamada

When there is a missing input file (vmlinux.o or Module.symvers), you are likely to get a ton of unresolved symbols.

Currently, Kbuild automatically adds the -w option to allow module builds to continue with warnings instead of errors.

This may not be what the user expects because it is generally more useful to catch all possible issues at build time instead of at run time.

Let's not do what the user did not ask.

If you still want to build modules anyway, you can proceed by explicitly setting KBUILD_MODPOST_WARN=1. Since you may miss a real issue, you need to be aware of what you are doing.

---

Changes in v2:
- Fix the closing parenthesis

 scripts/Makefile.modpost | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
scripts/Makefile.modpost +3 -5
index 43343e13c542..0980c58d8afc 100644
@@ -121,16 +121,14 @@ modpost-args += -e $(addprefix -i , $(KBUILD_EXTRA_SYMBOLS))
 
 endif # ($(KBUILD_EXTMOD),)
 
-ifneq ($(missing-input),)
-modpost-args += -w
-endif
-
 quiet_cmd_modpost = MODPOST $@
       cmd_modpost = \
 	$(if $(missing-input), \
 		echo >&2 "WARNING: $(missing-input) is missing."; \
 		echo >&2 "         Modules may not have dependencies or modversions."; \
-		echo >&2 "         You may get many unresolved symbol warnings.";) \
+		echo >&2 "         You may get many unresolved symbol errors."; \
+		echo >&2 "         You can set KBUILD_MODPOST_WARN=1 to turn errors into warning"; \
+		echo >&2 "         if you want to proceed at your own risk.";) \
 	$(MODPOST) $(modpost-args)
 
 targets += $(output-symdump)
Signature · 1 line
2.34.1

Thanks for putting this together. I verified it's working as expected for me. Feel free to add:

Regards,
Will