From: Joe Lawrence <joe.lawrence@redhat.com>
To: live-patching@vger.kernel.org
Cc: Josh Poimboeuf <jpoimboe@kernel.org>, Song Liu <song@kernel.org>,
Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>
Subject: [RFC 1/4] objtool/klp: add --symvers option to klp diff
Date: Tue, 12 May 2026 18:10:59 -0400 [thread overview]
Message-ID: <20260512221102.2720763-2-joe.lawrence@redhat.com> (raw)
In-Reply-To: <20260512221102.2720763-1-joe.lawrence@redhat.com>
Add a --symvers (-s) option that accepts a path to Module.symvers. When
provided, it replaces the default "Module.symvers" filename used by the
auto-detection logic.
This decoupling helps to enable scenarios like out-of-tree module
patching and unit testing of klp-diff, where object files /
Module.symvers live outside the kernel tree.
The existing auto-detection behavior (try cwd, then top_level_dir()
fallback) is preserved regardless of whether --symvers is specified.
Assisted-by: Cursor:claude-4.6-opus
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
---
tools/objtool/klp-diff.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/objtool/klp-diff.c b/tools/objtool/klp-diff.c
index b9624bd9439b..bd8d64f2f3f6 100644
--- a/tools/objtool/klp-diff.c
+++ b/tools/objtool/klp-diff.c
@@ -34,6 +34,7 @@ struct export {
char *mod, *sym;
};
+static const char *symvers_path = "Module.symvers";
bool debug, debug_correlate, debug_clone;
int indent;
@@ -47,6 +48,7 @@ static const struct option klp_diff_options[] = {
OPT_BOOLEAN('d', "debug", &debug, "enable all debug output"),
OPT_BOOLEAN(0, "debug-correlate", &debug_correlate, "enable correlation debug output"),
OPT_BOOLEAN(0, "debug-clone", &debug_clone, "enable cloning debug output"),
+ OPT_STRING('s', "symvers", &symvers_path, "path", "path to Module.symvers (default: Module.symvers)"),
OPT_END(),
};
@@ -86,16 +88,15 @@ static char *escape_str(const char *orig)
static int read_exports(void)
{
- const char *symvers = "Module.symvers";
char line[1024], *path = NULL;
unsigned int line_num = 1;
FILE *file;
- file = fopen(symvers, "r");
+ file = fopen(symvers_path, "r");
if (!file) {
- path = top_level_dir(symvers);
+ path = top_level_dir(symvers_path);
if (!path) {
- ERROR("can't open '%s', \"objtool diff\" should be run from the kernel tree", symvers);
+ ERROR("can't open '%s', \"objtool diff\" should be run from the kernel tree", symvers_path);
return -1;
}
--
2.53.0
next prev parent reply other threads:[~2026-05-12 22:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 22:10 [RFC 0/4] klp-build: simple OOT module support Joe Lawrence
2026-05-12 22:10 ` Joe Lawrence [this message]
2026-05-12 22:11 ` [RFC 2/4] objtool/klp: allow special section entry size overrides Joe Lawrence
2026-05-12 22:11 ` [RFC 3/4] objtool/klp: add --arch option to display target architecture Joe Lawrence
2026-05-12 22:11 ` [RFC 4/4] livepatch/klp-build: add basic out-of-tree module patching support Joe Lawrence
2026-05-12 23:30 ` [RFC 0/4] klp-build: simple OOT module support Song Liu
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=20260512221102.2720763-2-joe.lawrence@redhat.com \
--to=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
--cc=song@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