Skip to content

Commit

Permalink
objtool: Add CONFIG_OBJTOOL_WERROR
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Josh Poimboeuf authored and Peter Zijlstra committed Mar 17, 2025
1 parent aa8b3e6 commit 3679906
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,17 @@ config FRAME_POINTER
config OBJTOOL
bool

config OBJTOOL_WERROR
bool "Upgrade objtool warnings to errors"
depends on OBJTOOL && !COMPILE_TEST
help
Fail the build on objtool warnings.

Objtool warnings can indicate kernel instability, including boot
failures. This option is highly recommended.

If unsure, say Y.

config STACK_VALIDATION
bool "Compile-time stack metadata validation"
depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER
Expand Down
1 change: 1 addition & 0 deletions scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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 --backtrace

objtool-args = $(objtool-args-y) \
$(if $(delay-objtool), --link) \
Expand Down

0 comments on commit 3679906

Please sign in to comment.