From: Nathan Chancellor <nathan@kernel.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
live-patching@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Joe Lawrence <joe.lawrence@redhat.com>,
Song Liu <song@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
Mark Rutland <mark.rutland@arm.com>,
Nicolas Schier <nsc@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH 09/14] kbuild: Only run objtool if there is at least one command
Date: Fri, 13 Mar 2026 17:45:22 -0700 [thread overview]
Message-ID: <20260314004522.GA3886710@ax162> (raw)
In-Reply-To: <b5f73df0d598e77104f7d2de5a84d69e75e80b9f.1772681234.git.jpoimboe@kernel.org>
On Wed, Mar 04, 2026 at 07:31:28PM -0800, Josh Poimboeuf wrote:
> Split the objtool args into commands and options, such that if no
> commands have been enabled, objtool doesn't run.
>
> This is in preparation in enabling objtool and klp-build for arm64.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
I assume this will go with the rest of the series.
> ---
> arch/x86/boot/startup/Makefile | 2 +-
> scripts/Makefile.build | 4 +--
> scripts/Makefile.lib | 46 ++++++++++++++++++----------------
> scripts/Makefile.vmlinux_o | 15 ++++-------
> 4 files changed, 33 insertions(+), 34 deletions(-)
>
> diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile
> index 5e499cfb29b5..a08297829fc6 100644
> --- a/arch/x86/boot/startup/Makefile
> +++ b/arch/x86/boot/startup/Makefile
> @@ -36,7 +36,7 @@ $(patsubst %.o,$(obj)/%.o,$(lib-y)): OBJECT_FILES_NON_STANDARD := y
> # relocations, even if other objtool actions are being deferred.
> #
> $(pi-objs): objtool-enabled = 1
> -$(pi-objs): objtool-args = $(if $(delay-objtool),--dry-run,$(objtool-args-y)) --noabs
> +$(pi-objs): objtool-args = $(if $(delay-objtool),--dry-run,$(objtool-cmds-y) $(objtool-opts-y)) --noabs
>
> #
> # Confine the startup code by prefixing all symbols with __pi_ (for position
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 32e209bc7985..d2d0776df947 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -277,7 +277,7 @@ endif # CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
> is-standard-object = $(if $(filter-out y%, $(OBJECT_FILES_NON_STANDARD_$(target-stem).o)$(OBJECT_FILES_NON_STANDARD)n),$(is-kernel-object))
>
> ifdef CONFIG_OBJTOOL
> -$(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if $(delay-objtool),$(is-single-obj-m),y))
> +$(obj)/%.o: private objtool-enabled = $(if $(is-standard-object),$(if $(objtool-cmds-y),$(if $(delay-objtool),$(is-single-obj-m),y)))
> endif
>
> ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
> @@ -499,7 +499,7 @@ define rule_ld_multi_m
> $(call cmd,gen_objtooldep)
> endef
>
> -$(multi-obj-m): private objtool-enabled := $(delay-objtool)
> +$(multi-obj-m): private objtool-enabled := $(if $(objtool-cmds-y),$(delay-objtool))
> $(multi-obj-m): private part-of-module := y
> $(multi-obj-m): %.o: %.mod FORCE
> $(call if_changed_rule,ld_multi_m)
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 0718e39cedda..40a462581666 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -183,27 +183,31 @@ ifdef CONFIG_OBJTOOL
>
> objtool := $(objtree)/tools/objtool/objtool
>
> -objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label
> -objtool-args-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr
> -objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --hacks=skylake
> -objtool-args-$(CONFIG_X86_KERNEL_IBT) += --ibt
> -objtool-args-$(CONFIG_FINEIBT) += --cfi
> -objtool-args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) += --mcount
> -ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
> -objtool-args-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT) += --mnop
> -endif
> -objtool-args-$(CONFIG_UNWINDER_ORC) += --orc
> -objtool-args-$(CONFIG_MITIGATION_RETPOLINE) += --retpoline
> -objtool-args-$(CONFIG_MITIGATION_RETHUNK) += --rethunk
> -objtool-args-$(CONFIG_MITIGATION_SLS) += --sls
> -objtool-args-$(CONFIG_STACK_VALIDATION) += --stackval
> -objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
> -objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
> -objtool-args-$(or $(CONFIG_GCOV_KERNEL),$(CONFIG_KCOV)) += --no-unreachable
> -objtool-args-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES)
> -objtool-args-$(CONFIG_OBJTOOL_WERROR) += --werror
> +# objtool commands
> +objtool-cmds-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label
> +objtool-cmds-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr
> +objtool-cmds-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --hacks=skylake
> +objtool-cmds-$(CONFIG_X86_KERNEL_IBT) += --ibt
> +objtool-cmds-$(CONFIG_FINEIBT) += --cfi
> +objtool-cmds-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) += --mcount
> +objtool-cmds-$(CONFIG_UNWINDER_ORC) += --orc
> +objtool-cmds-$(CONFIG_MITIGATION_RETPOLINE) += --retpoline
> +objtool-cmds-$(CONFIG_MITIGATION_RETHUNK) += --rethunk
> +objtool-cmds-$(CONFIG_MITIGATION_SLS) += --sls
> +objtool-cmds-$(CONFIG_STACK_VALIDATION) += --stackval
> +objtool-cmds-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
> +objtool-cmds-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
> +objtool-cmds-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES)
> +objtool-cmds-y += $(OBJTOOL_ARGS)
>
> -objtool-args = $(objtool-args-y) \
> +# objtool options
> +ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
> +objtool-opts-$(CONFIG_HAVE_OBJTOOL_NOP_MCOUNT) += --mnop
> +endif
> +objtool-opts-$(or $(CONFIG_GCOV_KERNEL),$(CONFIG_KCOV)) += --no-unreachable
> +objtool-opts-$(CONFIG_OBJTOOL_WERROR) += --werror
> +
> +objtool-args = $(objtool-cmds-y) $(objtool-opts-y) \
> $(if $(delay-objtool), --link) \
> $(if $(part-of-module), --module)
>
> @@ -212,7 +216,7 @@ delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT),$(CONFIG_KLP_
> cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool-args) $@)
> cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
>
> -objtool-enabled := y
> +objtool-enabled = $(if $(objtool-cmds-y),y)
>
> endif # CONFIG_OBJTOOL
>
> diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o
> index 527352c222ff..09af33203bd8 100644
> --- a/scripts/Makefile.vmlinux_o
> +++ b/scripts/Makefile.vmlinux_o
> @@ -36,18 +36,13 @@ endif
> # For !delay-objtool + CONFIG_NOINSTR_VALIDATION, it runs on both translation
> # units and vmlinux.o, with the latter only used for noinstr/unret validation.
>
> -objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION))
> -
> -ifeq ($(delay-objtool),y)
> -vmlinux-objtool-args-y += $(objtool-args-y)
> -else
> -vmlinux-objtool-args-$(CONFIG_OBJTOOL_WERROR) += --werror
> +ifneq ($(delay-objtool),y)
> +objtool-cmds-y =
> +objtool-opts-y += --link
> endif
>
> -vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr \
> - $(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_MITIGATION_SRSO)), --unret)
> -
> -objtool-args = $(vmlinux-objtool-args-y) --link
> +objtool-cmds-$(CONFIG_NOINSTR_VALIDATION) += --noinstr \
> + $(if $(or $(CONFIG_MITIGATION_UNRET_ENTRY),$(CONFIG_MITIGATION_SRSO)), --unret)
>
> # Link of vmlinux.o used for section mismatch analysis
> # ---------------------------------------------------------------------------
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-03-14 0:45 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 3:31 [PATCH 00/14] objtool/arm64: Port klp-build to arm64 Josh Poimboeuf
2026-03-05 3:31 ` [PATCH 01/14] objtool: Fix data alignment in elf_add_data() Josh Poimboeuf
2026-03-09 19:54 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2026-03-05 3:31 ` [PATCH 02/14] objtool: Fix ERROR_INSN() error message Josh Poimboeuf
2026-03-09 19:54 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2026-03-05 3:31 ` [PATCH 03/14] arm64: Annotate intra-function calls Josh Poimboeuf
2026-03-11 23:12 ` Song Liu
2026-03-05 3:31 ` [PATCH 04/14] arm64: head: Move boot header to .head.data Josh Poimboeuf
2026-03-11 23:12 ` Song Liu
2026-03-05 3:31 ` [PATCH 05/14] arm64: Fix EFI linking with -fdata-sections Josh Poimboeuf
2026-03-11 23:12 ` Song Liu
2026-03-05 3:31 ` [PATCH 06/14] crypto: arm64: Move data to .rodata Josh Poimboeuf
2026-03-05 3:31 ` [PATCH 07/14] objtool: Extricate checksum calculation from validate_branch() Josh Poimboeuf
2026-03-10 10:47 ` Miroslav Benes
2026-03-10 16:27 ` Josh Poimboeuf
2026-03-11 8:24 ` Miroslav Benes
2026-03-17 17:21 ` Josh Poimboeuf
2026-03-05 3:31 ` [PATCH 08/14] objtool: Allow setting --mnop without --mcount Josh Poimboeuf
2026-03-11 23:13 ` Song Liu
2026-03-05 3:31 ` [PATCH 09/14] kbuild: Only run objtool if there is at least one command Josh Poimboeuf
2026-03-14 0:45 ` Nathan Chancellor [this message]
2026-03-05 3:31 ` [PATCH 10/14] objtool: Ignore jumps to the end of the function for non-CFG arches Josh Poimboeuf
2026-03-11 23:14 ` Song Liu
2026-03-05 3:31 ` [PATCH 11/14] objtool: Allow empty alternatives Josh Poimboeuf
2026-03-11 23:14 ` Song Liu
2026-03-05 3:31 ` [PATCH 12/14] objtool: Reuse consecutive string references Josh Poimboeuf
2026-03-11 23:15 ` Song Liu
2026-03-05 3:31 ` [PATCH 13/14] objtool: Introduce objtool for arm64 Josh Poimboeuf
2026-03-05 3:31 ` [PATCH 14/14] klp-build: Support cross-compilation Josh Poimboeuf
2026-03-11 23:18 ` Song Liu
2026-03-16 19:15 ` Josh Poimboeuf
2026-03-17 17:52 ` Josh Poimboeuf
2026-03-17 18:21 ` Song Liu
2026-03-17 18:53 ` Josh Poimboeuf
2026-03-17 18:58 ` Song Liu
2026-03-11 23:23 ` [PATCH 00/14] objtool/arm64: Port klp-build to arm64 Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260314004522.GA3886710@ax162 \
--to=nathan@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=herbert@gondor.apana.org.au \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nsc@kernel.org \
--cc=peterz@infradead.org \
--cc=song@kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox