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: 310afefe71 ("ANDROID: kbuild: add support for Clang LTO")
Change-Id: I3e6f676e841eed730ce8cccdfbd312f63660c293
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Sami Tolvanen
2019-11-27 12:54:00 -08:00
parent 93306180b8
commit 2d939f16c3

View File

@@ -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)