path: root/scripts/Makefile.modfinal
diff options
authorMasahiro Yamada <>2020-09-08 13:27:08 +0900
committerMasahiro Yamada <>2020-09-25 00:36:41 +0900
commit596b0474d3d9b1242eab713f84d8873f9887d980 (patch)
tree90679684690ff83518c12455779683ff28f01561 /scripts/Makefile.modfinal
parent887af6d7c99e963c6f92af8e985f9aa6f4f9eac2 (diff)
kbuild: preprocess module linker script
There was a request to preprocess the module linker script like we do for the vmlinux one. ( The difference between and is that the latter is needed for external module builds, thus must be cleaned up by 'make mrproper' instead of 'make clean'. Also, it must be created by 'make modules_prepare'. You cannot put it in arch/$(SRCARCH)/kernel/, which is cleaned up by 'make clean'. I moved arch/$(SRCARCH)/kernel/ to arch/$(SRCARCH)/include/asm/, which is included from scripts/ scripts/ is fine because 'make clean' keeps all the build artifacts under scripts/. You can add arch-specific sections in <asm/>. Signed-off-by: Masahiro Yamada <> Tested-by: Jessica Yu <> Acked-by: Will Deacon <> Acked-by: Geert Uytterhoeven <> Acked-by: Palmer Dabbelt <> Reviewed-by: Kees Cook <> Acked-by: Jessica Yu <>
Diffstat (limited to 'scripts/Makefile.modfinal')
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index 411c1e600e7d..ae01baf96f4e 100644
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -33,11 +33,10 @@ quiet_cmd_ld_ko_o = LD [M] $@
cmd_ld_ko_o = \
- $(addprefix -T , $(KBUILD_LDS_MODULE)) \
- -o $@ $(filter %.o, $^); \
+ -T scripts/ -o $@ $(filter %.o, $^); \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
-$(modules): %.ko: %.o %.mod.o $(KBUILD_LDS_MODULE) FORCE
+$(modules): %.ko: %.o %.mod.o scripts/ FORCE
+$(call if_changed,ld_ko_o)
targets += $(modules) $(modules:.ko=.mod.o)