From 2d939f16c34039a6b411fb656ffc49434c195ccf Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Wed, 27 Nov 2019 12:54:00 -0800 Subject: [PATCH] ANDROID: kbuild: fix modfinal with LTO Makefile.modpost was split to Makefile.modfinal in 5.4. This file doesn't include include/config/auto.conf, which breaks checking for kernel configuration. This change adds the missing include and cleans up the LTO build rule. Bug: 145296861 Fixes: 310afefe71d4 ("ANDROID: kbuild: add support for Clang LTO") Change-Id: I3e6f676e841eed730ce8cccdfbd312f63660c293 Signed-off-by: Sami Tolvanen --- scripts/Makefile.modfinal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index 6eb343ed0cad..216a3f84bafe 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -6,6 +6,7 @@ PHONY := __modfinal __modfinal: +include $(objtree)/include/config/auto.conf include $(srctree)/scripts/Kbuild.include # for c_flags @@ -35,11 +36,10 @@ ifdef CONFIG_LTO_CLANG cmd_ld_ko_o = \ $(LD) -r $(LDFLAGS) \ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ - $(addprefix -T , $(KBUILD_LDS_MODULE)) \ + $(addprefix -T , $(KBUILD_LDS_MODULE)) \ $(shell [ -s $(@:.ko=.o.symversions) ] && \ echo -T $(@:.ko=.o.symversions)) \ - -o $@ --whole-archive \ - $(filter-out FORCE,$(^:$(modpost-ext).o=.o)); \ + -o $@ --whole-archive $(filter %.o, $^); \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) ifdef CONFIG_FTRACE_MCOUNT_RECORD @@ -54,7 +54,7 @@ else $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) endif -$(modules): %.ko: %$(modpost-ext).o %.o %.mod.o $(KBUILD_LDS_MODULE) FORCE +$(modules): %.ko: %.o %.mod.o $(KBUILD_LDS_MODULE) FORCE +$(call if_changed,ld_ko_o) targets += $(modules) $(modules:.ko=.mod.o)