Skip to content

Commit 3679906

Browse files
jpoimboePeter Zijlstra
authored andcommitted
objtool: Add CONFIG_OBJTOOL_WERROR
Objtool warnings can be indicative of crashes, broken live patching, or even boot failures. Ignoring them is not recommended. Add CONFIG_OBJTOOL_WERROR to upgrade objtool warnings to errors by enabling the objtool --Werror option. Also set --backtrace to print the branches leading up to the warning, which can help considerably when debugging certain warnings. To avoid breaking bots too badly for now, make it the default for real world builds only (!COMPILE_TEST). Co-developed-by: Brendan Jackman <jackmanb@google.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/3e7c109313ff15da6c80788965cc7450115b0196.1741975349.git.jpoimboe@kernel.org
1 parent aa8b3e6 commit 3679906

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/Kconfig.debug

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,17 @@ config FRAME_POINTER
545545
config OBJTOOL
546546
bool
547547

548+
config OBJTOOL_WERROR
549+
bool "Upgrade objtool warnings to errors"
550+
depends on OBJTOOL && !COMPILE_TEST
551+
help
552+
Fail the build on objtool warnings.
553+
554+
Objtool warnings can indicate kernel instability, including boot
555+
failures. This option is highly recommended.
556+
557+
If unsure, say Y.
558+
548559
config STACK_VALIDATION
549560
bool "Compile-time stack metadata validation"
550561
depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER

scripts/Makefile.lib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
277277
objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
278278
objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable
279279
objtool-args-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES)
280+
objtool-args-$(CONFIG_OBJTOOL_WERROR) += --Werror --backtrace
280281

281282
objtool-args = $(objtool-args-y) \
282283
$(if $(delay-objtool), --link) \

0 commit comments

Comments
 (0)