linux/tools/objtool
Nathan Chancellor fdb12c8a24
kbuild: Leave objtool binary around with 'make clean'
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 68b4fe32d7 ("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: 68b4fe32d7 ("kbuild: Add objtool to top-level clean target")
Reported-by: Michal Suchanek <msuchanek@suse.de>
Closes: https://lore.kernel.org/20260225112633.6123-1-msuchanek@suse.de/
Reported-by: Rainer Fiebig <jrf@mailbox.org>
Closes: https://lore.kernel.org/62d12399-76e5-3d40-126a-7490b4795b17@mailbox.org/
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>
Link: https://patch.msgid.link/20260227-avoid-objtool-binary-removal-clean-v1-1-122f3e55eae9@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-03-02 14:22:39 -07:00
..
arch objtool: Allow multiple pv_ops arrays 2026-01-13 13:39:49 +01:00
Documentation Revert "objtool: Warn on functions with ambiguous -ffunction-sections section names" 2025-11-21 10:04:10 +01:00
include/objtool - A nice cleanup to the paravirt code containing a unification of the paravirt 2026-02-10 19:01:45 -08:00
.gitignore objtool: Add Function to get the name of a CPU feature 2025-11-24 20:39:47 +01:00
Build objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
builtin-check.c objtool: Add wide output for disassembly 2025-11-24 20:40:48 +01:00
builtin-klp.c objtool/klp: Add post-link subcommand to finalize livepatch modules 2025-10-14 14:50:18 -07:00
check.c Rust fixes for v7.0-rc1 2026-02-22 08:43:31 -08:00
disas.c objtool: Print bfd_vma as unsigned long long on ia32-x86_64 cross build 2026-01-27 08:19:35 -08:00
elf.c objtool: Replace custom macros in elf.c with shared ones 2026-01-27 08:20:41 -08:00
klp-diff.c objtool/klp: Fix symbol correlation for orphaned local symbols 2026-02-05 08:00:45 -08:00
klp-post-link.c objtool/klp: Add post-link subcommand to finalize livepatch modules 2025-10-14 14:50:18 -07:00
Makefile kbuild: Leave objtool binary around with 'make clean' 2026-03-02 14:22:39 -07:00
noreturns.h x86/smpboot: Mark native_play_dead() as __noreturn 2025-10-30 08:29:41 -07:00
objtool.c objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
orc_dump.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
orc_gen.c objtool: Add annotype() helper 2025-10-14 14:46:49 -07:00
signal.c objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
special.c objtool: Provide access to feature and flags of group alternatives 2025-11-21 15:30:14 +01:00
sync-check.sh objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00
trace.c objtool: Improve tracing of alternative instructions 2025-11-21 15:30:11 +01:00
weak.c objtool/klp: Introduce klp diff subcommand for diffing object files 2025-10-14 14:50:18 -07:00