Skip to content

Commit d809ee1

Browse files
jpoimboeSasha Levin
authored andcommitted
kbuild: Add objtool to top-level clean target
[ Upstream commit 68b4fe32d73789dea23e356f468de67c8367ef8f ] Objtool is an integral part of the build, make sure it gets cleaned by "make clean" and "make mrproper". Fixes: 442f04c ("objtool: Add tool to perform compile-time stack metadata validation") Reported-by: Jens Remus <jremus@linux.ibm.com> Closes: https://lore.kernel.org/15f2af3b-be33-46fc-b972-6b8e7e0aa52e@linux.ibm.com Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Tested-by: Jens Remus <jremus@linux.ibm.com> Link: https://patch.msgid.link/968faf2ed30fa8b3519f79f01a1ecfe7929553e5.1770759919.git.jpoimboe@kernel.org [nathan: use Closes: instead of Link: per checkpatch.pl] Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e156a10 commit d809ee1

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,15 @@ ifneq ($(wildcard $(resolve_btfids_O)),)
13561356
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
13571357
endif
13581358

1359+
PHONY += objtool_clean
1360+
1361+
objtool_O = $(abspath $(objtree))/tools/objtool
1362+
1363+
objtool_clean:
1364+
ifneq ($(wildcard $(objtool_O)),)
1365+
$(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) clean
1366+
endif
1367+
13591368
tools/: FORCE
13601369
$(Q)mkdir -p $(objtree)/tools
13611370
$(Q)$(MAKE) O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
@@ -1509,7 +1518,7 @@ vmlinuxclean:
15091518
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
15101519
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
15111520

1512-
clean: archclean vmlinuxclean resolve_btfids_clean
1521+
clean: archclean vmlinuxclean resolve_btfids_clean objtool_clean
15131522

15141523
# mrproper - Delete all generated files, including .config
15151524
#

tools/objtool/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ srctree := $(patsubst %/,%,$(dir $(CURDIR)))
77
srctree := $(patsubst %/,%,$(dir $(srctree)))
88
endif
99

10+
RM ?= rm -f
11+
1012
LIBSUBCMD_DIR = $(srctree)/tools/lib/subcmd/
1113
ifneq ($(OUTPUT),)
1214
LIBSUBCMD_OUTPUT = $(abspath $(OUTPUT))/libsubcmd

0 commit comments

Comments
 (0)