From: Brendan Jackman <jackmanb@google.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
Brendan Jackman <jackmanb@google.com>
Subject: [PATCH v3 1/2] objtool: Add --Werror
Date: Mon, 13 Jan 2025 14:05:15 +0000 [thread overview]
Message-ID: <20250113-objtool-strict-v3-1-8b51f94957fb@google.com> (raw)
In-Reply-To: <20250113-objtool-strict-v3-0-8b51f94957fb@google.com>
At present objtool only prints to the terminal when observing "fatal
warnings". This option lets you have it produce an error instead.
The use case for this is noinstr validation; so far I've never seen any
false warnings here, but it quite often detects real bugs. It would
be useful for the build to fail when I have those bugs.
Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
tools/objtool/builtin-check.c | 6 ++++++
tools/objtool/check.c | 7 ++-----
tools/objtool/include/objtool/builtin.h | 1 +
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 387d56a7f5fb8da8435d0a3f5c05eeee66932c9b..0b28082df90710ff7127327deb857c0548f378c7 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -94,6 +94,12 @@ static const struct option check_options[] = {
OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section addresses in warnings"),
OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"),
OPT_BOOLEAN('v', "verbose", &opts.verbose, "verbose warnings"),
+ /*
+ * For now, don't fail the kernel build on fatal warnings by default.
+ * These errors are still fairly common due to the growing matrix of
+ * supported toolchains and their recent pace of change.
+ */
+ OPT_BOOLEAN(0, "Werror", &opts.werror, "fail on fatal warnings"),
OPT_END(),
};
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 76060da755b5c51cda3a669d8245d7d004e25f22..e44135293eb45f908e00359d84d954cfeddd266f 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4944,10 +4944,7 @@ 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.
- */
+ if (opts.werror && warnings)
+ return 1;
return 0;
}
diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/include/objtool/builtin.h
index fcca6662c8b4b5e0048e54fada8694cc2e6ebc34..97d668010efadfa05bb6e25e1967a7d72bf77815 100644
--- a/tools/objtool/include/objtool/builtin.h
+++ b/tools/objtool/include/objtool/builtin.h
@@ -38,6 +38,7 @@ struct opts {
bool sec_address;
bool stats;
bool verbose;
+ bool werror;
};
extern struct opts opts;
--
2.47.1.613.gc27f4b7a9f-goog
next prev parent reply other threads:[~2025-01-13 14:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 14:05 [PATCH v3 0/2] objtool: Add option to fail build on vmlinux warnings Brendan Jackman
2025-01-13 14:05 ` Brendan Jackman [this message]
2025-01-14 17:24 ` [PATCH v3 1/2] objtool: Add --Werror Nathan Chancellor
2025-01-14 18:17 ` Josh Poimboeuf
2025-01-13 14:05 ` [PATCH v3 2/2] kbuild: Add option to fail build on vmlinux objtool issues Brendan Jackman
2025-01-14 0:14 ` [PATCH v3 0/2] objtool: Add option to fail build on vmlinux warnings Josh Poimboeuf
2025-01-30 15:55 ` Brendan Jackman
2025-01-30 18:30 ` Nathan Chancellor
2025-01-31 10:44 ` Brendan Jackman
2025-01-31 20:49 ` Nathan Chancellor
2025-02-06 15:05 ` Brendan Jackman
2025-02-06 17:10 ` Nathan Chancellor
2025-02-07 2:51 ` Josh Poimboeuf
2025-02-07 10:16 ` Brendan Jackman
2025-02-07 21:41 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250113-objtool-strict-v3-1-8b51f94957fb@google.com \
--to=jackmanb@google.com \
--cc=akpm@linux-foundation.org \
--cc=jpoimboe@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox