diff options
| author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-03-14 12:29:08 -0700 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2025-03-17 11:36:01 +0100 |
| commit | bb62243943dbef4592266e817f4e2e5a96293907 (patch) | |
| tree | d59956ae90dc8c0a5756924b57f450afde5f8051 /tools/objtool/check.c | |
| parent | objtool: Add --output option (diff) | |
| download | linux-bb62243943dbef4592266e817f4e2e5a96293907.tar.gz linux-bb62243943dbef4592266e817f4e2e5a96293907.zip | |
objtool: Add --Werror option
Any objtool warning has the potential of reflecting (or triggering) a
major bug in the kernel or compiler which could result in crashing the
kernel or breaking the livepatch consistency model.
In preparation for failing the build on objtool errors/warnings, add a
new --Werror option.
[ jpoimboe: commit log, comments, error out on fatal errors too ]
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/e423ea4ec297f510a108aa6c78b52b9fe30fa8c1.1741975349.git.jpoimboe@kernel.org
Diffstat (limited to 'tools/objtool/check.c')
| -rw-r--r-- | tools/objtool/check.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 2f64e46fe02d..48d7bc5b4736 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4756,9 +4756,18 @@ int check(struct objtool_file *file) out: /* - * For now, don't fail the kernel build on fatal warnings. These - * errors are still fairly common due to the growing matrix of - * supported toolchains and their recent pace of change. + * CONFIG_OBJTOOL_WERROR upgrades all warnings (and errors) to actual + * errors. + * + * Note that even "fatal" type errors don't actually return an error + * without CONFIG_OBJTOOL_WERROR. That probably needs improved at some + * point. */ + if (opts.werror && (ret || warnings)) { + if (warnings) + WARN("%d warning(s) upgraded to errors", warnings); + return 1; + } + return 0; } |
