If vmlinux.o is rebuilt after modules, the current modpost code throws away the information already stored in Module.symvers. This is due to commit mentioned in the Fixes tag, which introduced this backward-incompatible change which may break ceratin build systems (such as that of OpenWRT). Add code to look if modules.order is present when doing modpost for vmlinux.o, and if it is, include it in modpost. The change introduced here is ugly, therefore this is only a RFC patch. Please comment whether fixing this backward-incompatibility is acceptable. Fixes: a721588d9475 ("kbuild: modpost: do not parse unnecessary ...") Signed-off-by: Marek Behún <marek.behun@xxxxxx> Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx> Cc: Michal Marek <michal.lkml@xxxxxxxxxxx> --- scripts/Makefile.modpost | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 952fff485546..d1eb4923e21b 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -60,7 +60,12 @@ MODPOST = scripts/mod/modpost \ ifdef MODPOST_VMLINUX quiet_cmd_modpost = MODPOST vmlinux.o +ifeq ($(wildcard $(MODORDER)),) cmd_modpost = $(MODPOST) vmlinux.o +else +MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - + cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST) vmlinux.o +endif __modpost: $(call cmd,modpost) -- 2.24.1