kbuild: unify vdso_install rules
Currently, there is no standard implementation for vdso_install, leading to various issues: 1. Code duplication Many architectures duplicate similar code just for copying files to the install destination. Some architectures (arm, sparc, x86) create build-id symlinks, introducing more code duplication. 2. Unintended updates of in-tree build artifacts The vdso_install rule depends on the vdso files to install. It may update in-tree build artifacts. This can be problematic, as explained in commit 19514fc6 ("arm, kbuild: make "make install" not depend on vmlinux"). 3. Broken code in some architectures Makefile code is often copied from one architecture to another without proper adaptation. 'make vdso_install' for parisc does not work. 'make vdso_install' for s390 installs vdso64, but not vdso32. To address these problems, this commit introduces a generic vdso_install rule. Architectures that support vdso_install need to define vdso-install-y in arch/*/Makefile. vdso-install-y lists the files to install. For example, arch/x86/Makefile looks like this: vdso-install-$(CONFIG_X86_64) += arch/x86/entry/vdso/vdso64.so.dbg vdso-install-$(CONFIG_X86_X32_ABI) += arch/x86/entry/vdso/vdsox32.so.dbg vdso-install-$(CONFIG_X86_32) += arch/x86/entry/vdso/vdso32.so.dbg vdso-install-$(CONFIG_IA32_EMULATION) += arch/x86/entry/vdso/vdso32.so.dbg These files will be installed to $(MODLIB)/vdso/ with the .dbg suffix, if exists, stripped away. vdso-install-y can optionally take the second field after the colon separator. This is needed because some architectures install a vdso file as a different base name. The following is a snippet from arch/arm64/Makefile. vdso-install-$(CONFIG_COMPAT_VDSO) += arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so This will rename vdso.so.dbg to vdso32.so during installation. If such architectures change their implementation so that the base names match, this workaround will go away. Signed-off-by:Masahiro Yamada <masahiroy@kernel.org> Acked-by: Sven Schnelle <svens@linux.ibm.com> # s390 Reviewed-by:
Nicolas Schier <nicolas@fjasle.eu> Reviewed-by:
Guo Ren <guoren@kernel.org> Acked-by: Helge Deller <deller@gmx.de> # parisc Acked-by:
Catalin Marinas <catalin.marinas@arm.com> Acked-by:
Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Showing
- Makefile 9 additions, 0 deletionsMakefile
- arch/arm/Makefile 1 addition, 6 deletionsarch/arm/Makefile
- arch/arm/vdso/Makefile 0 additions, 25 deletionsarch/arm/vdso/Makefile
- arch/arm64/Makefile 3 additions, 6 deletionsarch/arm64/Makefile
- arch/arm64/kernel/vdso/Makefile 0 additions, 10 deletionsarch/arm64/kernel/vdso/Makefile
- arch/arm64/kernel/vdso32/Makefile 0 additions, 10 deletionsarch/arm64/kernel/vdso32/Makefile
- arch/loongarch/Makefile 1 addition, 3 deletionsarch/loongarch/Makefile
- arch/loongarch/vdso/Makefile 0 additions, 10 deletionsarch/loongarch/vdso/Makefile
- arch/parisc/Makefile 2 additions, 6 deletionsarch/parisc/Makefile
- arch/riscv/Makefile 3 additions, 6 deletionsarch/riscv/Makefile
- arch/riscv/kernel/compat_vdso/Makefile 0 additions, 10 deletionsarch/riscv/kernel/compat_vdso/Makefile
- arch/riscv/kernel/vdso/Makefile 0 additions, 10 deletionsarch/riscv/kernel/vdso/Makefile
- arch/s390/Makefile 3 additions, 3 deletionsarch/s390/Makefile
- arch/s390/kernel/vdso32/Makefile 0 additions, 10 deletionsarch/s390/kernel/vdso32/Makefile
- arch/s390/kernel/vdso64/Makefile 0 additions, 10 deletionsarch/s390/kernel/vdso64/Makefile
- arch/sparc/Makefile 2 additions, 3 deletionsarch/sparc/Makefile
- arch/sparc/vdso/Makefile 0 additions, 27 deletionsarch/sparc/vdso/Makefile
- arch/x86/Makefile 4 additions, 3 deletionsarch/x86/Makefile
- arch/x86/entry/vdso/Makefile 0 additions, 27 deletionsarch/x86/entry/vdso/Makefile
- scripts/Makefile.vdsoinst 45 additions, 0 deletionsscripts/Makefile.vdsoinst
Loading
Please register or sign in to comment