@@ -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
@@ -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) \
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(+)