Skip to content

Commit 4c08df5

Browse files
committed
objtool: Add CONFIG_OBJTOOL_WERROR
JIRA: https://issues.redhat.com/browse/RHEL-85302 commit 3679906 Author: Josh Poimboeuf <jpoimboe@kernel.org> Date: Fri Mar 14 12:29:11 2025 -0700 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 Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
1 parent 01f0871 commit 4c08df5

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
@@ -467,6 +467,17 @@ config FRAME_POINTER
467467
config OBJTOOL
468468
bool
469469

470+
config OBJTOOL_WERROR
471+
bool "Upgrade objtool warnings to errors"
472+
depends on OBJTOOL && !COMPILE_TEST
473+
help
474+
Fail the build on objtool warnings.
475+
476+
Objtool warnings can indicate kernel instability, including boot
477+
failures. This option is highly recommended.
478+
479+
If unsure, say Y.
480+
470481
config STACK_VALIDATION
471482
bool "Compile-time stack metadata validation"
472483
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
@@ -258,6 +258,7 @@ objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
258258
objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
259259
objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable
260260
objtool-args-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES)
261+
objtool-args-$(CONFIG_OBJTOOL_WERROR) += --Werror --backtrace
261262

262263
objtool-args = $(objtool-args-y) \
263264
$(if $(delay-objtool), --link) \

0 commit comments

Comments
 (0)