From: "tip-bot2 for Peter Zijlstra" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Borislav Petkov <bp@alien8.de>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: objtool/core] objtool: Parse options from OBJTOOL_ARGS
Date: Wed, 03 Mar 2021 08:45:31 -0000 [thread overview]
Message-ID: <161476113169.20312.14290136035364654285.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210226110004.252553847@infradead.org>
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: b52eb21aeca75790869c26b91b1d7b80b3946430
Gitweb: https://git.kernel.org/tip/b52eb21aeca75790869c26b91b1d7b80b3946430
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Fri, 26 Feb 2021 11:32:30 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 03 Mar 2021 09:38:32 +01:00
objtool: Parse options from OBJTOOL_ARGS
Teach objtool to parse options from the OBJTOOL_ARGS environment
variable.
This enables things like:
$ OBJTOOL_ARGS="--backup" make O=defconfig-build/ kernel/ponies.o
to obtain both defconfig-build/kernel/ponies.o{,.orig} and easily
inspect what objtool actually did.
Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20210226110004.252553847@infradead.org
---
tools/objtool/builtin-check.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 0399752..8b38b5d 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -15,6 +15,7 @@
#include <subcmd/parse-options.h>
#include <string.h>
+#include <stdlib.h>
#include <objtool/builtin.h>
#include <objtool/objtool.h>
@@ -26,6 +27,11 @@ static const char * const check_usage[] = {
NULL,
};
+static const char * const env_usage[] = {
+ "OBJTOOL_ARGS=\"<options>\"",
+ NULL,
+};
+
const struct option check_options[] = {
OPT_BOOLEAN('f', "no-fp", &no_fp, "Skip frame pointer validation"),
OPT_BOOLEAN('u', "no-unreachable", &no_unreachable, "Skip 'unreachable instruction' warnings"),
@@ -44,6 +50,25 @@ const struct option check_options[] = {
int cmd_parse_options(int argc, const char **argv, const char * const usage[])
{
+ const char *envv[16] = { };
+ char *env;
+ int envc;
+
+ env = getenv("OBJTOOL_ARGS");
+ if (env) {
+ envv[0] = "OBJTOOL_ARGS";
+ for (envc = 1; envc < ARRAY_SIZE(envv); ) {
+ envv[envc++] = env;
+ env = strchr(env, ' ');
+ if (!env)
+ break;
+ *env = '\0';
+ env++;
+ }
+
+ parse_options(envc, envv, check_options, env_usage, 0);
+ }
+
argc = parse_options(argc, argv, check_options, usage, 0);
if (argc != 1)
usage_with_options(usage, check_options);
next prev parent reply other threads:[~2021-03-03 14:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 10:57 [PATCH 0/3] objtool: OBJTOOL_ARGS and --backup Peter Zijlstra
2021-02-26 10:57 ` [PATCH 1/3] objtool: Add --backup Peter Zijlstra
2021-02-26 11:48 ` Borislav Petkov
2021-03-02 11:58 ` Peter Zijlstra
2021-03-03 8:45 ` [tip: objtool/core] " tip-bot2 for Peter Zijlstra
2021-03-06 11:48 ` tip-bot2 for Peter Zijlstra
2021-02-26 10:57 ` [PATCH 2/3] objtool: Collate parse_options() users Peter Zijlstra
2021-03-03 8:45 ` [tip: objtool/core] " tip-bot2 for Peter Zijlstra
2021-03-06 11:48 ` tip-bot2 for Peter Zijlstra
2021-02-26 10:57 ` [PATCH 3/3] objtool: Parse options from OBJTOOL_ARGS Peter Zijlstra
2021-03-03 8:45 ` tip-bot2 for Peter Zijlstra [this message]
2021-03-04 14:12 ` [tip: objtool/core] " Peter Zijlstra
2021-03-06 11:48 ` tip-bot2 for Peter Zijlstra
2021-02-26 12:27 ` [PATCH 0/3] objtool: OBJTOOL_ARGS and --backup Peter Zijlstra
2021-03-03 0:29 ` Josh Poimboeuf
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=161476113169.20312.14290136035364654285.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@alien8.de \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).