diff options
author | Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> | 2017-10-14 10:47:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-10-18 09:22:26 -0400 |
commit | 6a93bb7e4a7d6670677d5b0eb980936eb9cc5d2e (patch) | |
tree | 3f7e6083e7c86c3a1142ed16c4e99f5d660c22d0 | |
parent | 2704fbb672d0d9a19414907fda7949283dcef6a1 (diff) |
objtool: Print top level commands on incorrect usage
Print top-level objtool commands, along with the error on incorrect
command line usage. Objtool command line parser exit's with code 129,
for incorrect usage. Convert the cmd_usage() exit code also, to maintain
consistency across objtool.
After the patch:
$ ./objtool -j
Unknown option: -j
usage: objtool COMMAND [ARGS]
Commands:
check Perform stack metadata validation on an object file
orc Generate in-place ORC unwind tables for an object file
$ echo $?
129
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1507992474-16142-1-git-send-email-kamalesh@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/objtool/objtool.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c index 31e0f9143840..07f329919828 100644 --- a/tools/objtool/objtool.c +++ b/tools/objtool/objtool.c | |||
@@ -70,7 +70,7 @@ static void cmd_usage(void) | |||
70 | 70 | ||
71 | printf("\n"); | 71 | printf("\n"); |
72 | 72 | ||
73 | exit(1); | 73 | exit(129); |
74 | } | 74 | } |
75 | 75 | ||
76 | static void handle_options(int *argc, const char ***argv) | 76 | static void handle_options(int *argc, const char ***argv) |
@@ -86,9 +86,7 @@ static void handle_options(int *argc, const char ***argv) | |||
86 | break; | 86 | break; |
87 | } else { | 87 | } else { |
88 | fprintf(stderr, "Unknown option: %s\n", cmd); | 88 | fprintf(stderr, "Unknown option: %s\n", cmd); |
89 | fprintf(stderr, "\n Usage: %s\n", | 89 | cmd_usage(); |
90 | objtool_usage_string); | ||
91 | exit(1); | ||
92 | } | 90 | } |
93 | 91 | ||
94 | (*argv)++; | 92 | (*argv)++; |