* [PATCH 1/5] csky: remove unused cmd_vdso_install @ 2023-10-09 12:42 Masahiro Yamada 2023-10-09 12:42 ` [PATCH 2/5] UML: " Masahiro Yamada ` (4 more replies) 0 siblings, 5 replies; 17+ messages in thread From: Masahiro Yamada @ 2023-10-09 12:42 UTC (permalink / raw) To: linux-kbuild Cc: linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Masahiro Yamada, Guo Ren You cannot run this code because arch/csky/Makefile does not define the vdso_install target. It appears that this code was blindly copied from another architecture. Remove the dead code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- arch/csky/kernel/vdso/Makefile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/csky/kernel/vdso/Makefile b/arch/csky/kernel/vdso/Makefile index 299e4e41ebc5..ddf784a62c11 100644 --- a/arch/csky/kernel/vdso/Makefile +++ b/arch/csky/kernel/vdso/Makefile @@ -58,13 +58,3 @@ quiet_cmd_vdsold = VDSOLD $@ # that contains the same symbols at the same offsets. quiet_cmd_so2s = SO2S $@ cmd_so2s = $(NM) -D $< | $(srctree)/$(src)/so2s.sh > $@ - -# install commands for the unstripped file -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ - -vdso.so: $(obj)/vdso.so.dbg - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso.so -- 2.39.2 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/5] UML: remove unused cmd_vdso_install 2023-10-09 12:42 [PATCH 1/5] csky: remove unused cmd_vdso_install Masahiro Yamada @ 2023-10-09 12:42 ` Masahiro Yamada 2023-10-09 13:09 ` Richard Weinberger 2023-10-09 12:42 ` [PATCH 3/5] parisc: remove broken vdso_install Masahiro Yamada ` (3 subsequent siblings) 4 siblings, 1 reply; 17+ messages in thread From: Masahiro Yamada @ 2023-10-09 12:42 UTC (permalink / raw) To: linux-kbuild Cc: linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Masahiro Yamada, Anton Ivanov, Borislav Petkov, Dave Hansen, H. Peter Anvin, Ingo Molnar, Johannes Berg, Richard Weinberger, Thomas Gleixner You cannot run this code because arch/um/Makefile does not define the vdso_install target. It appears that this code was blindly copied from another architecture. Remove the dead code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- arch/x86/um/vdso/Makefile | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/arch/x86/um/vdso/Makefile b/arch/x86/um/vdso/Makefile index 6825e146a62f..b86d634730b2 100644 --- a/arch/x86/um/vdso/Makefile +++ b/arch/x86/um/vdso/Makefile @@ -67,15 +67,3 @@ quiet_cmd_vdso = VDSO $@ VDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv -z noexecstack GCOV_PROFILE := n - -# -# Install the unstripped copy of vdso*.so listed in $(vdso-install-y). -# -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ -$(vdso-install-y): %.so: $(obj)/%.so.dbg FORCE - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -PHONY += vdso_install $(vdso-install-y) -vdso_install: $(vdso-install-y) -- 2.39.2 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 2/5] UML: remove unused cmd_vdso_install 2023-10-09 12:42 ` [PATCH 2/5] UML: " Masahiro Yamada @ 2023-10-09 13:09 ` Richard Weinberger 0 siblings, 0 replies; 17+ messages in thread From: Richard Weinberger @ 2023-10-09 13:09 UTC (permalink / raw) To: masahiroy Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, anton ivanov, bp, dave hansen, hpa, mingo, Johannes Berg, tglx ----- Ursprüngliche Mail ----- > Von: "masahiroy" <masahiroy@kernel.org> > An: "linux-kbuild" <linux-kbuild@vger.kernel.org> > CC: "linux-kernel" <linux-kernel@vger.kernel.org>, "linux-arm-kernel" <linux-arm-kernel@lists.infradead.org>, > linux-csky@vger.kernel.org, "linux-parisc" <linux-parisc@vger.kernel.org>, linux-riscv@lists.infradead.org, > linux-s390@vger.kernel.org, "linux-um" <linux-um@lists.infradead.org>, "loongarch" <loongarch@lists.linux.dev>, > "sparclinux" <sparclinux@vger.kernel.org>, "x86" <x86@kernel.org>, "masahiroy" <masahiroy@kernel.org>, "anton ivanov" > <anton.ivanov@cambridgegreys.com>, "bp" <bp@alien8.de>, "dave hansen" <dave.hansen@linux.intel.com>, "hpa" > <hpa@zytor.com>, "mingo" <mingo@redhat.com>, "Johannes Berg" <johannes@sipsolutions.net>, "richard" <richard@nod.at>, > "tglx" <tglx@linutronix.de> > Gesendet: Montag, 9. Oktober 2023 14:42:07 > Betreff: [PATCH 2/5] UML: remove unused cmd_vdso_install > You cannot run this code because arch/um/Makefile does not define the > vdso_install target. > > It appears that this code was blindly copied from another architecture. > > Remove the dead code. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Richard Weinberger <richard@nod.at> Thanks, //richard ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/5] parisc: remove broken vdso_install 2023-10-09 12:42 [PATCH 1/5] csky: remove unused cmd_vdso_install Masahiro Yamada 2023-10-09 12:42 ` [PATCH 2/5] UML: " Masahiro Yamada @ 2023-10-09 12:42 ` Masahiro Yamada 2023-10-12 7:24 ` Helge Deller 2023-10-09 12:42 ` [PATCH 4/5] kbuild: unify vdso_install rules Masahiro Yamada ` (2 subsequent siblings) 4 siblings, 1 reply; 17+ messages in thread From: Masahiro Yamada @ 2023-10-09 12:42 UTC (permalink / raw) To: linux-kbuild Cc: linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Masahiro Yamada, Helge Deller, James E.J. Bottomley 'make ARCH=parisc vdso_install' has never worked. It attempts to descend into arch/parisc/kernel/vdso/, which does not exist. The command just fails: scripts/Makefile.build:41: arch/parisc/kernel/vdso/Makefile: No such file or directory The second line is also meaningless because parisc does not define CONFIG_COMPAT_VDSO. It appears that this code was copied from another architecture without proper adaptation. Remove the broken code. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- arch/parisc/Makefile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 968ebe17494c..4222fa73c34a 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile @@ -177,13 +177,6 @@ vdso_prepare: prepare0 $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h endif -PHONY += vdso_install - -vdso_install: - $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso $@ - $(if $(CONFIG_COMPAT_VDSO), \ - $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 $@) - install: KBUILD_IMAGE := vmlinux zinstall: KBUILD_IMAGE := vmlinuz install zinstall: -- 2.39.2 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 3/5] parisc: remove broken vdso_install 2023-10-09 12:42 ` [PATCH 3/5] parisc: remove broken vdso_install Masahiro Yamada @ 2023-10-12 7:24 ` Helge Deller 0 siblings, 0 replies; 17+ messages in thread From: Helge Deller @ 2023-10-12 7:24 UTC (permalink / raw) To: Masahiro Yamada, linux-kbuild Cc: linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, James E.J. Bottomley Hi Masahiro, On 10/9/23 14:42, Masahiro Yamada wrote: > 'make ARCH=parisc vdso_install' has never worked. It attempts to > descend into arch/parisc/kernel/vdso/, which does not exist. > > The command just fails: > > scripts/Makefile.build:41: arch/parisc/kernel/vdso/Makefile: No such file or directory > > The second line is also meaningless because parisc does not define > CONFIG_COMPAT_VDSO. > > It appears that this code was copied from another architecture without > proper adaptation. Yes. > Remove the broken code. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Thanks for cleaning this up and making it consistent across the architectures. Acked-by: Helge Deller <deller@gmx.de> # parisc In case you do a v2 version of the patch, would you add to arch/parisc/Makefile (otherwise I can send a follow-up patch in the parisc git tree): vdso-install-y += arch/parisc/kernel/vdso32/vdso32.so vdso-install-$(CONFIG_64BIT) += arch/parisc/kernel/vdso64/vdso64.so Thanks! Helge ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/5] kbuild: unify vdso_install rules 2023-10-09 12:42 [PATCH 1/5] csky: remove unused cmd_vdso_install Masahiro Yamada 2023-10-09 12:42 ` [PATCH 2/5] UML: " Masahiro Yamada 2023-10-09 12:42 ` [PATCH 3/5] parisc: remove broken vdso_install Masahiro Yamada @ 2023-10-09 12:42 ` Masahiro Yamada 2023-10-10 7:36 ` Sven Schnelle ` (3 more replies) 2023-10-09 12:42 ` [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets Masahiro Yamada 2023-10-09 15:16 ` [PATCH 1/5] csky: remove unused cmd_vdso_install Guo Ren 4 siblings, 4 replies; 17+ messages in thread From: Masahiro Yamada @ 2023-10-09 12:42 UTC (permalink / raw) To: linux-kbuild Cc: linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Masahiro Yamada, Albert Ou, Alexander Gordeev, Andy Lutomirski, Borislav Petkov, Catalin Marinas, Christian Borntraeger, Dave Hansen, David S. Miller, Guo Ren, H. Peter Anvin, Heiko Carstens, Huacai Chen, Ingo Molnar, Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Palmer Dabbelt, Paul Walmsley, Russell King, Sven Schnelle, Thomas Gleixner, Vasily Gorbik, WANG Xuerui, Will Deacon 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. Accidental 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 19514fc665ff ("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 or testing. The previous commits removed broken code from csky, UML, and parisc. Another issue is that 'make vdso_install' for ARCH=s390 installs vdso64, but not vdso32. To address these problems, this commit introduces the generic vdso_install. 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 vdso files 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 file names match, this workaround will go away. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- Makefile | 9 ++++++ arch/arm/Makefile | 7 +--- arch/arm/vdso/Makefile | 25 -------------- arch/arm64/Makefile | 9 ++---- arch/arm64/kernel/vdso/Makefile | 10 ------ arch/arm64/kernel/vdso32/Makefile | 10 ------ arch/loongarch/Makefile | 4 +-- arch/loongarch/vdso/Makefile | 10 ------ arch/riscv/Makefile | 9 ++---- arch/riscv/kernel/compat_vdso/Makefile | 10 ------ arch/riscv/kernel/vdso/Makefile | 10 ------ arch/s390/Makefile | 6 ++-- arch/s390/kernel/vdso32/Makefile | 10 ------ arch/s390/kernel/vdso64/Makefile | 10 ------ arch/sparc/Makefile | 5 ++- arch/sparc/vdso/Makefile | 27 ---------------- arch/x86/Makefile | 7 ++-- arch/x86/entry/vdso/Makefile | 27 ---------------- scripts/Makefile.vdsoinst | 45 ++++++++++++++++++++++++++ 19 files changed, 71 insertions(+), 179 deletions(-) create mode 100644 scripts/Makefile.vdsoinst diff --git a/Makefile b/Makefile index 373649c7374e..2170d56630e8 100644 --- a/Makefile +++ b/Makefile @@ -1317,6 +1317,14 @@ scripts_unifdef: scripts_basic quiet_cmd_install = INSTALL $(INSTALL_PATH) cmd_install = unset sub_make_done; $(srctree)/scripts/install.sh +# --------------------------------------------------------------------------- +# vDSO install + +PHONY += vdso_install +vdso_install: export INSTALL_FILES = $(vdso-install-y) +vdso_install: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst + # --------------------------------------------------------------------------- # Tools @@ -1560,6 +1568,7 @@ help: @echo '* vmlinux - Build the bare kernel' @echo '* modules - Build all modules' @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)' + @echo ' vdso_install - Install unstripped vdso to INSTALL_MOD_PATH (default: /)' @echo ' dir/ - Build all files in dir and below' @echo ' dir/file.[ois] - Build specified target only' @echo ' dir/file.ll - Build the LLVM assembly file' diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 547e5856eaa0..5ba42f69f8ce 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -304,11 +304,7 @@ $(INSTALL_TARGETS): KBUILD_IMAGE = $(boot)/$(patsubst %install,%Image,$@) $(INSTALL_TARGETS): $(call cmd,install) -PHONY += vdso_install -vdso_install: -ifeq ($(CONFIG_VDSO),y) - $(Q)$(MAKE) $(build)=arch/arm/vdso $@ -endif +vdso-install-$(CONFIG_VDSO) += arch/arm/vdso/vdso.so.dbg # My testing targets (bypasses dependencies) bp:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/bootpImage @@ -331,7 +327,6 @@ define archhelp echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or' echo ' (distribution) /sbin/$(INSTALLKERNEL) or' echo ' install to $$(INSTALL_PATH) and run lilo' - echo ' vdso_install - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso' echo echo ' multi_v7_lpae_defconfig - multi_v7_defconfig with CONFIG_ARM_LPAE enabled' endef diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile index 515ca33b854c..d761bd2e2f40 100644 --- a/arch/arm/vdso/Makefile +++ b/arch/arm/vdso/Makefile @@ -63,28 +63,3 @@ quiet_cmd_vdsold_and_vdso_check = LD $@ quiet_cmd_vdsomunge = MUNGE $@ cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@ - -# -# Install the unstripped copy of vdso.so.dbg. If our toolchain -# supports build-id, install .build-id links as well. -# -# Cribbed from arch/x86/vdso/Makefile. -# -quiet_cmd_vdso_install = INSTALL $< -define cmd_vdso_install - cp $< "$(MODLIB)/vdso/vdso.so"; \ - if readelf -n $< | grep -q 'Build ID'; then \ - buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ - first=`echo $$buildid | cut -b-2`; \ - last=`echo $$buildid | cut -b3-`; \ - mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ - ln -sf "../../vdso.so" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ - fi -endef - -$(MODLIB)/vdso: FORCE - @mkdir -p $(MODLIB)/vdso - -PHONY += vdso_install -vdso_install: $(obj)/vdso.so.dbg $(MODLIB)/vdso - $(call cmd,vdso_install) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 2d49aea0ff67..4bd85cc0d32b 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -169,12 +169,6 @@ install: KBUILD_IMAGE := $(boot)/Image install zinstall: $(call cmd,install) -PHONY += vdso_install -vdso_install: - $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ - $(if $(CONFIG_COMPAT_VDSO), \ - $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@) - archprepare: $(Q)$(MAKE) $(build)=arch/arm64/tools kapi ifeq ($(CONFIG_ARM64_ERRATUM_843419),y) @@ -205,6 +199,9 @@ ifdef CONFIG_COMPAT_VDSO endif endif +vdso-install-y += arch/arm64/kernel/vdso/vdso.so.dbg +vdso-install-$(CONFIG_COMPAT_VDSO) += arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so + include $(srctree)/scripts/Makefile.defconf PHONY += virtconfig diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index fe7a53c6781f..8818287f1095 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -78,13 +78,3 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE # Actual build commands quiet_cmd_vdsold_and_vdso_check = LD $@ cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check) - -# Install commands for the unstripped file -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ - -vdso.so: $(obj)/vdso.so.dbg - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso.so diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index 2f73e5bca213..1f911a76c5af 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -172,13 +172,3 @@ gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh quiet_cmd_vdsosym = VDSOSYM $@ # The AArch64 nm should be able to read an AArch32 binary cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ - -# Install commands for the unstripped file -quiet_cmd_vdso_install = INSTALL32 $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so - -vdso.so: $(obj)/vdso.so.dbg - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso.so diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index fb0fada43197..b86f2ff31659 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -136,9 +136,7 @@ vdso_prepare: prepare0 $(Q)$(MAKE) $(build)=arch/loongarch/vdso include/generated/vdso-offsets.h endif -PHONY += vdso_install -vdso_install: - $(Q)$(MAKE) $(build)=arch/loongarch/vdso $@ +vdso-install-y += arch/loongarch/vdso/vdso.so.dbg all: $(notdir $(KBUILD_IMAGE)) diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile index 5c97d1463328..c74c9921304f 100644 --- a/arch/loongarch/vdso/Makefile +++ b/arch/loongarch/vdso/Makefile @@ -83,13 +83,3 @@ $(obj)/vdso.so: $(obj)/vdso.so.dbg FORCE obj-y += vdso.o $(obj)/vdso.o : $(obj)/vdso.so - -# install commands for the unstripped file -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ - -vdso.so: $(obj)/vdso.so.dbg - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso.so diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 1329e060c548..18a47b4d6795 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -131,12 +131,6 @@ endif libs-y += arch/riscv/lib/ libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a -PHONY += vdso_install -vdso_install: - $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ - $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ - $(build)=arch/riscv/kernel/compat_vdso compat_$@) - ifeq ($(KBUILD_EXTMOD),) ifeq ($(CONFIG_MMU),y) prepare: vdso_prepare @@ -148,6 +142,9 @@ vdso_prepare: prepare0 endif endif +vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg +vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so + ifneq ($(CONFIG_XIP_KERNEL),y) ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy) KBUILD_IMAGE := $(boot)/loader.bin diff --git a/arch/riscv/kernel/compat_vdso/Makefile b/arch/riscv/kernel/compat_vdso/Makefile index b86e5e2c3aea..62fa393b2eb2 100644 --- a/arch/riscv/kernel/compat_vdso/Makefile +++ b/arch/riscv/kernel/compat_vdso/Makefile @@ -76,13 +76,3 @@ quiet_cmd_compat_vdsold = VDSOLD $@ # actual build commands quiet_cmd_compat_vdsoas = VDSOAS $@ cmd_compat_vdsoas = $(COMPAT_CC) $(a_flags) $(COMPAT_CC_FLAGS) -c -o $@ $< - -# install commands for the unstripped file -quiet_cmd_compat_vdso_install = INSTALL $@ - cmd_compat_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/compat_vdso/$@ - -compat_vdso.so: $(obj)/compat_vdso.so.dbg - @mkdir -p $(MODLIB)/compat_vdso - $(call cmd,compat_vdso_install) - -compat_vdso_install: compat_vdso.so diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile index 6b1dba11bf6d..e8aa7c380007 100644 --- a/arch/riscv/kernel/vdso/Makefile +++ b/arch/riscv/kernel/vdso/Makefile @@ -73,13 +73,3 @@ quiet_cmd_vdsold = VDSOLD $@ cmd_vdsold = $(LD) $(ld_flags) -T $(filter-out FORCE,$^) -o $@.tmp && \ $(OBJCOPY) $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \ rm $@.tmp - -# install commands for the unstripped file -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ - -vdso.so: $(obj)/vdso.so.dbg - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso.so diff --git a/arch/s390/Makefile b/arch/s390/Makefile index a53a36ee0731..73873e451686 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile @@ -138,9 +138,6 @@ bzImage: vmlinux zfcpdump: $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ -vdso_install: - $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ - archheaders: $(Q)$(MAKE) $(build)=$(syscalls) uapi @@ -160,6 +157,9 @@ vdso_prepare: prepare0 $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ $(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h) +vdso-install-y += arch/s390/kernel/vdso64/vdso64.so.dbg +vdso-install-$(CONFIG_COMPAT) += arch/s390/kernel/vdso32/vdso32.so.dbg + ifdef CONFIG_EXPOLINE_EXTERN modules_prepare: expoline_prepare expoline_prepare: scripts diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile index 23e868b79a6c..caec7db6f966 100644 --- a/arch/s390/kernel/vdso32/Makefile +++ b/arch/s390/kernel/vdso32/Makefile @@ -61,16 +61,6 @@ quiet_cmd_vdso32as = VDSO32A $@ quiet_cmd_vdso32cc = VDSO32C $@ cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $< -# install commands for the unstripped file -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ - -vdso32.so: $(obj)/vdso32.so.dbg - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso32.so - # Generate VDSO offsets using helper script gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh quiet_cmd_vdsosym = VDSOSYM $@ diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile index fc1c6ff8178f..e3c9085f8fa7 100644 --- a/arch/s390/kernel/vdso64/Makefile +++ b/arch/s390/kernel/vdso64/Makefile @@ -70,16 +70,6 @@ quiet_cmd_vdso64as = VDSO64A $@ quiet_cmd_vdso64cc = VDSO64C $@ cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $< -# install commands for the unstripped file -quiet_cmd_vdso_install = INSTALL $@ - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ - -vdso64.so: $(obj)/vdso64.so.dbg - @mkdir -p $(MODLIB)/vdso - $(call cmd,vdso_install) - -vdso_install: vdso64.so - # Generate VDSO offsets using helper script gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh quiet_cmd_vdsosym = VDSOSYM $@ diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 7417345c6639..5f6035936131 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -76,9 +76,8 @@ install: archheaders: $(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all -PHONY += vdso_install -vdso_install: - $(Q)$(MAKE) $(build)=arch/sparc/vdso $@ +vdso-install-$(CONFIG_SPARC64) += arch/sparc/vdso/vdso64.so.dbg +vdso-install-$(CONFIG_COMPAT) += arch/sparc/vdso/vdso32.so.dbg # This is the image used for packaging KBUILD_IMAGE := $(boot)/zImage diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile index 77d7b9032158..d08c3a0443f3 100644 --- a/arch/sparc/vdso/Makefile +++ b/arch/sparc/vdso/Makefile @@ -116,30 +116,3 @@ quiet_cmd_vdso = VDSO $@ VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic GCOV_PROFILE := n - -# -# Install the unstripped copies of vdso*.so. If our toolchain supports -# build-id, install .build-id links as well. -# -quiet_cmd_vdso_install = INSTALL $(@:install_%=%) -define cmd_vdso_install - cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ - if readelf -n $< |grep -q 'Build ID'; then \ - buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ - first=`echo $$buildid | cut -b-2`; \ - last=`echo $$buildid | cut -b3-`; \ - mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ - ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ - fi -endef - -vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) - -$(MODLIB)/vdso: FORCE - @mkdir -p $(MODLIB)/vdso - -$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso FORCE - $(call cmd,vdso_install) - -PHONY += vdso_install $(vdso_img_insttargets) -vdso_install: $(vdso_img_insttargets) FORCE diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 5bfe5caaa444..3ff53a2d4ff0 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -291,9 +291,10 @@ PHONY += install install: $(call cmd,install) -PHONY += vdso_install -vdso_install: - $(Q)$(MAKE) $(build)=arch/x86/entry/vdso $@ +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 archprepare: checkbin checkbin: diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index 6a1821bd7d5e..c197efd82922 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -190,31 +190,4 @@ GCOV_PROFILE := n quiet_cmd_vdso_and_check = VDSO $@ cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check) -# -# Install the unstripped copies of vdso*.so. If our toolchain supports -# build-id, install .build-id links as well. -# -quiet_cmd_vdso_install = INSTALL $(@:install_%=%) -define cmd_vdso_install - cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ - if readelf -n $< |grep -q 'Build ID'; then \ - buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ - first=`echo $$buildid | cut -b-2`; \ - last=`echo $$buildid | cut -b3-`; \ - mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ - ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ - fi -endef - -vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) - -$(MODLIB)/vdso: FORCE - @mkdir -p $(MODLIB)/vdso - -$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso - $(call cmd,vdso_install) - -PHONY += vdso_install $(vdso_img_insttargets) -vdso_install: $(vdso_img_insttargets) - clean-files := vdso32.so vdso32.so.dbg vdso64* vdso-image-*.c vdsox32.so* diff --git a/scripts/Makefile.vdsoinst b/scripts/Makefile.vdsoinst new file mode 100644 index 000000000000..1022d9fdd976 --- /dev/null +++ b/scripts/Makefile.vdsoinst @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: GPL-2.0-only +# ========================================================================== +# Install unstripped copies of vDSO +# ========================================================================== + +PHONY := __default +__default: + @: + +include $(srctree)/scripts/Kbuild.include + +install-dir := $(MODLIB)/vdso + +define gen_install_rules + +src := $$(firstword $$(subst :,$(space),$(1))) +dest := $(install-dir)/$$(or $$(word 2,$$(subst :,$(space),$(1))),$$(patsubst %.dbg,%,$$(notdir $(1)))) + +__default: $$(dest) +$$(dest): $$(src) FORCE + $$(call cmd,install) + +# Some architectures create .build-id symlinks +ifneq ($(filter arm sparc x86, $(SRCARCH)),) +link := $(install-dir)/.build-id/$$(shell $(READELF) -n $$(src) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p') + +__default: $$(link) +$$(link): $$(dest) FORCE + $$(call cmd,symlink) +endif + +endef + +$(foreach x, $(sort $(INSTALL_FILES)), $(eval $(call gen_install_rules,$(x)))) + +quiet_cmd_install = INSTALL $@ + cmd_install = mkdir -p $(dir $@); cp $< $@ + +quiet_cmd_symlink = SYMLINK $@ + cmd_symlink = mkdir -p $(dir $@); ln -sf --relative $< $@ + +PHONY += FORCE +FORCE: + +.PHONY: $(PHONY) -- 2.39.2 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] kbuild: unify vdso_install rules 2023-10-09 12:42 ` [PATCH 4/5] kbuild: unify vdso_install rules Masahiro Yamada @ 2023-10-10 7:36 ` Sven Schnelle 2023-10-11 2:23 ` Guo Ren ` (2 subsequent siblings) 3 siblings, 0 replies; 17+ messages in thread From: Sven Schnelle @ 2023-10-10 7:36 UTC (permalink / raw) To: Masahiro Yamada Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Albert Ou, Alexander Gordeev, Andy Lutomirski, Borislav Petkov, Catalin Marinas, Christian Borntraeger, Dave Hansen, David S. Miller, Guo Ren, H. Peter Anvin, Heiko Carstens, Huacai Chen, Ingo Molnar, Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Palmer Dabbelt, Paul Walmsley, Russell King, Thomas Gleixner, Vasily Gorbik, WANG Xuerui, Will Deacon Masahiro Yamada <masahiroy@kernel.org> writes: > 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. Accidental 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 19514fc665ff ("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 or testing. > > The previous commits removed broken code from csky, UML, and parisc. > > Another issue is that 'make vdso_install' for ARCH=s390 installs > vdso64, but not vdso32. > > To address these problems, this commit introduces the generic vdso_install. > > 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 vdso > files 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 file names match, > this workaround will go away. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- Acked-by: Sven Schnelle <svens@linux.ibm.com> # s390 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] kbuild: unify vdso_install rules 2023-10-09 12:42 ` [PATCH 4/5] kbuild: unify vdso_install rules Masahiro Yamada 2023-10-10 7:36 ` Sven Schnelle @ 2023-10-11 2:23 ` Guo Ren 2023-10-11 12:52 ` Masahiro Yamada 2023-10-11 20:10 ` Nicolas Schier 2023-10-27 19:48 ` Russell King (Oracle) 3 siblings, 1 reply; 17+ messages in thread From: Guo Ren @ 2023-10-11 2:23 UTC (permalink / raw) To: Masahiro Yamada Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Albert Ou, Alexander Gordeev, Andy Lutomirski, Borislav Petkov, Catalin Marinas, Christian Borntraeger, Dave Hansen, David S. Miller, H. Peter Anvin, Heiko Carstens, Huacai Chen, Ingo Molnar, Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Palmer Dabbelt, Paul Walmsley, Russell King, Sven Schnelle, Thomas Gleixner, Vasily Gorbik, WANG Xuerui, Will Deacon On Mon, Oct 9, 2023 at 8:42 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > 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. Accidental 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 19514fc665ff ("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 or testing. > > The previous commits removed broken code from csky, UML, and parisc. > > Another issue is that 'make vdso_install' for ARCH=s390 installs > vdso64, but not vdso32. > > To address these problems, this commit introduces the generic vdso_install. > > 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 vdso > files 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 file names match, > this workaround will go away. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > Makefile | 9 ++++++ > arch/arm/Makefile | 7 +--- > arch/arm/vdso/Makefile | 25 -------------- > arch/arm64/Makefile | 9 ++---- > arch/arm64/kernel/vdso/Makefile | 10 ------ > arch/arm64/kernel/vdso32/Makefile | 10 ------ > arch/loongarch/Makefile | 4 +-- > arch/loongarch/vdso/Makefile | 10 ------ > arch/riscv/Makefile | 9 ++---- > arch/riscv/kernel/compat_vdso/Makefile | 10 ------ > arch/riscv/kernel/vdso/Makefile | 10 ------ > arch/s390/Makefile | 6 ++-- > arch/s390/kernel/vdso32/Makefile | 10 ------ > arch/s390/kernel/vdso64/Makefile | 10 ------ > arch/sparc/Makefile | 5 ++- > arch/sparc/vdso/Makefile | 27 ---------------- > arch/x86/Makefile | 7 ++-- > arch/x86/entry/vdso/Makefile | 27 ---------------- > scripts/Makefile.vdsoinst | 45 ++++++++++++++++++++++++++ > 19 files changed, 71 insertions(+), 179 deletions(-) > create mode 100644 scripts/Makefile.vdsoinst > > diff --git a/Makefile b/Makefile > index 373649c7374e..2170d56630e8 100644 > --- a/Makefile > +++ b/Makefile > @@ -1317,6 +1317,14 @@ scripts_unifdef: scripts_basic > quiet_cmd_install = INSTALL $(INSTALL_PATH) > cmd_install = unset sub_make_done; $(srctree)/scripts/install.sh > > +# --------------------------------------------------------------------------- > +# vDSO install > + > +PHONY += vdso_install > +vdso_install: export INSTALL_FILES = $(vdso-install-y) > +vdso_install: > + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst > + > # --------------------------------------------------------------------------- > # Tools > > @@ -1560,6 +1568,7 @@ help: > @echo '* vmlinux - Build the bare kernel' > @echo '* modules - Build all modules' > @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)' > + @echo ' vdso_install - Install unstripped vdso to INSTALL_MOD_PATH (default: /)' > @echo ' dir/ - Build all files in dir and below' > @echo ' dir/file.[ois] - Build specified target only' > @echo ' dir/file.ll - Build the LLVM assembly file' > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > index 547e5856eaa0..5ba42f69f8ce 100644 > --- a/arch/arm/Makefile > +++ b/arch/arm/Makefile > @@ -304,11 +304,7 @@ $(INSTALL_TARGETS): KBUILD_IMAGE = $(boot)/$(patsubst %install,%Image,$@) > $(INSTALL_TARGETS): > $(call cmd,install) > > -PHONY += vdso_install > -vdso_install: > -ifeq ($(CONFIG_VDSO),y) > - $(Q)$(MAKE) $(build)=arch/arm/vdso $@ > -endif > +vdso-install-$(CONFIG_VDSO) += arch/arm/vdso/vdso.so.dbg > > # My testing targets (bypasses dependencies) > bp:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/bootpImage > @@ -331,7 +327,6 @@ define archhelp > echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or' > echo ' (distribution) /sbin/$(INSTALLKERNEL) or' > echo ' install to $$(INSTALL_PATH) and run lilo' > - echo ' vdso_install - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso' > echo > echo ' multi_v7_lpae_defconfig - multi_v7_defconfig with CONFIG_ARM_LPAE enabled' > endef > diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile > index 515ca33b854c..d761bd2e2f40 100644 > --- a/arch/arm/vdso/Makefile > +++ b/arch/arm/vdso/Makefile > @@ -63,28 +63,3 @@ quiet_cmd_vdsold_and_vdso_check = LD $@ > > quiet_cmd_vdsomunge = MUNGE $@ > cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@ > - > -# > -# Install the unstripped copy of vdso.so.dbg. If our toolchain > -# supports build-id, install .build-id links as well. > -# > -# Cribbed from arch/x86/vdso/Makefile. > -# > -quiet_cmd_vdso_install = INSTALL $< > -define cmd_vdso_install > - cp $< "$(MODLIB)/vdso/vdso.so"; \ > - if readelf -n $< | grep -q 'Build ID'; then \ > - buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ > - first=`echo $$buildid | cut -b-2`; \ > - last=`echo $$buildid | cut -b3-`; \ > - mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ > - ln -sf "../../vdso.so" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ > - fi > -endef > - > -$(MODLIB)/vdso: FORCE > - @mkdir -p $(MODLIB)/vdso > - > -PHONY += vdso_install > -vdso_install: $(obj)/vdso.so.dbg $(MODLIB)/vdso > - $(call cmd,vdso_install) > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 2d49aea0ff67..4bd85cc0d32b 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -169,12 +169,6 @@ install: KBUILD_IMAGE := $(boot)/Image > install zinstall: > $(call cmd,install) > > -PHONY += vdso_install > -vdso_install: > - $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ > - $(if $(CONFIG_COMPAT_VDSO), \ > - $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@) > - > archprepare: > $(Q)$(MAKE) $(build)=arch/arm64/tools kapi > ifeq ($(CONFIG_ARM64_ERRATUM_843419),y) > @@ -205,6 +199,9 @@ ifdef CONFIG_COMPAT_VDSO > endif > endif > > +vdso-install-y += arch/arm64/kernel/vdso/vdso.so.dbg > +vdso-install-$(CONFIG_COMPAT_VDSO) += arch/arm64/kernel/vdso32/vdso.so.dbg:vdso32.so > + > include $(srctree)/scripts/Makefile.defconf > > PHONY += virtconfig > diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile > index fe7a53c6781f..8818287f1095 100644 > --- a/arch/arm64/kernel/vdso/Makefile > +++ b/arch/arm64/kernel/vdso/Makefile > @@ -78,13 +78,3 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE > # Actual build commands > quiet_cmd_vdsold_and_vdso_check = LD $@ > cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check) > - > -# Install commands for the unstripped file > -quiet_cmd_vdso_install = INSTALL $@ > - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ > - > -vdso.so: $(obj)/vdso.so.dbg > - @mkdir -p $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -vdso_install: vdso.so > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 2f73e5bca213..1f911a76c5af 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -172,13 +172,3 @@ gen-vdsosym := $(srctree)/$(src)/../vdso/gen_vdso_offsets.sh > quiet_cmd_vdsosym = VDSOSYM $@ > # The AArch64 nm should be able to read an AArch32 binary > cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ > - > -# Install commands for the unstripped file > -quiet_cmd_vdso_install = INSTALL32 $@ > - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so > - > -vdso.so: $(obj)/vdso.so.dbg > - @mkdir -p $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -vdso_install: vdso.so > diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile > index fb0fada43197..b86f2ff31659 100644 > --- a/arch/loongarch/Makefile > +++ b/arch/loongarch/Makefile > @@ -136,9 +136,7 @@ vdso_prepare: prepare0 > $(Q)$(MAKE) $(build)=arch/loongarch/vdso include/generated/vdso-offsets.h > endif > > -PHONY += vdso_install > -vdso_install: > - $(Q)$(MAKE) $(build)=arch/loongarch/vdso $@ > +vdso-install-y += arch/loongarch/vdso/vdso.so.dbg > > all: $(notdir $(KBUILD_IMAGE)) > > diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile > index 5c97d1463328..c74c9921304f 100644 > --- a/arch/loongarch/vdso/Makefile > +++ b/arch/loongarch/vdso/Makefile > @@ -83,13 +83,3 @@ $(obj)/vdso.so: $(obj)/vdso.so.dbg FORCE > obj-y += vdso.o > > $(obj)/vdso.o : $(obj)/vdso.so > - > -# install commands for the unstripped file > -quiet_cmd_vdso_install = INSTALL $@ > - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ > - > -vdso.so: $(obj)/vdso.so.dbg > - @mkdir -p $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -vdso_install: vdso.so > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile > index 1329e060c548..18a47b4d6795 100644 > --- a/arch/riscv/Makefile > +++ b/arch/riscv/Makefile > @@ -131,12 +131,6 @@ endif > libs-y += arch/riscv/lib/ > libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a > > -PHONY += vdso_install > -vdso_install: > - $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ > - $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ > - $(build)=arch/riscv/kernel/compat_vdso compat_$@) > - > ifeq ($(KBUILD_EXTMOD),) > ifeq ($(CONFIG_MMU),y) > prepare: vdso_prepare > @@ -148,6 +142,9 @@ vdso_prepare: prepare0 > endif > endif > > +vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg > +vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so Why do we need ":../compat_vdso/compat_vdso.so" here? > + > ifneq ($(CONFIG_XIP_KERNEL),y) > ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy) > KBUILD_IMAGE := $(boot)/loader.bin > diff --git a/arch/riscv/kernel/compat_vdso/Makefile b/arch/riscv/kernel/compat_vdso/Makefile > index b86e5e2c3aea..62fa393b2eb2 100644 > --- a/arch/riscv/kernel/compat_vdso/Makefile > +++ b/arch/riscv/kernel/compat_vdso/Makefile > @@ -76,13 +76,3 @@ quiet_cmd_compat_vdsold = VDSOLD $@ > # actual build commands > quiet_cmd_compat_vdsoas = VDSOAS $@ > cmd_compat_vdsoas = $(COMPAT_CC) $(a_flags) $(COMPAT_CC_FLAGS) -c -o $@ $< > - > -# install commands for the unstripped file > -quiet_cmd_compat_vdso_install = INSTALL $@ > - cmd_compat_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/compat_vdso/$@ > - > -compat_vdso.so: $(obj)/compat_vdso.so.dbg > - @mkdir -p $(MODLIB)/compat_vdso > - $(call cmd,compat_vdso_install) > - > -compat_vdso_install: compat_vdso.so > diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile > index 6b1dba11bf6d..e8aa7c380007 100644 > --- a/arch/riscv/kernel/vdso/Makefile > +++ b/arch/riscv/kernel/vdso/Makefile > @@ -73,13 +73,3 @@ quiet_cmd_vdsold = VDSOLD $@ > cmd_vdsold = $(LD) $(ld_flags) -T $(filter-out FORCE,$^) -o $@.tmp && \ > $(OBJCOPY) $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \ > rm $@.tmp > - > -# install commands for the unstripped file > -quiet_cmd_vdso_install = INSTALL $@ > - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ > - > -vdso.so: $(obj)/vdso.so.dbg > - @mkdir -p $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -vdso_install: vdso.so > diff --git a/arch/s390/Makefile b/arch/s390/Makefile > index a53a36ee0731..73873e451686 100644 > --- a/arch/s390/Makefile > +++ b/arch/s390/Makefile > @@ -138,9 +138,6 @@ bzImage: vmlinux > zfcpdump: > $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ > > -vdso_install: > - $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ > - > archheaders: > $(Q)$(MAKE) $(build)=$(syscalls) uapi > > @@ -160,6 +157,9 @@ vdso_prepare: prepare0 > $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ > $(build)=arch/s390/kernel/vdso32 include/generated/vdso32-offsets.h) > > +vdso-install-y += arch/s390/kernel/vdso64/vdso64.so.dbg > +vdso-install-$(CONFIG_COMPAT) += arch/s390/kernel/vdso32/vdso32.so.dbg > + > ifdef CONFIG_EXPOLINE_EXTERN > modules_prepare: expoline_prepare > expoline_prepare: scripts > diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile > index 23e868b79a6c..caec7db6f966 100644 > --- a/arch/s390/kernel/vdso32/Makefile > +++ b/arch/s390/kernel/vdso32/Makefile > @@ -61,16 +61,6 @@ quiet_cmd_vdso32as = VDSO32A $@ > quiet_cmd_vdso32cc = VDSO32C $@ > cmd_vdso32cc = $(CC) $(c_flags) -c -o $@ $< > > -# install commands for the unstripped file > -quiet_cmd_vdso_install = INSTALL $@ > - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ > - > -vdso32.so: $(obj)/vdso32.so.dbg > - @mkdir -p $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -vdso_install: vdso32.so > - > # Generate VDSO offsets using helper script > gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh > quiet_cmd_vdsosym = VDSOSYM $@ > diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile > index fc1c6ff8178f..e3c9085f8fa7 100644 > --- a/arch/s390/kernel/vdso64/Makefile > +++ b/arch/s390/kernel/vdso64/Makefile > @@ -70,16 +70,6 @@ quiet_cmd_vdso64as = VDSO64A $@ > quiet_cmd_vdso64cc = VDSO64C $@ > cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $< > > -# install commands for the unstripped file > -quiet_cmd_vdso_install = INSTALL $@ > - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ > - > -vdso64.so: $(obj)/vdso64.so.dbg > - @mkdir -p $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -vdso_install: vdso64.so > - > # Generate VDSO offsets using helper script > gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh > quiet_cmd_vdsosym = VDSOSYM $@ > diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile > index 7417345c6639..5f6035936131 100644 > --- a/arch/sparc/Makefile > +++ b/arch/sparc/Makefile > @@ -76,9 +76,8 @@ install: > archheaders: > $(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all > > -PHONY += vdso_install > -vdso_install: > - $(Q)$(MAKE) $(build)=arch/sparc/vdso $@ > +vdso-install-$(CONFIG_SPARC64) += arch/sparc/vdso/vdso64.so.dbg > +vdso-install-$(CONFIG_COMPAT) += arch/sparc/vdso/vdso32.so.dbg > > # This is the image used for packaging > KBUILD_IMAGE := $(boot)/zImage > diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile > index 77d7b9032158..d08c3a0443f3 100644 > --- a/arch/sparc/vdso/Makefile > +++ b/arch/sparc/vdso/Makefile > @@ -116,30 +116,3 @@ quiet_cmd_vdso = VDSO $@ > > VDSO_LDFLAGS = -shared --hash-style=both --build-id=sha1 -Bsymbolic > GCOV_PROFILE := n > - > -# > -# Install the unstripped copies of vdso*.so. If our toolchain supports > -# build-id, install .build-id links as well. > -# > -quiet_cmd_vdso_install = INSTALL $(@:install_%=%) > -define cmd_vdso_install > - cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ > - if readelf -n $< |grep -q 'Build ID'; then \ > - buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ > - first=`echo $$buildid | cut -b-2`; \ > - last=`echo $$buildid | cut -b3-`; \ > - mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ > - ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ > - fi > -endef > - > -vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) > - > -$(MODLIB)/vdso: FORCE > - @mkdir -p $(MODLIB)/vdso > - > -$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso FORCE > - $(call cmd,vdso_install) > - > -PHONY += vdso_install $(vdso_img_insttargets) > -vdso_install: $(vdso_img_insttargets) FORCE > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index 5bfe5caaa444..3ff53a2d4ff0 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -291,9 +291,10 @@ PHONY += install > install: > $(call cmd,install) > > -PHONY += vdso_install > -vdso_install: > - $(Q)$(MAKE) $(build)=arch/x86/entry/vdso $@ > +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 > > archprepare: checkbin > checkbin: > diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile > index 6a1821bd7d5e..c197efd82922 100644 > --- a/arch/x86/entry/vdso/Makefile > +++ b/arch/x86/entry/vdso/Makefile > @@ -190,31 +190,4 @@ GCOV_PROFILE := n > quiet_cmd_vdso_and_check = VDSO $@ > cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check) > > -# > -# Install the unstripped copies of vdso*.so. If our toolchain supports > -# build-id, install .build-id links as well. > -# > -quiet_cmd_vdso_install = INSTALL $(@:install_%=%) > -define cmd_vdso_install > - cp $< "$(MODLIB)/vdso/$(@:install_%=%)"; \ > - if readelf -n $< |grep -q 'Build ID'; then \ > - buildid=`readelf -n $< |grep 'Build ID' |sed -e 's/^.*Build ID: \(.*\)$$/\1/'`; \ > - first=`echo $$buildid | cut -b-2`; \ > - last=`echo $$buildid | cut -b3-`; \ > - mkdir -p "$(MODLIB)/vdso/.build-id/$$first"; \ > - ln -sf "../../$(@:install_%=%)" "$(MODLIB)/vdso/.build-id/$$first/$$last.debug"; \ > - fi > -endef > - > -vdso_img_insttargets := $(vdso_img_sodbg:%.dbg=install_%) > - > -$(MODLIB)/vdso: FORCE > - @mkdir -p $(MODLIB)/vdso > - > -$(vdso_img_insttargets): install_%: $(obj)/%.dbg $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -PHONY += vdso_install $(vdso_img_insttargets) > -vdso_install: $(vdso_img_insttargets) > - > clean-files := vdso32.so vdso32.so.dbg vdso64* vdso-image-*.c vdsox32.so* > diff --git a/scripts/Makefile.vdsoinst b/scripts/Makefile.vdsoinst > new file mode 100644 > index 000000000000..1022d9fdd976 > --- /dev/null > +++ b/scripts/Makefile.vdsoinst > @@ -0,0 +1,45 @@ > +# SPDX-License-Identifier: GPL-2.0-only > +# ========================================================================== > +# Install unstripped copies of vDSO > +# ========================================================================== > + > +PHONY := __default > +__default: > + @: > + > +include $(srctree)/scripts/Kbuild.include > + > +install-dir := $(MODLIB)/vdso > + > +define gen_install_rules > + > +src := $$(firstword $$(subst :,$(space),$(1))) > +dest := $(install-dir)/$$(or $$(word 2,$$(subst :,$(space),$(1))),$$(patsubst %.dbg,%,$$(notdir $(1)))) > + > +__default: $$(dest) > +$$(dest): $$(src) FORCE > + $$(call cmd,install) > + > +# Some architectures create .build-id symlinks > +ifneq ($(filter arm sparc x86, $(SRCARCH)),) > +link := $(install-dir)/.build-id/$$(shell $(READELF) -n $$(src) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p') > + > +__default: $$(link) > +$$(link): $$(dest) FORCE > + $$(call cmd,symlink) > +endif > + > +endef > + > +$(foreach x, $(sort $(INSTALL_FILES)), $(eval $(call gen_install_rules,$(x)))) > + > +quiet_cmd_install = INSTALL $@ > + cmd_install = mkdir -p $(dir $@); cp $< $@ > + > +quiet_cmd_symlink = SYMLINK $@ > + cmd_symlink = mkdir -p $(dir $@); ln -sf --relative $< $@ > + > +PHONY += FORCE > +FORCE: > + > +.PHONY: $(PHONY) > -- > 2.39.2 > -- Best Regards Guo Ren ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] kbuild: unify vdso_install rules 2023-10-11 2:23 ` Guo Ren @ 2023-10-11 12:52 ` Masahiro Yamada 2023-10-12 6:21 ` Guo Ren 0 siblings, 1 reply; 17+ messages in thread From: Masahiro Yamada @ 2023-10-11 12:52 UTC (permalink / raw) To: Guo Ren Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Albert Ou, Alexander Gordeev, Andy Lutomirski, Borislav Petkov, Catalin Marinas, Christian Borntraeger, Dave Hansen, David S. Miller, H. Peter Anvin, Heiko Carstens, Huacai Chen, Ingo Molnar, Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Palmer Dabbelt, Paul Walmsley, Russell King, Sven Schnelle, Thomas Gleixner, Vasily Gorbik, WANG Xuerui, Will Deacon On Wed, Oct 11, 2023 at 11:24 AM Guo Ren <guoren@kernel.org> wrote: > > On Mon, Oct 9, 2023 at 8:42 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > --- a/arch/riscv/Makefile > > +++ b/arch/riscv/Makefile > > @@ -131,12 +131,6 @@ endif > > libs-y += arch/riscv/lib/ > > libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a > > > > -PHONY += vdso_install > > -vdso_install: > > - $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ > > - $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ > > - $(build)=arch/riscv/kernel/compat_vdso compat_$@) > > - > > ifeq ($(KBUILD_EXTMOD),) > > ifeq ($(CONFIG_MMU),y) > > prepare: vdso_prepare > > @@ -148,6 +142,9 @@ vdso_prepare: prepare0 > > endif > > endif > > > > +vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg > > +vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so > Why do we need ":../compat_vdso/compat_vdso.so" here? All architectures except riscv install vdso files to /lib/modules/$(uname -r)/vdso/. See the following code in arch/riscv/kernel/compat_vdso/Makefile: quiet_cmd_compat_vdso_install = INSTALL $@ cmd_compat_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/compat_vdso/$@ Riscv copies the compat vdso to /lib/modules/$(uname -r)/compat_vdso/. This commit preserves the current installation path as-is. If the riscv maintainers agree, we can change the installation destination to /lib/modules/$(uname -r)/vdso/ for consistency. -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] kbuild: unify vdso_install rules 2023-10-11 12:52 ` Masahiro Yamada @ 2023-10-12 6:21 ` Guo Ren 0 siblings, 0 replies; 17+ messages in thread From: Guo Ren @ 2023-10-12 6:21 UTC (permalink / raw) To: Masahiro Yamada Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Albert Ou, Alexander Gordeev, Andy Lutomirski, Borislav Petkov, Catalin Marinas, Christian Borntraeger, Dave Hansen, David S. Miller, H. Peter Anvin, Heiko Carstens, Huacai Chen, Ingo Molnar, Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Palmer Dabbelt, Paul Walmsley, Russell King, Sven Schnelle, Thomas Gleixner, Vasily Gorbik, WANG Xuerui, Will Deacon On Wed, Oct 11, 2023 at 8:53 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > On Wed, Oct 11, 2023 at 11:24 AM Guo Ren <guoren@kernel.org> wrote: > > > > On Mon, Oct 9, 2023 at 8:42 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > --- a/arch/riscv/Makefile > > > +++ b/arch/riscv/Makefile > > > @@ -131,12 +131,6 @@ endif > > > libs-y += arch/riscv/lib/ > > > libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a > > > > > > -PHONY += vdso_install > > > -vdso_install: > > > - $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ > > > - $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ > > > - $(build)=arch/riscv/kernel/compat_vdso compat_$@) > > > - > > > ifeq ($(KBUILD_EXTMOD),) > > > ifeq ($(CONFIG_MMU),y) > > > prepare: vdso_prepare > > > @@ -148,6 +142,9 @@ vdso_prepare: prepare0 > > > endif > > > endif > > > > > > +vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg > > > +vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so > > Why do we need ":../compat_vdso/compat_vdso.so" here? > > > > > All architectures except riscv install vdso files > to /lib/modules/$(uname -r)/vdso/. > > > > See the following code in arch/riscv/kernel/compat_vdso/Makefile: > > > quiet_cmd_compat_vdso_install = INSTALL $@ > cmd_compat_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/compat_vdso/$@ > > > > > Riscv copies the compat vdso to > /lib/modules/$(uname -r)/compat_vdso/. > > > > This commit preserves the current installation path as-is. > > If the riscv maintainers agree, we can change the > installation destination to /lib/modules/$(uname -r)/vdso/ > for consistency. Yes, but it should be another patch. Thx for the clarification. Reviewed-by: Guo Ren <guoren@kernel.org> > > > > -- > Best Regards > Masahiro Yamada -- Best Regards Guo Ren ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] kbuild: unify vdso_install rules 2023-10-09 12:42 ` [PATCH 4/5] kbuild: unify vdso_install rules Masahiro Yamada 2023-10-10 7:36 ` Sven Schnelle 2023-10-11 2:23 ` Guo Ren @ 2023-10-11 20:10 ` Nicolas Schier 2023-10-27 19:48 ` Russell King (Oracle) 3 siblings, 0 replies; 17+ messages in thread From: Nicolas Schier @ 2023-10-11 20:10 UTC (permalink / raw) To: Masahiro Yamada Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Albert Ou, Alexander Gordeev, Andy Lutomirski, Borislav Petkov, Catalin Marinas, Christian Borntraeger, Dave Hansen, David S. Miller, Guo Ren, H. Peter Anvin, Heiko Carstens, Huacai Chen, Ingo Molnar, Nathan Chancellor, Nick Desaulniers, Palmer Dabbelt, Paul Walmsley, Russell King, Sven Schnelle, Thomas Gleixner, Vasily Gorbik, WANG Xuerui, Will Deacon On Mon 09 Oct 2023 21:42:09 GMT, Masahiro Yamada wrote: > 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. Accidental 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 19514fc665ff ("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 or testing. > > The previous commits removed broken code from csky, UML, and parisc. > > Another issue is that 'make vdso_install' for ARCH=s390 installs > vdso64, but not vdso32. > > To address these problems, this commit introduces the generic vdso_install. > > 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 vdso > files 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 file names match, > this workaround will go away. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- Thanks for cleaning this up! Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/5] kbuild: unify vdso_install rules 2023-10-09 12:42 ` [PATCH 4/5] kbuild: unify vdso_install rules Masahiro Yamada ` (2 preceding siblings ...) 2023-10-11 20:10 ` Nicolas Schier @ 2023-10-27 19:48 ` Russell King (Oracle) 3 siblings, 0 replies; 17+ messages in thread From: Russell King (Oracle) @ 2023-10-27 19:48 UTC (permalink / raw) To: Masahiro Yamada Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Albert Ou, Alexander Gordeev, Andy Lutomirski, Borislav Petkov, Catalin Marinas, Christian Borntraeger, Dave Hansen, David S. Miller, Guo Ren, H. Peter Anvin, Heiko Carstens, Huacai Chen, Ingo Molnar, Nathan Chancellor, Nick Desaulniers, Nicolas Schier, Palmer Dabbelt, Paul Walmsley, Sven Schnelle, Thomas Gleixner, Vasily Gorbik, WANG Xuerui, Will Deacon On Mon, Oct 09, 2023 at 09:42:09PM +0900, Masahiro Yamada wrote: > arch/arm/Makefile | 7 +--- > arch/arm/vdso/Makefile | 25 -------------- Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets 2023-10-09 12:42 [PATCH 1/5] csky: remove unused cmd_vdso_install Masahiro Yamada ` (2 preceding siblings ...) 2023-10-09 12:42 ` [PATCH 4/5] kbuild: unify vdso_install rules Masahiro Yamada @ 2023-10-09 12:42 ` Masahiro Yamada 2023-10-09 16:44 ` Nathan Chancellor 2023-10-09 15:16 ` [PATCH 1/5] csky: remove unused cmd_vdso_install Guo Ren 4 siblings, 1 reply; 17+ messages in thread From: Masahiro Yamada @ 2023-10-09 12:42 UTC (permalink / raw) To: linux-kbuild Cc: linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Masahiro Yamada, Nathan Chancellor, Nick Desaulniers, Nicolas Schier Now that vdso_install does not depend on any in-tree build artifact, it no longer invokes a compiler, making no-compiler-targets the same as no-sync-config-targets. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- Makefile | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 2170d56630e8..982b1ad33287 100644 --- a/Makefile +++ b/Makefile @@ -277,10 +277,6 @@ no-dot-config-targets := $(clean-targets) \ $(version_h) headers headers_% archheaders archscripts \ %asm-generic kernelversion %src-pkg dt_binding_check \ outputmakefile rustavailable rustfmt rustfmtcheck -# Installation targets should not require compiler. Unfortunately, vdso_install -# is an exception where build artifacts may be updated. This must be fixed. -no-compiler-targets := $(no-dot-config-targets) install dtbs_install \ - headers_install modules_install modules_sign kernelrelease image_name no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \ image_name single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/ @@ -288,7 +284,6 @@ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes % config-build := mixed-build := need-config := 1 -need-compiler := 1 may-sync-config := 1 single-build := @@ -298,12 +293,6 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) endif endif -ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),) - ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),) - need-compiler := - endif -endif - ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) may-sync-config := @@ -675,7 +664,7 @@ endif # Include this also for config targets because some architectures need # cc-cross-prefix to determine CROSS_COMPILE. -ifdef need-compiler +ifdef may-sync-config include $(srctree)/scripts/Makefile.compiler endif -- 2.39.2 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets 2023-10-09 12:42 ` [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets Masahiro Yamada @ 2023-10-09 16:44 ` Nathan Chancellor 2023-10-14 8:41 ` Masahiro Yamada 0 siblings, 1 reply; 17+ messages in thread From: Nathan Chancellor @ 2023-10-09 16:44 UTC (permalink / raw) To: Masahiro Yamada Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Nick Desaulniers, Nicolas Schier On Mon, Oct 09, 2023 at 09:42:10PM +0900, Masahiro Yamada wrote: > Now that vdso_install does not depend on any in-tree build artifact, > it no longer invokes a compiler, making no-compiler-targets the same > as no-sync-config-targets. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > Makefile | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/Makefile b/Makefile > index 2170d56630e8..982b1ad33287 100644 > --- a/Makefile > +++ b/Makefile > @@ -277,10 +277,6 @@ no-dot-config-targets := $(clean-targets) \ > $(version_h) headers headers_% archheaders archscripts \ > %asm-generic kernelversion %src-pkg dt_binding_check \ > outputmakefile rustavailable rustfmt rustfmtcheck > -# Installation targets should not require compiler. Unfortunately, vdso_install > -# is an exception where build artifacts may be updated. This must be fixed. > -no-compiler-targets := $(no-dot-config-targets) install dtbs_install \ > - headers_install modules_install modules_sign kernelrelease image_name > no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \ > image_name > single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/ > @@ -288,7 +284,6 @@ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes % > config-build := > mixed-build := > need-config := 1 > -need-compiler := 1 > may-sync-config := 1 > single-build := > > @@ -298,12 +293,6 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) > endif > endif > > -ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),) > - ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),) > - need-compiler := > - endif > -endif > - MIPS and LoongArch seem to have grown a usage of need-compiler in 4fe4a6374c4d ("MIPS: Only fiddle with CHECKFLAGS if `need-compiler'") and 54c2c9df083f ("LoongArch: Only fiddle with CHECKFLAGS if `need-compiler'"). With this removal, should those be updated as well? > ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) > ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) > may-sync-config := > @@ -675,7 +664,7 @@ endif > > # Include this also for config targets because some architectures need > # cc-cross-prefix to determine CROSS_COMPILE. > -ifdef need-compiler > +ifdef may-sync-config > include $(srctree)/scripts/Makefile.compiler > endif > > -- > 2.39.2 > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets 2023-10-09 16:44 ` Nathan Chancellor @ 2023-10-14 8:41 ` Masahiro Yamada 0 siblings, 0 replies; 17+ messages in thread From: Masahiro Yamada @ 2023-10-14 8:41 UTC (permalink / raw) To: Nathan Chancellor Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86, Nick Desaulniers, Nicolas Schier On Tue, Oct 10, 2023 at 1:44 AM Nathan Chancellor <nathan@kernel.org> wrote: > > On Mon, Oct 09, 2023 at 09:42:10PM +0900, Masahiro Yamada wrote: > > Now that vdso_install does not depend on any in-tree build artifact, > > it no longer invokes a compiler, making no-compiler-targets the same > > as no-sync-config-targets. > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > --- > > > > Makefile | 13 +------------ > > 1 file changed, 1 insertion(+), 12 deletions(-) > > > > diff --git a/Makefile b/Makefile > > index 2170d56630e8..982b1ad33287 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -277,10 +277,6 @@ no-dot-config-targets := $(clean-targets) \ > > $(version_h) headers headers_% archheaders archscripts \ > > %asm-generic kernelversion %src-pkg dt_binding_check \ > > outputmakefile rustavailable rustfmt rustfmtcheck > > -# Installation targets should not require compiler. Unfortunately, vdso_install > > -# is an exception where build artifacts may be updated. This must be fixed. > > -no-compiler-targets := $(no-dot-config-targets) install dtbs_install \ > > - headers_install modules_install modules_sign kernelrelease image_name > > no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \ > > image_name > > single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/ > > @@ -288,7 +284,6 @@ single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes % > > config-build := > > mixed-build := > > need-config := 1 > > -need-compiler := 1 > > may-sync-config := 1 > > single-build := > > > > @@ -298,12 +293,6 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) > > endif > > endif > > > > -ifneq ($(filter $(no-compiler-targets), $(MAKECMDGOALS)),) > > - ifeq ($(filter-out $(no-compiler-targets), $(MAKECMDGOALS)),) > > - need-compiler := > > - endif > > -endif > > - > > MIPS and LoongArch seem to have grown a usage of need-compiler in > 4fe4a6374c4d ("MIPS: Only fiddle with CHECKFLAGS if `need-compiler'") > and 54c2c9df083f ("LoongArch: Only fiddle with CHECKFLAGS if > `need-compiler'"). With this removal, should those be updated as well? Right, but may-sync-config and need-compiler are not interchangeable due to the following code. ifneq ($(KBUILD_EXTMOD),) may-sync-config := endif I will keep both. -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] csky: remove unused cmd_vdso_install 2023-10-09 12:42 [PATCH 1/5] csky: remove unused cmd_vdso_install Masahiro Yamada ` (3 preceding siblings ...) 2023-10-09 12:42 ` [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets Masahiro Yamada @ 2023-10-09 15:16 ` Guo Ren 2023-10-14 9:08 ` Masahiro Yamada 4 siblings, 1 reply; 17+ messages in thread From: Guo Ren @ 2023-10-09 15:16 UTC (permalink / raw) To: Masahiro Yamada Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86 On Mon, Oct 9, 2023 at 8:42 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > You cannot run this code because arch/csky/Makefile does not define the > vdso_install target. > > It appears that this code was blindly copied from another architecture. Yes, I do that. Thx for pointing it out. Acked-by: Guo Ren <guoren@kernel.org> > > Remove the dead code. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > arch/csky/kernel/vdso/Makefile | 10 ---------- > 1 file changed, 10 deletions(-) > > diff --git a/arch/csky/kernel/vdso/Makefile b/arch/csky/kernel/vdso/Makefile > index 299e4e41ebc5..ddf784a62c11 100644 > --- a/arch/csky/kernel/vdso/Makefile > +++ b/arch/csky/kernel/vdso/Makefile > @@ -58,13 +58,3 @@ quiet_cmd_vdsold = VDSOLD $@ > # that contains the same symbols at the same offsets. > quiet_cmd_so2s = SO2S $@ > cmd_so2s = $(NM) -D $< | $(srctree)/$(src)/so2s.sh > $@ > - > -# install commands for the unstripped file > -quiet_cmd_vdso_install = INSTALL $@ > - cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ > - > -vdso.so: $(obj)/vdso.so.dbg > - @mkdir -p $(MODLIB)/vdso > - $(call cmd,vdso_install) > - > -vdso_install: vdso.so > -- > 2.39.2 > -- Best Regards Guo Ren ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/5] csky: remove unused cmd_vdso_install 2023-10-09 15:16 ` [PATCH 1/5] csky: remove unused cmd_vdso_install Guo Ren @ 2023-10-14 9:08 ` Masahiro Yamada 0 siblings, 0 replies; 17+ messages in thread From: Masahiro Yamada @ 2023-10-14 9:08 UTC (permalink / raw) To: Guo Ren Cc: linux-kbuild, linux-kernel, linux-arm-kernel, linux-csky, linux-parisc, linux-riscv, linux-s390, linux-um, loongarch, sparclinux, x86 On Tue, Oct 10, 2023 at 12:16 AM Guo Ren <guoren@kernel.org> wrote: > > On Mon, Oct 9, 2023 at 8:42 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > > > You cannot run this code because arch/csky/Makefile does not define the > > vdso_install target. > > > > It appears that this code was blindly copied from another architecture. > Yes, I do that. Thx for pointing it out. > > Acked-by: Guo Ren <guoren@kernel.org> Applied to linux-kbuild. -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2023-10-27 19:49 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-10-09 12:42 [PATCH 1/5] csky: remove unused cmd_vdso_install Masahiro Yamada 2023-10-09 12:42 ` [PATCH 2/5] UML: " Masahiro Yamada 2023-10-09 13:09 ` Richard Weinberger 2023-10-09 12:42 ` [PATCH 3/5] parisc: remove broken vdso_install Masahiro Yamada 2023-10-12 7:24 ` Helge Deller 2023-10-09 12:42 ` [PATCH 4/5] kbuild: unify vdso_install rules Masahiro Yamada 2023-10-10 7:36 ` Sven Schnelle 2023-10-11 2:23 ` Guo Ren 2023-10-11 12:52 ` Masahiro Yamada 2023-10-12 6:21 ` Guo Ren 2023-10-11 20:10 ` Nicolas Schier 2023-10-27 19:48 ` Russell King (Oracle) 2023-10-09 12:42 ` [PATCH 5/5] kbuild: unify no-compiler-targets and no-sync-config-targets Masahiro Yamada 2023-10-09 16:44 ` Nathan Chancellor 2023-10-14 8:41 ` Masahiro Yamada 2023-10-09 15:16 ` [PATCH 1/5] csky: remove unused cmd_vdso_install Guo Ren 2023-10-14 9:08 ` Masahiro Yamada
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).