From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FA483EDAC1 for ; Mon, 9 Mar 2026 18:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773082538; cv=none; b=W5COlbmPEOqYTIMioRvR6m0eRIFRUIBwCn9FDL1/pwewp2APoG004V7NvkjlJMrWoVzyF5PHrDN4y4buTnU3HncoGvVX/6ssFU0u3FMjj1ZeezeQPTlEsIoN4DqPA6vGU86hMwDoLfmsqaiNzW3SpIWMD7lRldDoatxbm5zdsq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773082538; c=relaxed/simple; bh=EuNXZGUQMLT/Pnzi45pnR8goAicSe2lD7q+YZIZIk3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jb8EEspA7I1sXRnCbFotqxrwS7HWGIKf+ixB0usfT5CoPXSR7LbxVwQnRAu3BvaONvBMUt3xjSCoPNsf8qfcFefdeWvFL3owKES+D24CODCES27It42S3PeSQ/SsNa2SXPbUfgUuGzSdJaz2etDC8heSWFUil1TZ/cKHuiK+BAk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uipK5l4C; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uipK5l4C" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1674AC4CEF7; Mon, 9 Mar 2026 18:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773082538; bh=EuNXZGUQMLT/Pnzi45pnR8goAicSe2lD7q+YZIZIk3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uipK5l4CYI/1iKn6ndca8dlf2T0H6ad7WJCa89gM6HRk7NTx3Tkcigdn3AfuuzwI2 6ZXIG9dAdv5M1NNXc2qQUM30TnrQ7Oi1f89WRAxfy7VZd45BPtRL+tdKG5EGj1j8yf DzX0zeLNNOb5T4ab+TY0GSeyCD6vVshQbFXSx0HGSbHAdNRS6PgDP+muQWNSEEfFBk drXHF4XuqmH3KAacD55fYiXHpBqY+Gh3SHBgWAFuJ806xv0DavOlog2mnng8NxPuRS xpvCBjcnA3RLWbpGrriI0paZIr28lKSlXbQEruofTt2V6TKcaeu0/E2XKJHks6uELA 4Mg47cgtvqTNA== From: Sasha Levin To: stable@vger.kernel.org Cc: Nathan Chancellor , Michal Suchanek , Rainer Fiebig , Josh Poimboeuf , "Peter Zijlstra (Intel)" , Nicolas Schier , Sasha Levin Subject: [PATCH 6.6.y] kbuild: Leave objtool binary around with 'make clean' Date: Mon, 9 Mar 2026 14:55:35 -0400 Message-ID: <20260309185535.1355869-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026030940-obliged-affront-0a04@gregkh> References: <2026030940-obliged-affront-0a04@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Nathan Chancellor [ Upstream commit fdb12c8a24a453bdd6759979b6ef1e04ebd4beb4 ] The difference between 'make clean' and 'make mrproper' is documented in 'make help' as: clean - Remove most generated files but keep the config and enough build support to build external modules mrproper - Remove all generated files + config + various backup files After commit 68b4fe32d737 ("kbuild: Add objtool to top-level clean target"), running 'make clean' then attempting to build an external module with the resulting build directory fails with $ make ARCH=x86_64 O=build clean $ make -C build M=... MO=... ... /bin/sh: line 1: .../build/tools/objtool/objtool: No such file or directory as 'make clean' removes the objtool binary. Split the objtool clean target into mrproper and clean like Kbuild does and remove all generated artifacts with 'make clean' except for the objtool binary, which is removed with 'make mrproper'. To avoid a small race when running the objtool clean target through both objtool_mrproper and objtool_clean when running 'make mrproper', modify objtool's clean up find command to avoid using find's '-delete' command by piping the files into 'xargs rm -f' like the rest of Kbuild does. Cc: stable@vger.kernel.org Fixes: 68b4fe32d737 ("kbuild: Add objtool to top-level clean target") Reported-by: Michal Suchanek Closes: https://lore.kernel.org/20260225112633.6123-1-msuchanek@suse.de/ Reported-by: Rainer Fiebig Closes: https://lore.kernel.org/62d12399-76e5-3d40-126a-7490b4795b17@mailbox.org/ Acked-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel) Reviewed-by: Nicolas Schier Tested-by: Nicolas Schier Link: https://patch.msgid.link/20260227-avoid-objtool-binary-removal-clean-v1-1-122f3e55eae9@kernel.org Signed-off-by: Nathan Chancellor [ Context ] Signed-off-by: Sasha Levin --- Makefile | 8 ++++---- tools/objtool/Makefile | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 022aed9031737..20c3688ff3bfb 100644 --- a/Makefile +++ b/Makefile @@ -1356,13 +1356,13 @@ ifneq ($(wildcard $(resolve_btfids_O)),) $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean endif -PHONY += objtool_clean +PHONY += objtool_clean objtool_mrproper objtool_O = $(abspath $(objtree))/tools/objtool -objtool_clean: +objtool_clean objtool_mrproper: ifneq ($(wildcard $(objtool_O)),) - $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) clean + $(Q)$(MAKE) -sC $(abs_srctree)/tools/objtool O=$(objtool_O) srctree=$(abs_srctree) $(patsubst objtool_%,%,$@) endif tools/: FORCE @@ -1529,7 +1529,7 @@ PHONY += $(mrproper-dirs) mrproper $(mrproper-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) -mrproper: clean $(mrproper-dirs) +mrproper: clean objtool_mrproper $(mrproper-dirs) $(call cmd,rmfiles) @find . $(RCS_FIND_IGNORE) \ \( -name '*.rmeta' \) \ diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index e9a0f89e9c39a..4efe652637f02 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -87,10 +87,12 @@ $(LIBSUBCMD)-clean: $(Q)$(RM) -r -- $(LIBSUBCMD_OUTPUT) clean: $(LIBSUBCMD)-clean - $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL) - $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete + $(Q)find $(OUTPUT) \( -name '*.o' -o -name '\.*.cmd' -o -name '\.*.d' \) -type f -print | xargs $(RM) $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep +mrproper: clean + $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL) + FORCE: -.PHONY: clean FORCE +.PHONY: clean mrproper FORCE -- 2.51.0