From: Brendan Jackman <jackmanb@google.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
Brendan Jackman <jackmanb@google.com>
Subject: [PATCH v3 2/2] kbuild: Add option to fail build on vmlinux objtool issues
Date: Mon, 13 Jan 2025 14:05:16 +0000 [thread overview]
Message-ID: <20250113-objtool-strict-v3-2-8b51f94957fb@google.com> (raw)
In-Reply-To: <20250113-objtool-strict-v3-0-8b51f94957fb@google.com>
NOINSTR_VALIDATION is pretty helpful for detecting bugs, it would be
helpful for the build to fail when those bugs arise.
If necessary it would be possible to enable this for individual
warnings, it seems unlikely there's a use-case for that though. So
for now just add a global setting.
When the this new option, OBJTOOL_WERROR, is set, also add --verbose:
if the build is failing then it's better to spit out any information
that might help diagnose the failure, even if that risks a very verbose
output.
Checkpatch-args: --ignore=CONFIG_DESCRIPTION
Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
lib/Kconfig.debug | 10 ++++++++++
scripts/Makefile.lib | 1 +
2 files changed, 11 insertions(+)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f3d72370587936fa373129cc9b246f15dac907be..3ee92da4733a3a504991d5dbb4d0cee84f519d64 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -545,6 +545,16 @@ config FRAME_POINTER
config OBJTOOL
bool
+config OBJTOOL_WERROR
+ bool "Run objtool with warnings as errors"
+ default n
+ depends on OBJTOOL
+ help
+ Fail the build when objtool produces warnings.
+
+ By default, objtool just prints warnings to the terminal without
+ causing a build failure. This config changes that.
+
config STACK_VALIDATION
bool "Compile-time stack metadata validation"
depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7395200538da89a2f6e6d21f8959f3f60d291d79..a1b264e532920dd649122968d5782ca8eff34ad9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -277,6 +277,7 @@ objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable
objtool-args-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES)
+objtool-args-$(CONFIG_OBJTOOL_WERROR) += --Werror --verbose
objtool-args = $(objtool-args-y) \
$(if $(delay-objtool), --link) \
--
2.47.1.613.gc27f4b7a9f-goog
next prev parent reply other threads:[~2025-01-13 14:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 14:05 [PATCH v3 0/2] objtool: Add option to fail build on vmlinux warnings Brendan Jackman
2025-01-13 14:05 ` [PATCH v3 1/2] objtool: Add --Werror Brendan Jackman
2025-01-14 17:24 ` Nathan Chancellor
2025-01-14 18:17 ` Josh Poimboeuf
2025-01-13 14:05 ` Brendan Jackman [this message]
2025-01-14 0:14 ` [PATCH v3 0/2] objtool: Add option to fail build on vmlinux warnings Josh Poimboeuf
2025-01-30 15:55 ` Brendan Jackman
2025-01-30 18:30 ` Nathan Chancellor
2025-01-31 10:44 ` Brendan Jackman
2025-01-31 20:49 ` Nathan Chancellor
2025-02-06 15:05 ` Brendan Jackman
2025-02-06 17:10 ` Nathan Chancellor
2025-02-07 2:51 ` Josh Poimboeuf
2025-02-07 10:16 ` Brendan Jackman
2025-02-07 21:41 ` Nathan Chancellor
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=20250113-objtool-strict-v3-2-8b51f94957fb@google.com \
--to=jackmanb@google.com \
--cc=akpm@linux-foundation.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
--cc=peterz@infradead.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