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 D460A3998B2; Wed, 13 May 2026 03:34:36 +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=1778643278; cv=none; b=bh48TOpnAkQKvB/v53jaWj53fGgLPdNkR84HmBemlml3wfVE+PUTSa+XyNp8NiK4DEdndBn5rFG+/7rN6ZslmTA0dv46CSrJKdoaYUto51tP9KQsNC+2Qy7GRNn1UM98y4+QHiFE63cWbQDvqBpa2EALNIxe3/AwcpeU20TJKZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778643278; c=relaxed/simple; bh=6qM6eS73y/2HGC/l7RWciS6d5w9G1tF/qeUGxjijkEE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H6Rkvfx7I2WHbVRCzQ1ab856YAppjBi+DzXUDDvWKIgXeGX8GWhtpkOX6K0Z1BXp/cA8/n3eoC2w14oKLj+SpbQY12OpdzgdEDHgqXJLF1sCO4CH2gcEAKd8qWZZjYhnq7Vj8i2mvmVAMGi+TACV1DahIDOvkYLGXF3Kz1JvxVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZMwNtuUs; 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="ZMwNtuUs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67B16C4AF0E; Wed, 13 May 2026 03:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778643276; bh=6qM6eS73y/2HGC/l7RWciS6d5w9G1tF/qeUGxjijkEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZMwNtuUso1KmF3zovvyP98IAAheQGw5HYUfApTI9FkfqlQEPmOsu/B2SkcYXBcXdi RuPi4hHEHz9ECpJJRlUzuCbIIBuIh2TYi7+hUzejgskeqL8abZ3yNnY8SjvvCAG65G frbBT1pD1JuWcqPdEz4mp+Xpsy1LnHXnXdK2NNtUMwUTxoJ5XUyHDOmJNxJH/w7iNw bDZD2CxdEKArrOJPU3e30Cl5cd+fYKhk0LlX5b40qGA/Hi8AM+ynQ572kUIMBJujGQ EgOzyvtCU3pmQLgImOtnqoRhFJQ6Ni8QeH/uIrDMypcvHoBF/Yb3yctQp2KWU1KSLp bAMIXincMPPIg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Miroslav Benes , Petr Mladek , Nathan Chancellor , Nicolas Schier Subject: [PATCH v3 09/21] kbuild: Only run objtool if there is at least one command Date: Tue, 12 May 2026 20:33:43 -0700 Message-ID: <8699672b82fef17e73a5f2e5528478778dbdab31.1778642120.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: live-patching@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Split the objtool args into commands and options, such that if no commands have been enabled, objtool doesn't run. This is in preparation for enabling objtool and klp-build for arm64. Reviewed-by: Nathan Chancellor Reviewed-by: Nicolas Schier Tested-by: Nathan Chancellor Signed-off-by: Josh Poimboeuf --- arch/x86/boot/startup/Makefile | 2 +- scripts/Makefile.build | 4 +-- scripts/Makefile.lib | 52 ++++++++++++++++++---------------- scripts/Makefile.vmlinux_o | 15 ++++------ 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile index 5e499cfb29b5c..a08297829fc63 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 3498d25b15e85..c4accfcd177d4 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 = $(and $(is-standard-object),$(objtool-cmds-y),$(if $(delay-objtool),$(is-single-obj-m),y)) endif ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) @@ -501,7 +501,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 7e216d82e9887..7f803796d20cf 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -183,30 +183,34 @@ 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_CALL_PADDING) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES) -ifdef CONFIG_CALL_PADDING -objtool-args-$(CONFIG_CFI) += --cfi -objtool-args-$(CONFIG_FINEIBT) += --fineibt -endif -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_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_CALL_PADDING) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES) +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-y += $(OBJTOOL_ARGS) -objtool-args = $(objtool-args-y) \ +# objtool options +ifdef CONFIG_CALL_PADDING +objtool-opts-$(CONFIG_CFI) += --cfi +objtool-opts-$(CONFIG_FINEIBT) += --fineibt +endif +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) @@ -215,7 +219,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 527352c222ff6..09af33203bd8d 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 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 A28613AC0CE; Wed, 13 May 2026 03:34:50 +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=1778643291; cv=none; b=itFv/PA3atS5fx/i2Jn/6qet8a0+jbKY2T5ssnn1EahA+JlPpWt1hdXiRGI/S7gFHPZ1pNkuznj6aWu9ZsnYRY8wL1afSUGDmFsROOgkEJ3xSHk9auERfI+jn1YWnSJpOwilDz3pylnLJRzCY+is44rgii8GJomUWHbzRXFDUzw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778643291; c=relaxed/simple; bh=6qM6eS73y/2HGC/l7RWciS6d5w9G1tF/qeUGxjijkEE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CalKfVATFlC+GPj3p184heTNXv3INgaKkMAcT43ZmqqSgNwWBVpJkWZOOk7VDr/cwhR4/qqbKYE8I0QK1SFV089DzRdJPaLBKteKHJBKv18zAmzrXO/RM2AJk73kTo/s0s/RA+XBezHik2edpT0pUiwxjaIQVd24hIgpHv9xQF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ohMOmZv+; 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="ohMOmZv+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09837C2BCC9; Wed, 13 May 2026 03:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778643290; bh=6qM6eS73y/2HGC/l7RWciS6d5w9G1tF/qeUGxjijkEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ohMOmZv+7PioVmwuGWUJEydizZIPCjZOmiUg7Bx08ndx/aDUunDHXY1eOxD1eEjvc tO6+d2dZ93dMtA58RXZlBIQjT6/t8eIUkPnwLnAX7A5ly0DuEygwp4h8hEHmThhkjx oXxc94HReQGW27VAaSyHdq6PWmJTgVCmW8sMuG39AFvUReJavru9JDhy0rN4MzhKmf qLxo3F3plA6FbesptXmdaxyAFiLRyp5TpcKiKLyYZmUD0BMM5NHRcFgRPejtvoqFhr PmByC1BETVjCC54xh1dXgPnd1Qrq8NqS7N4YOHmjvo64qWgKsyhpwYLN+LHw9yxN8C 2LW/LPxlPKszQ== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Peter Zijlstra , Joe Lawrence , Song Liu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Mark Rutland , Miroslav Benes , Petr Mladek , Nathan Chancellor , Nicolas Schier Subject: [PATCH v3 09/21] kbuild: Only run objtool if there is at least one command Date: Tue, 12 May 2026 20:34:05 -0700 Message-ID: <8699672b82fef17e73a5f2e5528478778dbdab31.1778642120.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: live-patching@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: <20260513033405.ylH_1D7BVLE81Xlb9tygz0lD2ijxrRQilAWeGh8BtkU@z> Split the objtool args into commands and options, such that if no commands have been enabled, objtool doesn't run. This is in preparation for enabling objtool and klp-build for arm64. Reviewed-by: Nathan Chancellor Reviewed-by: Nicolas Schier Tested-by: Nathan Chancellor Signed-off-by: Josh Poimboeuf --- arch/x86/boot/startup/Makefile | 2 +- scripts/Makefile.build | 4 +-- scripts/Makefile.lib | 52 ++++++++++++++++++---------------- scripts/Makefile.vmlinux_o | 15 ++++------ 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile index 5e499cfb29b5c..a08297829fc63 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 3498d25b15e85..c4accfcd177d4 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 = $(and $(is-standard-object),$(objtool-cmds-y),$(if $(delay-objtool),$(is-single-obj-m),y)) endif ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) @@ -501,7 +501,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 7e216d82e9887..7f803796d20cf 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -183,30 +183,34 @@ 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_CALL_PADDING) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES) -ifdef CONFIG_CALL_PADDING -objtool-args-$(CONFIG_CFI) += --cfi -objtool-args-$(CONFIG_FINEIBT) += --fineibt -endif -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_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_CALL_PADDING) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES) +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-y += $(OBJTOOL_ARGS) -objtool-args = $(objtool-args-y) \ +# objtool options +ifdef CONFIG_CALL_PADDING +objtool-opts-$(CONFIG_CFI) += --cfi +objtool-opts-$(CONFIG_FINEIBT) += --fineibt +endif +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) @@ -215,7 +219,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 527352c222ff6..09af33203bd8d 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