From 470dec0b53a4bf67c2b99178d60293e187313b42 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Thu, 10 Dec 2020 17:31:39 +0100 Subject: [PATCH] kbuild: Look for module.lds under arch directory too Forwarded: not-needed Bug-Debian: https://bugs.debian.org/975571 The module.lds linker script is now built under the scripts directory, where previously it was under arch/$(SRCARCH). However, we package the scripts directory as linux-kbuild, which is meant to be able to do support native and cross-builds. That means it shouldn't contain files for a specific target architecture without a wrapper to select between them, and it doesn't appear that linker scripts are powerful enough to implement such a wrapper. Building module.lds in a different location would require relatively large changes. Moving it in the package build rules can work, but we need to support custom kernel builds from the same source so we can't assume it's moved. Therefore, we move module.lds under the arch build directory in rules.real and change Makefile.modfinal to look for it in both places. Gbp-Pq: Topic debian Gbp-Pq: Name kbuild-look-for-module.lds-under-arch-directory-too.patch --- scripts/Makefile.modfinal | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index ae01baf96f4..4a2ceb3e8e3 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -28,15 +28,16 @@ quiet_cmd_cc_o_c = CC [M] $@ $(call if_changed_dep,cc_o_c) ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) +ARCH_MODULE_LDS := $(word 1,$(wildcard scripts/module.lds arch/$(SRCARCH)/module.lds)) quiet_cmd_ld_ko_o = LD [M] $@ cmd_ld_ko_o = \ $(LD) -r $(KBUILD_LDFLAGS) \ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ - -T scripts/module.lds -o $@ $(filter %.o, $^); \ + -T $(ARCH_MODULE_LDS) -o $@ $(filter %.o, $^); \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) -$(modules): %.ko: %.o %.mod.o scripts/module.lds FORCE +$(modules): %.ko: %.o %.mod.o $(ARCH_MODULE_LDS) FORCE +$(call if_changed,ld_ko_o) targets += $(modules) $(modules:.ko=.mod.o) -- 2.30.2