On 1/27/2020 7:35 PM, Masahiro Yamada wrote:
On Tue, Jan 28, 2020 at 6:50 AM Greg Rose <gvrose8192@xxxxxxxxx> wrote:
Since this commit:ccflags-y is passed only for compiling C files in that directory.
'commit 9b9a3f20cbe0 ("kbuild: split final module linking out into Makefile.modfinal")'
at least one out-of-tree external kernel module build fails
during the modfinal make phase because Makefile.modfinal does
not include the ccflags-y variable from the exernal module's Kbuild.
It is not used for compiling *.mod.c
This is true for both in-kernel and external modules.
So, ccflags-y is not a good choice
for passing such flags that should be globally effective.
Maybe, KCFLAGS should work.
module:
 $(MAKE) KCFLAGS=... M=$(PWD) -C /lib/modules/$(uname -r)/build modules
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -21,6 +21,10 @@ __modfinal: $(modules)
 modname = $(notdir $(@:.mod.o=))
 part-of-module = y
+# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
+include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
+ÂÂÂÂÂÂÂÂÂÂÂÂ $(KBUILD_EXTMOD)/Kbuild)
+