kbuild: preprocess module linker script
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 8 Sep 2020 04:27:08 +0000 (13:27 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 24 Sep 2020 15:36:41 +0000 (00:36 +0900)
commit596b0474d3d9b1242eab713f84d8873f9887d980
tree90679684690ff83518c12455779683ff28f01561
parent887af6d7c99e963c6f92af8e985f9aa6f4f9eac2
kbuild: preprocess module linker script

There was a request to preprocess the module linker script like we
do for the vmlinux one. (https://lkml.org/lkml/2020/8/21/512)

The difference between vmlinux.lds and module.lds 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/module.lds to
arch/$(SRCARCH)/include/asm/module.lds.h, which is included from
scripts/module.lds.S.

scripts/module.lds is fine because 'make clean' keeps all the
build artifacts under scripts/.

You can add arch-specific sections in <asm/module.lds.h>.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Jessica Yu <jeyu@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Jessica Yu <jeyu@kernel.org>
28 files changed:
Makefile
arch/arm/Makefile
arch/arm/include/asm/module.lds.h [new file with mode: 0644]
arch/arm/kernel/module.lds [deleted file]
arch/arm64/Makefile
arch/arm64/include/asm/module.lds.h [new file with mode: 0644]
arch/arm64/kernel/module.lds [deleted file]
arch/ia64/Makefile
arch/ia64/include/asm/module.lds.h [new file with mode: 0644]
arch/ia64/module.lds [deleted file]
arch/m68k/Makefile
arch/m68k/include/asm/module.lds.h [new file with mode: 0644]
arch/m68k/kernel/module.lds [deleted file]
arch/powerpc/Makefile
arch/powerpc/include/asm/module.lds.h [new file with mode: 0644]
arch/powerpc/kernel/module.lds [deleted file]
arch/riscv/Makefile
arch/riscv/include/asm/module.lds.h [new file with mode: 0644]
arch/riscv/kernel/module.lds [deleted file]
arch/um/include/asm/Kbuild
include/asm-generic/Kbuild
include/asm-generic/module.lds.h [new file with mode: 0644]
scripts/.gitignore
scripts/Makefile
scripts/Makefile.modfinal
scripts/module-common.lds [deleted file]
scripts/module.lds.S [new file with mode: 0644]
scripts/package/builddeb