[PATCH] arm64: compat: Fix flip/flop vdso building bug

From: Vincenzo Frascino
Date: Fri Jul 12 2019 - 08:06:37 EST


Running "make" on an already compiled kernel tree will rebuild the
vdso32 library even if this has not been modified.

$ make
GEN Makefile
Using linux as source for kernel
CALL linux/scripts/atomic/check-atomics.sh
CALL linux/scripts/checksyscalls.sh
VDSOCHK arch/arm64/kernel/vdso32/vdso.so.raw
VDSOSYM include/generated/vdso32-offsets.h
CHK include/generated/compile.h
CC arch/arm64/kernel/signal.o
CC arch/arm64/kernel/vdso.o
CC arch/arm64/kernel/signal32.o
VDSOL arch/arm64/kernel/vdso32/vdso.so.raw
MUNGE arch/arm64/kernel/vdso32/vdso.so.dbg
OBJCOPY arch/arm64/kernel/vdso32/vdso.so
AS arch/arm64/kernel/vdso32/vdso.o
AR arch/arm64/kernel/vdso32/built-in.a
AR arch/arm64/kernel/built-in.a
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
AR init/built-in.a
LD vmlinux.o
MODPOST vmlinux.o

The issue is generated by the fact that "if_changed" is called twice
in a single target.

Fix the build bug merging the two commands into a single function.

Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Fixes: a7f71a2c8903 ("arm64: compat: Add vDSO")
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
---
arch/arm64/kernel/vdso32/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 288c14d30b45..fb572b6f1bf5 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -144,8 +144,7 @@ $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/$(munge) FORCE

# Link rule for the .so file, .lds has to be first
$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
- $(call if_changed,vdsold)
- $(call if_changed,vdso_check)
+ $(call if_changed,vdsold_and_vdso_check)

# Compilation rules for the vDSO sources
$(c-obj-vdso): %.o: %.c FORCE
@@ -156,6 +155,9 @@ $(asm-obj-vdso): %.o: %.S FORCE
$(call if_changed_dep,vdsoas)

# Actual build commands
+quiet_cmd_vdsold_and_vdso_check = LD $@
+ cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check)
+
quiet_cmd_vdsold = VDSOL $@
cmd_vdsold = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \
-Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
--
2.22.0