summaryrefslogtreecommitdiffstats
path: root/tools/objtool/builtin-orc.c
diff options
context:
space:
mode:
authorJulien Thierry <jthierry@redhat.com>2020-08-25 13:47:39 +0100
committerJosh Poimboeuf <jpoimboe@redhat.com>2020-09-01 17:19:07 -0500
commit6545eb030e6f14cef8793a86312483c788eaee46 (patch)
tree19301101e41edf3595fd3a5ceaa5d7804abc3821 /tools/objtool/builtin-orc.c
parent7c9903c9bf716d89b34f96cc2ed64e28dabf570b (diff)
downloadlinux-6545eb030e6f14cef8793a86312483c788eaee46.tar.bz2
objtool: Move object file loading out of check()
Structure objtool_file can be used by different subcommands. In fact it already is, by check and orc. Provide a function that allows to initialize objtool_file, that builtin can call, without relying on check to do the correct setup for them and explicitly hand the objtool_file to them. Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Julien Thierry <jthierry@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Diffstat (limited to 'tools/objtool/builtin-orc.c')
-rw-r--r--tools/objtool/builtin-orc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/objtool/builtin-orc.c b/tools/objtool/builtin-orc.c
index b1dfe2007962..3979f275a775 100644
--- a/tools/objtool/builtin-orc.c
+++ b/tools/objtool/builtin-orc.c
@@ -31,13 +31,19 @@ int cmd_orc(int argc, const char **argv)
usage_with_options(orc_usage, check_options);
if (!strncmp(argv[0], "gen", 3)) {
+ struct objtool_file *file;
+
argc = parse_options(argc, argv, check_options, orc_usage, 0);
if (argc != 1)
usage_with_options(orc_usage, check_options);
objname = argv[0];
- return check(objname, true);
+ file = objtool_open_read(objname);
+ if (!file)
+ return 1;
+
+ return check(file, true);
}
if (!strcmp(argv[0], "dump")) {