Skip to content

Commit 944cfe9

Browse files
committed
kbuild: modpost: include .*.cmd files only when targets exist
If a build rule fails, the .DELETE_ON_ERROR special target removes the target, but does nothing for the .*.cmd file, which might be corrupted. So, .*.cmd files should be included only when the corresponding targets exist. Commit 392885e ("kbuild: let fixdep directly write to .*.cmd files") missed to fix up this file. Fixes: 392885e ("kbuild: let fixdep directly write to .*.cmd") Cc: <stable@vger.kernel.org> # v5.0+ Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 5241ab4 commit 944cfe9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

scripts/Makefile.modpost

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,8 @@ FORCE:
145145
# optimization, we don't need to read them if the target does not
146146
# exist, we will rebuild anyway in that case.
147147

148-
cmd_files := $(wildcard $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd))
148+
existing-targets := $(wildcard $(sort $(targets)))
149149

150-
ifneq ($(cmd_files),)
151-
include $(cmd_files)
152-
endif
150+
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
153151

154152
.PHONY: $(PHONY)

0 commit comments

Comments
 (0)